Repository navigation
fix: let completion replies send photos and attachments - #176594
Conversation
Allow source-bound completion sends to carry media and attachments through the normal outbound media policy, including media-only replies. Preserve channel, account, destination, thread, reply target and send-action restrictions. Fixes #176144.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 23c8c1f451
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Accept media captions under the same directive restrictions as message text. Preserve Markdown indentation and exercise the normal media loader with source session context in the regression fixture.
|
Codex review: needs real behavior proof before merge. What this changesThis PR permits source-bound completion replies to send media, attachments, captions, and file metadata through existing outbound delivery. Example: A completion sends media=https://example.com/photo.png with caption=Replacement photo to its source conversation.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 3 items remain Keep this PR open: it addresses a confirmed completion-delivery failure with approved direction, and the earlier code findings are fixed; no new concrete defect was found. Priority: P2 Before merge
FindingsNone. Tests
Agent review detailsHow this fits togetherThe message tool validates completion authority and arguments, then passes permitted content to shared outbound preparation, media-access policy, and channel delivery. flowchart LR
A[Completion turn] --> B[Message tool authority]
B --> C[Source routing policy]
C --> D[Outbound preparation]
D --> E[Media access policy]
E --> F[Channel transport]
F --> G[Delivery completion]
Technical reviewBest possible solution: Keep the narrow content allowlist and shared outbound owners, with requester and source authority demonstrated at media I/O and transport handoff. Do we have a high-confidence way to reproduce the issue? Current main deterministically rejects completion media through its argument allowlist and directive checks, corroborating the linked report; no target code was executed during this review. Is this the best way to solve the issue? The patch uses the smallest existing-owner repair: admit content fields, retain routing restrictions, delegate content validation to outbound delivery, and normalize MIME metadata at its current owner. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against fa0605b3deba. Merge-risk optionsMaintainer options:
Provenance checked
TestingProof path: in-process harness. SecurityNeeds attention: No concrete bypass remains identified, but the newly enabled media effects require final-effect authority evidence. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +9, Tests +201, Docs +19. Total +229 across 7 files. Added test files: 1. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (3 earlier review cycles)
Reviewed October 19, 2026, 12:10 AM ET / 04:10 UTC (Revision 4). |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: ad950472a6
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
…completion-source-reply-media # Conflicts: # src/agents/tools/message-tool.test.ts
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
) * fix: allow completion replies to send media Allow source-bound completion sends to carry media and attachments through the normal outbound media policy, including media-only replies. Preserve channel, account, destination, thread, reply target and send-action restrictions. Fixes openclaw#176144. * test: prepare runtime config for completion media replies * fix: preserve completion media content and routing checks Accept media captions under the same directive restrictions as message text. Preserve Markdown indentation and exercise the normal media loader with source session context in the regression fixture. * test: align completion media fixtures with delivery contracts * test: preserve literal local Markdown image behavior * fix: allow completion media filename and MIME metadata * fix: preserve MIME aliases for outbound media * fix(agents): reject directives hidden in completion media * test(agents): adapt completion reply fixture to current owners
Fixes #176144
What Problem This Solves
Fixes: completion and settle replies reject requested photos and files, leaving the agent to send plain text or raw image markup instead.
User Impact
Completion replies can send
mediaandattachments, with or without text or acaption, plus normal filename/MIME metadata, to the current conversation.MEDIA:directives and remote Markdown images follow normal outbound delivery. Local files still require the normal allowed media roots; local Markdown paths remain literal text. Channel, account, destination, thread, and thesendaction remain locked. ExplicitreplyTostays limited to the current message or thread; inline reply and audio directives remain restricted. No new config, SDK, or schema changes.Why This Change Was Made
The execution allowlist continued to reject media after #175309 exposed the full stable message schema to completion turns. Permit media content and remove duplicate completion-only text validation. The existing outbound sender remains the sole owner of text-or-media validation and media access, without a new resolver or broader roots. Caption fallback validation preserves Markdown indentation so existing reply/audio restrictions still apply. Source policy checks reply/audio tags with the sender’s inline parser before media extraction, so media URLs cannot hide a directive that would later change the reply target.
The normal outbound preparation owner also canonicalizes the advertised
mimeTypealias tocontentTypebefore its explicit-media early return. This preserves MIME metadata for both ordinary and completion sends, using the existing contentType-first reader and preserving buffer validation behavior.Product decision from Peter: “Allow media, keep target lock (Recommended)”. The completion-source tests move into a focused sibling suite because the existing test file cannot grow under the line-cap ratchet.
Fact/lifetime audit: this change captures no new state or deferred effects. Existing turn/session authority and binding checks remain at awaited preparation and the outbound handoff. Channel/account/target/thread identity and config remain the admitted send’s existing inputs; media paths, roots, and limits are resolved and enforced by normal outbound owners.
Evidence
delivers completion media and attachments to the current source through normal sendsexercises the real message tool/action runner through a synthetic transport: remote media, media-only attachments, captions, filename/MIME metadata,MEDIA:, remote Markdown images, same-thread replies, and successful source completion.applies normal local media roots and empty-send validation to completion repliesuses the shared media loader and requires the allowed-directory error, failed delivery, no source completion, and no platform send. Existing retargeting, non-send, and reply/audio refusal cases also carry media and metadata. The denial table additionally coversreply directive inside a media-only URL,reply directive inside a media caption, andaudio directive inside a media URL, requiring rejection before secrets or dispatch.dedupes resolved media while retaining first-entry metadata (%j)regression covers MIME-alias preservation andcontentTypeprecedence, asserting both canonical send metadata and attachment payload metadata.git diff --checkpass. Independent Codex autoreview in branch mode through P2 is scoped-clean, including the shared MIME-normalization correction and the inline-directive routing repair.Current main at
b791dd0664e58c5f0c3776ee333b7be4bf8b524fwas fetched successfully and merged without conflicts. It includes the earlier UI and Codex test-type fixes and repairs the mock-export ratchet by preserving the realci-test-timingsmodule exports. The PR patch is unchanged by this merge; the only overlap is main’s independent requester documentation update. Changed-file oxlint/oxfmt and whitespace checks pass; the existing full-branch P2 autoreview covers the unchanged patch.The completion fixture uses module spies after main retired private injection hooks, retaining the real outbound runner for media delivery/access-policy cases and restoring spies after every test.
CI run 39196007075 passed for
618d52d5bdbd23acad113bc4aa3ac35a5a05e9a1: 40 jobs passed, 27 skipped, no failures. The mock-export ratchet, selected Node/Bun tests, both UI E2E shards, production/test typechecks, and lint all passed. No inherited failure exception is needed; the UI bundle-performance job was skipped for this PR’s scope.ClawSweeper’s completed exact-head review states verbatim: “Codex review: needs real behavior proof before merge.” It reports Findings: None, confirms the earlier directive finding is repaired, and marks the fix scope complete. The remaining proof/security holds ask for additional production-owner authority evidence (requester-denied workspace access and revocation during media preparation); the review identifies no concrete remaining bypass. These are proof-only requests: PR CI is the proof per maintainer policy, so no additional local/live proof was run. Exactly one re-review request was posted for this head; no second request was posted. The PR remains open and unmerged.