Skip to content

feat: Preserve todo progress during compaction#25982

Open
pzy2000 wants to merge 2 commits into
anomalyco:devfrom
pzy2000:dev
Open

feat: Preserve todo progress during compaction#25982
pzy2000 wants to merge 2 commits into
anomalyco:devfrom
pzy2000:dev

Conversation

@pzy2000
Copy link
Copy Markdown

@pzy2000 pzy2000 commented May 6, 2026

Issue for this PR

Closes #18071
Closes #18564
Closes #5934
Closes #15096

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

Todo progress could be lost from the model context after compaction because the summary relied on the model to remember and include it.

This PR adds deterministic compaction anchors for the current TodoWrite state, plus the active plan file path when one exists. The anchors are included during compaction and written back into the compacted summary after it succeeds. Repeated compactions strip old anchor blocks first, so stale todo statuses are replaced by the latest state.

How did you verify your code works?

Added regression tests for:

  • preserving current todos in compacted summaries
  • replacing stale todo anchors across repeated compactions
  • preserving the plan file path when a plan exists

Ran:

  • bun test test/session/compaction.test.ts
  • bun typecheck
  • git diff --check

Screenshots / recordings

N/A, this is not a UI change.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

@github-actions github-actions Bot added needs:compliance This means the issue will auto-close after 2 hours. and removed needs:compliance This means the issue will auto-close after 2 hours. labels May 6, 2026
@github-actions
Copy link
Copy Markdown
Contributor

github-actions Bot commented May 6, 2026

Thanks for updating your PR! It now meets our contributing guidelines. 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant