Skip to content

fix(desktop): fold the send queue into its header; count a stop's rows; fold a shot burst - #1629

Merged
huichen merged 6 commits into
mainfrom
pr/huichen
Nov 16, 2026
Merged

huichen merged 6 commits into
mainfrom
pr/huichen

Conversation

@huichen

@huichen huichen commented Nov 16, 2026

Copy link
Copy Markdown
Collaborator

The desktop send-queue panel used to draw every waiting row over the conversation, so a reply coming back could be hidden behind seven of them. Mobile already collapses such a panel and opens it on press; this brings the desktop to that behaviour, in both composers that share the panel (this app's own queue and a paired computer's). Two follow-ups ride along: the local interrupt control now says how many waiting rows a stop carries, and the screenshot fixture folds a queued burst into one turn the way the Agent does, which is what had send-queue-local-interrupt red on the base commit.

Commits

  • fix(desktop): open the send queue as its header line — the panel is closed by default; the header line (title, count, what will become of the rows) is itself the toggle, and one press draws the rows. Retry for a failed delivery stays outside the toggle so rescuing a message does not also fold the panel, and folding clears an open editor or answer menu.
  • fix(desktop): tell the composer how many waiting rows a stop carries — Composer.queueCount had lost its only supplier in feat(desktop,mobile,agent): a session-owned send queue, paged replay, journal fixes #1485, leaving the "Stop and send the queued messages" branch unreachable; the count now comes from agentQueue, counting the rows a stop will actually release and leaving a parked row out.
  • fix(screenshots): fold a waiting burst into one turn, as the Agent does — the mock's drainShotQueue handed queued messages out one at a time, so "interrupt and send all" produced two transcript rows where the Agent produces one folded message. It now folds the batch and reports the merged terminal acks through session_queue. The scenario's "the panel is gone" assertion is a separate step, because the panel learns about a folded row on its next poll.

Verification

Run in the main checkout at a3bf54424 (the frozen SHA), Node 26.3.0, ulimit -n 8192. No Rust crate is touched by this branch.

  • npx tsc --noEmit (desktop) → clean
  • npx eslint on the 6 changed TS/TSX files → clean
  • npx vitest run on AgentThread.test.tsx, SendQueuePanel.test.tsx, RemoteComposer.test.tsx, i18n.test.ts → 188 passed
  • npx vitest run --no-file-parallelism src/features/agent src/features/remote-peer → 157 files / 2355 tests passed
  • npx vitest run src/i18n/localeKeys.test.ts → 2 passed (the two new queue.expand / queue.collapse keys exist in both locales)
  • python3 scripts/tests/test-screenshot-scenario-fragments.py → ok (fragments merge, override and fail loudly)
  • python3 load of the real scenario table through capture.load_scenarios → both changed fragments parse and merge
  • make check-docs → 421 docs OK, 0 pairs pending bilingualization, provider matrix 13 rows

Notes

  • The panel is shared code (SendQueuePanel.tsx), so the behaviour change reaches the paired-computer composer too.
  • The screenshot changes are fixture and scenario only; they do not ship in the app, but send-queue-local-interrupt and send-queue-local-queued now capture green instead of red.

User-visible changes

  • Desktop send queue is closed by default. Before: every waiting row was drawn over the conversation whenever the queue was non-empty, so a reply could arrive behind them. After: the reader sees one header line (title, count, what will become of the rows) and one press draws the rows; a failed-delivery retry stays reachable while folded, and folding clears a half-typed edit or an open answer menu. Applies to both the local composer and a paired computer's. Revert 7293743a3.
  • The interrupt control counts the rows a stop releases. Before: plain "Stop" no matter how many messages waited behind the run (the branch that read queueCount had been unreachable since feat(desktop,mobile,agent): a session-owned send queue, paged replay, journal fixes #1485). After: "Stop and send the queued messages" when rows are waiting; a parked row, which waits for a person, is counted out. Revert a3164ed24.
  • Screenshot fixture only, no app behaviour. The shot mock now folds a queued burst into one turn and reports merged acks, and the send-queue / choice-cards scenarios open the panel before reading rows. Revert e634ee3e5.

The desktop panel drew every waiting row over the conversation whenever the
queue was non-empty, so a reply could come back hidden behind seven rows.
Mobile already collapses it and opens it on press; this brings the desktop to
the same behaviour — closed by default, the header line (title, count, what
will become of them) is what the reader sees, and one press on that line draws
the rows.

The header itself is the toggle rather than a chevron beside it: it is a line
of text and folding a queue should not mean hitting a 14px arrow. Retry for a
failed delivery stays outside the toggle so rescuing a message does not also
fold the rows, and folding clears an open editor or answer menu so a half-typed
edit is not redrawn on the next expand.

Shared panel, so both composers (this app's queue and a paired computer's) get
it. Tests open the panel first; two new ones cover the closed state and the
cleared editor.
The local composer's interrupt control had a branch that said "Stop and send
the queued messages" instead of "Stop", and it could never be reached: it reads
`Composer.queueCount`, and nothing supplied it.

The prop was not always missing. #1485 moved the send queue from the clients
into the session and deleted `queueCount={` from both composers with it — the
phone's `queueItems.length` and this app's `sendQueue.items.length`. The phone
lost nothing, because "Stop and send the queue" was retired along with the
client-side queue. Here the deleted source was the only one, the branch that
reads it stayed, and the control has said plain "Stop" ever since however many
rows were waiting behind the run.

The Agent's own queue is the source that replaced it, so the count comes from
`agentQueue` now. It has to say something true: ending the run is what lets the
waiting rows go (the session starts them at the turn boundary), so the wording
holds for the rows that will run. A parked row is counted out rather than in —
it waits for a person to release it, and a stop does not release it.

`screenshot: send-queue-local-queued` asserted exactly this and had been red on
the base commit; it now passes, and reverting only this line reddens it again.
`send-queue-local-interrupt` had been red on the base commit, and the reason
was the fixture rather than the product: `drainShotQueue` handed queued
messages out one at a time, so pressing "interrupt and send all" with one row
held and one in the field left *two* messages in the transcript.

The Agent does not work that way. Every send opts into `enqueue_coalescing`
(`QUEUED_SEND_POLICY`), and at the turn boundary
`drain_coalescing_after_first` joins everything queued directly behind the
front request into it — their texts in queue order, one paragraph each — and
records the folded rows terminal with reason `merged`, which is how their
client learns the submission was answered as part of another run. The
fixture's own comment above `streamShotRun` already described that fold, so
the behaviour it produced was the one thing the comment did not.

`drainShotQueue` now folds the batch and reports the `merged` acks through
`session_queue`, whose `recentTerminalAcks` used to be hard-coded empty. That
also exercises the notice those acks drive, which no capture could reach
before.

The scenario's final step asserted the panel was already gone on the same
frame the message appeared. The panel reads the queue on its own tick
(`QUEUE_POLL_MS`, 2 s) and learns about a folded row from `recentTerminalAcks`
on the next read, so that assertion lost a race it was never meant to run:
measured 949 ms to the merged message, 2067 ms to the panel going. The wait is
now its own step, which keeps "the rows merged" from being judged by a panel
that has not caught up yet.

Verified: the scenario captures green and says `one message carried both` /
`the queue emptied`; a probe confirmed the two sentences land in one
`[data-message-id]` row. `send-queue-local-queued`, `send-queue-local-choice`,
`send-queue-choice`, `choice-card-queue` and `choice-card-queue-remote` all
still capture; 2359 JS tests pass.
@huichen
huichen enabled auto-merge (squash) November 16, 2026 10:21
@huichen
huichen merged commit 09b4275 into main Nov 16, 2026
18 of 20 checks passed
@huichen
huichen deleted the pr/huichen branch November 16, 2026 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant