Skip to content

fix(react-core): route turn-2 Enter to send during interrupt-resume - #5195

Merged
jpr5 merged 1 commit into
mainfrom
fix/gen-ui-interrupt-minimal
Jun 3, 2026
Merged

jpr5 merged 1 commit into
mainfrom
fix/gen-ui-interrupt-minimal

Conversation

@jpr5

@jpr5 jpr5 commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

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-core v2 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's activeRunCompletionPromise before dispatching the new message, instead of pre-empting it via runAgent/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

  • Isolated-D6 e2e (dist-overlay): both pills green — langgraph-typescript and langgraph-python, each turnsCompleted: 2, state: green.
  • react-core suite: 1201 passed (95 files). Red-green confirmed for the Enter-routing + queuing tests (they fail without the fix).
  • Typecheck: zero new errors in touched files. Build: publishable dist.
  • 7-agent code review converged to zero subject-scoped findings.

Follow-ups (separate PRs)

  • Send-queue serialization + suggestion-path in-flight guard (robust completion-promise via core RunHandler).
  • gen-ui-interrupt demo matrix: DRY the duplicated demo pages into a shared component (thin per-hook adapters), migrate non-LangGraph integrations off the dead-on-Strategy-B useInterrupt to useHumanInTheLoop, and minimize the strands/langroid backends.

Release: standard release / create-pr → merge → release / publish (OIDC) flow — no changeset.

🤖 Generated with Claude Code

…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.
@vercel

vercel Bot commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
chat-with-your-data Ready Ready Preview, Comment Jun 3, 2026 8:32pm
docs Ready Ready Preview, Comment Jun 3, 2026 8:32pm
form-filling Ready Ready Preview, Comment Jun 3, 2026 8:32pm
research-canvas Ready Ready Preview, Comment Jun 3, 2026 8:32pm
travel Ready Ready Preview, Comment Jun 3, 2026 8:32pm

Request Review

@github-actions

github-actions Bot commented Jun 3, 2026

Copy link
Copy Markdown
Contributor

📣 Social Copy Generator

Generate social media copies (Twitter/X, LinkedIn, Blog Post) for this PR using Claude.

  • Generate social media copies

@github-actions

github-actions Bot commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Production Digest-Pinning Audit

All 27 services digest-pinned.

Run 2026-06-03 13:26:24 PDT — 0 finding(s).

@pkg-pr-new

pkg-pr-new Bot commented Jun 3, 2026 •

Copy link
Copy Markdown

Open in StackBlitz

@copilotkit/a2ui-renderer

pnpm add https://pkg.pr.new/@copilotkit/a2ui-renderer@5195

@copilotkit/agentcore-runner

pnpm add https://pkg.pr.new/@copilotkit/agentcore-runner@5195

@copilotkitnext/angular

pnpm add https://pkg.pr.new/@copilotkitnext/angular@5195

@copilotkit/core

pnpm add https://pkg.pr.new/@copilotkit/core@5195

@copilotkit/react-core

pnpm add https://pkg.pr.new/@copilotkit/react-core@5195

@copilotkit/react-native

pnpm add https://pkg.pr.new/@copilotkit/react-native@5195

@copilotkit/react-textarea

pnpm add https://pkg.pr.new/@copilotkit/react-textarea@5195

@copilotkit/react-ui

pnpm add https://pkg.pr.new/@copilotkit/react-ui@5195

@copilotkit/runtime

pnpm add https://pkg.pr.new/@copilotkit/runtime@5195

@copilotkit/runtime-client-gql

pnpm add https://pkg.pr.new/@copilotkit/runtime-client-gql@5195

@copilotkit/sdk-js

pnpm add https://pkg.pr.new/@copilotkit/sdk-js@5195

@copilotkit/shared

pnpm add https://pkg.pr.new/@copilotkit/shared@5195

@copilotkit/sqlite-runner

pnpm add https://pkg.pr.new/@copilotkit/sqlite-runner@5195

@copilotkit/voice

pnpm add https://pkg.pr.new/@copilotkit/voice@5195

@copilotkit/vue

pnpm add https://pkg.pr.new/@copilotkit/vue@5195

@copilotkit/web-inspector

pnpm add https://pkg.pr.new/@copilotkit/web-inspector@5195

commit: cd0e145

@github-actions

github-actions Bot commented Jun 3, 2026 •

Copy link
Copy Markdown
Contributor

Size Change: +484 B (+0.05%)

Total Size: 980 kB

📦 View Changed
Filename Size Change
packages/react-core/dist/copilotkit-B5RsC6la.mjs 0 B -88.4 kB (removed) 🏆
packages/react-core/dist/copilotkit-BRNy5UvX.mjs 88.6 kB +88.6 kB (new file) 🆕
packages/react-core/dist/copilotkit-DhONbYmz.cjs 89.7 kB +89.7 kB (new file) 🆕
packages/react-core/dist/copilotkit-IQO0VDZb.cjs 0 B -89.6 kB (removed) 🏆
packages/react-core/dist/index.cjs 16.9 kB -2 B (-0.01%)
packages/react-core/dist/v2/index.mjs 889 B +2 B (+0.23%)
packages/react-core/dist/v2/index.umd.js 89.5 kB +195 B (+0.22%)
ℹ️ View Unchanged
Filename Size
packages/a2ui-renderer/dist/_virtual/_rolldown/runtime.cjs 516 B
packages/a2ui-renderer/dist/a2ui-types.cjs 172 B
packages/a2ui-renderer/dist/a2ui-types.mjs 171 B
packages/a2ui-renderer/dist/index.cjs 842 B
packages/a2ui-renderer/dist/index.mjs 563 B
packages/a2ui-renderer/dist/index.umd.js 12.2 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/A2uiSurface.cjs 1.49 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/A2uiSurface.mjs 1.43 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/adapter.cjs 1.07 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/adapter.mjs 1.01 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.cjs 904 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/AudioPlayer.mjs 492 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Button.cjs 1 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Button.mjs 596 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Card.cjs 829 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Card.mjs 419 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.cjs 1.1 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/CheckBox.mjs 1.02 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/ChildList.cjs 799 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/ChildList.mjs 737 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.cjs 1.63 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/ChoicePicker.mjs 1.57 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Column.cjs 856 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Column.mjs 802 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.cjs 1.12 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/DateTimeInput.mjs 1.05 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.cjs 842 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Divider.mjs 432 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.cjs 877 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Icon.mjs 469 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Image.cjs 995 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Image.mjs 587 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/List.cjs 920 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/List.mjs 508 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.cjs 1.19 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Modal.mjs 1.13 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Row.cjs 855 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Row.mjs 801 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.cjs 1.06 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Slider.mjs 984 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.cjs 1.1 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Tabs.mjs 1.04 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Text.cjs 903 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Text.mjs 489 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.cjs 1.21 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/TextField.mjs 1.14 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Video.cjs 788 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/components/Video.mjs 378 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/index.cjs 928 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/index.mjs 855 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/utils.cjs 579 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/basic/utils.mjs 556 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.cjs 982 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Button.mjs 580 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/ChildList.cjs 800 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/ChildList.mjs 735 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.cjs 1.08 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Column.mjs 1.02 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.cjs 1.07 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Row.mjs 1.01 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.cjs 894 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/Text.mjs 839 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.cjs 1.21 kB
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/components/TextField.mjs 802 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/index.cjs 849 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/catalog/minimal/index.mjs 804 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/index.cjs 310 B
packages/a2ui-renderer/dist/react-renderer/a2ui-react/index.mjs 325 B
packages/a2ui-renderer/dist/react-renderer/catalog-utils.cjs 1.59 kB
packages/a2ui-renderer/dist/react-renderer/catalog-utils.mjs 1.52 kB
packages/a2ui-renderer/dist/react-renderer/core/A2UIProvider.cjs 1.5 kB
packages/a2ui-renderer/dist/react-renderer/core/A2UIProvider.mjs 1.42 kB
packages/a2ui-renderer/dist/react-renderer/core/A2UIRenderer.cjs 728 B
packages/a2ui-renderer/dist/react-renderer/core/A2UIRenderer.mjs 671 B
packages/a2ui-renderer/dist/react-renderer/create-catalog.cjs 1.35 kB
packages/a2ui-renderer/dist/react-renderer/create-catalog.mjs 1.28 kB
packages/a2ui-renderer/dist/react-renderer/hooks/useA2UI.cjs 316 B
packages/a2ui-renderer/dist/react-renderer/hooks/useA2UI.mjs 309 B
packages/a2ui-renderer/dist/react-renderer/index.cjs 399 B
packages/a2ui-renderer/dist/react-renderer/index.mjs 515 B
packages/a2ui-renderer/dist/react-renderer/lib/utils.cjs 236 B
packages/a2ui-renderer/dist/react-renderer/lib/utils.mjs 188 B
packages/a2ui-renderer/dist/react-renderer/styles/index.cjs 239 B
packages/a2ui-renderer/dist/react-renderer/styles/index.mjs 231 B
packages/a2ui-renderer/dist/react-renderer/theme/ThemeContext.cjs 436 B
packages/a2ui-renderer/dist/react-renderer/theme/ThemeContext.mjs 381 B
packages/core/dist/index.cjs 31.6 kB
packages/core/dist/index.mjs 31.4 kB
packages/core/dist/index.umd.js 34.5 kB
packages/react-core/dist/index.mjs 16.9 kB
packages/react-core/dist/index.umd.js 61.9 kB
packages/react-core/dist/v2/context.cjs 1.53 kB
packages/react-core/dist/v2/context.mjs 1.46 kB
packages/react-core/dist/v2/headless.cjs 10.3 kB
packages/react-core/dist/v2/headless.mjs 9.73 kB
packages/react-core/dist/v2/index.cjs 1.06 kB
packages/react-textarea/dist/index.cjs 18.1 kB
packages/react-textarea/dist/index.mjs 17.4 kB
packages/react-textarea/dist/index.umd.js 18.8 kB
packages/react-ui/dist/index.cjs 24.8 kB
packages/react-ui/dist/index.mjs 24.1 kB
packages/react-ui/dist/index.umd.js 26 kB
packages/runtime-client-gql/dist/_virtual/_rolldown/runtime.cjs 516 B
packages/runtime-client-gql/dist/client/conversion.cjs 1.52 kB
packages/runtime-client-gql/dist/client/conversion.mjs 1.45 kB
packages/runtime-client-gql/dist/client/CopilotRuntimeClient.cjs 1.48 kB
packages/runtime-client-gql/dist/client/CopilotRuntimeClient.mjs 1.44 kB
packages/runtime-client-gql/dist/client/types.cjs 701 B
packages/runtime-client-gql/dist/client/types.mjs 642 B
packages/runtime-client-gql/dist/graphql/@generated/gql.cjs 850 B
packages/runtime-client-gql/dist/graphql/@generated/gql.mjs 850 B
packages/runtime-client-gql/dist/graphql/@generated/graphql.cjs 2.4 kB
packages/runtime-client-gql/dist/graphql/@generated/graphql.mjs 2.36 kB
packages/runtime-client-gql/dist/graphql/definitions/mutations.cjs 740 B
packages/runtime-client-gql/dist/graphql/definitions/mutations.mjs 732 B
packages/runtime-client-gql/dist/graphql/definitions/queries.cjs 316 B
packages/runtime-client-gql/dist/graphql/definitions/queries.mjs 304 B
packages/runtime-client-gql/dist/index.cjs 679 B
packages/runtime-client-gql/dist/index.mjs 495 B
packages/runtime-client-gql/dist/index.umd.js 9.46 kB
packages/runtime-client-gql/dist/message-conversion/agui-to-gql.cjs 1.7 kB
packages/runtime-client-gql/dist/message-conversion/agui-to-gql.mjs 1.67 kB
packages/runtime-client-gql/dist/message-conversion/gql-to-agui.cjs 1.56 kB
packages/runtime-client-gql/dist/message-conversion/gql-to-agui.mjs 1.53 kB
packages/runtime-client-gql/dist/package.cjs 181 B
packages/runtime-client-gql/dist/package.mjs 116 B
packages/shared/dist/_virtual/_rolldown/runtime.cjs 516 B
packages/shared/dist/a2ui-prompts.cjs 2.85 kB
packages/shared/dist/a2ui-prompts.mjs 2.85 kB
packages/shared/dist/attachments/utils.cjs 1.74 kB
packages/shared/dist/attachments/utils.mjs 1.7 kB
packages/shared/dist/constants/index.cjs 362 B
packages/shared/dist/constants/index.mjs 345 B
packages/shared/dist/debug.cjs 454 B
packages/shared/dist/debug.mjs 452 B
packages/shared/dist/finalize-events.cjs 1.09 kB
packages/shared/dist/finalize-events.mjs 1.05 kB
packages/shared/dist/index.cjs 1.76 kB
packages/shared/dist/index.mjs 1.46 kB
packages/shared/dist/index.umd.js 20.2 kB
packages/shared/dist/logger.cjs 112 B
packages/shared/dist/logger.mjs 112 B
packages/shared/dist/package.cjs 181 B
packages/shared/dist/package.mjs 116 B
packages/shared/dist/standard-schema.cjs 740 B
packages/shared/dist/standard-schema.mjs 737 B
packages/shared/dist/telemetry/lambda-client.cjs 1.15 kB
packages/shared/dist/telemetry/lambda-client.mjs 1.14 kB
packages/shared/dist/telemetry/telemetry-client.cjs 1.33 kB
packages/shared/dist/telemetry/telemetry-client.mjs 1.28 kB
packages/shared/dist/telemetry/utils.cjs 321 B
packages/shared/dist/telemetry/utils.mjs 277 B
packages/shared/dist/transcription-errors.cjs 951 B
packages/shared/dist/transcription-errors.mjs 944 B
packages/shared/dist/utils/clipboard.cjs 407 B
packages/shared/dist/utils/clipboard.mjs 405 B
packages/shared/dist/utils/conditions.cjs 540 B
packages/shared/dist/utils/conditions.mjs 536 B
packages/shared/dist/utils/console-styling.cjs 1.24 kB
packages/shared/dist/utils/console-styling.mjs 1.22 kB
packages/shared/dist/utils/errors.cjs 4.51 kB
packages/shared/dist/utils/errors.mjs 4.41 kB
packages/shared/dist/utils/index.cjs 1.39 kB
packages/shared/dist/utils/index.mjs 1.65 kB
packages/shared/dist/utils/json-schema.cjs 1.97 kB
packages/shared/dist/utils/json-schema.mjs 1.91 kB
packages/shared/dist/utils/random-id.cjs 618 B
packages/shared/dist/utils/random-id.mjs 559 B
packages/shared/dist/utils/requests.cjs 706 B
packages/shared/dist/utils/requests.mjs 704 B
packages/shared/dist/utils/types.cjs 161 B
packages/shared/dist/utils/types.mjs 160 B
packages/voice/dist/_virtual/_rolldown/runtime.cjs 516 B
packages/voice/dist/index.cjs 175 B
packages/voice/dist/index.mjs 95 B
packages/voice/dist/index.umd.js 1.5 kB
packages/voice/dist/transcription/transcription-service-openai.cjs 495 B
packages/voice/dist/transcription/transcription-service-openai.mjs 434 B
packages/web-inspector/dist/assets/inspector-logo-icon.cjs 499 B
packages/web-inspector/dist/assets/inspector-logo-icon.mjs 434 B
packages/web-inspector/dist/assets/inspector-logo.cjs 4.32 kB
packages/web-inspector/dist/assets/inspector-logo.mjs 4.23 kB
packages/web-inspector/dist/index.cjs 43.3 kB
packages/web-inspector/dist/index.mjs 43.2 kB
packages/web-inspector/dist/index.umd.js 59.6 kB
packages/web-inspector/dist/lib/context-helpers.cjs 862 B
packages/web-inspector/dist/lib/context-helpers.mjs 830 B
packages/web-inspector/dist/lib/persistence.cjs 1.2 kB
packages/web-inspector/dist/lib/persistence.mjs 1.16 kB
packages/web-inspector/dist/lib/telemetry.cjs 1.67 kB
packages/web-inspector/dist/lib/telemetry.mjs 1.63 kB
packages/web-inspector/dist/styles/generated.cjs 6.41 kB
packages/web-inspector/dist/styles/generated.mjs 6.35 kB

compressed-size-action

@jpr5
jpr5 merged commit 63fd2f0 into main Jun 3, 2026
39 checks passed
@jpr5
jpr5 deleted the fix/gen-ui-interrupt-minimal branch June 3, 2026 21:36
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).
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]>
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

5 active and 1 inactive deployments
Preview – travel — cd0e1453 Deployed Jun 3, 2026 by vercel[bot]
Preview – research-canvas — cd0e1453 Deployed Jun 3, 2026 by vercel[bot]
Preview – docs — cd0e1453 Deployed Jun 3, 2026 by vercel[bot]
Preview – form-filling — cd0e1453 Deployed Jun 3, 2026 by vercel[bot]
Preview – chat-with-your-data — cd0e1453 Deployed Jun 3, 2026 by vercel[bot]
npm — cd0e1453 Deployed Jun 3, 2026 by jpr5 via build #6222
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.

1 participant