Repository navigation
fix(media): decode file URLs at the native reply boundary - #133146
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 30, 2026, 3:44 AM ET / 07:44 UTC. ClawSweeper reviewWhat this changesThe PR preserves Regression provenancePossible regression — probable (reviewed change; known regression link). No predecessor PR is attributed. Merge readinessKeep open: the native reply conversion fixes the reported staging path, but the prior P2 Control UI localhost-preview blocker remains on the exact head. Priority: P2 Review scores
Verification
How this fits togetherAssistant reply text is parsed into media references, then native reply handling applies local-file policy and stages attachments for channel delivery. The Control UI separately proxies local assistant-media references for chat previews. flowchart LR
A[Assistant reply text] --> B[Shared media parser]
B --> C[Native reply handling]
C --> D[Local-file policy]
D --> E[Attachment staging]
B --> F[Control UI preview policy]
F --> G[Gateway media proxy]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource -1, Tests +95. Total +94 across 7 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Allow only the canonical Do we have a high-confidence way to reproduce the issue? Yes—source inspection gives a high-confidence path: the PR emits Is this the best way to solve the issue? No. Moving decoding to the native owner is the right delivery boundary, but the change is incomplete until the Control UI recognizes the same safe localhost form and continues rejecting remote authorities. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f1d2c5b91f80. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
The localhost preview finding does not reproduce through the actual UI owner. I ran the exported Rank-up disposition: skip the proposed production policy change because the existing policy already admits localhost; adding an exception would duplicate the URL parser's contract. The focused actual-owner proof covers the requested allowed-root/proxy boundary and negative controls, so no additional test-only head change is needed for this false positive. The repair remains production net -1. The branch is being refreshed onto the separately repaired main commit without changing the patch. Final hosted CI and native landing gates still apply. |
7d9084f to
c2f67f4
Compare
|
Merged via squash.
|
…33146) * fix(media): decode file URLs at the native reply boundary * test(media): consolidate file URL cases and satisfy lint * test(media): simplify the shared attachment table assertion
Closes #133144
What Problem This Solves
Legacy final-reply attachments fail when a valid local file URL contains an encoded filename or a
localhostauthority. A file namedcafé 100% image.pngloads through the direct media loader, but prefix stripping turns its URL into a nonexistent percent-encoded filename or a relativelocalhost/...path.Why This Change Was Made
The shared parser now preserves file URL references. The existing native reply-directive producer converts valid local URLs with the canonical file URL helper before reply policy and attachment deduplication. That preserves the legacy directive-to-path contract without importing Node filesystem code into the browser or copying a decoder. Raw structured host file URLs retain their existing reply policy, and malformed URLs, remote hosts, and encoded separators still reach native rejection.
Production LOC is -1 (+15/-16): URL conversion moves to its native owner, and that owner's silent-text handling returns the conditional value directly with its explanatory comment retained. Test LOC is +95 (+116/-21). No new dependency, configuration, public API, persistent state, or security policy is introduced.
User Impact
Legacy
MEDIA:replies can load local files with spaces, Unicode, literal percent signs, and localhost file URLs. Captions, filenames, MIME types, and file bytes are preserved. Equivalent explicit local paths and directive URLs still produce one attachment. Existing structured-file-URL restrictions and sandbox mapping remain intact.Evidence
3f1c84c706bf1e4c8bc7b2ab106ab96ff1fe6ddb: encoded filenames producednot-found; localhost producedpath-not-allowed. Direct URL loading succeeded.image/png, and exact bytes; the same raw structured host URL remained blocked, and mixed explicit/directive references deduplicated to one attachment. No provider or channel credentials were used.c2f67f402e9a41e3b5e2aa11443a9894bf174f0f, a byte-for-byte patch-identical rebase onto repaired mainbe5e79ca4713c33a11ccd56b2d728c19f0779f3d. The refreshed head passed 213 focused parser/reply-policy/outbound tests, the four-case real attachment-staging proof, and fresh autoreview. An obsolete CI run was canceled after its preflight proved it still checked out the earlier broken-main merge tree; new-head hosted CI remains required.Dependency behavior was checked directly in installed
@openclaw/fs-safe0.5.6. Stablev2026.6.9already distinguished legacy directive-to-path conversion from raw structured file URL policy; #121676 retained that distinction when broadening URL spelling. The original prefix-stripping introduction is unknown. Windows-native execution and an authenticated channel send were not run locally; the real proof covers the shared filesystem loading and reply staging boundary.The latest ClawSweeper localhost-preview finding was checked through the actual exported UI policy and proxy helpers: local authorities normalize to an empty hostname before the existing guard. Lowercase/uppercase localhost inside allowed roots pass; remote hosts, outside paths, and encoded separators remain rejected. Proxy URLs retain the exact source and media ticket. The proposed production policy change is skipped as a false positive; the unchanged policy already satisfies that rank-up request.