Skip to content

fix(compaction): drop thinking blocks from the live tail - #1320

Merged
TheGreatAxios merged 1 commit into
mainfrom
cl-9899-compact-occupancy-from-60-down-to-under-10
Oct 5, 2026
Merged

TheGreatAxios merged 1 commit into
mainfrom
cl-9899-compact-occupancy-from-60-down-to-under-10

Conversation

@TheGreatAxios

Copy link
Copy Markdown
Collaborator

Summary

  • The live tail drops thinking and redacted_thinking blocks so uncapped newest-pair thinking cannot pin post-fold occupancy near 45%. Full thinking stays in the archived transcript.
  • Thinking-only live turns become the existing [thinking-only turn omitted] marker so adapters do not 400 on empty content. Newest tool-call/result pairs still stay for resume.
  • Compact records and telemetry now include live_tokens (post-fold live-turn token estimate). Tail budget stays 2500.

On a 40k-token thinking fixture: origin/main kept 40,144 live tokens with thinking; this branch folds to 2,375 live tokens (under 10% of 128k).

Verification

  • bun test src/context-compactor.test.ts src/session/compactor-pairing.test.ts — 45 pass
  • Compaction baseline: bun test ./evals/compaction/metrics.test.ts ./e2e/compaction-baseline.test.ts pass
  • Occupancy eval vs origin/main (main: 40144 live tokens + thinking; this branch: 2375, no thinking)

Fixes CL-9899

Replaces #1316 (closed when its base branch was deleted on merge of #1315).

Uncapped thinking on the newest pair was pinning post-fold occupancy
near 45%. The live copy drops thinking and redacted_thinking; the
archive keeps the full bodies. Thinking-only turns become the existing
omitted marker so adapters do not 400 on empty content.
@linear-code

linear-code Bot commented Oct 5, 2026

Copy link
Copy Markdown

CL-9899

@TheGreatAxios
TheGreatAxios merged commit fa15f46 into main Oct 5, 2026
26 checks passed
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