Skip to content

A message sent past the queue shows its own words, and queueing one no longer scrolls the chat - #1118

Open
naman0r wants to merge 2 commits into
yetanotherbrowser:mainfrom
naman0r:fix/chat-message-queue
Open

naman0r wants to merge 2 commits into
yetanotherbrowser:mainfrom
naman0r:fix/chat-message-queue

Conversation

@naman0r

@naman0r naman0r commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

What changes

With messages queued behind a running agent, pressing Enter on a new message now shows that message, with its own attachments, instead of the first queued one. Queueing a message with ⌘Enter no longer scrolls the conversation to the bottom; a message that is actually sent still does.

Fixes #1029
Fixes #1030

Why it happened

The chat keeps your words for messages still to be heard back in saying, with their labels in carrying and their attachments in attaching. The last queue.count entries are taken as the queue's (ChatTranscript.swift:113, unqueue at ChatColumn.swift:2917, sendNow at Agents.swift:2665), and acknowledgements take from the front (Agents.swift:657-660, and Agents.swift:3647-3649 for Codex).

  • Enter after queued messages shows queued text instead of the new draft #1029: Agents.followUp (Sources/Fast/ChatColumn.swift:2953-2957) appended every follow-up to the end of all three arrays, queued or sent now. With Q1 and Q2 queued and S sent with Enter, they held [Q1, Q2, S] while S was acknowledged first, so S was shown as Q1, with Q1's labels and attachments. A message sent now now goes ahead of the queued entries. ⌘Enter still appends, and so does a Cursor steer, since steer appends it to Cursor's queue.
  • Queueing a chat message with ⌘Enter jumps the transcript to the bottom #1030: ChatTranscript.body (Sources/Fast/ChatTranscript.swift:94) took sent from the whole saying.count, and .onChange(of: sent) (ChatTranscript.swift:285) treats any increase as a send: it sets follow, clears holding and below and scrolls to the end. It now reads Session.sends: the sent words not yet heard back (saying.count - queue.count) plus those heard back since the session was made (Session.echoed). A queued message leaves it alone. Claude Code and Cursor say a message back in the same step the queue lets it go (turned, then send), so the words heard back are counted too, or that send would not scroll. A session revived from a saved chat starts at zero, so opening one or picking its model does not scroll it.

Proof

  • Logic: a test that fails on main and passes here: swift test --filter 'ChatQueueTests'

New tests in Tests/FastTests/ChatQueueTests.swift, on a running Claude Code session whose stdin is a temporary file:

  • aMessageSentNowIsShownWithItsOwnWordsAndWhatWentWithIt: queues Q1 and Q2, then sends S with a quote; S is shown with its own words, label and retry attachment, and Q1 and Q2 stay queued in order.
  • queueingIsNotSendingButTheQueueLettingOneGoIs: queueing two messages leaves sends at 0; Claude Code's end-of-turn event, fed through Agents.hear, makes the queue let Q1 go and Claude Code say it back, and sends becomes 1.

With the two fixes undone (followUp appending again, the marker returning saying.count), on the first commit's version of the tests:

✘ ChatQueueTests.swift:36:9: Expectation failed: (asked.text → "Q1") == "S: please do this now"
✘ ChatQueueTests.swift:37:9: Expectation failed: (asked.detail → "") == (ChatAttachment.labels(tabs: [], files: [], quotes: ["the line"]).joined(separator: "\n") → "q:“the line”")
✘ ChatQueueTests.swift:38:9: Expectation failed: (session.sent[asked.id] → []) == ([.quote("the line")] → [Fast.ChatAttachment.quote("the line")])
✘ ChatQueueTests.swift:40:9: Expectation failed: (session.saying → ["Q2", "S: please do this now"]) == ["Q1", "Q2"]
✘ ChatQueueTests.swift:41:9: Expectation failed: (session.carrying == [[], []] → false) && (session.attaching == [[], []] → <not evaluated>)
✘ ChatQueueTests.swift:49:9: Expectation failed: (session.unheard → 2) == 0
✘ ChatQueueTests.swift:52:9: Expectation failed: (session.unheard → 2) == 1
✘ Test run with 2 tests in 1 suite failed after 0.038 seconds with 7 issues.

The current tests against the first commit of this PR (b0278e5, where the marker was saying.count - queue.count and missed a send acknowledged at once):

✘ ChatQueueTests.swift:42:9: Expectation failed: (session.unheard → 0) == 1
✘ ChatQueueTests.swift:55:9: Expectation failed: (session.unheard → 0) == 1
✘ Test run with 2 tests in 1 suite failed after 0.043 seconds with 2 issues.

With this branch:

swift test --filter 'ChatQueueTests|RemoteTaskFoundationTests|AgentArchiveLifecycleTests|ChatStreamStabilityTests|LiveStreamTests'
✔ Test run with 31 tests in 5 suites passed after 36.948 seconds.

Checked on

  • Checked through tests only, on macOS 27.0 on Apple silicon. Yab Dev was not built from this branch, and the real scroll position was not checked in the app.
  • Engine(s) tried: not about a page

Checklist

  • swift test passes (or the suites this touches: list them): ChatQueueTests, RemoteTaskFoundationTests, AgentArchiveLifecycleTests, ChatStreamStabilityTests, LiveStreamTests
  • ./design-check --head is clean, or each exception says why with // design:
  • Anything that changes how Yab looks was approved in the issue first (nothing here changes how Yab looks)
  • A new menu item is also a command in the field; a new Settings row is classified in NativeActions.swift (no new menu item or Settings row)
  • Words on screen and in docs are American English, with no em dashes

Not verified

  • The transcript's scroll position in the running app; the tests check the count that drives the scroll, not SwiftUI geometry.
  • The Codex acknowledgement path (Agents.swift:3647-3649) and the Codex steer paths have no test of their own. They take from the front of the same arrays, so the same order applies, but only the Claude Code path is tested.
  • Cursor sessions, Reduce Motion, and queue rows changing the composer's height.

Not in this PR

  • unqueue (ChatColumn.swift:2918) removes the taken-back message from saying but leaves its entries in carrying and attaching, so later messages can show the wrong labels and retry with the wrong attachments.
  • A steer that dispatchAllowed refuses leaves its words in saying, where the next acknowledgement can pick them up.

…o longer scrolls the chat

followUp appended every follow-up to the end of saying, carrying and
attaching, queued or sent now. The rest of the chat takes the last
queue.count of them as the queue's, and acknowledgements take from the
front, so with Q1 and Q2 queued an Enter on S showed S as Q1, with Q1's
labels and attachments. A message sent now now goes ahead of the queued
ones (yetanotherbrowser#1029).

The transcript followed saying.count down to the end, so a queued message
scrolled it as a send would. It now follows Session.unheard, the words
sent and not yet heard back, which a queued message leaves alone (yetanotherbrowser#1030).
@greptile-apps

greptile-apps Bot commented Nov 24, 2026 •

Copy link
Copy Markdown

RetriggerView in GreptileConfidence Score: 5/5

[Medium impact] The PR appears safe to merge, with the previous scrolling finding addressed and no new actionable issues found.

Summary

The PR keeps messages sent immediately ahead of queued messages, with their own labels and attachments.

  • An immediate message keeps its own words and attachments ahead of the queue.
  • The chat scrolls for sent messages, not messages still queued.

Reviews (2) · Last reviewed commit: "A message the queue lets go scrolls the ..." · Reviewed by Greptile

Comment thread Sources/Fast/ChatTranscript.swift Resolved
Claude Code and Cursor say a released message back the moment it goes:
turned takes it off the queue and send's acknowledgement takes its words
off saying in the same step, so saying.count - queue.count never moved
and the transcript stayed where the reader was. Session.sends adds the
words heard back since the session was made, so a send is still counted
once acknowledged. A session revived from a saved chat starts at zero,
so opening one or picking its model does not scroll it.
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.

Queueing a chat message with ⌘Enter jumps the transcript to the bottom Enter after queued messages shows queued text instead of the new draft

1 participant