30 lines
1.7 KiB
Markdown
30 lines
1.7 KiB
Markdown
# Context Manager Task 5 Legacy Fix Report
|
|
|
|
## Status
|
|
- DONE
|
|
|
|
## Changes
|
|
- Updated `.pi/agent/extensions/context-manager/src/runtime.ts` so `syncSnapshotZone()` no longer preserves a stored legacy `lastZone` when `lastObservedTokens` is missing.
|
|
- Legacy snapshots without token observations now normalize back to `lastZone: "green"`, which matches the runtime's safe default when pressure cannot be recomputed.
|
|
- Added regression coverage in `.pi/agent/extensions/context-manager/src/runtime.test.ts` for both direct restore of a legacy snapshot and the real persisted path of `deserializeLatestSnapshot(...)` followed by `runtime.restore(...)`.
|
|
- Left new-schema snapshot behavior unchanged: snapshots that include `lastObservedTokens` still recompute `lastZone` against the receiving runtime policy.
|
|
|
|
## Tests
|
|
- `cd .pi/agent/extensions/context-manager && npx tsx --test src/runtime.test.ts` → 6 passed, 0 failed
|
|
- `cd .pi/agent/extensions/context-manager && npx tsx --test src/runtime.test.ts src/persist.test.ts src/summaries.test.ts` → 11 passed, 0 failed
|
|
- `cd .pi/agent/extensions/context-manager && npm test` → 35 passed, 0 failed
|
|
|
|
## Files Changed
|
|
- `.pi/agent/extensions/context-manager/src/runtime.ts`
|
|
- `.pi/agent/extensions/context-manager/src/runtime.test.ts`
|
|
- `.pi/reviews/context-manager-task5-legacy-fix-report.md`
|
|
|
|
## Self-Review Findings
|
|
- The fix is narrowly scoped to restore/policy resync behavior for snapshots missing `lastObservedTokens`.
|
|
- The public API stays the same.
|
|
- New-schema snapshots keep the existing recompute behavior.
|
|
- Legacy snapshots no longer carry a stale red/yellow/compact zone into a runtime that lacks the data needed to validate it.
|
|
|
|
## Concerns
|
|
- None.
|