Skip to content

fix(fork): show and edit queued messages only in their view in Chat mode - #274

Merged
orbitingflea merged 2 commits into
mainfrom
feat/queued-message-scope
Nov 24, 2026
Merged

orbitingflea merged 2 commits into
mainfrom
feat/queued-message-scope

Conversation

@orbitingflea

@orbitingflea orbitingflea commented Nov 24, 2026 •

Copy link
Copy Markdown
Owner

Behaviour change

Behaviour change: yes, Chat mode users see queued and guest messages only in their view and edit queued replies in their reply box.

Why

Scope Chat mode queues and edits by view. Before, footers listed all runs, missing messages showed "Queued message", and tooltips named an unused key.

What changed

  • queuedRunsScope.ts maps loaded user replies to sub-threads, other runs and guest messages to the main list, and hides message-less runs.
  • subThreadsState.ts reads sub-threads outside React.
  • QueuedRunsControl.tsx filters rows, keeps first and edited rows when collapsed, and announces whole-queue position.
  • ChatView.tsx wires counts, keys, tooltips, and ownership; drops the edit block with subThreadReply.ts.
  • useQueuedRunEdit.ts tracks ownership by reply record past dequeue, locks other boxes, keeps them enabled on save, and returns text to the message's box.

Scope

Queued-only sub-threads skip "All replies" until run; Reply opens them. As on main, "Saving" is uncounted and "/word " goes to the main list.

Tradeoffs

One edit per thread avoids shared drafts and lost text. Queued replies to agent answers with unloaded questions stay in the main list for reachability over matching the Working line.

Blast Radius

Chat mode queue UI and edits; Normal mode unchanged.

Verification

New tests failed on main and pass. Related tests and non-test checks pass; one upstream timeout in changed-files (details).

Verification details
  • Updated test/fakeEnvironment.ts so fake threads can carry projection messages.
  • Added a browser test of the queue control in the main list, two sub-threads, and Normal mode. It covers user, agent, and task messages, a reply under an unloaded first message, active edits, queue keys, and missing messages. It failed on main and passes here.
  • Added app-level browser tests that open the main list and a reply sub-thread with three queued messages, send a queued run before its message, and edit a queued reply in its reply box. They failed on main and pass here.
  • Added edit hook tests in a fork test file. An open edit moves to the view that lists its run with its text. Another view cannot start a second edit and stays enabled during the owner's save. Recovered text returns to the message box that now shows the message.
  • Added a unit test that maps each message kind to the same view the Working line uses once the run starts.
  • Existing queue, edit, and display-mode tests pass (69 of 69 across 7 files). In the changed-files check, format, lint, knip, typecheck, and the React compiler pass. Its test step passes except one upstream test in QueuedRunsControl.browser.test.tsx. "opens queued images in the existing gallery" times out on a click when the check runs all 11 browser test files at once. Those 11 files pass when run together directly (148 of 148), and that test passes alone in about 0.57 s, matching main. Desktop and phone-width screenshots of the main list and a reply view are unchanged and still look right.

@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:L labels Nov 24, 2026
@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

This PR changes the test suite by +18 test cases (browser +14, unit +4, server 0).

New browser test files: apps/web/src/fork/subThreads/queuedRunEditOwnership.browser.test.tsx, apps/web/src/fork/subThreads/queuedRunsInChat.browser.test.tsx, apps/web/src/fork/subThreads/queuedRunsScope.browser.test.tsx.
Each browser test file costs CI seconds of module loading before its first test runs; a unit test costs milliseconds.

Keep tests that would fail for a real reason, and test logic below the UI where it can be. See Testing.

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

Thread transfer impact

⚠️ The latest CI run did not produce a thread transfer result for 0a96260.

This comment will update automatically after the next completed run.

orbitingflea and others added 2 commits November 24, 2026 17:23
Failing tests. In Chat mode the main list and each sub-thread list every
queued message of the thread: a main-list message shows in every
sub-thread, a reply shows in the main list and in other sub-threads, and a
reply's run shows in the main list as "Queued message" while its message
is still on the way. A queued reply cannot be edited in its reply box, and
a reply's queue offers a shortcut that does not run there. Edit hook
tests cover one edit per thread owned by the view that lists its run.
Fake threads can now carry projection messages.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Each Chat view (the main list, or one sub-thread) listed every queued
message of the thread. A queued message now shows only in the view where
it belongs: a typed reply in its sub-thread when the loaded history shows
that sub-thread, anything else (main-list typing, agents, tasks, wakes,
slash commands) in the main list. A run whose message has not arrived yet
shows in no view; the sending view keeps its own Saving row. The count,
footer and queue keys follow the same rows. Pending guest messages show in
the main list only, and a reply view offers no queue shortcuts. Normal mode
still lists every queued message.

The thread keeps one queued-message edit, owned by the view that lists the
message, judged from its reply record: a queued reply is edited in its
reply box in Chat mode and in the main box in Normal mode, and an open edit
moves with it across a mode switch. Another view cannot start a second
edit meanwhile, only the owning composer shows the save in flight, the
message's current box gets unsaved text back when its run leaves the queue,
and a collapsed queue keeps the edited row on screen at its queue position.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:L vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant