Skip to content

fix(media-understanding): resolve inbound media:// refs carried as attachment url - #117268

Merged
steipete merged 8 commits into
openclaw:mainfrom
harjothkhara:oss-find/openclaw-2026-07-31-f
Aug 2, 2026
Merged

steipete merged 8 commits into
openclaw:mainfrom
harjothkhara:oss-find/openclaw-2026-07-31-f

Conversation

@harjothkhara

@harjothkhara harjothkhara commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Inbound media can be stored locally and carried to media understanding as a
media://inbound/<id> attachment URL. The attachment cache only resolved
attachment.path, then sent attachment.url to the remote fetch path. That
turned a valid local identity into MediaFetchError and silently lost audio
transcription.

This repair makes MediaAttachmentCache the canonical owner of the resolution
order:

  • prefer a valid trusted local path;
  • retry a valid media://inbound store alias only when that path is missing,
    blocked, or empty;
  • keep maxBytes failures terminal;
  • allow only HTTP(S) URLs into the remote fetcher;
  • fail malformed and cross-bucket media aliases closed without network access.

QA Channel now has a fixture-only carrier switch and a real Gateway scenario
covering the URL-only stored-audio path.

Why This Is the Best Fix

The failure belongs at the attachment cache boundary, where local and remote
sources are classified. Teaching the SSRF-guarded HTTP fetcher about local
store identities would duplicate media-reference policy and weaken ownership.
Changing channel producers would reject a valid shape already supported by the
channel SDK and Gateway claim-check flow.

The local read block is shared by path and alias resolution, so the repair does
not create parallel read policy. No operator config or persistent storage
surface changes.

Evidence

Functional proof head: 1911c63a3f7bc1097b6b1338a87f104e56368931.
Current head: a0f5b1f3b308bce344aba2c10014717e87a1af9b, rebased onto
98c0d9deca5dff8346677c2a5ae5824301cb3516.

The rebase did not change the semantic patch:

  • Before/after patch SHA-256:
    6ab1c40b26ed6113d4a3a98fcd1b765f8c9fecd36df5d2eb994e61d0918552f1
  • Rebased tree matches the precomputed clean merge tree:
    0cbe9aa7334c620adf102ab74b778b4ca590002f
  • The post-proof changes only strengthen QA coverage classification and require
    exactly one completed outbound marker reply.

Sanitized AWS Crabbox used public networking, no Tailscale, no credential
hydration, and a fresh PR checkout pinned to the functional proof head:

  • Run: https://crabbox.openclaw.ai/portal/runs/run_2d54b40512bd
  • Focused tests: 44 passed (12 media-understanding, 32 QA extension)
  • Private QA build: passed with OPENCLAW_BUILD_PRIVATE_QA=1
  • QA Channel -> ephemeral Gateway -> mock transcription: 1/1 scenario passed
  • Runtime result: markerReplies=1
  • Negative log scan: no MediaFetchError or audio: failed
  • CI=1 pnpm check:changed: passed, including typecheck and all lint shards
  • Trusted autoreview: clean, no actionable P0/P1 findings; not rerun because the
    semantic patch is byte-identical after rebase

Observed QA result:

reply=Reply with only this exact marker: WHATSAPP_QA_AUDIO_TRANSCRIPT_OK
markerReplies=1
MediaFetchError matches=0
audio: failed matches=0

GitHub CI is running on the current exact head.

Production and QA wiring delta is +158/-63 (net +95); test/scenario delta is
+479. The positive production delta is the explicit source classification,
one shared local-read path, alias retry state, and the QA-only carrier seam.

Thanks @harjothkhara for the original diagnosis and patch.

Closes #114634

@harjothkhara
harjothkhara marked this pull request as ready for review August 1, 2026 06:57
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 2, 2026, 5:48 AM ET / 09:48 UTC.

ClawSweeper review

What this changes

The branch resolves valid inbound media://inbound/... aliases carried in attachment URLs as local media-store files before media understanding considers HTTP fetching, and adds focused unit plus QA Gateway coverage.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

The PR appears to be a well-scoped repair at the correct attachment-cache boundary, with no discrete correctness or security finding from the reviewed source. It is still necessary because current main at b7bbb4f does not contain the fix; keep it open until the remaining exact-head CI completes successfully.

Priority: P1
Reviewed head: fcd7e0899e9e56d9b3f494017596e536ac87d1af

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused owner-boundary repair with strong runtime proof and no review finding; required current-head CI remains the only merge gate visible in this review.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (live_output): The PR body supplies after-fix sanitized Crabbox evidence for the QA Channel → Gateway → mock-transcription flow, showing exactly one expected reply and no media-fetch failure; redact-sensitive terminal evidence is an appropriate proof format here.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (live_output): The PR body supplies after-fix sanitized Crabbox evidence for the QA Channel → Gateway → mock-transcription flow, showing exactly one expected reply and no media-fetch failure; redact-sensitive terminal evidence is an appropriate proof format here.
Evidence reviewed 7 items Current-main failure path: Current main uses the attachment URL directly as the remote-fetch input after local-path resolution; a URL-only media://inbound/... reference therefore cannot be read through the local media-store resolver.
Existing canonical media-store contract: The shared classifier identifies media:// as a media-store URL, and the resolver accepts only the inbound bucket while rejecting malformed, nested, and cross-bucket identifiers.
Patch uses the correct boundary: The proposed cache classifies a URL before fetching, retries a valid inbound-store alias after a missing or blocked local path, and preserves terminal max-byte errors; its tests cover URL-only audio, stale paths, blocked paths, invalid aliases, and no-network rejection.
Findings None None.
Security None None.

How this fits together

Channel plugins emit attachment facts with a local path or URL, then media understanding’s attachment cache reads an allowed local file or fetches an approved remote HTTP source. The resulting buffer or path is passed to audio, image, document, or video processing so the agent can receive the derived result.

flowchart LR
  A[Inbound channel media] --> B[Attachment facts]
  B --> C[Media attachment cache]
  C --> D{Local-store alias or HTTP URL}
  D --> E[Allowed local media read]
  D --> F[SSRF-guarded HTTP fetch]
  E --> G[Media understanding provider]
  F --> G
  G --> H[Transcript or extracted context]
Loading

Before merge

  • Resolve merge risk (P1) - Required checks are still running on the current PR head, so merge readiness is not yet established even though the code review found no blocking defect.
  • Resolve merge risk (P1) - The PR is behind current main; GitHub reports it mergeable and local read-only merge inspection found no conflict, but required CI must validate the final mergeable head.
  • Complete next step (P2) - No mechanical repair is identified; wait for the remaining exact-head CI and normal maintainer merge review.
Agent review details

Security

None.

PR surface

Source +101, Tests +469, Other +103. Total +673 across 9 files.

View PR surface stats
Area Files Added Removed Net
Source 4 165 64 +101
Tests 4 469 0 +469
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 103 0 +103
Total 9 737 64 +673

Review metrics

None.

Stored data model

Persistent data-model change detected: persistent cache schema: qa/scenarios/media/inbound-media-store-audio-transcription.yaml, persistent cache schema: src/media-understanding/media-understanding-url-fallback.test.ts, serialized state: extensions/qa-lab/src/scenario-catalog-channels.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #114634
Summary: This PR is a concrete candidate fix for the linked inbound WhatsApp Cloud audio transcription failure.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Retain one canonical attachment-cache flow: resolve permitted local paths and valid inbound-store aliases locally, send only HTTP(S) URLs to the SSRF-guarded fetcher, and merge after the remaining exact-head checks pass.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Retain one canonical attachment-cache flow: resolve permitted local paths and valid inbound-store aliases locally, send only HTTP(S) URLs to the SSRF-guarded fetcher, and merge after the remaining exact-head checks pass.

Do we have a high-confidence way to reproduce the issue?

Yes: current main sends a URL-only media://inbound/... attachment to the remote-fetch branch, while the shared resolver already maps that identifier to an allowed local inbound-store file. The PR adds focused source-level regression coverage and a reported Gateway scenario for that exact path.

Is this the best way to solve the issue?

Yes: the attachment cache is the single owner that chooses local versus remote reads; using the existing media-reference classifier there avoids teaching the SSRF-guarded HTTP fetcher about local identities or forcing individual channels to duplicate source-classification policy.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b7bbb4f98a1f.

Labels

Label justifications:

  • P1: The repaired path prevents an inbound voice-note transcription workflow from silently failing for affected channel users.
  • 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): The PR body supplies after-fix sanitized Crabbox evidence for the QA Channel → Gateway → mock-transcription flow, showing exactly one expected reply and no media-fetch failure; redact-sensitive terminal evidence is an appropriate proof format here.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body supplies after-fix sanitized Crabbox evidence for the QA Channel → Gateway → mock-transcription flow, showing exactly one expected reply and no media-fetch failure; redact-sensitive terminal evidence is an appropriate proof format here.

Evidence

What I checked:

  • Current-main failure path: Current main uses the attachment URL directly as the remote-fetch input after local-path resolution; a URL-only media://inbound/... reference therefore cannot be read through the local media-store resolver. (src/media-understanding/attachments.cache.ts:147, b7bbb4f98a1f)
  • Existing canonical media-store contract: The shared classifier identifies media:// as a media-store URL, and the resolver accepts only the inbound bucket while rejecting malformed, nested, and cross-bucket identifiers. (src/media/media-reference.ts:53, b7bbb4f98a1f)
  • Patch uses the correct boundary: The proposed cache classifies a URL before fetching, retries a valid inbound-store alias after a missing or blocked local path, and preserves terminal max-byte errors; its tests cover URL-only audio, stale paths, blocked paths, invalid aliases, and no-network rejection. (src/media-understanding/attachments.cache.ts:165, fcd7e0899e9e)
  • Remote-fetch contract: The remote reader is implemented as an SSRF-guarded remote-media fetch, while media-understanding’s own runtime only treats HTTP(S) values as remote references; keeping media:// out of that fetcher preserves the existing ownership split. (src/media/fetch.ts:709, b7bbb4f98a1f)
  • History and current ownership: The present cache and media-reference implementation is carried by current-main commit 81031012b222275b9dc2a7bb6e431432a1144581; local history shows Peter Steinberger as the dominant contributor to these central files, with Vincent Koc also a repeated contributor. The PR’s substantive repair commit is 8836d627c738a5b651d21be7bcff34f66be25e41. (src/media-understanding/attachments.cache.ts:146, 81031012b222)
  • Real behavior evidence: The PR body reports a sanitized Crabbox run of the QA Channel to ephemeral Gateway flow with mock transcription: one expected marker reply, no MediaFetchError, no audio: failed, focused tests passing, and a private QA build passing. The downloaded-media manifest contains only an unrelated failed example.com image download, so no additional visual artifact was available or needed for this terminal-style proof. (qa/scenarios/media/inbound-media-store-audio-transcription.yaml:1, fcd7e0899e9e)

Likely related people:

  • Peter Steinberger: Current-main blame attributes the affected cache and media-reference lines to the current carried-forward commit, and the local shortlog shows the largest contribution count across these files. (role: dominant current-main area contributor; confidence: high; commits: 81031012b222, b54a7f802ea3; files: src/media-understanding/attachments.cache.ts, src/media/media-reference.ts)
  • vincentkoc: Vincent Koc authored the substantive stored-inbound URL-alias repair commit and has repeated historical contributions in the same media-resolution files. (role: recent media-resolution contributor; confidence: high; commits: 8836d627c738; files: src/media-understanding/attachments.cache.ts, src/media/media-reference.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Wait for the in-progress required checks to finish successfully on the current head before merge.

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 (13 earlier review cycles; latest 8 shown)
  • reviewed 2026-08-01T09:06:19.179Z sha 1911c63a3f7bc1097b6b1338a87f104e56368931 :: needs real behavior proof before merge. :: [P3] Remove the release-owned changelog entry
  • reviewed 2026-08-01T09:24:21.674Z sha dbe6d3fe5a9461720e843703359b606236a55caf :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T09:37:34.389Z sha dbe6d3fe5a9461720e843703359b606236a55caf :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T05:23:02.285Z sha 8ef8e64f3f7d03d512a3058a48e13ebd096aeb54 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T07:24:10.512Z sha a0f5b1f :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T08:21:26.314Z sha b54a7f8 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T08:47:00.436Z sha b0bdb8b :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T09:31:17.554Z sha 30868dc :: needs maintainer review before merge. :: none

@harjothkhara
harjothkhara force-pushed the oss-find/openclaw-2026-07-31-f branch from 69a4dc9 to 3938428 Compare August 1, 2026 07:26
@vincentkoc vincentkoc self-assigned this Aug 1, 2026
@vincentkoc
vincentkoc force-pushed the oss-find/openclaw-2026-07-31-f branch from 7ced477 to 574b2d2 Compare August 1, 2026 07:50
@openclaw-barnacle openclaw-barnacle Bot added channel: qa-channel Channel integration: qa-channel extensions: qa-lab labels Aug 1, 2026
@vincentkoc
vincentkoc force-pushed the oss-find/openclaw-2026-07-31-f branch from 574b2d2 to 6342062 Compare August 1, 2026 07:54
@vincentkoc
vincentkoc force-pushed the oss-find/openclaw-2026-07-31-f branch 2 times, most recently from dbdfda9 to 72119f2 Compare August 1, 2026 08:32
@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 1, 2026
@vincentkoc
vincentkoc force-pushed the oss-find/openclaw-2026-07-31-f branch from 72119f2 to 1911c63 Compare August 1, 2026 09:00
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. labels Aug 1, 2026
@vincentkoc

Copy link
Copy Markdown
Member

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@openclaw-barnacle openclaw-barnacle Bot added triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. and removed triage: needs-pr-context Candidate: external PR body lacks required problem context or evidence. labels Aug 1, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 1, 2026
@clawsweeper clawsweeper Bot added 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. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 1, 2026
@vincentkoc
vincentkoc force-pushed the oss-find/openclaw-2026-07-31-f branch from 8ef8e64 to a0f5b1f Compare August 2, 2026 07:18
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 2, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. labels Aug 2, 2026
@steipete
steipete merged commit 18f31f6 into openclaw:main Aug 2, 2026
124 of 126 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 3, 2026
…tachment url (openclaw#117268)

* fix(media-understanding): resolve inbound media:// refs carried as attachment url

* fix(media-understanding): resolve stored inbound URL aliases

Co-authored-by: harjoth <[email protected]>

* test(qa): classify stored inbound media proof

* test(qa): require exact inbound media completion

* fix(media-understanding): preserve local media refs

---------

Co-authored-by: Vincent Koc <[email protected]>
Co-authored-by: Peter Steinberger <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: qa-channel Channel integration: qa-channel extensions: qa-lab P1 High-priority user-facing bug, regression, or broken workflow. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

[Bug]: WhatsApp Cloud audio transcription fails with MediaFetchError even though media already downloaded locally

3 participants