Repository navigation
fix(audio): preserve complete voice-note transcription - #145391
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. Reviewed September 11, 2026, 11:53 PM ET / September 12, 2026, 03:53 UTC (Revision 6). ClawSweeper reviewWhat this changesDeepgram Flux transcription converts complete voice notes into temporary files and uploads small sequential chunks, with documentation and regression coverage. Merge readiness✅ Ready for maintainer review This PR remains necessary: current main and v2026.9.4 retain the silent 20-minute cutoff. No introduced correctness or security defect was found, and the retained behavior proof supports the repair. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw sends incoming voice notes through the configured transcription plugin. Deepgram Flux converts the audio and sends it over WebSocket, then returns transcript text for CLI output or the agent's conversation input. flowchart LR
A[Voice note] --> B[Configured transcription provider]
B --> C[Full audio conversion]
C --> D[Private temporary file]
D --> E[Sequential WebSocket upload]
E --> F[Transcript or explicit failure]
F --> G[CLI output or agent input]
F --> H[Temporary file cleanup]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +9, Tests +115, Docs +5. Total +129 across 4 files. View PR surface stats
Review metricsNone. Technical reviewBest possible solution: Keep complete conversion in the existing Deepgram plugin, with bounded upload memory, existing request limits, and attempt-owned temporary-file cleanup. Do we have a high-confidence way to reproduce the issue? Yes: current main explicitly limits decoding to 1,200 seconds, and retained CLI evidence demonstrates successful output omitting a marker at 21 minutes. This review inspected source and evidence without executing the target. Is this the best way to solve the issue? Yes: repairing the existing decoder preserves the provider contract and avoids holding complete decoded audio in memory; registered-entrypoint and installed-host evidence support the approach. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a9ff79407881. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
ca77dee to
f00b48c
Compare
Co-authored-by: Ayaan Zaidi <[email protected]>
Co-authored-by: Ayaan Zaidi <[email protected]>
f00b48c to
c8d5800
Compare
|
landpr-approve-admin-merge |
|
Thanks @obviyus! Merged after the exact-head review and independent census acceptance.
CI run 34669587249, attempt 1, passed: 77 successful jobs, 16 skipped. Proof includes the registered-callback real-decoder regression, protocol and HTTP sibling tests, and the published v2026.9.4 host with previous state. CLI and Telegram captures remain attributed to The procedural owner-review hold was waived under the head-pinned approval. No code, security, or CI finding was waived. |
## Problem and fix A 25-minute voice note can return a successful transcript containing only its first 20 minutes. The audio decoder introduced in openclaw#141836 stops at 1,200 seconds, and downstream consumers receive plain transcript text with no indication that audio was omitted. Remove that decoder cutoff and its matching decoded-buffer cap. Decode the complete input into a private temporary file, then upload sequential 80 ms frames from a small reusable buffer. The existing operation deadline, cancellation, transport policy, transcript-size checks, and error handling remain in place. The file handle and temporary workspace close when the attempt finishes or fails. Existing input-size and request-timeout settings still apply. This reverses the 20-minute conversion choice in openclaw#141836. The inspected introduction and discussion give no measured resource requirement for that duration. Temporary storage avoids retaining the whole decoded recording on the JavaScript heap. No configuration key, schema, migration, or protocol field is added. ## Consumers - `extensions/deepgram/audio-flux.ts`: `decodeDeepgramFluxAudio` has one caller, `transcribeDeepgramFluxAudio`; `DEEPGRAM_FLUX_MAX_PCM_BYTES` is private and has no outside reader. The decoder now writes a file instead of returning a full PCM buffer. Its only caller owns the file and reads it sequentially. - `extensions/deepgram/audio.ts:41,68` dispatches the existing `transcribeDeepgramAudio` callback to the streaming implementation. Its default HTTP path is unchanged. - Voice-note registration: `extensions/deepgram/openclaw.plugin.json:20–22` declares the media-understanding provider contract; `index.ts:11` registers the provider whose `transcribeAudio` callback is assigned in `media-understanding-provider.ts:10`. `src/plugins/registry-registrars-providers.ts:277–281` writes that registration to `registry.mediaUnderstandingProviders`. `src/media-understanding/provider-registry.ts:33–46` reads prepared providers or resolves the `mediaUnderstandingProviders` capability and builds the provider map; its lookup at `:66–70` returns the selected provider. - `extensions/deepgram/capability-catalog.ts:4–6` exposes realtime transcription only. It does not expose the voice-note callback changed by this PR. - `src/media-understanding/runner.entries.ts:897–933` invokes the registered callback and consumes `result.text`. `src/media-understanding/runtime.ts:425–448` carries the result to `src/cli/capability-cli/audio.ts:39–60,79–88`, which delivers the existing CLI output. - `src/media-understanding/audio-transcription-runner.ts:47–49` extracts the transcript string. `src/media-understanding/audio-preflight.ts:78` stores only `transcribed: true` on the matching attachment fact; it returns the transcript separately at `:88`. `extensions/telegram/src/bot-message-context.body.ts:307–320` reads that returned string and passes it to `src/plugin-sdk/media-understanding-runtime.ts:18–20` to frame the agent input. Telegram proof inspects the complete transcript at the final model-request boundary. - The ordinary media-apply path also reads audio transcription outputs: `src/media-understanding/apply.ts:236–245` formats them into `ctx.Transcript` and, when there is no original user text, `ctx.CommandBody` and `ctx.RawBody`. - `MEDIA_FFMPEG_MAX_AUDIO_DURATION_SECS` remains owned by `src/media/ffmpeg-limits.ts` and exported by `src/plugin-sdk/media-runtime.ts`. Its separate outbound-audio consumers in `extensions/discord/src/voice-message.ts`, `extensions/feishu/src/media.ts`, and `extensions/whatsapp/src/outbound-media-contract.ts` remain unchanged. Only this decoder stops consuming it. - `docs/providers/deepgram.md` documents whole-file conversion and the remaining input/time limits. UI and native clients continue to consume ordinary message text; no new value shape reaches them. ## Contention No shared lock, queue, transaction, or single-writer is held by the changed plugin code. Decoding, file handles, and sequential socket writes belong to one attempt. The real-decoder regression starts a second HTTP transcription after the long upload starts and verifies that it finishes before the long request is released. ## Invalidation No shared cache or persisted derived value is added or changed. Each attempt creates its own temporary audio file and disposes it before returning. Reload and restart do not reuse converted audio. ## Tests The latest rebase is head `c8d5800f76c250db0c4b1b9c642c57359d8c8cc8`, onto main `badf4503a7f8f057929ac2c861b678cdf6ff21c1`. Range-diff confirms both contribution commits are unchanged. The following CLI and Telegram captures retain their tested head `f00b48c6`; they are reused because audio, registry, process, temporary-file and transport owners are unchanged. New adjacent branches apply to update requests and update canaries, which these fixtures do not enter. Fresh CI, merge-tree census and independent review assess the new head. Earlier validation ran at head `f00b48c6940dde8bbe8cc1a522d0ae2032c817f3` and CI merge tree `0f5c7bb522dec992db8e4f96f0ffd35a864f58b3`. Those public CLI and Telegram runs confirmed complete audio delivery and the late marker through the changed registry and session owners. Earlier runtime captures remain pre-rebase evidence accepted by reviews at `3b4eec76a35b8cc7a2021e07f74b46744122a475` and `ca77dee9616e097c14062398aa36d39b169c44e0`; they are not relabeled as new-head runs. The original defect base remains `5d6155ee3fcac130f3aff53cc6fd8adf41f72678`. Decoder and installed-release compatibility evidence is retained because those owners and contracts are unchanged. - Production CLI, pinned base `5d6155ee3fcac130f3aff53cc6fd8adf41f72678`: generated 1,500 seconds of real audio with spoken words at 21:00. The recording endpoint received 1,200 seconds / 38,400,000 bytes. The CLI exited 0 with `ok: true`, omitted the late words, and supplied no partial fact. - Same CLI on the candidate: endpoint received all 1,500 seconds / 48,000,000 bytes, and the delivered transcript contained the late words. Exit 0. The before/after temporary-workspace census was empty. - `audio-flux.live.test.ts`: `index.ts` registration → registered `transcribeAudio` → real ffmpeg → local protocol endpoint. Failed on the base with `prefix only` instead of `late marker`; passed after repair, with byte-for-byte coverage and the concurrent sibling check. This fixture requires ffmpeg and uses no external provider credential. - `audio-flux.test.ts`: protocol, deadline, malformed-response, transcript-size, and network-policy cases now invoke the callback obtained from `index.ts` registration. The decoder fake writes its PCM output to the real output-file boundary. Together with unchanged `audio.test.ts` sibling cases: 18 passed. The real-decoder regression adds one passing test. - Published `v2026.9.4` host: original plugin reproduced the cutoff. The candidate plugin, built through the repository package-runtime builder, returned the late words on that installed host while reusing its previous state directory. Both CLI runs exited 0; no migration was needed. - Telegram Test Server: a real user driver sent the 25-minute voice note. The endpoint received all audio, and the recorded model request contained the late words in its audio transcript. The bot replied, the runner completed, its scratch state was removed, and its listeners closed. Inference was deterministic; this proves transcript delivery, not speech-recognition quality or model judgment. - Focused formatting and lint passed. Full CI, merge-tree structural checks, and exact-head landing review are required before merge. ### Deletion ledger and moved responsibilities No test was deleted. The protocol-case assertion requiring `-t 1200` and a 38,400,000-byte buffer was removed because it enshrined the defect. Full-audio coverage moves to the registered-callback real-decoder regression. Existing request, transcript, policy, and deadline assertions remain; the deadline case now awaits asynchronous cleanup after advancing the original deadline. Decoded-audio storage moves from the full stdout buffer to the existing temporary-workspace owner; a scoped file handle owns reads. The process helper still owns decoder cancellation and timeout, and the existing socket owner still owns connection cleanup. No parallel implementation or compatibility alias remains. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Long voice notes could return a successful transcript that silently omitted audio after 20 minutes.
Why This Change Was Made
The streaming transcription decoder converts the complete recording to a temporary file and uploads it in small frames. This reverses the duration cutoff introduced in #141836 while retaining input-size limits, deadlines, cancellation, and cleanup.
User Impact
Long recordings can deliver their complete transcript without keeping the full decoded audio in memory. No configuration change is required.
Evidence
The real CLI received all 25 minutes after the fix, including speech at minute 21; the baseline received only 20 minutes. Registered transcription tests cover the real decoder, concurrent requests, protocol errors, and cleanup. Telegram voice-note delivery preserved the late words in the agent input. The same plugin flow passed on installed v2026.9.4 state. These runs used a controlled transcription endpoint.
Consumers: voice-note transcription and the audio CLI now receive the complete recording.