Repository navigation
fix(react-core): route turn-2 Enter to send during interrupt-resume - #5195
Merged
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
5 of 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
8 tasks done
AlemTuzlak
added a commit
that referenced
this pull request
Nov 3, 2026
…to core Add the chat session pieces to @copilotkit/core and use them from the React, Vue and Angular CopilotChat: - ɵcreateChatSubmitter: send, suggestion, stop and transcription, with the send queue, the upload guard and the timed notice. - ɵThreadSwitchCoordinator: pins the thread, resets the agent on a switch to a fresh thread, orders teardowns, tracks connections. - ɵresetAgentThreadBaseline: one reset, also used by the run handler. Behaviour now shared by all three frameworks: - Vue queues a send behind the thread's connection and the run in flight (#5195), for typed messages and suggestions, instead of aborting the connect. - A send blocked by an upload shows chatAttachmentsUploadingText and restores the typed text in Vue and Angular (was React only). - Blank text is ignored and a loading suggestion cannot be picked (was Angular only). - A blank transcript leaves the input as it was (was Angular only). - Angular logs a failed detach instead of leaving the rejection unhandled, waits for every earlier teardown, and only resets while the fresh thread is still current. - Angular logs connect failures as "CopilotChat: connection failed" and a failed thread load blocks the send with threadLoadErrorText. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Merged
2 of 4 tasks
AlemTuzlak
added a commit
that referenced
this pull request
Nov 4, 2026
…e message view into core (#8179) The chat's send, attachment, thread-switch and message-list logic now lives in `@copilotkit/core`. React, Vue and Angular call it, so a fix there applies to all three. This fixes Vue sends that did not wait for the active run (#5195), Angular welcome-screen gating, and other drift between the three frameworks. This is PR 6 of 10 in the "2.0 core pipeline" stack. Base: `alem/2.0-core-agents-threads`. Merge it after PR 5. ## What does this PR do? New internal (`ɵ`) modules in `packages/core/src/chat/` and `packages/core/src/core/`: - `attachment-queue.ts`: `ɵAttachmentQueue`. It checks file type and size, shows a placeholder per file, uploads (`onUpload` or base64), and hands ready files to the next message. - `session.ts`: `ɵcreateChatSubmitter`. It owns send, suggestion, stop and transcription: the send queue, the upload guard, and the 5-second notice. - `thread-switch.ts` and `thread-baseline.ts`: `ɵThreadSwitchCoordinator` and `ɵresetAgentThreadBaseline`. They pin the thread, reset the agent on a switch to a fresh thread, and keep teardowns in order. The run handler uses the same reset. - `message-view.ts`: `ɵcreateMessageViewModel` for tool-call layout, the "turn" work summaries, and the cursor rule. - `chat-view.ts`: `ɵgetChatViewState` (suggestions, welcome screen, connecting indicator, padding) and the pin-to-send tracker. Fixes: - Vue now waits for the thread to load and for the active run before it sends (#5195). Before, a send in Vue stopped a thread load that was in progress, and the chat could stay in "connecting". - Vue and Angular show `chatAttachmentsUploadingText` and keep the typed text when an upload blocks a send. - Angular hides the welcome screen while the thread loads and when `[welcomeScreen]` is `false`. It also takes `[autoScroll]` instead of always scrolling. - Angular logs a failed detach on a thread switch instead of leaving an unhandled rejection. Not in this PR: a core connect/reconnect controller (item 6 of the slice). It is designed but not built. React, Vue and Angular still own their connect code. BREAKING CHANGE: behavior only. No public export, prop or input is removed or renamed. Migration steps are on the chat 2.0 migration page: - [Sending messages](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-chat-session/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#sending-messages): a send waits for the active run and the thread load. Blank text and loading suggestions are not sent. Angular sends text untrimmed. - [Attachment uploads](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-chat-session/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#attachment-uploads): `processFiles` needs `enabled: true`. Vue and Angular honor `maxConcurrentUploads`. - [Welcome screen and suggestions in Angular](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-chat-session/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#welcome-screen-and-suggestions-in-angular): a custom `<copilot-chat-view>` must pass `[isRunning]` and `[isConnecting]`. - [Console messages](https://github.com/CopilotKit/CopilotKit/blob/alem/2.0-core-chat-session/showcase/shell-docs/src/content/docs/migrate/chat-2.0.mdx#console-messages): new text for the Vue duplicate-ID warning and the Angular connect failure. ## Related PRs and Issues - Stack: PR 6 of 10, "2.0 core pipeline". Base `alem/2.0-core-agents-threads` (PR 5). - #5195 (Vue send did not wait for the active run). ## Checklist - [ ] I have read the [Contribution Guide](https://github.com/copilotkit/copilotkit/blob/master/CONTRIBUTING.md) - [x] If the PR changes or adds functionality, I have updated the relevant documentation - [x] If the PR contains a breaking change, the title has `!` (for example `feat(react-core)!: ...`) and the description has a `BREAKING CHANGE:` line with migration steps. See [VERSIONING.md](https://github.com/CopilotKit/CopilotKit/blob/main/VERSIONING.md) - [ ] "Allow edits by maintainers" is checked (lets us help iterate on your PR directly — faster turnaround for everyone) ## Merge notes - Angular `copilot-chat.ts` combines this layer's change with layer 5's. This layer makes a send wait for the thread to load. Layer 5 makes a failed connect end the Inspector's "view thread" override. Both now sit in the same connect callback. - A carry-over commit (`f47b53867f`) moves the React-only "connecting" indicator rule from 2.0.0 into core's `ɵgetChatViewState`, with tests. React reads it from there. ## Testing Commands run: - Before the stack merge: `nx run` build, check-types and test for `@copilotkit/core`, `@copilotkit/react-core`, `@copilotkit/vue` and `@copilotkit/angular`. Build and check-types passed. Tests: core 119/119 files, React 2482 passed. Vue 1437/1438 and Angular 675/677. The failures were timeouts under machine load (`build-entries`, `inspector.spec`, `mcp-apps-widget.spec`), and they passed when run alone. - On this head (`f47b53867f`): `nx run-many -t check-types` for the four packages passed. `nx run @copilotkit/core:test`: 146/146 files passed. `nx run` build for React, Vue and Angular passed when run one at a time. In one parallel run, the builds read a stale core `dist` and failed. - `nx run @copilotkit/v2-migration:test`: 52/52. `pnpm check:public-api-manifest`: current. - Not run: `nx run @copilotkit/vue:lint`. It fails with 197 errors on lines this PR does not touch. Core, React and Angular have no lint target. I ran repo `oxlint` on the changed files: 0 errors. Manual test (Vue, #5195): 1. On the base branch, open a Vue chat with an explicit `threadId` that has history. Send a message while the history still loads. The load stops, and the chat can stay in "connecting". 2. On this branch, do the same. The message waits until the history loads, then sends. 3. While a reply streams, send a second message. It sends after the first run ends. It does not stop that run. How this PR makes testing easy: core unit tests for every new module in `packages/core/src/chat/__tests__/` (`attachment-queue`, `session`, `thread-switch`, `message-view`, `chat-view`) and `packages/core/src/core/__tests__/thread-baseline.test.ts`. New Angular specs cover `[welcomeScreen]`, `[autoScroll]` and the connecting welcome gate. ## Risk / rollback The main risk is send timing. A send now waits for the active run in Vue. If a run never ends (for example, a human-in-the-loop prompt with no answer after its component unmounts in Vue), later sends wait too. To roll back, revert this PR. It has no data or config migration. ## Stack Merge in this order. Each PR's base is the PR above it. | # | PR | Area | Base | |---|---|---|---| | 1 | #8181 | Chat primitives | `2.0.0` | | 2 | #8173 | Provider config and runtime info | PR 1 | | 3 | #8176 | Tool-call rendering | PR 2 | | 4 | #8175 | A2UI, Open Generative UI, MCP Apps | PR 3 | | 5 | #8174 | Agents, threads, chat configuration | PR 4 | | 6 | **#8179 (this PR)** | Chat sends, attachments, message view | PR 5 | | 7 | #8178 | Chat input, recorder, DOM controllers | PR 6 | | 8 | #8177 | Markdown renderer | PR 7 | | 9 | #8182 | Suggestions, Inspector, learning | PR 8 | | 10 | #8180 | Interrupts and human-in-the-loop | PR 9 | **Stack verification.** After each merge, the stack builder ran these on this layer's head before pushing it, all with `--skip-nx-cache`: build, check-types and tests for core, react-core, vue and angular, plus the packages this layer touches; the codemod tests; oxlint; and `check:public-api-manifest`. On the top layer it also ran publint, attw, and the shell-docs tests and build. All passed. 🤖 Generated with [Claude Code](https://claude.com/claude-code) <!-- This is an auto-generated comment: release notes by coderabbit.ai --> <!-- coderabbit-ai-generated:v1 --> ## Summary by CodeRabbit * **New Features** * Chat submission, stopping, transcription, attachment handling, and thread switching now follow consistent behavior across React, Vue, and Angular. * Chat views now provide more consistent welcome-screen, suggestion, connecting-indicator, and message-layout behavior, with configurable welcome screens and auto-scrolling in Angular. * **Bug Fixes** * Sends wait for active runs and thread connections; failed connections and attachment uploads are handled more consistently. * **Documentation** * Updated the chat 2.0 migration guide with cross-framework behavior and Angular welcome-screen details. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
This branch was successfully deployed
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