Repository navigation
Description
Describe the bug
A session about a third full shows "Compacting conversation…". One model call reported a doubled prompt (#5392), and the background compaction started on that single number — although the session.compaction_start event itself shows the runtime's own breakdown of the context well under the threshold:
trigger threshold
currentTokens 790,176 (82% of 968,000)
breakdown 312,920 (system 45,606 + conversation 224,057 + tools 43,257) = 32%
The next call read 405,981 again.
Frequency: 21 of 251 threshold compactions in 5 days on one machine started this way. Three ran to completion and summarised sessions that were really 52–67% full; one fired at a reported 134%. The other 18 never completed — a local extension cancels such starts (confirmed in its log for 5 of them).
Extensions: the trigger is the runtime's own; an extension only observed it, and in some cases cancelled it.
Wanted labels: area:context-memory, type: Bug.
Affected version
Runtime 1.0.102-0.unstable.r41779900948.gf482387 (desktop app 1.1.35).
Steps to reproduce
Needs a doubled usage report, which is intermittent:
- Work in a Claude Opus 5.5 session at 30–60% of its window.
- When one call reports its prompt doubled, the next
session.compaction_start(trigger: "threshold") fires withcurrentTokens≈ 2× the event's ownsystemTokens + conversationTokens + toolDefinitionsTokens.
Expected behavior
One implausible reading does not start a compaction: the trigger count is checked against the runtime's own estimate of the same context, or confirmed by the next reading.
Additional context
App version 1.1.35
OS Windows 10 Enterprise 26H2 (build 26300.9711)
Architecture AMD64
Copilot CLI copilot-sdk-runtime-1.0.102-0.unstable.r41779900948.gf482387
In-depth investigation
What the trigger counts. Across 251 threshold starts, currentTokens equals the last parent request's input + output (p10–p90 1.00) — so one reported number decides.
The two populations do not overlap. currentTokens ÷ (system + conversation + tools) from the same event:
- genuine starts: at most 1.27;
- starts after a doubled report: at least 2.17.
A cut-off anywhere between them (e.g. 1.95), falling back to the breakdown, would have stopped all 21 and none of the 230 genuine ones.
Cost of the three that completed: unsteered summaries at a real 52–67% full, each discarding working context the session still had room for.
Activity