Skip to content

Merge v2 - #2794

Merged
tylerslaton merged 128 commits into
mainfrom
mme/merge-v2
Dec 18, 2025
Merged

tylerslaton merged 128 commits into
mainfrom
mme/merge-v2

Conversation

@mme

@mme mme commented Dec 3, 2025 •

Copy link
Copy Markdown
Contributor

What does this PR do?

This PR moves the CopilotKit folder to src/v1.x and add src/v2.x

Summary by CodeRabbit

  • New Features

    • Coagent state rendering, suggestions support, and chat readiness spinner added
  • Bug Fixes

    • Improved state synchronization and predictive updates; fixed tool result arguments and agent instantiation/merging; interrupt rendering stability improved
  • Chores

    • Repository layout and CI/CD contexts reorganized for v1.x; release metadata and changesets added
  • Documentation

    • Docs, examples, and guides updated to reference the new v1.x source layout

✏️ Tip: You can customize this high-level summary in your review settings.

ranst91 and others added 30 commits October 17, 2025 21:03
Co-authored-by: Ran Shemtov <[email protected]>
Signed-off-by: Tyler Slaton <[email protected]>
@github-actions

github-actions Bot commented Dec 18, 2025 •

Copy link
Copy Markdown
Contributor

Preview environments destroyed for this pull request.

@github-actions

github-actions Bot commented Dec 18, 2025 •

Copy link
Copy Markdown
Contributor

Test Results

Status: ❌ Failed (View Run)

Commit: f610ae1

Duration: 1615.7s

Total Tests: 37

Pass Rate: 5.4%

Failed Tests: 35

❌ Failed Tests

🔍 Detailed Results

coagents-research-canvas

CoAgents Research Canvas (UI) - Local Depenencies

Model Browser Status Video
OpenAI chromium ❌ FAILED Video
Anthropic chromium ✅ PASSED -
CrewAI chromium ✅ PASSED -

coagents-qa-native

CoAgents QA Native (UI) - Local

Model Browser Status Video
OpenAI chromium ❌ FAILED Video
Anthropic chromium ❌ FAILED Video

coagents-qa-text

CoAgents QA Text (UI) - Local

Model Browser Status Video
OpenAI chromium ❌ FAILED Video
Anthropic chromium ❌ FAILED Video
OpenAI (LGC Python) chromium ❌ FAILED Video
Anthropic (LGC Python) chromium ❌ FAILED Video
OpenAI (LGC JS) chromium ❌ FAILED Video
Anthropic (LGC JS) chromium ❌ FAILED Video

coagents-routing

CoAgents Routing (UI) - Local

Model Browser Status Video
OpenAI chromium ❌ FAILED Video
Anthropic chromium ❌ FAILED Video

next-openai

Next OpenAI - Self Hosted

Model Browser Status Video
OpenAI chromium ❌ FAILED Video, Video, Video, Video, Video, Video
Anthropic chromium ❌ FAILED Video, Video, Video, Video, Video, Video
LangChain (OpenAI) chromium ❌ FAILED Video, Video, Video, Video, Video, Video
Groq chromium ❌ FAILED Video, Video, Video, Video, Video, Video

@changesets-bot-copilotkit

Copy link
Copy Markdown

⏭️ Changeset Not Required

Latest commit: d8e3b40

No changes in this PR affected the @copilitkit/* packages. Merging this PR will not cause a version bump for any packages.

Changeset is not required for this PR.

@tylerslaton
tylerslaton merged commit 036d541 into main Dec 18, 2025
@tylerslaton
tylerslaton deleted the mme/merge-v2 branch December 18, 2025 18:09
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 -->

This branch was successfully deployed

3 active deployments
Preview – docs — d8e3b40a Deployed Dec 18, 2025 by vercel[bot]
Preview – examples-coagents-research-canvas-ui — d8e3b40a Deployed Dec 18, 2025 by vercel[bot]
Preview – examples-coagents-ai-travel-app — d8e3b40a Deployed Dec 18, 2025 by vercel[bot]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants