Skip to content
Source
Sign inSign up
pingdotgg/t3code

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

Closedrobertnisipeanu(GitHub profile, opens in a new tab) opened this issue 7 comments

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 signalCompletion signalResult metadata
ClaudeSDKStatusMessage status:"compacting"compact_boundary + end status with compact_result/compact_errorpre_tokens, post_tokens, duration_ms, trigger
CodexcontextCompaction item startedsame item completed (also thread/compacted, which the protocol marks deprecated in favor of the item)none on the item; token usage arrives separately
OpenCodesession time.compacting timestamp (via session updates)session.compacted eventauto 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.

#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.

  1. thomasbrugman(GitHub profile, opens in a new tab)commented

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

  2. 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.
  3. 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.

  4. 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.

  5. +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"

  6. +1 I have ran into this a couple of times. The agent just becomes unresponsive and I have no idea why. It is incredibly frustrating.

  7. Closing as fixed by https://github.com/pingdotgg/t3code/pull/9293 — compaction now has its own Compacting… state and completed divider (with token counts when available) instead of a generic Working label.

  8. juliusmarminge closed this

Sign in to join this conversation.