Repository navigation
fix(sandbox): resolve bare upload handles to staged inbound media - #129269
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 8:05 AM ET / 12:05 UTC. ClawSweeper reviewWhat this changesThe PR carries staged upload-handle mappings into sandbox image, PDF, and generation tools so bare handles resolve to their staged files. Merge readinessThe PR remains necessary and is a correct producer-owned repair for the linked sandbox upload failure. No introduced correctness finding was found; wait for exact-head CI to finish before merge. Priority: P1 Review scores
Verification
How this fits togetherInbound uploads are copied into a private sandbox workspace before agent tools read them. The embedded runner builds the tool set for that turn and now carries the staging producer’s exact handle-to-path facts into media resolution. flowchart LR
Upload[Inbound upload]
Stage[Sandbox staging]
Fact[Staged media fact]
Map[Turn alias map]
Runner[Embedded runner]
Tool[Media tool]
Read[Sandbox file read]
Upload --> Stage --> Fact --> Map --> Runner --> Tool --> Read
Before merge
Agent review detailsSecurityNone. PR surfaceSource +51, Tests +146. Total +197 across 18 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Merge the producer-owned per-turn mapping after exact-head CI is green, retaining direct workspace-file precedence and ambiguous-alias rejection. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible: current main treats the bare handle as a direct workspace path, while the supplied Docker trace reports ENOENT before this branch and a successful staged-file read after it. Is this the best way to solve the issue? Yes: preserving the staging producer’s exact per-turn fact is safer and more maintainable than rediscovering files by scanning the sandbox workspace. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a8c8c8270836. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Thanks for the controlled JPG/PNG test in #129084 — the split was real, and it exposed a gap in the first version of this fallback. The mechanism:
So it is not format-specific handling in the media store — it is a landed-filename vs handle-match gap: the fallback required the staged filename to equal the bare handle character-for-character. The fix (c41b5b9fcea) closes that gap:
Regression coverage added for the JPG-with-extension case ( |
CI triage:
|
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
CI triage — shard failures trace to main's red window (now recovered), not this diff
Completed CI runs don't auto-refresh, so a re-run of the failed jobs against current main should turn these checks green. No product failure is attributable to this PR's changes. |
|
Hi @steipete @vincentkoc — follow-up on my CI triage comment above: main's red window is now closed. push-to-main CI has been fully green since 12:38Z today:
This PR's head ( As an external contributor I have no write access to rerun failed jobs myself — could you please rerun the failed jobs on this PR? Thanks! |
3331862 to
7a2f11e
Compare
d751514 to
909c736
Compare
909c736 to
ff25eb7
Compare
ff25eb7 to
aa4a2f8
Compare
|
@steipete @vincentkoc @joshavant — security-owner review requested for the CODEOWNERS sandbox path. Exact head |
|
Thanks @Finn763! Proof: In a real Docker sandbox, a 519-byte uploaded JPEG referenced by its bare
Example
|
Carry the staging producer's exact upload-handle mapping into every sandbox media tool. Bare handles now resolve to verified staged inputs without directory scans or extension guesses, while direct workspace files remain authoritative and ambiguous aliases fail closed. Co-authored-by: Ayaan Zaidi <[email protected]>
What Problem This Solves
Sandboxed agents could not inspect an uploaded image when the model used its bare
file_<id>handle. The image tool resolved that handle at the workspace root and returnedENOENT, even though inbound staging had copied the image into the private sandbox input directory.PR #122031 established the contract: managed inbound media references remain available for later inspection.
Root cause
The staging producer knew the exact private path, but tool construction discarded that mapping. The stale patch scanned a former flat
media/inboundlayout and added directory-listing APIs. Current staging uses marker-ownedmedia/inbound/openclaw-staged-<id>/input-<name>directories, so that scan could not own the mapping.Fix
file_aliases, reject ambiguous aliases, and keep an existing workspace file authoritative.media://inbound/...handling unchanged.No directory scan, extension allowlist, filesystem bridge API, config change, or documented behavior change is added.
Evidence
0320297d7a1573c08cfaab781f93bd57dc4a694b: a real Docker sandbox staged a 519-byte JPEG,view_image("file_proof")returnedENOENT, and the exact staged path read with JPEG signatureffd8ff.aa4a2f88049a37af4814d68ab87f52b3f0ac2f7c: the same Docker and image-tool flow loaded the 519-byte JPEG from the producer path through the bare handle.view_image, PDF, and media-generation references.Scope
ENOENT; PDF and generation references cover the shared sibling path.Closes #129084