Repository navigation
fix(infer): pass the interrupt signal to embedding batches - #192846
wangmiao0668000666 wants to merge 1 commit into
Conversation
infer embedding create runs a provider embedBatch without forwarding the CLI work-scope signal, so an accepted Ctrl+C cannot cancel the in-flight provider request and the command waits out the batch. Mirror the image, web and TTS capability commands by handing getAsyncWorkSignal() to the embedBatch call; runCapabilityCommand already suppresses late output for accepted interrupts. Precedent: openclaw#191176, openclaw#191628, openclaw#191635, openclaw#192818
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs real behavior proof before merge. What this changesForward the CLI cancellation signal to embedding batches and add an interruption regression. Example: Press Ctrl+C while
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 2 items remain Keep open: this PR addresses a current cancellation defect with a focused runtime change, but its added regression causes a test-budget CI failure. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherThe embedding CLI resolves the selected provider, submits text through embedBatch, closes the provider, and publishes vectors through the shared cancellation-aware output wrapper. flowchart LR
A[CLI invocation] --> B[Async work scope]
B --> C[Embedding command]
C --> D[Embedding provider]
D --> E[HTTP transport]
D --> F[Provider cleanup]
F --> G[Cancellation-aware output]
Technical reviewBest possible solution: Keep the existing signal-forwarding fix and preserve its regression within the repository's test-line budget. Do we have a high-confidence way to reproduce the issue? Source confirms that current main drops the existing cancellation signal before embedBatch; the contributor reports a matching red/green regression, but no target code was executed during this review. Is this the best way to solve the issue? Forwarding the existing work-scope signal at the CLI call site is the smallest complete runtime fix and preserves provider selection, cleanup, and shared output ownership. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 07e545e113f1. Provenance checked
TestingProof path: unit tests only. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +2, Tests +21. Total +23 across 2 files. Added test files: 0. View PR surface stats
LabelsLabel changes:
Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed November 4, 2026, 10:30 AM ET / 15:30 UTC. |
|
Thank you — your embedding fix commit is preserved with authorship in #192896, together with the model-run sibling. Real controlling-PTY Ctrl+C now proves both candidate embedding requests close promptly and exit naturally with status 130, while main requires SIGKILL; uninterrupted controls pass. The combined regression coverage has net-negative test lines without an allocation. Original PRs remain open until the sweep lands. |
fix(infer): stop model and embedding runs on Ctrl+C `openclaw infer model run` (local and Gateway) and the embedding command did not pass the existing work-scope abort signal, so Ctrl+C did not stop the request. The CLI hung until it was force-killed about 2 seconds later. The commands now pass the signal: the local or embedding provider request closes, the Gateway caller RPC closes, and the CLI exits with 130. Gateway-side generation keeps its existing behavior. Uninterrupted runs are unchanged. Sweep of #192818 and #192846; both contributor commits are kept. Evidence: built CLI with a real PTY and SIGINT, against slow local provider and Gateway fixtures, twice per ref for each path. Main reached SIGKILL after 2.05 to 2.27 s; with this change the CLI exited with 130 in 30 to 56 ms, and the provider HTTP request or Gateway RPC closed within 3 ms. All uninterrupted controls pass. Details: #192896 (comment). Thanks @wangmiao0668000666. Co-authored-by: wangmiao0668000666 <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
|
Thanks @wangmiao0668000666. Your commit landed as part of sweep #192896 (958ae1a), together with the related interrupt fix. Closing this one as included. |
…w#192896) fix(infer): stop model and embedding runs on Ctrl+C `openclaw infer model run` (local and Gateway) and the embedding command did not pass the existing work-scope abort signal, so Ctrl+C did not stop the request. The CLI hung until it was force-killed about 2 seconds later. The commands now pass the signal: the local or embedding provider request closes, the Gateway caller RPC closes, and the CLI exits with 130. Gateway-side generation keeps its existing behavior. Uninterrupted runs are unchanged. Sweep of openclaw#192818 and openclaw#192846; both contributor commits are kept. Evidence: built CLI with a real PTY and SIGINT, against slow local provider and Gateway fixtures, twice per ref for each path. Main reached SIGKILL after 2.05 to 2.27 s; with this change the CLI exited with 130 in 30 to 56 ms, and the provider HTTP request or Gateway RPC closed within 3 ms. All uninterrupted controls pass. Details: openclaw#192896 (comment). Thanks @wangmiao0668000666. Co-authored-by: wangmiao0668000666 <[email protected]> Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
openclaw infer embedding createruns its providerembedBatchwithout forwarding the CLI work-scope cancellation signal, so an accepted Ctrl+C cannot cancel the in-flight provider request. The command then waits out the batch before the sharedrunCapabilityCommandsuppresses the late output — inconsistent with the otherinfercapability commands, which cancel immediately.User Impact
Interrupting a slow embedding batch now cancels the upstream request promptly instead of waiting for it to finish. Uninterrupted runs are unchanged, and accepted interrupts still exit without publishing a failure (the existing
runCapabilityCommandcontract).Why This Change Was Made
runCapabilityCommandalready acquires the CLI work-scope signal and suppresses output for accepted interrupts, butembedding createnever handed that signal to the work itself:embedBatchwas called with only{ inputType: "document" }. This change mirrors the image (#191176), web (#191628), TTS (#191635) and model run (#192818) interrupt fixes in the sameinferfamily — those siblings already document their interrupt contract indocs/cli/infer.md; embedding did not. TheEmbeddingProviderCallOptions.signalfield already exists and is consumed by the embedding adapters (for example GitHub CopilotwithRemoteHttpResponse({ signal }), ClawRouter, Google, llama.cpp), and the in-tree memory host already forwards it throughembedMemoryDocuments. No new timeout, owner, configuration, or API is introduced.Behavior classification: behavior-completing — completes the sibling interrupt contract for the last
infercapability command that lacked it.Evidence
Base
1835c9cad10a936fbd079a52e65bb2ede5ef1e38(currentorigin/main). Head3d1a8d1d902(fix/infer-embedding-signal).All runs in the repository test harness (vitest CLI shard, Node 24.22.1,
--user 0:0,OPENCLAW_VITEST_RUNTIME=node).Regression (new case,
capability-cli.embedding.test-support.ts— "passes the interrupt signal to the embedding batch and suppresses late output"):vitest run src/cli/capability-cli.test.ts -t "passes the interrupt signal"AssertionError: expected [] to have a length of 1 but got +0atexpect(received).toHaveLength(1)/expect(received[0]!.aborted).toBe(true)✓ passes the interrupt signal to the embedding batch and suppresses late output—1 passedThe red assertion is on the exact missing behavior: the embedBatch options carried no
signal(empty array), so the batch was not cancellable; with the change the received signal isaborted === trueand late output is suppressed.Full suite (no regression):
capability-cli.test.ts(includes all existing embedding cases viaregisterEmbeddingCapabilityCliTests)107 passed (107)capability-cli/embedding.clawrouter.integration.test.ts(real ClawRouter HTTP path)1 passed (1)Static checks:
run-format --checkclean;tsgo --noEmitclean (exit 0);oxlint0 warnings / 0 errors on both changed files.Not tested: no live-Gateway
--gatewayCtrl+C run is claimed (the signal hand-off is unit-asserted; provider transports that ignore mid-stream abort still fall back to the post-run suppression). No Windows or macOS run. No real provider credentials were used.Impact Surface
src/cli/capability-cli/embedding.tsgetAsyncWorkSignal()and pass toembedBatchoptionsrunCapabilityCommandalready owns the accepted-interrupt exit pathsrc/cli/capability-cli.embedding.test-support.tsNo migrations, persisted state, config schema, or public API changes. Two-way door: reverting restores the previous wait-out behavior with no state changes.
Maintainer Edits
wangmiao0668000666/openclaw,fix/infer-embedding-signal).Maintainer Options
getAsyncWorkSignal()owner, with the siblinginfercommands (#191176/#191628/#191635/#192818) already shipped through this exact shape. Embedding adapters already consumesignal.createEmbeddingProviderinstead of at the CLI call site — larger blast radius, touches the facade, not needed since the CLI is the only non-forwarding caller.infer embedding create; no change to memory-side embedding (already forwards the signal), providers list, or other commands.