Skip to content

cancelBackgroundCompaction() emits no compaction_complete, so "Compacting conversation…" stays on screen #5394

Open

Description

@doomslayer2k

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

  1. In an extension, listen for session.compaction_start with trigger: "threshold".
  2. Call session.rpc.history.cancelBackgroundCompaction() within ~150 ms.
  3. Observe: the call resolves { cancelled: false }; no compaction runs (no summary, tokens unchanged); no session.compaction_complete is 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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area:context-memoryContext window, memory, compaction, checkpoints, and instruction loadingarea:pluginsPlugin system, marketplace, hooks, skills, extensions, and custom agents

    Type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions