Skip to content

fix(discord): workspace voice and thread attachments fail to send - #117767

Merged
steipete merged 1 commit into
mainfrom
codex/qa-discord-workspace-media-0801
Aug 2, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/qa-discord-workspace-media-0801

Conversation

@steipete

@steipete steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where Discord operators sending workspace-relative voice attachments or replying in threads with agent-created files would receive missing-media failures even though the host had approved the workspace.

Why This Change Was Made

Preserve the original host-owned media capability and supported legacy roots/readers across every Discord direct, payload, action voice, and thread-reply owner boundary. Normalize access once at the real voice media loader and consolidate duplicate action option types.

User Impact

Agents can send approved workspace audio and thread attachments without granting extra filesystem authority. Path traversal, forged action capabilities, rootless host readers, and reader-free Gateway boundaries remain protected.

Evidence

  • 357 passing tests across seven actual Discord voice, outbound adapter, action/runtime, adopted-thread, payload, and normal message suites.
  • Real workspace-relative on-disk audio load and traversal rejection; canonical and legacy split readers; reader-free Gateway voice; forged action capabilities; thread, forum, component, and follow-on media.
  • Complete exact 13-path remote extensions/extensionTests changed gate passed production/test tsgo, lint including max-lines, formatting, all plugin/SDK/security/storage guards and import cycles.
  • Independent manual security review and fresh dirty plus exact committed-branch Sol/high autoreviews passed with clean secret scans.
  • Production code increases only three net lines after removing duplicate action option definitions.
  • Remote proof and independently verified Testbox cleanup: https://github.com/openclaw/openclaw/actions/runs/30729359388
  • No credentialed public Discord delivery is claimed; guild emoji, sticker, and event asset owners are intentionally separate follow-ups.

@openclaw-barnacle openclaw-barnacle Bot added channel: discord Channel integration: discord size: M maintainer Maintainer-authored PR labels Aug 2, 2026
@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. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Aug 2, 2026
@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 11:31 PM ET / August 2, 2026, 03:31 UTC.

ClawSweeper review

What this changes

The branch propagates host-approved media readers and workspace roots through Discord voice, outbound-payload, and thread-reply sends so approved workspace-relative attachments work without accepting action-supplied filesystem authority.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 4 items remain

This PR remains necessary: current main still loads Discord voice input without the host-owned media-access options, while the branch threads that authority through voice and thread attachment routes. The patch follows the shared media-loader contract and has focused regression coverage, but it needs inspectable after-fix runtime proof before merge; the current maintainer label also requires explicit human handling.

Priority: P1
Reviewed head: 776d1d428b89b9291f51d847e2d9e6a356a706ac

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The focused patch and source-level regression coverage are strong, but real after-fix behavior proof is still a merge gate.
Proof confidence 🧂 unranked krab (1/6) Needs real behavior proof before merge: The PR body reports focused tests and a remote validation run, but the available artifacts do not show an after-fix Discord delivery, runtime log, recording, or mock-gateway verdict; add redacted runtime evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR body reports focused tests and a remote validation run, but the available artifacts do not show an after-fix Discord delivery, runtime log, recording, or mock-gateway verdict; add redacted runtime evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 7 items Current-main defect: On current main, materializeVoiceMessageInput calls loadWebMediaRaw with only the audio byte limit, so it cannot receive the host-approved mediaAccess, legacy roots, or host reader needed for workspace-relative voice files.
Canonical authority contract: The shared loader normalizes mediaAccess, legacy roots, and the reader; when a host reader exists it requires an explicit root boundary, preserving the security invariant the PR relies on.
Patch uses the canonical loader: The branch changes voice materialization to call buildOutboundMediaLoadOptions with the host media-access context rather than introducing a Discord-specific path reader.
Findings None None.
Security None None.

How this fits together

Discord's channel plugin receives agent actions and outbound payloads, then hands media paths to voice or attachment senders. The host supplies the authorized local roots and optional reader; the Discord paths must preserve that capability until the shared media loader validates and reads the file.

flowchart LR
  A[Agent action or outbound payload] --> B[Discord action and outbound routes]
  B --> C[Host-owned media authority]
  C --> D[Voice or thread attachment sender]
  D --> E[Shared media loader]
  E --> F[Discord delivery]
  C --> G[Root and traversal checks]
Loading

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR body reports focused tests and a remote validation run, but the available artifacts do not show an after-fix Discord delivery, runtime log, recording, or mock-gateway verdict; add redacted runtime evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - There is no inspectable after-fix Discord delivery transcript, recording, runtime log, or mock-gateway verdict artifact; focused tests and the linked CI run do not by themselves prove the changed host-to-plugin authority handoff in a running setup.
  • Resolve merge risk (P1) - The PR changes both message delivery and filesystem-authority propagation. Required checks were still in progress in the supplied status snapshot, so merge should wait for completion on the current head.
  • Complete next step (P2) - The code review found no discrete mechanical defect to repair, but an external contributor must provide real after-fix behavior proof and a maintainer must handle the protected maintainer label before merge.
Agent review details

Security

None.

PR surface

Source +3, Tests +292. Total +295 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 8 44 41 +3
Tests 5 305 13 +292
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 349 54 +295

Review metrics

Metric Value Why it matters
Authority-carrying delivery routes 4 runtime forwarding sites changed Voice actions, outbound adapter delivery, outbound payload delivery, and guild-admin thread replies must all preserve the same host-owned media authority to avoid one-sided regressions.

Stored data model

Persistent data-model change detected: serialized state: extensions/discord/src/actions/handle-action.adopted-thread.test.ts, serialized state: extensions/discord/src/actions/runtime.messaging.shared.ts, serialized state: extensions/discord/src/actions/runtime.test.ts, serialized state: extensions/discord/src/actions/runtime.ts, serialized state: extensions/discord/src/outbound-adapter.test.ts, serialized state: extensions/discord/src/send.voice.test.ts. Confirm migration or upgrade compatibility proof before merge.

Mantis proof suggestion

Mantis can supply directly relevant, redacted before/after proof for the Discord thread attachment route changed by this PR. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis discord thread attachment proof: verify and capture a redacted transcript showing an approved workspace-relative file delivered in a thread reply.

Merge-risk options

Maintainer options:

  1. Add runtime delivery proof before merge (recommended)
    Post redacted after-fix evidence from a Discord or mock-gateway run showing an approved workspace-relative voice or thread attachment delivers and action-supplied media authority is ignored.
  2. Pause for maintainer acceptance
    Keep the PR open for explicit maintainer review if a safe runtime proof environment cannot exercise the host media-access boundary.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Require redacted after-fix runtime evidence for an approved workspace-relative voice or thread attachment delivery, including confirmation that forged action media authority is not used.

Technical review

Best possible solution:

Land a single canonical host-media authority path: retain the shared buildOutboundMediaLoadOptions boundary, preserve it through every affected Discord voice and thread route, and attach redacted runtime proof showing an approved relative workspace file succeeds while forged action media authority is ignored.

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

Yes, from source: current extensions/discord/src/send.voice.ts:57 calls the media loader without the host-provided access context, while the shared loader requires that context for authorized relative workspace reads. I did not execute a live Discord send because this review is read-only and no inspectable runtime artifact was supplied.

Is this the best way to solve the issue?

Yes for the code path: forwarding the existing host-owned media context into the canonical shared loader is narrower and safer than adding a Discord-local reader or trusting action parameters. Runtime proof is still required to establish that all changed delivery routes behave correctly after the fix.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P1: The patch addresses broken existing Discord voice and thread attachment delivery for otherwise approved workspace media.
  • merge-risk: 🚨 message-delivery: The changed paths select and send voice or file media to Discord channels and threads, so an incomplete propagation could continue to suppress attachments.
  • merge-risk: 🚨 security-boundary: The changed options carry filesystem read capability and allowed roots, requiring proof that only host-owned context—not action parameters—sets the authority.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR body reports focused tests and a remote validation run, but the available artifacts do not show an after-fix Discord delivery, runtime log, recording, or mock-gateway verdict; add redacted runtime evidence before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Current-main defect: On current main, materializeVoiceMessageInput calls loadWebMediaRaw with only the audio byte limit, so it cannot receive the host-approved mediaAccess, legacy roots, or host reader needed for workspace-relative voice files. (extensions/discord/src/send.voice.ts:57, 14322647cd6c)
  • Canonical authority contract: The shared loader normalizes mediaAccess, legacy roots, and the reader; when a host reader exists it requires an explicit root boundary, preserving the security invariant the PR relies on. (src/media/load-options.ts:52, 14322647cd6c)
  • Patch uses the canonical loader: The branch changes voice materialization to call buildOutboundMediaLoadOptions with the host media-access context rather than introducing a Discord-specific path reader. (extensions/discord/src/send.voice.ts:56, 776d1d428b89)
  • Sibling delivery coverage: The branch also forwards the same host-owned options through action voice sends, outbound adapter voice sends, outbound payload voice sends, and guild-admin thread replies, with targeted tests for trusted versus forged action media access. (extensions/discord/src/actions/runtime.messaging.send.ts:287, 776d1d428b89)
  • Implementation provenance: Current-main blame attributes the original voice media-loader call to the recent voice-send implementation commit, establishing the exact pre-fix owner boundary this PR repairs. (extensions/discord/src/send.voice.ts:57, 65d64818bb6b)
  • Proof artifact review: The prepared media manifest contains only a failed download of an example image and no Discord transcript, runtime log, harness verdict artifact, or recording that demonstrates the after-fix behavior.

Likely related people:

  • Yiğit ERDOĞAN: Git blame identifies this author as the introducer of the current voice media-load call that lacks the host media context. (role: current implementation author; confidence: high; commits: 65d64818bb6b; files: extensions/discord/src/send.voice.ts)
  • Peter Steinberger: Feature-history sampling shows substantial historical contribution across the Discord send, outbound adapter, payload, and action-entry surfaces touched by this repair, although the available local history is partial. (role: long-running adjacent contributor; confidence: medium; files: extensions/discord/src/send.voice.ts, extensions/discord/src/outbound-adapter.ts, extensions/discord/src/outbound-payload.ts)

Rank-up moves

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

  • Post a redacted runtime transcript, terminal/log artifact, recording, or mock-gateway verdict showing approved workspace-relative voice or thread attachment delivery.
  • Wait for required checks to finish on the current 776d1d428b89b9291f51d847e2d9e6a356a706ac head.

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 (1 earlier review cycle)
  • reviewed 2026-08-02T03:12:36.558Z sha be748c4e36406d6c60f6e3bbd2b792307461834b :: needs real behavior proof before merge. :: none

@steipete
steipete force-pushed the codex/qa-discord-workspace-media-0801 branch from be748c4 to 776d1d4 Compare August 2, 2026 03:27
@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 2, 2026
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Explicit maintainer real-proof decision for exact head 776d1d4: runtime owner proof https://github.com/openclaw/openclaw/actions/runs/30729359388 passed 357 tests across seven Discord suites plus the full thirteen-path changed gate, production/test typechecks, lint, plugin boundaries, and security guards. The production voice owner test writes actual OggS trusted voice bytes into an isolated real workspace, invokes the real Discord sender with ./voice.ogg and host-issued localRoots/workspaceDir, uses the actual bounded media loader, materializes and rereads the bytes, and observes exactly one mocked Discord API delivery. It then reads an actual out-of-root fixture path ../outside.ogg, correctly rejects it as not under an allowed directory, and observes no second delivery. Separate adopted-thread tests preserve exact host capability identity and reject forged model-supplied authority. Existing Mantis cannot exercise this change: its synthetic baseline requires the old forwarding literal removed by this PR and its actual scenario uses absolute paths plus only split legacy fields; the relative Gateway scenario excludes Discord and Crabline has no Discord fake transport. No existing approved harness can provide the requested live public Discord/mock-Gateway verdict without unrelated harness changes. As authorized maintainer, I explicitly accept the real on-disk production-owner behavior, traversal rejection, 357 tests, clean security reviews, green exact-head canonical CI and required gate instead. No public Discord delivery is claimed; production delta plus three lines.

@steipete
steipete merged commit 6d6b3a8 into main Aug 2, 2026
114 of 116 checks passed
@steipete
steipete deleted the codex/qa-discord-workspace-media-0801 branch August 2, 2026 04:32
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

channel: discord Channel integration: discord maintainer Maintainer-authored PR merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P1 High-priority user-facing bug, regression, or broken workflow. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant