Skip to content

fix(infer): forward interrupt signal to audio transcription requests - #193893

Merged
obviyus merged 2 commits into
openclaw:mainfrom
wangmiao0668000666:fix/audio-transcribe-interrupt
Nov 6, 2026
Merged

obviyus merged 2 commits into
openclaw:mainfrom
wangmiao0668000666:fix/audio-transcribe-interrupt

Conversation

@wangmiao0668000666

@wangmiao0668000666 wangmiao0668000666 commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

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 existing MediaExecutionContext, 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, shipped openclaw.mjs entry 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/transcriptions fixture: 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.

Build / interrupted run Exit SIGINT → exit SIGINT → HTTP close
Main 1 SIGKILL (waitpid -9) 2022.3 ms 2020.3 ms
Main 2 SIGKILL (waitpid -9) 2229.1 ms 2226.9 ms
Candidate 1 130 116.7 ms 3.6 ms
Candidate 2 130 102.8 ms 2.1 ms

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.

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).
@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added cli CLI command changes size: S labels Nov 6, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 6, 2026
@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Forward the CLI invocation’s interrupt signal to audio transcription through the existing media execution context.

Example: Press Ctrl+C while openclaw infer audio transcribe --file memo.wav --json awaits an OpenAI-compatible transcription response.

  • Before: The HTTP request remains pending until the launcher forcibly terminates the process.
  • After: The request closes cooperatively, the CLI exits with status 130, and no transcript is printed.

Review scores

Measure Result What it means
Overall readiness 🦞 diamond lobster (5/6) A minimal, useful repair with shipped-entry-point cancellation proof, successful controls, and no actionable findings; exact-head CI is still progressing.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The audio CLI and real HTTP transport are exercised by the linked Linux PTY receipt: after a complete WAV upload, actual terminal SIGINT closes the candidate request before natural exit 130 and produces no late transcript; uninterrupted controls preserve request bytes and output attribution. The previously requested audio-specific proof is satisfied, and the final production change only removes comments.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Ctrl+C leaves a pending audio transcription request running until the launcher forcibly terminates the CLI.
Reason: Cooperative interruption is an established CLI contract, and this repair restores it using existing lifecycle mechanisms without adding product choices.

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
Reviewed head: 11265e05b336b4e9170b622f4e3cf1e6e14cfceb

Before merge

None.

Findings

None.

Agent review details

How this fits together

The 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]
Loading

Technical review

Best 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

  • Shared audio/video command execution keeps the original intent (4bf68b9: Consolidate equivalent CLI execution and reporting while preserving options, output, and lifecycle ordering; this identifies the shared module’s creation, not the defect’s original introduction.)
  • Cancellation regression matrix keeps the original intent (958ae1a: Verify pending model work observes invocation cancellation, suppresses output, and releases resources.)
  • Audio attribution and request hints keeps the original intent (bc183cb: Preserve the provider and model that actually produced the transcript in CLI output.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

PR surface

Source +5, Tests -2, Docs +3. Total +6 across 3 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 10 5 +5
Tests 1 13 15 -2
Docs 1 3 0 +3
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 26 20 +6

Preflight source

Source 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

Metric Value Why it matters
Production versus test LOC Production +10/-5; tests +13/-15 The small production increase connects existing lifecycle owners, while regression coverage extends an existing matrix without additional scaffolding.

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🦞 diamond lobster, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: A bounded CLI cancellation defect keeps a transcription request alive until process escalation; ordinary successful transcription remains functional.
  • rating: 🦞 diamond lobster: Overall readiness is 🦞 diamond lobster; proof is 🦞 diamond lobster and patch quality is 🦞 diamond lobster.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-11-06T02:27:39.275Z sha 963fe71 :: needs real behavior proof before merge. :: none

Reviewed November 5, 2026, 10:00 PM ET / November 6, 2026, 03:00 UTC (Revision 2).

@obviyus

obviyus commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Built CLI / real PTY transcription cancellation proof

Preserved @wangmiao0668000666's repair. Frozen main 454088a9018a226808d9e6b74d430747659bc03c versus contributor candidate 963fe71aed1ab3c35979dcd29f1d2694460b7517, independently installed/runtime-built in secretless Linux Docker node:24.22.1. Later production edits remove only explanatory comments; cancellation behavior is unchanged.

Reused the real PTY driver from #192896 (proofs/192818-sweep/pty-proof.py). The shipped node openclaw.mjs --profile <owned-profile> infer audio transcribe runs in a genuine controlling terminal created by pty.fork. After the fixture receives the complete multipart upload and waits 500 ms, the driver writes the terminal's VINTR byte (0x03), producing a real SIGINT to its foreground process group. Normal launcher behavior is preserved: no OPENCLAW_NO_RESPAWN override, no second interrupt, and no harness kill during observations. All safetyKill flags are false.

Fixture: faithful OpenAI-compatible POST /v1/audio/transcriptions, valid 16,044-byte WAV, model gpt-4o-transcribe, language en, synthetic local-only API key. It returns an ordinary valid JSON transcript after 10 seconds of processing latency unless the peer cancels. A passive socket observer records client FIN/reset; it neither consumes request data nor injects faults. No mocks/imports from either checkout are used by the proof driver.

Observed main twice / candidate twice:

Build / interrupt PTY exit SIGINT → exit SIGINT → HTTP peer close Late success/transcript
Main 1 SIGKILL (waitpid -9) 2022.3 ms 2020.3 ms none
Main 2 SIGKILL (waitpid -9) 2229.1 ms 2226.9 ms none
Candidate 1 130 116.7 ms 3.6 ms none
Candidate 2 130 102.8 ms 2.1 ms none

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):

^CCommand interrupted by SIGINT. Waiting for cleanup before exiting.

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 control

One 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. controls-comparison.json asserts equality after normalizing only owned output/upload filenames and unique prompt/transcript markers:

provider=openai, model=gpt-4o-transcribe, capability=audio.transcribe
language=en, fileBytes=16044
WAV sha256=56d4af65701c26df20bd4021eda95b6e830348ce3a746086079fe89285548dc9
one request and one completed response per build; exit 0

Isolation and retained evidence

Separate explicit profiles, HOME/config/state/workspaces and exact binary config/agent SQLite readbacks under /work/runs/asr193893_a3_{base,cand}/. This local CLI path needs no running Gateway; none was started. No real provider credentials or live user state were mounted. Config bytes stayed unchanged throughout.

~/Developer/.agents/handoffs/openclaw-bugloop/proofs/193893/pty-a3/ retains events.jsonl, requests.json, results.json, summary.json, controls-comparison.json, per-case JSON and raw .pty.log files. pty-proof.py is the retained driver. Private test-host addresses from the previous PR body were removed; all endpoints in this proof are task-local loopback.

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 infer controller coverage passes 110/110. Typed lint on both changed TS files, focused canonical test typecheck and formatter passed. The consolidated audio interrupt row is red on frozen main (109 other controller cases pass). The existing local/Gateway model cancellation rows and embedding cleanup regression remain intact.

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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XS and removed size: S labels Nov 6, 2026
@obviyus

obviyus commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 6, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Nov 6, 2026
@obviyus
obviyus merged commit 1ce6c0e into openclaw:main Nov 6, 2026
134 of 140 checks passed
@obviyus

obviyus commented Nov 6, 2026

Copy link
Copy Markdown
Collaborator

Landed in 1ce6c0e. Thanks @wangmiao0668000666. Ctrl+C now stops audio transcription right away.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
…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]>
@wangmiao0668000666
wangmiao0668000666 deleted the fix/audio-transcribe-interrupt branch November 6, 2026 06:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cli CLI command changes docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. size: XS status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants