mirror of
https://github.com/wassname/pi-dynamic-context-pruning.git
synced 2026-06-27 18:05:36 +08:00
9812beb817
- Fix Infinity anchorTimestamp repair on JSON round-trip (blocks extending to end-of-conversation now restored correctly instead of discarded) - Fix nextBlockId calculation to use max(id)+1 instead of array length - Rename internal prompt tag <dcp-message-id> to <dcp-id> - Add regression tests for corrupted-block resilience (PR #3, @wassname) - Update README with Contributors section - Update CHANGELOG for 1.0.7 - Bump package.json to 1.0.7 Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
3.4 KiB
3.4 KiB
Changelog
[1.0.7] - 2026-04-14
Fixed
- Infinity anchorTimestamp ghost block spiral — When a
compressrange extended to the end of the conversation,resolveAnchorTimestampreturnedInfinity.JSON.stringify(Infinity)serialises tonull, so on session restore the corrupted block's timestamps coerced to0in JS overlap checks, making every new range appear to overlap the ghost block and trapping the model in a compression spiral (101 failures over 2 hours).resolveAnchorTimestampnow returnsendTimestamp + 1instead ofInfinity. - Corrupted block propagation on session restore —
index.tsnow filters out any persisted compression block whosestartTimestamp,endTimestamp, oranchorTimestampis non-finite before restoring state, preventing ghost blocks from surviving across sessions. - Non-finite timestamp guard — All code paths that create or apply compression blocks now validate timestamps are finite before proceeding, failing fast rather than silently corrupting state.
- Overlap error diagnostics — Overlap error messages now include the existing block's timestamp range to aid debugging.
- Prompt tag name mismatch — The prompt tag was named
<dcp-message-id>but the code injected<dcp-id>; tag name corrected to<dcp-id>throughoutprompts.ts. - Duplicate test — Removed a duplicate test case from
pruner.test.ts.
Added
- Regression tests — New test cases for the
Infinityanchor scenario,null-timestamp corrupted blocks, and corrupted-block resilience on session restore.
Thanks to @wassname for diagnosing and fixing the compression spiral root cause in #3.
[1.0.6] - 2026-04-09
Fixed
- Orphaned tool_use/tool_result after compression — Compression ranges that touched part of an assistant→toolResult group could leave orphaned
tool_useortool_resultblocks, causing Anthropic API 400 errors (unexpected tool_use_id found in tool_result blocks). The backward and forward expansion logic now correctly skips PI-internal passthrough roles (compaction,branch_summary,custom_message) when scanning for paired messages, ensuring atomic removal of complete tool groups. - Content mutation across context events —
applyPruningnow deep-clones message content instead of shallow-copying, preventing injecteddcp-idblocks from accumulating on shared message objects across successive context events.
Added
- Post-compression repair function —
repairOrphanedToolPairsruns after all compression blocks are applied as a safety net. It removes orphanedtoolResult/bashExecutionmessages whosetoolCallIdhas no matchingtoolCallin any assistant message, and strips orphanedtoolCallblocks from assistant messages whose results no longer exist. - New test cases — Tests 5–9 covering passthrough role handling (backward and forward expansion), content mutation isolation, multi-block orphan repair, and direct orphan cleanup.
[1.0.5] - 2026-04-06
Fixed
- Prevent orphaned tool_use blocks from compression and harden autocomplete.
[1.0.4] - 2026-04-05
Fixed
- Tool crash on compression.
[1.0.3] - 2026-04-04
Fixed
- Various errors and issues.
[1.0.2] - 2026-04-03
Changed
- Added pi package details to package.json.
[1.0.1] - 2026-04-02
Added
- Initial release.