Repository navigation
fix(infer): forward interrupt signal to audio transcription requests - #193893
Conversation
Ctrl+C accepted by infer audio transcribe cancels the pending provider request instead of letting it finish and suppressing only its late output. CLI execution has no separate authority fence, so the invocation signal alone guards each request attempt. Precedent: openclaw#192896 (same shape; this patch extends it to the media-understanding CLI command).
|
🦞👀 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 the CLI invocation’s interrupt signal to audio transcription through the existing media execution context. Example: Press Ctrl+C while
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review This PR fixes a current audio cancellation defect with a focused change and sufficient shipped-CLI proof; no actionable defects were found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe inference CLI resolves the audio file and provider settings, invokes the shared media runtime, and formats its transcription result; invocation cancellation now reaches the runtime’s existing transport and process lifecycle. flowchart LR
A[Audio CLI command] --> B[Media runtime]
C[Invocation work scope] --> B
B --> D[Provider execution]
D --> E[Transcription transport]
B --> F[CLI output boundary]
Technical reviewBest possible solution: Use the existing invocation signal at the audio CLI boundary and retain the shared media runtime’s cancellation, cleanup, and output suppression owners. Do we have a high-confidence way to reproduce the issue? Current-main source still omits the supported execution context, and the supplied built-CLI before/after proof records the resulting forced termination versus cooperative cancellation; this review ran no target code. Is this the best way to solve the issue? The patch is the smallest complete fix: connect the invocation’s existing signal to the existing media execution context, preserving request hints, attribution, successful output, and video behavior. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 04d93fb8469c. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
PR surfaceSource +5, Tests -2, Docs +3. Total +6 across 3 files. Added test files: 0. View PR surface stats
Preflight sourceSource unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified. Review metrics
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 HistoryReview history (1 earlier review cycle)
Reviewed November 5, 2026, 10:00 PM ET / November 6, 2026, 03:00 UTC (Revision 2). |
Built CLI / real PTY transcription cancellation proofPreserved @wangmiao0668000666's repair. Frozen main Reused the real PTY driver from #192896 ( Fixture: faithful OpenAI-compatible Observed main twice / candidate twice:
Main keeps the request alive until process termination rather than cooperating with cancellation. Candidate closes the request before process exit and exits cleanly/promptly with 130. Every interrupted case makes one request and the fixture completes zero transcripts. No harness safety kill is involved. Actual candidate terminal output (ANSI reset sequences omitted): The captured output contains no success envelope, audio.transcription result, or fixture transcript marker. PTY output is drained through EOF and the fixture handler is observed through termination, so late output is not merely hidden by a short sampling window. Uninterrupted controlOne full uninterrupted transcription on each build exits 0 after the normal delayed response, uploads the same WAV bytes/SHA-256, and prints the same provider/model/capability/transport/output shape and expected successful transcript. Isolation and retained evidenceSeparate explicit profiles, HOME/config/state/workspaces and exact binary config/agent SQLite readbacks under
Setup failures remain separately recorded and do not count as reproduction: the initial copied driver was truncated at a reader footer; the first config incorrectly nested models under tools.media.audio; then the fixture's overly narrow whisper-1 assertion rejected the provider's normal gpt-4o-transcribe selection. The successful a3 run explicitly selects and serves gpt-4o-transcribe, with valid ordinary responses and no fixture errors. No product conclusion uses the failed setup attempts. Focused checks: 116 tests passed across the CLI controller and lazy-registration suites; final exact Simplification: remove the new registration helper and duplicated option builder; keep the actual attribution/hints regression in its original suite and add audio to the existing cancellation matrix. Remove explanatory production comments without changing behavior. Whole-PR production +10/-5 (net +5; 15 gross); tests +13/-15 (net -2); docs +3/-0. No allocation file, test-only production seam, schema/auth or retry-policy change. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Landed in 1ce6c0e. Thanks @wangmiao0668000666. Ctrl+C now stops audio transcription right away. |
…penclaw#193893) fix(infer): stop audio transcription on Ctrl+C `openclaw infer audio transcribe` did not pass the invocation's abort signal to the media execution context, so Ctrl+C did not cancel the provider request and the CLI hung until it was force-killed. The existing signal is now forwarded, as openclaw#192896 did for model and embedding runs. No API, default or policy change. Evidence: built CLI with a real PTY SIGINT during transcription against a slow local provider, twice per ref. Main ended in SIGKILL after about 2 seconds; with this change the CLI exits with 130 in 103 to 117 ms, the HTTP request closes within 4 ms, and no late transcript is printed. Uninterrupted controls match. Details: openclaw#193893 (comment). Thanks @wangmiao0668000666. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Related: #192896. This repairs the same invocation-cancellation gap for
infer audio transcribe.The CLI does not forward its existing invocation abort signal into the existing media execution context. Ctrl+C is accepted, but the transcription provider request remains pending until the normal launcher terminates the process instead of completing cooperative cancellation.
Fix
Preserve @wangmiao0668000666's fix: obtain the existing async-work signal and pass it to
transcribeAudioFile's existingMediaExecutionContext, with its normal abort fence. No new cancellation owner, retry policy, flags, schema, auth, model-facing guidance or video behavior change.Remove explanatory comments, the new test-registration helper and its duplicated option builder. Keep attribution/hints coverage in its original suite and add audio to the existing local/Gateway cancellation matrix, retaining its no-output and resource-cleanup assertions. Update the existing Audio CLI documentation.
Evidence
Built CLI / real PTY before-after receipt.
Independent Linux runtime builds, secretless
node:24.22.1, shippedopenclaw.mjsentry point in a genuine controlling terminal. Reused #192896's PTY driver. After a complete valid WAV multipart upload is pending, a real Ctrl+C/VINTR produces SIGINT to the terminal foreground process group. Normal launcher behavior is preserved; there is no OPENCLAW_NO_RESPAWN override, second interrupt, or harness kill.Faithful local OpenAI-compatible
/v1/audio/transcriptionsfixture: valid ordinary response after 10 seconds processing latency, passive peer-close observation, synthetic local-only key. No fault injection or provider mocks imported into the CLI.waitpid -9)waitpid -9)All interrupted cases make one request, complete zero provider responses, and print no success envelope/transcript. Candidate output is only the normal interrupted/cleanup notice; PTY bytes are drained through EOF and fixture handlers observed through completion. All harness safety-kill flags are false.
Uninterrupted controls on both builds exit 0 and complete exactly one response. Captured request/envelope equality is asserted after normalizing only owned filenames and unique run/transcript markers: same provider openai, model gpt-4o-transcribe, language en, audio.transcribe envelope, 16,044-byte WAV and SHA-256. No external provider or live user state is used. Separate explicit profiles/HOME/config/state/workspaces; exact binary config/SQLite paths verified. This local path starts no Gateway. Config bytes stay unchanged.
116 focused controller/lazy-registration tests passed; final exact infer controller coverage 110/110. Typed lint, focused test typecheck and formatter passed. The consolidated audio cancellation row fails on frozen main; 109 other controller cases pass.
Whole-PR deltas: production +10/-5 (net +5; 15 gross); tests +13/-15 (net -2); docs +3/-0. Contributor commits preserved. No allocation file or test-only production hooks.
Private test-host details from the previous body have been removed. The complete proof is reproducible using only task-local loopback endpoints; retained evidence is under
proofs/193893/pty-a3/.Merge risk
Low: only the audio CLI supplies an already-supported execution context. Normal transcription request hints, provider attribution and successful output remain unchanged in the paired control. Cancellation uses the existing invocation and media owners. Reverting restores process escalation on interrupt; no stored-format, configuration, protocol or migration concern.