Skip to content

Fix sending messages during active turns#3919

Open
jakeleventhal wants to merge 2 commits into
pingdotgg:mainfrom
jakeleventhal:t3code/fix-send-during-agent-response
Open

Fix sending messages during active turns#3919
jakeleventhal wants to merge 2 commits into
pingdotgg:mainfrom
jakeleventhal:t3code/fix-send-during-agent-response

Conversation

@jakeleventhal

@jakeleventhal jakeleventhal commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

What changed

  • track the latest projected user message in the local dispatch snapshot
  • acknowledge sends that add a steering message to an already-running turn
  • add regression coverage for steering without a new turn or timestamp change

Why

Messages sent while an agent was already working remain on the current turn. The composer only recognized server acknowledgment when turn metadata changed, so its local sending state could remain stuck until the thread was remounted by navigating away and back.

This change also treats the newly projected user message as acknowledgment, allowing subsequent steering messages without thread navigation.

Validation

  • pnpm exec vp test apps/web/src/components/ChatView.logic.test.ts
  • pnpm exec vp check
  • pnpm exec vp run typecheck

Note

Fix message sending during active turns by recognizing steering messages as server acknowledgment

  • hasServerAcknowledgedLocalDispatch now returns true during a running turn when the latest user message ID changes, treating a projected steering message as server acknowledgment
  • LocalDispatchSnapshot gains a latestUserMessageId field, captured via findLast over messages with role === 'user' at snapshot creation time
  • ChatView.useLocalDispatchState passes the current latestUserMessageId into the acknowledgment check, clearing activeLocalDispatch and unblocking isSendBusy sooner when a steering message appears

Macroscope summarized e78403b.


Note

Low Risk
Narrow composer UX fix in local dispatch acknowledgment logic with targeted unit tests; no auth, data, or API surface changes.

Overview
Fixes the composer staying in Sending after you message an agent that is already working. Steering adds a user message on the same running turn, so turn timestamps often do not change and the old acknowledgment logic never cleared local dispatch.

LocalDispatchSnapshot now records latestUserMessageId at send time. hasServerAcknowledgedLocalDispatch compares that id to the thread’s latest user message and, while phase === "running", treats a new projected message as server acknowledgment even when turn metadata is unchanged. useLocalDispatchState passes the current latest user message id into that check.

Regression test covers steering onto a running turn without a new turn or timestamp change.

Reviewed by Cursor Bugbot for commit e78403b. Bugbot is set up for automated code reviews on this repo. Configure here.

@coderabbitai

coderabbitai Bot commented Jul 12, 2026

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: a22784af-c6dd-48ba-81d5-90132596d787

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions github-actions Bot added vouch:unvouched PR author is not yet trusted in the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Jul 12, 2026
@jakeleventhal jakeleventhal marked this pull request as ready for review July 12, 2026 18:45
Comment thread apps/web/src/components/ChatView.tsx

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes using high effort and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 9361c84. Configure here.

Comment thread apps/web/src/components/ChatView.tsx Outdated
@macroscopeapp

macroscopeapp Bot commented Jul 12, 2026

Copy link
Copy Markdown
Contributor

Approvability

Verdict: Approved

Straightforward bug fix that adds tracking for the latest user message ID to properly acknowledge steering messages during active turns. The change is self-contained with clear intent, good documentation, and comprehensive test coverage.

You can customize Macroscope's approvability policy. Learn more.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 9361c84e3b

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread apps/web/src/components/ChatView.tsx Outdated
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:unvouched PR author is not yet trusted in the VOUCHED list.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant