Repository navigation
fix: retain photos on later sandbox conversation turns - #179301
Conversation
Honor persisted workspace provenance when choosing the local media reference, so later turns hydrate the same staged copy while previews keep the original URI. Sandbox containment and bounded reads remain unchanged. Fixes #179258. Regression introduced by 728d16e (#161842). Tests and live proof deferred to PR CI per maintainer policy; local changed-file lint and formatting only.
|
🦞👀 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. |
A workspace marker identifies staged filesystem copies, not media URI paths. Keep URI inputs on their existing parsing path so remote attachment preparation still rejects malformed inbound references. Addresses the existing invalid-uri staging regression reported by PR CI run 39574497224. Local changed-file lint and formatting pass; test execution remains delegated to PR CI.
…sandbox-history-media-staged-provenance
|
Codex review: needs maintainer review before merge. What this changesThis PR makes later sandbox turns select an image’s persisted staged path while preserving its original preview URI. Example: A user sends sample.jpg through Telegram, then asks “What color was it?” without uploading it again.
Review scores
ProductKind: Bug fix · Worth it: Yes · Fix scope: Complete Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness✅ Ready for maintainer review Keep this PR open: it narrowly repairs a verified persistence-to-replay mismatch that remains on current main, with no actionable correctness finding. Priority: P2 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherInbound attachment staging supplies media facts to transcript persistence; the shared reference resolver later selects sources for image hydration, which validates and reads them through the active sandbox bridge before supplying model input. flowchart TD
A[Inbound photo] --> B[Workspace staging]
B --> C[Persisted transcript]
C --> D[Media reference resolver]
D --> E[Sandbox filesystem bridge]
E --> F[Historical image hydration]
F --> G[Model context]
Technical reviewBest possible solution: Use the existing shared resolver and persisted workspace metadata to recover staged images while retaining preview URIs and active sandbox validation. Do we have a high-confidence way to reproduce the issue? Current-main staging, transcript normalization, reference selection, and sandbox alias validation establish the reported failure path; no target code or tests were executed during this review. Is this the best way to solve the issue? This is the smallest complete repair: it recognizes already-persisted staging metadata at the shared selection owner without adding state, rewriting transcripts, or weakening filesystem validation. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against a4fbed5dbef8. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
PR surfaceSource 0, Tests +47, Docs +2. Total +49 across 3 files. Added test files: 0. 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. LabelsLabel changes:
Label justifications:
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 Reviewed October 21, 2026, 5:35 AM ET / 09:35 UTC. |
|
PR CI is the proof for this change per maintainer policy. Live Gateway/Telegram/Docker proof and local test/typecheck execution were intentionally skipped. CI run 39576023477 completed successfully on ClawSweeper reported no code findings on this head. Its live-proof note does not require additional proof under this policy. This PR remains open and ready; no merge was performed. |
|
Merged via squash.
|
* fix: retain staged photos in sandbox conversation history Honor persisted workspace provenance when choosing the local media reference, so later turns hydrate the same staged copy while previews keep the original URI. Sandbox containment and bounded reads remain unchanged. Fixes openclaw#179258. Regression introduced by 2a7d513 (openclaw#161842). Tests and live proof deferred to PR CI per maintainer policy; local changed-file lint and formatting only. * fix: preserve validation for workspace media URI inputs A workspace marker identifies staged filesystem copies, not media URI paths. Keep URI inputs on their existing parsing path so remote attachment preparation still rejects malformed inbound references. Addresses the existing invalid-uri staging regression reported by PR CI run 39574497224. Local changed-file lint and formatting pass; test execution remains delegated to PR CI.
Keep temporary channel-image read failures on the current run rather than persisting permanent hydration suppression. Reconcile run-only skips with recorded attachments through one shared source-and-occurrence matcher for prompt hydration, workers, and image-input detection. Both admission-mode regressions fail on the base; 170 focused tests pass with the fix. Preserve intentional suppression and leave ambiguous historical records unchanged. Exact-head CI passes. Co-authored-by: Masato Hoshino <[email protected]> (cherry picked from commit 15a5706) Release adaptation: baseline images.ts lacks applySandboxStagedImagePaths (#179301), so the recorded-fact suppression is applied directly to normalizeMediaFacts and the main-only staged-copy media-refs case is not ported. Baseline attempt-session-prepare still attaches persisted facts as runtime prompt facts, so those now go through applyRunHydrationSuppression with the attempt media to keep this run skipping the unreadable image. The collect-queue case is ported into the baseline enqueue/scheduleFollowupDrain test style.
…porary, openclaw#179258) On later turns the loader followed the media://inbound alias to media/inbound/<id> inside the sandbox, where no copy exists; the staged copy lives under media/inbound/openclaw-staged-<uuid>/. The photo dropped out of model context after its first model call ("Sandbox media reference is not staged"). Seen on the motivator group agent since 2026-10-26. Port of openclaw#179301 (merged to main 2026-10-21); 10.7 lacks the `fact.staged && fact.path` branch that the upstream diff edits, so the condition is applied to the bare alias lookup. TEMPORARY: remove once we run a release containing openclaw#179301 (not in v2026.10.9 or v2026.10.10-beta.5). Running as a dist patch on 2026.10.7 since 2026-10-30.
* fix: retain staged photos in sandbox conversation history Honor persisted workspace provenance when choosing the local media reference, so later turns hydrate the same staged copy while previews keep the original URI. Sandbox containment and bounded reads remain unchanged. Fixes openclaw#179258. Regression introduced by 728d16e (openclaw#161842). Tests and live proof deferred to PR CI per maintainer policy; local changed-file lint and formatting only. * fix: preserve validation for workspace media URI inputs A workspace marker identifies staged filesystem copies, not media URI paths. Keep URI inputs on their existing parsing path so remote attachment preparation still rejects malformed inbound references. Addresses the existing invalid-uri staging regression reported by PR CI run 39574497224. Local changed-file lint and formatting pass; test execution remains delegated to PR CI. (cherry picked from commit 662e2d3)
Fixes #179258
What Problem This Solves
Fixes photos disappearing from model context on later text-only turns in Docker-sandboxed conversations, including Telegram photos whose staged copies still exist.
User Impact
Retained images hydrate from the same staged copy on later turns, including affected existing transcripts. History previews retain the original managed URI. Missing copies and paths outside the active sandbox remain unavailable; no configuration changes or migration are required.
Why This Change Was Made
Commit 728d16e (#161842) preserved the original media URI for previews, but transcript serialization omits the runtime
stagedflag. Replay consequently preferred that URI and searched a different sandbox filename. The current-turn fix in #168537 cannot repair a later turn without current-attempt media.The canonical media-reference resolver now recognizes the persisted
workspaceDiras staging provenance for filesystem paths, matching the existinghasStagedMediaFactscontract. Paths that are themselves media URIs still reach the existing URI parser and validation. This uses metadata already present in affected transcripts rather than adding another stored field or rewriting history. The active sandbox bridge still enforces containment and bounded reads.Evidence
fc3a42a7eb87a906597187f18db62201020d275b; no live reproduction claimed.replays a staged photo on a later sandbox turn: present,missing, andoutside-rootinstage-sandbox-media.history.test.ts. These compose real staging, transcript serialization, and later-turn hydration with a host-backed sandbox filesystem fixture; only sandbox provisioning is mocked. The original store file remains present, so rejected copies must not fall back to host media.a7fcc948d7da4591ac3ccc7d408ffd5870269745passed all 14 staging/history tests, including the three new cases (7.18s suite, 9.79s wrapper under Bun), and all 15 remote-workspace attachment tests. Initial CI caught the existinginvalid-uritest regressing when a media URI carried workspace metadata; the follow-up preserves URI validation, and that test now passes. Full CI run 39576023477 completed successfully on that exact head; the native CI watcher reported GREEN with superseded checks reconciled.