system_interface: guard interrupt-and-send against concurrent restarts#170
Draft
pseay-imbue wants to merge 1 commit into
Draft
system_interface: guard interrupt-and-send against concurrent restarts#170pseay-imbue wants to merge 1 commit into
pseay-imbue wants to merge 1 commit into
Conversation
Each queued-message bubble renders its own "interrupt and send" button, and interruptAndResend had no per-agent in-flight guard. Triggering the action on several queued messages at once fired overlapping restarts of the same agent; a send from one sequence landed mid-restart of another, failing with "0 successful agents". Add a module-level per-agent in-flight set: interruptAndResend now returns early if a resend is already running for that agent, and releases the guard in a finally so it clears on success and error alike. Mirrors MessageInput's isInterruptInFlight guard. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
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.
Problem
In the chat web UI, a queued message exposes an "interrupt and send" action (
interruptAndResendinPendingMessageView.ts), which restarts the agent and then re-sends the message. Each queued message bubble renders its own button, andinterruptAndResendhad no per-agent in-flight guard. With multiple queued messages, triggering the action on more than one fires several interrupt+send sequences concurrently against the same agent. The overlapping restarts repeatedly tear down and re-spawn the agent, so a send from one sequence lands while another's restart is mid-flight, producing:MessageInput.ts'shandleInterruptalready guards against this withisInterruptInFlight;interruptAndResendwas missing the equivalent.Fix
Add a per-agent in-flight guard to
interruptAndResend:const interruptResendInFlight = new Set<string>().finally, so the guard clears on both success and error.markPendingMessageSending/markPendingMessageQueued/removePendingMessage/ failurealert) is unchanged.Tests
Added three tests to
PendingMessageView.test.ts: a held/deferredinterruptAgentproves a second concurrent resend for the same agent is a no-op (interruptAgent/sendMessageeach called once), plus two asserting the guard clears after success and after failure so a later resend still runs.Checks (from
apps/system_interface/frontend):npm test153 passed / 0 failed;npm run lintclean;npm run format:checkclean.Scope / follow-ups
🤖 Generated with Claude Code