Skip to content

[Feature]: Show compaction state and result instead of a generic "Working" #7652

Closed

Description

@robertnisipeanu

What

When a provider compacts a thread, the timeline shows Working for N, exactly like any other work. Nothing says compaction is running, how long it has been running, or whether it succeeded. On a long compaction the only honest read of the UI is "something is happening".

Proposal

Give compaction its own timeline state, and a result line when it lands:

Compaction state proposal

Deliberately no percentage or progress bar. No provider emits real compaction progress — the Claude Code CLI's own compaction bar is a pure function of elapsed time (1 − e^(−elapsed/90s), capped at 95%; it snaps to done when the operation finishes). Replicating a synthetic bar is possible but it would be a lying spinner, so this proposal sticks to what is true: the state, the elapsed time, and the result.

What each provider gives us

Provider "Compacting" start signal Completion signal Result metadata
Claude SDKStatusMessage status:"compacting" compact_boundary + end status with compact_result/compact_error pre_tokens, post_tokens, duration_ms, trigger
Codex contextCompaction item started same item completed (also thread/compacted, which the protocol marks deprecated in favor of the item) none on the item; token usage arrives separately
OpenCode session time.compacting timestamp (via session updates) session.compacted event auto flag on the CompactionPart
Cursor — — ACP has no compaction concept
Grok — — ACP has no compaction concept

So three of five providers can feed a shared "compacting" thread state, and per AGENTS.md the ACP pair get an explicit "not supported here".

Where the code stands

  • Claude: ClaudeAdapter.ts:3119 reads status:"compacting" but flattens it into the generic waiting session state — that is why the UI says Working. The compact_boundary already becomes a context-compaction activity (ProviderRuntimeIngestion.ts:744, summary "Context compacted") with the raw compact_metadata in its payload, so the result line is mostly a client-rendering task. compact_result/compact_error appear nowhere in the repo — a failed compaction is indistinguishable from a successful one.
  • Codex: CodexAdapter.ts maps compaction items to the canonical context_compaction type, but ingestion filters item lifecycle events to tool types (ProviderRuntimeIngestion.ts:847), so both the start and completion of a Codex compaction are dropped. Codex compaction visibility currently rests entirely on the deprecated thread/compacted notification; wiring the item fixes that.
  • OpenCode: OpenCodeAdapter.ts handles none of the compaction signals.
  • Nothing in apps/web references context compaction at all — every compact hit in the web client is layout density.

Suggested shape

  1. A compacting state on the shared thread/session contract that any adapter can raise and clear, rendered as the "Compacting context" row with a client-side elapsed timer.
  2. The completion row rendered from the existing context-compaction activity, with token delta and duration where the provider supplies them (Claude), plain "Context compacted" where it does not.
  3. A failure variant fed by Claude's compact_result:"failed"/compact_error.

Stacked per-adapter PRs on top of the contract change would fit how this decomposes.

Related

#7589 — a heartbeat with no turn stranded a thread on Working forever after /compact. The fix stops the stranding, but compaction that outlives its turn surfaces nothing at all, which makes this gap more visible rather than less.

Screenshots are the real timeline row with the proposed states patched in.

Activity

  1. thomasbrugman commented on Aug 20, 2026

    @thomasbrugman

    That seems good. I reckon we add this for other adapters that support this. So, stacked PR's may be useful here.

  2. changed the title [-][Feature]: Show compaction progress and result instead of a generic "Working"[/-] [+][Feature]: Show compaction state and result instead of a generic "Working"[/+] on Aug 20, 2026
  3. robertnisipeanu commented on Aug 20, 2026

    @robertnisipeanu
    Author

    Edited the PR description and the PoC generated image. Initially it contained information only about Claude Code and it also suggested adding a compaction progress (percentage bar and percentage numbers) with it, just like it is in the CLI.
    After some digging, it seems that:

    1. The progress of compaction is not available in the CLI.
    2. The progress in claude code CLI is synthetic, and just a math formula based on how much time elapsed since starting compaction. I decided that is unreliable to use, as T3 Code would essentially have to duplicate the same formula, which could change at any time in Claude Code.
  4. thomasbrugman commented on Aug 20, 2026

    @thomasbrugman

    Edited the PR description and the PoC generated image. Initially it contained information only about Claude Code and it also suggested adding a compaction progress (percentage bar and percentage numbers) with it, just like it is in the CLI.
    After some digging, it seems that:

    1. The progress of compaction is not available in the CLI.
    2. The progress in claude code CLI is synthetic, and just a math formula based on how much time elapsed since starting compaction. I decided that is unreliable to use, as T3 Code would essentially have to duplicate the same formula, which could change at any time in Claude Code.

    I essentially ran into the same conclusion, but thanks for confirming. I'll see what I can do.

  5. Torrey-Smith-165 commented on Aug 27, 2026

    @Torrey-Smith-165

    Would really appreciate this one getting fixed. My claude sessions keep showing "thinking" state for ~3 minutes when they are really compacting. It feels like the agent is broken and stuck in a thinking loop, especially given that T3 code has no way of allowing for displaying thinking traces.

  6. minipuft commented on Aug 28, 2026

    @minipuft

    +1 I end up wasting tokens canceling expecting something is going wrong. Any sort of message or notification would be better than the regular "Thinking"

  7. 6 remaining items

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

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions