Skip to content

Test that replacing old reads alone does not trigger a shake - #19

Merged
HugoLopes45 merged 2 commits into
mainfrom
test/stale-only-no-shake
Nov 11, 2026
Merged

HugoLopes45 merged 2 commits into
mainfrom
test/stale-only-no-shake

Conversation

@HugoLopes45

@HugoLopes45 HugoLopes45 commented Nov 11, 2026 •

Copy link
Copy Markdown
Owner

Why

#16 changed the shake gate after a handoff from Pi's raw token count to the planned result. The #16 review noted a second case that the change affects, and no test covered it: replacing superseded reads alone brings the context under the threshold, but not to progressRatio of it. Then turn_end keeps only those edits and does not shake. That is the intended behavior: one cache break instead of two, and the code blocks stay visible until the next threshold.

Changed behavior

None. Test only.

Verification

  • Head e0f57ca, repository root: npm run check, 1 run, tsc and lint clean, 101 tests passed.
  • The test fails when the gate uses Pi's raw token count (tokens > limit), the bug fixed in Shake after handoff only when pruning is not enough #16: it finds an Elided block edit next to the superseded read. 1 run.
  • Calibration: the threshold is 11,000 tokens. Replacing the read leaves about 10,500 tokens, above 8,800 (80%). With a threshold of 10,000, the context stays above the threshold and the shake runs, so the test is about 500 tokens from that edge. A change to Pi's token estimate can move it. The failure would then show as a second edit, not as a silent pass.
  • The test also fails when planMaintenance returns the raw token count after the stale edit: it finds 1 compaction entry where it expects 0. 1 run.
  • Independent review (fresh-context reviewer, hl-code-review): Clear, 1 limited finding. A handoff compaction could pass the edit-count assertion. Fixed in e0f57ca with the no-compaction and done assertions.

Risk and rollback

Low: one new test in test/extension.test.ts. Rollback: revert the squash commit. Owner: HugoLopes45.

When replacing superseded reads brings the context under the threshold but not to progressRatio of it, turn_end keeps only those edits and does not shake, so the context breaks the prompt cache once instead of twice. The test pins this and fails with the gate on Pi's raw token count.
@HugoLopes45 HugoLopes45 self-assigned this Nov 11, 2026
A regression that keeps the planned tokens above the threshold would run a handoff compaction and still pass the edit-count assertion.
@HugoLopes45
HugoLopes45 marked this pull request as ready for review November 11, 2026 19:19
@HugoLopes45
HugoLopes45 merged commit 1b03ff3 into main Nov 11, 2026
6 checks passed
@HugoLopes45
HugoLopes45 deleted the test/stale-only-no-shake branch November 11, 2026 19:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant