Skip to content

fix(compaction): keep growth latch after under-threshold folds - #1315

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-9902-keep-compaction-growth-latch-after-under-threshold-folds
Oct 5, 2026
Merged

TheGreatAxios merged 1 commit into
mainfrom
cl-9902-keep-compaction-growth-latch-after-under-threshold-folds

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • After every compact, the growth latch stays set so a fold that only lands just under 60% cannot immediately re-arm at the next 60% crossing.
  • Re-arm requires a 20% resume gap past the post-compact snapshot. Deep folds still re-arm at 60% because that gap is already satisfied.
  • Under-threshold usage still restores overflow and consecutive-compact budgets.

Verification

  • bun run lint, bun run typecheck, bun run check:dead-exports, and bun run build pass
  • bun run test — 8315 pass, 0 fail
  • bun test src/agent/compaction.test.ts — 66 pass, including overflow-while-under-threshold-latch

Fixes CL-9902

A fold that only lands just under 60% used to clear the latch, so the
next 60% crossing compacted again. The 20% resume gap already exists
for still-over folds; it now applies after every compact.
@linear-code

linear-code Bot commented Oct 4, 2026

Copy link
Copy Markdown

CL-9902

@TheGreatAxios TheGreatAxios left a comment

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Review · Approve

After every compact the growth latch stays set, so a fold that only lands just under 60% cannot immediately re-arm at the next 60% crossing. Deep folds still re-arm at 60%; overflow still fires while latched.

Findings

No findings.

git diff origin/main...HEAD --stat is four files, no binaries. bun test src/agent/compaction.test.ts src/provider/context-window-thresholds.test.ts pass (exit 0). Occupancy fixture is unchanged on this branch (40,144 live tokens with thinking) — expected; fold depth is #1316.

@TheGreatAxios
TheGreatAxios merged commit 328fb4d into main Oct 5, 2026
13 checks passed
@TheGreatAxios
TheGreatAxios deleted the cl-9902-keep-compaction-growth-latch-after-under-threshold-folds branch October 5, 2026 01:44
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