Skip to content

fix(audio): preserve complete voice-note transcription - #145391

Merged
obviyus merged 2 commits into
mainfrom
land/deepgram-transcript-bound
Sep 12, 2026
Merged

obviyus merged 2 commits into
mainfrom
land/deepgram-transcript-bound

Conversation

@obviyus

@obviyus obviyus commented Sep 11, 2026 •

Copy link
Copy Markdown
Collaborator

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.

@clawsweeper

clawsweeper Bot commented Sep 11, 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 docs Improvements or additions to documentation extensions: deepgram size: M maintainer Maintainer-authored PR labels Sep 11, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 11, 2026
@clawsweeper

clawsweeper Bot commented Sep 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed September 11, 2026, 11:53 PM ET / September 12, 2026, 03:53 UTC (Revision 6).

ClawSweeper review

What this changes

Deepgram 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
Reviewed head: c8d5800f76c250db0c4b1b9c642c57359d8c8cc8

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused repair with strong retained production-path evidence and no actionable introduced defect.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): Retained CLI and Telegram Test Server observations exercise the registered Flux decoder and real transport: all 1,500 seconds arrive, late transcript text reaches agent input, and temporary files are cleaned up. Relevant source identities match the earlier tested head; the evidence proves delivery rather than speech-recognition quality.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): Retained CLI and Telegram Test Server observations exercise the registered Flux decoder and real transport: all 1,500 seconds arrive, late transcript text reaches agent input, and temporary files are cleaned up. Relevant source identities match the earlier tested head; the evidence proves delivery rather than speech-recognition quality.
Evidence reviewed 10 items Current main still needs the repair: The main-to-head comparison shows that main retains the ffmpeg duration cutoff and decoded-buffer cap; this PR removes them. The Flux source is unchanged between the pinned base and fetched main.
Latest release retains the cutoff: Inspection of the supplied v2026.9.4 release commit confirms the same duration-limited decoder. No shipped fix is established.
Production ownership and cleanup: The complete modules show that the registered transcription callback still selects the existing Flux implementation. Conversion must finish successfully before upload; scoped disposal closes the file before removing its workspace, and each frame awaits the socket send callback before buffer reuse.
Findings None None.
Security None None.

How this fits together

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

Before merge

None.

Agent review details

Security

None.

PR surface

Source +9, Tests +115, Docs +5. Total +129 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 1 31 22 +9
Tests 2 159 44 +115
Docs 1 5 0 +5
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 195 66 +129

Review metrics

None.

Technical review

Best 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.

Labels

Label justifications:

  • P2: The repair prevents silent truncation of long voice notes when Deepgram Flux is selected, with a limited provider-specific scope.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (live_output): Retained CLI and Telegram Test Server observations exercise the registered Flux decoder and real transport: all 1,500 seconds arrive, late transcript text reaches agent input, and temporary files are cleaned up. Relevant source identities match the earlier tested head; the evidence proves delivery rather than speech-recognition quality.
  • proof: sufficient: Contributor real behavior proof is sufficient. Retained CLI and Telegram Test Server observations exercise the registered Flux decoder and real transport: all 1,500 seconds arrive, late transcript text reaches agent input, and temporary files are cleaned up. Relevant source identities match the earlier tested head; the evidence proves delivery rather than speech-recognition quality.
  • proof: telegram-e2e: This PR needs Telegram Test Server proof with the repository E2E skill. Complete voice-note transcription affects Telegram agent input; retained Test Server evidence covers the late-audio delivery.

Evidence

What I checked:

  • Current main still needs the repair: The main-to-head comparison shows that main retains the ffmpeg duration cutoff and decoded-buffer cap; this PR removes them. The Flux source is unchanged between the pinned base and fetched main. (extensions/deepgram/audio-flux.ts:141, a9ff79407881)
  • Latest release retains the cutoff: Inspection of the supplied v2026.9.4 release commit confirms the same duration-limited decoder. No shipped fix is established. (extensions/deepgram/audio-flux.ts:141, 3a9d69db306c)
  • Production ownership and cleanup: The complete modules show that the registered transcription callback still selects the existing Flux implementation. Conversion must finish successfully before upload; scoped disposal closes the file before removing its workspace, and each frame awaits the socket send callback before buffer reuse. (extensions/deepgram/audio-flux.ts:184, c8d5800f76c2)
  • Retained real behavior evidence: The captured PR body, sourceRevision c15ee56c851c777c6e6b3b4e7cde355356514bedcd50fe8cb48b01467bfe97ba, reports production CLI delivery increasing from 38,400,000 to 48,000,000 bytes, late transcript text reaching the Telegram model request, an empty temporary-workspace census, and candidate-plugin success on an installed v2026.9.4 host. The captures explicitly retain their earlier execution identities; they are not presented as fresh head executions. (f00b48c6940d)
  • Proof survives the rebase: GitHub contents metadata for the tested head matches local HEAD blob identities throughout the Deepgram directory. Separate checks also match the process executor, provider WebSocket connector, and temporary-workspace wrapper. An unavailable local earlier-head comparison was replaced with these read-only GitHub checks. (extensions/deepgram/audio-flux.ts, f00b48c6940d)
  • Meaningful regression coverage: The real-decoder test invokes the registered callback, checks all 48,000,000 PCM bytes and a marker beyond 20 minutes, and verifies a concurrent Nova request completes. Existing deadline, protocol, transcript-size, and private-network cases remain. Tests were inspected, not executed during this read-only review. (extensions/deepgram/audio-flux.live.test.ts:13, c8d5800f76c2)

Likely related people:

  • Ayaan Zaidi: Raw commit 41aec3c adds extensions/deepgram/audio-flux.ts:125 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 41aec3ca92bc; files: extensions/deepgram/audio-flux.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (5 earlier review cycles)
  • reviewed 2026-09-11T23:23:36.273Z sha 3b4eec7 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-11T23:46:11.271Z sha ca77dee :: needs maintainer review before merge. :: none
  • reviewed 2026-09-12T02:47:37.092Z sha f00b48c6940dde8bbe8cc1a522d0ae2032c817f3 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-12T02:54:15.953Z sha f00b48c6940dde8bbe8cc1a522d0ae2032c817f3 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-12T03:17:18.777Z sha c8d5800 :: needs maintainer review before merge. :: none

@obviyus
obviyus force-pushed the land/deepgram-transcript-bound branch from ca77dee to f00b48c Compare September 12, 2026 02:41
@clawsweeper clawsweeper Bot added the proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. label Sep 12, 2026
@obviyus

obviyus commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator Author

landpr-approve-admin-merge
pr: 145391
head: c8d5800
scope: owner-review

@obviyus
obviyus merged commit fec3b7d into main Sep 12, 2026
147 checks passed
@obviyus
obviyus deleted the land/deepgram-transcript-bound branch September 12, 2026 04:01
@obviyus

obviyus commented Sep 12, 2026

Copy link
Copy Markdown
Collaborator Author

Thanks @obviyus!

Merged after the exact-head review and independent census acceptance.

Before After
A 25-minute voice note returned only its first 20 minutes as a successful transcript. All 25 minutes reached the transcription endpoint, and the late marker reached both CLI output and Telegram's agent input.

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 f00b48c6940dde8bbe8cc1a522d0ae2032c817f3; both contribution commits are unchanged at the landed head.

The procedural owner-review hold was waived under the head-pinned approval. No code, security, or CI finding was waived.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 12, 2026
## 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]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation extensions: deepgram maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: telegram-e2e This PR needs Telegram Test Server proof with the repository E2E skill. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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.

1 participant