1.7 KiB
1.7 KiB
Context Manager Task 5 Legacy Fix Report
Status
- DONE
Changes
- Updated
.pi/agent/extensions/context-manager/src/runtime.tssosyncSnapshotZone()no longer preserves a stored legacylastZonewhenlastObservedTokensis 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.tsfor both direct restore of a legacy snapshot and the real persisted path ofdeserializeLatestSnapshot(...)followed byruntime.restore(...). - Left new-schema snapshot behavior unchanged: snapshots that include
lastObservedTokensstill recomputelastZoneagainst the receiving runtime policy.
Tests
cd .pi/agent/extensions/context-manager && npx tsx --test src/runtime.test.ts→ 6 passed, 0 failedcd .pi/agent/extensions/context-manager && npx tsx --test src/runtime.test.ts src/persist.test.ts src/summaries.test.ts→ 11 passed, 0 failedcd .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.