Repository navigation
Description
Describe the bug
After an SDK extension cancels a background compaction with session.rpc.history.cancelBackgroundCompaction(), the compaction stops but the session never emits session.compaction_complete. The app's "Compacting conversation…" line therefore stays in the chat — still there 7.5 minutes later, mid-turn — while the session carries on normally. Users read it as a compaction in progress, or a stuck session.
The call also returns { cancelled: false } when it does cancel (3 of 3 in a probe, then across three end-to-end runs), so the caller cannot tell success from failure either.
Frequency: every cancellation.
Extensions: this is the extension API's own behaviour; reproducing needs an extension that calls it.
Wanted labels: area:sessions, area:context-memory, type: Bug.
Affected version
Runtime 1.0.102-0.unstable.r41779900948.gf482387 (desktop app 1.1.35).
Steps to reproduce
- In an extension, listen for
session.compaction_startwithtrigger: "threshold". - Call
session.rpc.history.cancelBackgroundCompaction()within ~150 ms. - Observe: the call resolves
{ cancelled: false }; no compaction runs (no summary, tokens unchanged); nosession.compaction_completeis ever written; the app keeps showing "Compacting conversation…".
Expected behavior
A cancelled compaction emits session.compaction_complete with outcome: "cancelled" — the event schema already has that value, and this machine's logs hold two such completions from other cancellation paths — and the call returns cancelled: true.
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
Probe with four threshold firings, three cancelled: 4 compaction_start, 1 compaction_complete — the completion is the uncancelled control. Each cancel was fired 117–153 ms after the start against an operation that otherwise takes ~25 s, and every one returned { cancelled: false }.
The visible case that led here: a doubled usage report started a threshold compaction on a session at 32% (#5392, #5393). The extension cancelled it at once, the session carried on, and "Compacting conversation…" stayed in the conversation.
Activity