Repository navigation
fix(vue,core): wait for the user on provider HITL tools, and abort wildcard handlers - #7315
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository: CopilotKit/CopilotKit/.coderabbit.yaml Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review. 📝 WalkthroughWalkthroughThe core wildcard tool path now forwards run abort signals. The Vue provider keeps human-in-the-loop calls pending until response or abort, injects execution-state callbacks, and supports wildcard tool names. Unit and end-to-end tests cover these behaviors. ChangesWildcard human-in-the-loop execution
Priority: ➖ Normal Estimated code review effort: 4 (Complex) | ~45 minutes Change: Bug fix · Severity of issue fixed: Medium 🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
@copilotkit/a2ui-renderer
@copilotkit/agentcore-runner
@copilotkit/angular
@copilotkit/channels
@copilotkit/channels-core
@copilotkit/channels-discord
@copilotkit/channels-intelligence
@copilotkit/channels-slack
@copilotkit/channels-teams
@copilotkit/channels-telegram
@copilotkit/channels-ui
@copilotkit/channels-whatsapp
@copilotkit/core
@copilotkit/intelligence-langgraph
@copilotkit/intelligence-mastra
@copilotkit/mcp-apps-renderer
@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-components
@copilotkit/web-inspector
commit: |
|
Size Change: -4.86 kB (-0.29%) Total Size: 1.69 MB 📦 View Changed
ℹ️ View Unchanged
|
The `humanInTheLoop` prop path registered a handler that warned and resolved `undefined` immediately, so the HITL UI flashed and disappeared instead of waiting for the user, and it registered `tool.render` unwrapped so the renderer never received a working `respond`. Brings the prop path to parity with the `useHumanInTheLoop` composable and with React's provider, which was fixed separately: - the tool call stays pending until `respond` is called - `respond` is live only while status is `Executing` - an aborted run rejects with `Human-in-the-loop interaction aborted`, so core records an explicit error tool result rather than silently resolving empty (#5554) - pending interactions are keyed by tool call id, so parallel interrupts on the same tool stay independent - a wildcard (`name: "*"`) registration keeps the invoked tool's name Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The unit tests drive the registered renderer directly with a synthesized handler context, which cannot catch a mismatch between the key the handler stores under and the tool call id the real pipeline supplies. This mounts `CopilotChat -> CopilotChatToolCallsView ->` the provider's wrapper, so the wrapper runs as a real Vue functional component and the key comes from core's own tool call id. Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
The named-tool path calls handlers with `signal:
this._runAbortController?.signal`, but `executeWildcardTool` passed only
`{ toolCall, agent }`. A wildcard handler that waits on something could
therefore never observe an abort, so a human-in-the-loop tool registered
as `"*"` stayed pending forever when the run was stopped.
Additive: handlers that ignore the signal are unaffected, and `signal`
was previously `undefined` for this path.
Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
67ef26a to
7a88eeb
Compare
Two frontend human-in-the-loop defects that are still live on
main. One commit each, so either can be reviewed or reverted alone.This replaces the two still-live halves of #6527, which I am closing. Its other two halves have since landed through other PRs — the parallel v1 tool rendering fix through #6682 (and its file has since moved under
v1-deprecated/), and the wildcard HITL name fix throughb17c8556be— so that branch is now two dead commits, one conflicting file path, and these two fixes. Rebasing it was not worth it.OSS-803 — Vue
humanInTheLoopprovider prop resolved immediatelyThe Vue provider's
humanInTheLoopprop path registered a handler that warned and resolvedundefinedright away, so the HITL UI flashed and disappeared instead of waiting for the user, and it registeredtool.renderunwrapped so the renderer never received a workingrespond.React's provider fixed exactly this separately (
packages/react-core/src/v2/providers/CopilotKitProvider.tsx,pendingHumanInTheLoopRef). This brings Vue to parity with it and with Vue's ownuseHumanInTheLoopcomposable:respondis calledrespondis live only while status isExecutingHuman-in-the-loop interaction aborted, so core records an explicit error tool result rather than silently resolving empty (Bug: renderAndWaitForResponse silently completes on user abandonment — no timeout, no error propagation to agent #5554)name: "*") registration keeps the invoked tool's nameagentId, whichVueHumanInTheLoopRenderPropsdeclares and the composable already supplies (this one is mine, not in fix: parallel v1 tool rendering, Vue provider HITL, wildcard HITL names and abort #6527)The abort bullet depends on a
signalthat core does not always supply — hence the second commit.packages/core— wildcard tool handlers never received the abort signalThe named-tool path calls handlers with
signal: this._runAbortController?.signal(run-handler.ts:918), butexecuteWildcardToolpassed only{ toolCall, agent }(run-handler.ts:1101). A wildcard handler that waits on something therefore could never observe an abort, so a HITL tool registered as"*"stayed pending forever when the run was stopped — in React'suseHumanInTheLoopas much as in the Vue provider path above.The fix adds that one argument. It is additive: handlers that ignore the signal are unaffected, and
signalwas previouslyundefinedfor this path.FrontendToolHandlerContext.signalis already optional and already documented (packages/core/src/types.ts:39).Testing
Every fix has a test that fails without it. Each negative control was run by reverting only the source file on this branch and re-running the same tests.
OSS-803 — 7 unit tests in
CopilotKitProvider.test.ts(pending-until-respond,respondonly while executing, abort rejects, already-aborted rejects, parallel interrupts independent, wildcard name,agentIdforwarded), plus 2 mounted end-to-end tests inCopilotKitProvider.hitl.e2e.test.ts. Two existing tests asserted the old placeholder behavior (resolves undefined+ the warning) or comparedrenderby identity, and were updated: the renderer is now a wrapper, so they assert it delegates to the user's component.The unit tests drive the registered renderer directly with a synthesized handler context, which cannot catch a mismatch between the key the handler stores under and the tool call id the real pipeline supplies. The e2e file closes that: it mounts
CopilotChat → CopilotChatToolCallsView →the provider's wrapper, so the wrapper runs as a real Vue functional component and the key comes from core's own tool call id.With the fix:
With
CopilotKitProvider.vuealone reverted toorigin/main, 11 fail — including both e2e tests, which never reachExecutingso no approve button is ever rendered:The
agentIdline mutation-checks on its own: deleting onlyagentId: tool.agentIdfrom the wrapper fails exactly one test,passes agentId through to the HITL renderer, and nothing else.core wildcard signal — 2 new tests in
core-abort-during-tool.test.ts, mirroring the named-tool pair already there: one asserts a wildcard handler receives anAbortSignal, the other thatstopAgent()during wildcard execution aborts it. With the fix,6 passed (6). Reverting only the changed line inrun-handler.tsfails both while the four existing tests stay green:Repo-wide checks
@copilotkit/vuefull suite106 passed (106)files,1135 passed (1135)tests@copilotkit/vuevue-tsc --noEmit@copilotkit/corefull suite (uncached)76 passed (76)files,894 passed (894)tests@copilotkit/coretsc --noEmitoxfmt --checkon all 6 changed filesAll matched files use the correct format.eslinton changed Vue filesorigin/mainon the same file (both unused-import false positives, same two symbols) — no new lint errorsThe stale-
@copilotkit/sharedbuild artifact that forced a--no-verifycommit and 20core-inspector-metadatatimeouts on #6527 is not present here: this worktree was set up with a fullpnpm install, so the core suite is genuinely green.Not in this PR
useHumanInTheLoopcomposable has the same wildcardnameclobber that React's hook fixed, and no abort handling at all. Separate from the prop path this PR fixes.request.signalgets wired up.Fixes OSS-803
🤖 Generated with Claude Code
Summary by CodeRabbit
New Features
Bug Fixes