Repository navigation
fix(cli): cancel infer web requests and discard late output - #191628
Conversation
|
🦞👀 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 maintainer review before merge. What this changesForward invocation cancellation to infer web requests and suppress results or failures arriving after interruption. Example: Press Ctrl-C during
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current-main cancellation defect with a focused change and no actionable findings; exact-head CI is still running. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe infer web CLI resolves configuration and providers, invokes the existing search or fetch owner, and publishes a capability envelope through shared CLI output and cleanup handling. flowchart TD
A[Infer web command] --> B[Configuration and provider resolution]
C[Invocation cancellation signal] --> D[Search or fetch owner]
B --> D
D --> E[Cancellation aware capability output]
C --> E
E --> F[CLI output and exit finalization]
Technical reviewBest possible solution: Land the focused reuse of existing request cancellation and output owners once required checks pass. Do we have a high-confidence way to reproduce the issue? Current-main source retains the missing signal forwarding and unconditional late publication; the supplied built-CLI comparison demonstrates the failure through equivalent production owners. Is this the best way to solve the issue? This is the smallest complete fix: connect all three web request paths to the invocation signal and reuse the established cancellation-aware output wrapper while retaining failure output draining. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bb10c4ba2356. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +1, Tests -5, Docs +3. Total -1 across 3 files. Added test files: 0. View PR surface stats
LabelsLabel changes: No label 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 HistoryReview history (4 earlier review cycles)
Reviewed November 2, 2026, 11:37 PM ET / November 3, 2026, 04:37 UTC (Revision 5). |
EvidenceBuilt main Exercised shipped The local HTTP peer first received each request. For interrupted runs the harness then sent real SIGINT to that CLI process group and withheld the response until stderr contained the root owner's actual acknowledgement: Only after observing that acknowledgement did the peer send its success page/search response or HTTP 503 failure. Two runs of each case per ref: All interrupted commands exited naturally with code 130. Candidate stderr contained only the root acknowledgement, with no late result/error. No forced kill occurred. Uninterrupted controls were run twice for all five cases on both refs: successes published their expected fixture content and exited 0; HTTP 503 failures remained visible and exited 1. Overall: 40 real CLI invocations / HTTP requests. Limit: no socket abort is claimed. The peer recorded The fix reuses Test consolidation restores the existing web cases to their original capability suite instead of retaining an extra registrar. One existing default-fetch case now closes a real AsyncWorkScope while its mocked provider returns, asserting both the invocation signal and discarded JSON. The existing normal output, provider state, disabled-fetch, structured-failure and SecretRef cases remain. Duplicated configuration setup and generic envelope echoes were removed; dedicated SecretRef and shared output-owner coverage remain. The old 294-line registrar was moved code, not new production code. No test-growth allocation remains. Baseline focused cases failed because the invocation signal was absent at the direct-fetch owner. Candidate complete capability suite: 102 tests passed, 50.61 s Vitest / 53.31 s runner (cold compilation included; test execution approximately 13.7 s). The two changed fetch cases took 2 ms each. Focused Oxfmt/Oxlint and whitespace checks passed. Whole-PR delta against the merge base: production +24/-23 (net +1), tests +104/-106 (net -2), docs +3/-0. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in cac59aa. Thanks @zhangguiping-xydt. Interrupted infer web commands no longer print late output. |
…#191628) fix(cli): don't publish web search or fetch output after the command is interrupted `infer web` search, direct fetch and pinned fetch did not follow the command's cancellation signal. After an acknowledged SIGINT, a late response was still printed. These commands now use the existing cancellation scope, so an interrupted run publishes nothing and exits with 130. Provider APIs, security guards and provider selection are unchanged, and uninterrupted runs are unchanged. Evidence: 40 built-CLI runs in secretless Node 24.22.1 Docker with delayed real HTTP responses released only after the SIGINT was acknowledged. Main published late search, pinned-fetch and direct-fetch output twice; with this change nothing was published and the command exited with 130, twice. Uninterrupted success and error controls kept exit codes 0 and 1. Details: openclaw#191628 (comment). Thanks @zhangguiping-xydt. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
infer web searchand web fetch can print a late result or provider failure after acknowledging Ctrl-C. Their request owners did not receive the invocation signal, and their output bypassed the existing cancellation-aware capability wrapper.What Changed
Forward the existing AsyncWorkScope signal to web search, the default fetch tool, and a pinned fetch provider. Use the existing
runCapabilityCommandowner to discard late success/failure output. Ordinary structured failures still exit nonzero after output drains, without overriding an acknowledged interruption.Provider APIs, security guards, selection, credentials and timeout policy are unchanged. No new signal manager or configuration is introduced.
Evidence
Head:
a11fa18f2f894253c467e7d34aa7949d8e42cfa0.Built CLI before/after proof: clean main/candidate builds in secretless Node 24.22.1 Docker, normal bundled Firecrawl search/pinned fetch and direct HTTP fetch. The delayed local peer receives each request, then the harness sends real SIGINT and waits for the actual root acknowledgement before releasing the response.
Twice per case, main prints late output after acknowledgement: search success 999 bytes, search HTTP 503 471 bytes, pinned-fetch success 794 bytes, pinned-fetch HTTP 503 464 bytes, direct-fetch success 1,080 bytes. Candidate prints zero stdout and only the root acknowledgement on stderr; all interrupted invocations exit naturally with 130. Uninterrupted successes remain visible with exit 0, and HTTP 503 failures remain visible with exit 1 on both refs. Forty CLI invocations total; no forced kills.
No socket-abort claim: every peer observation had
responseClosedBeforeFinish=false. The proof establishes cancellation acknowledgement, late-output suppression and exit-status preservation; the regression separately checks signal forwarding.Consolidated the interruption regression into existing default-fetch cases and restored moved web tests to their original suite. Removed the extra registrar and test-growth allocation, duplicate configuration setup and generic envelope echoes, retaining provider-state, normal output, disabled-fetch, structured-failure and SecretRef coverage.
Merge Danger
Two-way door: reverting restores prior cancellation/output behavior; there are no persisted state or public-contract changes. Blast radius is local infer web search/fetch interruption and ordinary failure exit handling. Other capability commands continue to use the same existing output owner.