fix(coding-agent): show a preparing turn's prompt in the TUI queued-messages area - #2063
Open
snimu wants to merge 2 commits into
Open
fix(coding-agent): show a preparing turn's prompt in the TUI queued-messages area#2063snimu wants to merge 2 commits into
snimu wants to merge 2 commits into
Conversation
…queue area Queued messages vanished from the interactive queued-messages preview while a compaction ran. The session-side lanes are correct: a message submitted during compaction queues visibly, and messages queued during streaming stay in their lanes while the pump is blocked. The invisible case is the queued message whose OWN turn triggers threshold compaction: at the boundary the pump selects it and its pre-turn compaction check starts the compaction while the action sits in "preparing" — by design out of the queued lanes (preparing turns are pump-owned) and reported through the snapshot's `active` field instead, which the TUI never rendered. The message disappeared for the whole compaction window. Render the snapshot's active entry: a turn in phase "preparing" shows as a "Starting: …" line in the queued-messages area (running/committing turns keep rendering through the transcript). The browse/edit hint still appears only for editable lane items. Fixes RES-1306.
… action snapshot Review follow-ups: steeringMode/followUpMode "all" prepares a batch, so during the batch's pre-turn compaction the snapshot's single active entry hid every prompt after the first; and the active label is compactRlmText over the raw prompt, which for injected agent messages surfaces truncated protocol metadata instead of the lane's "Agent message received: …" preview. The snapshot now publishes an optional `preparing` list: previews of all pump-owned turns that have not started, built with the SAME queuedAgentMessagePreview projection the lanes use. The TUI renders each as a "Starting" line and falls back to active.label for older daemons that do not publish the field (additive optional metadata; old clients ignore it).
snimu
force-pushed
the
sebastian/compaction-queue-visibility-2026-09-05
branch
from
September 7, 2026 09:19
473421f to
0691720
Compare
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 0691720. Configure here.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

Fixes the user report that queued messages don't show up in the interactive TUI while a compaction is running.
Linear: https://linear.app/primeintellect/issue/RES-1306/queued-messages-dont-show-up-while-compaction-is-running
LOC
+194/-5 total: src +20/-5 (one file,
interactive-mode.ts), tests +173 (two existing files), +1 changelog fragment. No new files besides the fragment.Root cause
Reproduced with a failing test before fixing. The session-side queue lanes are correct in both reported scenarios: a message submitted during compaction takes the
queueForBusybranch and queues visibly, and messages queued during streaming stay in their lanes while the pump is blocked by compaction (both now pinned). The invisible case is the queued message whose OWN turn triggers the compaction: at the run boundary the pump selects the queued action, and the turn's pre-turn threshold-compaction check (preTurnCompaction: "beforeModelSelection"for queued turns) starts the compaction while the action sits in lifecyclepreparing. Preparing turns are deliberately out of the queued lanes (three existing pins: preparing inputs are pump-owned "activity", not editable queue members) and are reported through the snapshot'sactivefield instead — which the interactive TUI never rendered. Result: for the entire compaction (which can run minutes on big transcripts), the user's queued message is nowhere on screen.Fix
Render the daemon-provided state instead of re-deriving it:
updatePendingMessagesDisplaynow showssessionActions.activewhen it is a turn in phasepreparing, as aStarting: …line at the top of the queued-messages area. Running/committing turns keep rendering through the transcript (no double-render), the browse/edit hint still appears only when editable lane items exist, and the feature-hint suppression covers the populated area. ThestyleQueuedMessagePreviewlabel union widens by"Starting"; no wire or session-core changes.An alternative fix (returning preparing turns to the snapshot lanes) was implemented and discarded: it contradicts three deliberate design pins (
removes preparing inputs from literal queue projections,keeps steering stop pending while a steering handoff is still preparing, coalesced-duplicate ownership) and would desync lane indexes used by queued-message mutation.Tests
agent-session-compaction.test.ts+2: (1) a message submitted during a gated manual compaction stays in the snapshot lanes AND in the emittedsession_action_update(the event the TUI renders from); (2) the reproduced interleave — queued follow-up, run ends, context growth lands at the boundary, its own pre-turn compaction runs — pins the contract thatactivecarries{kind: "turn", phase: "preparing", label}for the whole window.interactive-mode-compaction.test.ts+1 (fail-unfixed verified: renders nothing before the fix): the realupdatePendingMessagesDisplayrendersStarting: queued before compactionfrom that snapshot, and arunningturn renders nothing there.Validation: 433 tests green across the affected local set (compaction, queue, queue-mutation, concurrent, in-process connection, session-list, queue-edit, feature-hints, hint-placement, status); sandbox full
test:cishows only the documented environmental failing set (config, extensions-*, resource-loader, tools EACCES-as-root; the one extratools.test.tsbash-persistence failure is the documented concurrent-tmpdir flake and passes in isolation);npm run checkgreen.Note
Low Risk
UI and optional snapshot field only; queue mutation semantics and lane ownership are unchanged, with backward-compatible fallback for older daemons.
Overview
Fixes queued prompts vanishing from the interactive queued-messages preview while compaction runs—especially when a follow-up turn’s own pre-turn compaction holds it in
preparingafter it leaves the editable lanes.Session snapshot:
getSessionActionSnapshotnow projects pump-owned turns inselectedorpreparinginto an optionalpreparinglist (same preview strings the lanes used), so an all-mode batch can stay visible for the whole compaction window. The existingactiveturn/phase payload is unchanged for running/committing work.TUI:
updatePendingMessagesDisplayrenders those previews asStarting:lines above steering/follow-ups, with a fallback to legacy daemons that only exposeactive.labelin phasepreparing. Browse/edit hints still require real lane queue items; feature-hint suppression treats the whole queue area as populated when only Starting lines show.Tests lock the snapshot/event contract during gated compaction and the interactive render path (including that running turns do not duplicate in this area). Changelog fragment for RES-1306.
Reviewed by Cursor Bugbot for commit 0691720. Bugbot is set up for automated code reviews on this repo. Configure here.
Note
Show preparing turn prompts in TUI queued-messages area during compaction
AgentSession.getSessionActionSnapshotto project preparing/selected turn actions and expose their prompt previews via a new optionalpreparingfield onSessionActionSnapshotInteractiveMode.updatePendingMessagesDisplayto render preparing previews with aStartinglabel in the queued-messages area, ahead of steering and follow-up messagesactive.labelfor older daemons; suppresses feature hints and browse/edit hints when only a preparing turn is shownSessionActionSnapshot.preparingis optional and ignored by older consumers, but any out-of-tree reader that snapshots the full interface must handle the new fieldMacroscope summarized 0691720.