Skip to content

fix(message): stage buffer-only send attachments#90808

Closed
arkyu2077 wants to merge 1 commit into
openclaw:mainfrom
arkyu2077:fix/90768-buffer-send
Closed

fix(message): stage buffer-only send attachments#90808
arkyu2077 wants to merge 1 commit into
openclaw:mainfrom
arkyu2077:fix/90768-buffer-send

Conversation

@arkyu2077

Copy link
Copy Markdown
Contributor

Summary

  • materialize buffer-only message.send attachments into a temp media file before delivery
  • reuse the staged path for normal send payload construction
  • add a focused regression test for buffer-only sends

Closes #90768

@openclaw-barnacle openclaw-barnacle Bot added size: S triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels Jun 6, 2026
@clawsweeper

clawsweeper Bot commented Jun 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 5, 2026, 10:21 PM ET / 02:21 UTC.

Summary
The PR stages top-level buffer-only message.send attachments into a temporary media file, wires that path into normal send payload construction, and adds a focused media runner regression test.

PR surface: Source +56, Tests +34. Total +90 across 2 files.

Reproducibility: yes. by source inspection: current main exposes buffer input in the message tool schema, but normal send payload assembly only recognizes explicit media/path/mediaUrls hints. I did not run a live reproduction because this review is read-only.

Review metrics: none identified.

Merge readiness
Overall: 🧂 unranked krab
Proof: 🧂 unranked krab
Patch quality: 🧂 unranked krab
Result: blocked until real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Fix the import paths to use the existing media-core helpers or local approved wrappers.
  • Enforce the existing outbound media byte cap and keep dry-run sends from writing files.
  • [P1] Add redacted real runtime or channel proof after the patch, then update the PR body to trigger a fresh review.

Proof guidance:

  • [P1] Needs real behavior proof before merge: The PR body contains only a summary and a regression test claim; it does not include after-fix real runtime/channel proof for this external PR. 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.

Risk before merge

  • [P1] The patch currently cannot build because the new relative media helper imports do not exist on current main.
  • [P1] If the imports are corrected as-is, buffer-only sends can decode and write unbounded user/model-provided base64 to disk before normal outbound media size limits run.
  • [P1] The new staging helper runs from buildSendPayloadParts, so dry-run/preview sends can create media files despite dry-run being expected to avoid delivery-side effects.
  • [P1] The external PR has no after-fix real runtime or channel proof; the added test is useful but mocked dispatch is not enough for this merge gate.

Maintainer options:

  1. Repair staging before merge (recommended)
    Fix the unresolved imports, enforce the existing outbound media byte cap, preserve no-write dry runs, and add real runtime/channel proof before this branch is reconsidered.
  2. Use a sibling branch instead
    If maintainers prefer fix(outbound): materialize buffer-only message.send attachments #90794 or another sibling PR, keep this branch open only until the chosen branch is actually merged or explicitly adopted.
  3. Accept temp-file staging with explicit ownership
    Maintainers could intentionally accept a temp-file implementation, but it still needs byte-limit, cleanup, dry-run, and proof coverage before merge.

Next step before merge

  • [P1] The branch needs contributor or maintainer repair plus real behavior proof; missing proof and competing open fix PRs make this unsuitable for an automated repair lane right now.

Security
Needs attention: The diff introduces a new filesystem write path for user/model-provided base64 without a byte cap, which needs attention before merge.

Review findings

  • [P1] Fix the unresolved media helper imports — src/infra/outbound/message-action-runner.ts:39-43
  • [P1] Bound staged buffer writes before decoding to disk — src/infra/outbound/message-action-runner.ts:517
  • [P2] Preserve no-write dry runs for buffer sends — src/infra/outbound/message-action-runner.ts:986-989
Review details

Best possible solution:

Land one canonical fix that stages buffer-only sends through the shared outbound media store with existing byte caps and dry-run-safe behavior, then require redacted real runtime or channel proof before merging whichever PR maintainers choose.

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

Yes by source inspection: current main exposes buffer input in the message tool schema, but normal send payload assembly only recognizes explicit media/path/mediaUrls hints. I did not run a live reproduction because this review is read-only.

Is this the best way to solve the issue?

No as submitted. Buffer-to-media staging is the right boundary, but this implementation needs valid media-core imports, shared media-store byte limits, dry-run-safe behavior, and real runtime/channel proof.

Full review comments:

  • [P1] Fix the unresolved media helper imports — src/infra/outbound/message-action-runner.ts:39-43
    The new imports point at ../../media/base64.js, ../../media/file-name.js, and ../../media/mime.js, but those modules do not exist under src/media on current main. Neighboring code imports these helpers from @openclaw/media-core/*, so this patch will fail module resolution before message.send can run.
    Confidence: 0.95
  • [P1] Bound staged buffer writes before decoding to disk — src/infra/outbound/message-action-runner.ts:517
    buffer is tool/model input, but the new helper decodes it and writes it directly to a temp file without using the existing outbound media byte cap. A large base64 payload can allocate and persist unbounded data before the normal media loading limits have a chance to protect the send path.
    Confidence: 0.9
  • [P2] Preserve no-write dry runs for buffer sends — src/infra/outbound/message-action-runner.ts:986-989
    buildSendPayloadParts also runs for dry-run sends, and this new call materializes the buffer before dispatch. That makes a preview-only message.send create media files; gate staging on real sends or add a dry-run validation path that does not write to disk.
    Confidence: 0.84

Overall correctness: patch is incorrect
Overall confidence: 0.91

AGENTS.md: found and applied where relevant.

Codex review notes: model gpt-5.5, reasoning high; reviewed against b1e4b6b65e2c.

Label changes

Label changes:

  • add P2: This is a focused outbound message-delivery bug fix with blocking implementation issues but no evidence of a core-wide outage.
  • add merge-risk: 🚨 message-delivery: The patch changes the generic message.send attachment path and could still fail to deliver or preview attachments correctly without byte-cap and dry-run fixes.
  • add merge-risk: 🚨 availability: The diff can break the build immediately and, after import repair, can write unbounded decoded buffers to disk before delivery.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🧂 unranked krab.
  • add 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 contains only a summary and a regression test claim; it does not include after-fix real runtime/channel proof for this external PR. 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.

Label justifications:

  • P2: This is a focused outbound message-delivery bug fix with blocking implementation issues but no evidence of a core-wide outage.
  • merge-risk: 🚨 availability: The diff can break the build immediately and, after import repair, can write unbounded decoded buffers to disk before delivery.
  • merge-risk: 🚨 message-delivery: The patch changes the generic message.send attachment path and could still fail to deliver or preview attachments correctly without byte-cap and dry-run fixes.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🧂 unranked krab.
  • 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 contains only a summary and a regression test claim; it does not include after-fix real runtime/channel proof for this external PR. 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

PR surface:

Source +56, Tests +34. Total +90 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 56 0 +56
Tests 1 34 0 +34
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 90 0 +90

Security concerns:

  • [medium] Unbounded buffer materialization — src/infra/outbound/message-action-runner.ts:517
    The new helper writes decoded buffer content to disk without enforcing MEDIA_MAX_BYTES or the channel/account media cap first, creating a resource-exhaustion path for large tool input.
    Confidence: 0.88

What I checked:

Likely related people:

  • Ayaan Zaidi: Current blame for buildSendPayloadParts, collectActionMediaSourceHints, and the message-tool buffer schema points to commit 85343ea on main. (role: current implementation author; confidence: medium; commits: 85343ea54608; files: src/infra/outbound/message-action-runner.ts, src/infra/outbound/message-action-params.ts, src/agents/tools/message-tool.ts)
  • Peter Steinberger: Recent history for the outbound/media access path includes commit 43ef8a5 centralizing outbound access plumbing, which is adjacent to the mediaAccess contract this fix must preserve. (role: adjacent media access refactor author; confidence: medium; commits: 43ef8a5a8657; files: src/infra/outbound/message-action-runner.ts, src/infra/outbound/outbound-send-service.ts, src/media/read-capability.ts)
  • Agustin Rivera: Commit c949af9 changed host media sender policy in the same media read-capability path that staged send media must respect. (role: adjacent policy contributor; confidence: medium; commits: c949af9fabf3; files: src/media/read-capability.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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.

How this review workflow works
  • 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.

@clawsweeper clawsweeper Bot added 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. labels Jun 6, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Superseded by the canonical fix now on main: 6a0fdea.

The landed version fixes #90768 across local sends, gateway message.action, and gateway delivery-mode send, with byte-limit validation, dry-run handling, target-validation ordering, and mixed explicit-media+buffer handling.

Proof: focused Vitest bundle, clean autoreview, and Testbox-through-Crabbox check:changed on blacksmith-testbox id tbx_01ktgrfezh38zq6vb5afncrch8 / https://github.com/openclaw/openclaw/actions/runs/27089344650.

Thanks @arkyu2077. Closing this PR as superseded by the landed main fix.

@vincentkoc vincentkoc closed this Jun 7, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

merge-risk: 🚨 availability 🚨 May cause crashes, hangs, restart loops, stalls, or process outages. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: message.send can fail for buffer-only attachments without an explicit media path or URL

2 participants