Repository navigation
Merge v2 - #2794
Merged
Merged
Merge v2#2794
Conversation
Co-authored-by: Ran Shemtov <[email protected]>
Signed-off-by: Tyler Slaton <[email protected]>
Signed-off-by: Tyler Slaton <[email protected]>
Signed-off-by: Tyler Slaton <[email protected]>
Contributor
|
Preview environments destroyed for this pull request. |
Contributor
Test ResultsStatus: ❌ Failed (View Run) Commit: f610ae1 Duration: 1615.7s Total Tests: 37 Pass Rate: 5.4% Failed Tests: 35 ❌ Failed Tests
🔍 Detailed Resultscoagents-research-canvasCoAgents Research Canvas (UI) - Local Depenencies
coagents-qa-nativeCoAgents QA Native (UI) - Local
coagents-qa-textCoAgents QA Text (UI) - Local
coagents-routingCoAgents Routing (UI) - Local
next-openaiNext OpenAI - Self Hosted
|
Signed-off-by: Tyler Slaton <[email protected]>
⏭️ Changeset Not RequiredLatest commit: d8e3b40 No changes in this PR affected the Changeset is not required for this PR. |
This was referenced Jan 9, 2026
tylerslaton
pushed a commit
that referenced
this pull request
Feb 18, 2026
- Move original CopilotKit/CopilotKit directory to src/v1.x - Introduce new v2 interfaces in src/v2.x - Align CI paths and preview environments to new layout Signed-off-by: Tyler Slaton <[email protected]> Co-authored-by: Ran Shemtov <[email protected]> Co-authored-by: Brandon McConnell <[email protected]> Co-authored-by: Mike Ryan <[email protected]>
BenTaylorDev
added a commit
that referenced
this pull request
Sep 8, 2026
…6851) ## Summary A human-in-the-loop tool declared through the `humanInTheLoop` **prop** on `<CopilotKitProvider>` never waited for the user. The handler resolved `undefined` the moment the agent invoked it, and the renderer was registered unwrapped, so it never received a working `respond`. The card appeared once at `Complete` over dead controls while the agent was told the tool had succeeded. This is not a regression. The placeholder handler is unchanged since the first v2 provider commit (`a2ef51aaf3`, #2794), so this documented prop has never waited. The reference page describes it as self-sufficient: "Declarative human-in-the-loop tool definitions. Each becomes both a tool handler and a tool call renderer." The `useHumanInTheLoop` hook path is unaffected and has always worked. ## Changes `packages/react-core/src/v2/providers/CopilotKitProvider.tsx`, matching `useHumanInTheLoop`: - park the tool call until the render calls `respond`, keyed by tool call id so one call of a tool cannot resolve another - wrap the registered renderer so it receives the full prop contract, with `respond` live only while the status is `Executing` - reject with `Human-in-the-loop interaction aborted` on abort, so core records an explicit error tool result rather than an empty success (#5554) - keep the invoked tool's name for a wildcard (`"*"`) registration instead of overwriting it with `"*"` Two existing unit tests asserted the placeholder behavior (the `console.warn`, and render identity). They now assert the waiting contract and that the wrapper renders the caller's component. ## Testing **New: `CopilotKitProvider.hitl.e2e.test.tsx` (4 tests).** These mount the real pipeline — `CopilotChat` -> tool calls view -> the provider's registered renderer — rather than calling the renderer directly, so a mismatch between the key the handler parks under and the tool call id the pipeline supplies cannot pass. All four fail on `main` for the right reason (`Unable to find an element by: [data-testid="hitl-respond"]` — the respond button never appears), and pass with the change. Each mechanism was mutation-checked separately: | Mutation | Result | | -- | -- | | handler resolves immediately (the old placeholder) | all 4 fail | | renderer registered unwrapped | all 4 fail | | wildcard branch removed | only the wildcard test fails | | park under the tool name instead of the tool call id | the 2 tests needing a live `respond` fail | **Suite, types, format** ``` $ node ../../node_modules/vitest/vitest.mjs run src/v2/providers/__tests__/ Test Files 17 passed (17) Tests 173 passed (173) $ tsc --noEmit (clean) ``` `oxfmt` applied to every changed file. The full `react-core` run also has 7 failures across `CopilotChatView.pinToSend.test.tsx` and `use-pin-to-send.test.tsx` (`ResizeObserver is not a constructor`). Those are pre-existing: I removed this change from the working tree and ran those two files on clean `main`, and they fail identically. **Live, in `examples/v2/react/demo` against a real agent and a rebuilt dist** | Page | Before | After | | -- | -- | -- | | provider prop, multi-route REST | card at `complete`, `respond` undefined, console warned, agent said "Please pick a time slot in the scheduler UI to confirm" over disabled buttons | parks at `executing` with live buttons for 17s, then "Booked a call with Sam about the Waterfall project meeting for Tue 14:00" | | provider prop, single route | same, and worse: "…has been scheduled" before anyone approved | parks, then reports the slot actually chosen (Wed 09:30) | | `useHumanInTheLoop` hook, multi-route REST | already correct | unchanged: `inProgress` -> `executing` -> `complete` with the chosen slot reaching the agent | ## Credit @Tushar-Khandelwal-2004 diagnosed this path and implemented the parking handler and the abort semantics first, in #4955. That PR predates the wildcard-name work and the current `main`, and its review asks were still open, so this lands the same fix rebased on `main` with the wildcard branch and pipeline-level tests added. #4955 is now closed in favor of this PR, with the credit staying with them. ## Related - #4955 — the earlier implementation of this fix (closed in favor of this PR) - #6527 — the identical Vue defect; the two changes agree on semantics - #4953 — the reporter hit the hook path, which does not reproduce on `main`; this is the confirmed provider-prop half of that report Angular already implements this path (`addHumanInTheLoop` -> `#hitl.onResult`), so React was the last framework missing it. <!-- This is an auto-generated comment: release notes by coderabbit.ai --> ## Summary by CodeRabbit * **New Features** * Human-in-the-loop tool calls now pause until a user responds. * Interactive renderers receive tool metadata and a callback for submitting responses. * Wildcard tools display the specific tool name that was invoked. * Aborted tool calls now return a clear error result. * **Bug Fixes** * Multiple pending tool calls can be resolved independently by their call ID. * Interactive handlers no longer emit an unnecessary warning while awaiting a response. <!-- end of auto-generated comment: release notes by coderabbit.ai -->
2 of 4 tasks
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.
What does this PR do?
This PR moves the
CopilotKitfolder tosrc/v1.xand addsrc/v2.xSummary by CodeRabbit
New Features
Bug Fixes
Chores
Documentation
✏️ Tip: You can customize this high-level summary in your review settings.