fix(react-core): route turn-2 Enter to send during interrupt-resume#5195
Merged
Conversation
…nstead of aborting the run On consecutive interrupts, pressing Enter for the second turn (turn-2) while the resumed run from turn-1 was still in flight routed the keystroke to the STOP action, aborting the in-flight resume instead of sending the new message. The fix gates the Enter handler on `canSend` so a pending/running state no longer maps Enter to STOP, and `onSubmitInput` now awaits the in-flight run's completion before dispatching the queued message — the message is sent after the current run finishes rather than aborting it. Also hardens the queuing and attachment tests to cover the consecutive- interrupt path and the send-after-run-completes behavior.
jpr5
requested review from
marthakelly,
mme,
ranst91 and
tylerslaton
as code owners
June 3, 2026 20:04
Contributor
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
📣 Social Copy GeneratorGenerate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.
|
Contributor
Production Digest-Pinning AuditAll 27 services digest-pinned. Run 2026-06-03 13:26:24 PDT — 0 finding(s). |
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkitnext/angular
@copilotkit/core
@copilotkit/react-core
@copilotkit/react-native
@copilotkit/react-textarea
@copilotkit/react-ui
@copilotkit/runtime
@copilotkit/runtime-client-gql
@copilotkit/sdk-js
@copilotkit/shared
@copilotkit/sqlite-runner
@copilotkit/voice
@copilotkit/vue
@copilotkit/web-inspector
commit: |
Contributor
|
Size Change: +484 B (+0.05%) Total Size: 980 kB 📦 View Changed
ℹ️ View Unchanged
|
jpr5
force-pushed
the
fix/gen-ui-interrupt-minimal
branch
from
June 3, 2026 20:25
b5ef776 to
c6e8b06
Compare
jpr5
force-pushed
the
fix/gen-ui-interrupt-minimal
branch
from
June 3, 2026 20:29
c6e8b06 to
cd0e145
Compare
Merged
6 tasks
jpr5
added a commit
that referenced
this pull request
Jun 4, 2026
…e the suggestion send path Replace the brittle `"activeRunCompletionPromise" in agent` probe + double `as unknown as` casts in CopilotChat with a typed `RunCompletionAware` contract plus an `isRunCompletionAware` type guard, both exported from core. IntelligenceAgent now declares the property and implements the interface, so the in-flight-run await is reachable without a cast and non-Intelligence agents still degrade safely. Cast sites in the attachments/e2e tests and the MockStepwiseAgent helper are updated to the typed accessor. Factor the await-then-send logic into a shared `waitForActiveRunToSettle` helper and call it from BOTH onSubmitInput and handleSelectSuggestion. This closes the suggestion-path in-flight gap: selecting a suggestion mid-run no longer pre-empts/aborts the active run (e.g. an interrupt RESUME) — the same regression PR #5195 fixed for the typed-Enter path. Adds a red-green regression test that parks the suggestion send on the in-flight promise.
jpr5
added a commit
that referenced
this pull request
Jun 4, 2026
CopilotChatInput intentionally diverges while a run is in flight: Enter with sendable text routes to SEND (the consecutive-interrupt unblock from #5195), while the send/stop button always routes to STOP. Only a comment bound these two behaviors together. Add a regression test asserting BOTH at once so a future refactor cannot silently re-converge them (verified red against both a button-sends-while-running and an Enter-also-stops mutation).
This was referenced Jun 13, 2026
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.
Summary
Fixes the consecutive-interrupt regression: after picking turn-1's interrupt option, the resume run is still streaming, so pressing Enter to send turn-2 was routed to STOP and aborted the in-flight run — the second interrupt's card never surfaced.
Two-part fix in
@copilotkit/react-corev2 chat:CopilotChatInput— Enter now routes to send whenever the composer holds sendable text (isProcessing && !canSend→ stop). Stop stays reachable via Enter only when the composer is empty. The send/stop button is unchanged (always stops during a run).CopilotChat.onSubmitInput— awaits the in-flight run'sactiveRunCompletionPromisebefore dispatching the new message, instead of pre-empting it viarunAgent/detachActiveRun. The two turns serialize: the resume finishes before the new message starts a fresh run. Typed text is optimistically cleared and restored on a blocked send.Scope is intentionally the react-core fix only (4 files).
Verification
langgraph-typescriptandlanggraph-python, eachturnsCompleted: 2,state: green.Follow-ups (separate PRs)
RunHandler).useInterrupttouseHumanInTheLoop, and minimize the strands/langroid backends.Release: standard
release / create-pr→ merge →release / publish(OIDC) flow — no changeset.🤖 Generated with Claude Code