Skip to content

fix: sandbox screenshots unavailable in managed project chats - #176199

Merged
shakkernerd merged 4 commits into
mainfrom
sandbox-screenshot-preview
Oct 18, 2026
Merged

shakkernerd merged 4 commits into
mainfrom
sandbox-screenshot-preview

Conversation

@shakkernerd

@shakkernerd shakkernerd commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Screenshots generated inside a local Docker or Podman sandbox can appear unavailable in their managed project conversation because the saved container path does not identify a Gateway-host file.

Fixes #176188.

User Impact

Authorized readers can preview their project screenshots in the conversation. Existing session/message access, containment and revocation checks still apply; no settings or permissions are added.

Why This Change Was Made

The media reader resolves the original workspace reference through the current managed worktree and joins its existing settlement owner. Before serving bytes, the sandbox mount owner verifies that the visible backing still identifies that workspace. Obscured or unverifiable paths remain unavailable. Inspectable stopped containers retain preview support. Image reads never provision a sandbox.

The original message reference remains the attachment identity. Virtual-path tickets bind to the current workspace through an opaque value without exposing a host path. Relative sandbox references retain that same namespace through message association and ticket reads. Explicit host paths and inbound uploads keep their existing behavior.

Evidence

The real HTTP regression fails on the base for an existing image in an unsynchronized projection. The corrected route serves its metadata and image bytes and rejects unrelated readers and issued tickets after access withdrawal or workspace reassignment.

Remote validation passed: formatting/lint, the affected compiler graphs, and 213 tests across 12 owner/consumer files (121.41 seconds; one existing skip). A final workdir-normalization check passed all 32 mount-owner cases. An actual Docker probe passed workspace, tmpfs, bind-override and volume cases while both running and stopped: ordinary workspace backing remained readable and obscured backing was rejected.

The browser comparison uses real Gateway sandbox execution to create the PNG, then appends a synthetic saved reference through the Gateway. It checks metadata, exact image bytes, preview click/Escape and reload after the owned container stops. The browser uses an owner session; the real HTTP fixture separately verifies guest authorization. Podman engine execution and representative workspace latency are not covered.

The relative-reference correction validates 64 cases across four media suites; the final 18-case HTTP authority run took 29.87 seconds. Captures below are from 8aaf876; its absolute-reference rendering path is unchanged by the relative-reference correction.

Visual evidence

Open preview

Before After
Saved sandbox screenshot reference is unavailable before the fix The same saved reference displays its owned screenshot

Open and close the preview, then reload after stopping the container

[email protected]

Visual verification

  • Baseline: 976dc66
  • Exact head: 8aaf876dfa09fe73de1ed81f6042b41ef4642ec3
  • Scenario: Generate a PNG through Gateway sandbox execution, append its saved virtual-path reference through chat.inject, then open and close its preview and reload after the container stops.
  • Runtime/build: OpenClaw 2026.10.4; Linux Chromium; source 8aaf876
  • Before: available false; naturalWidth 0
  • After: available true; naturalWidth 180
  • Same synthetic fixture, viewport and generated image bytes on both revisions
  • Actual assistant-media metadata and decoded PNG bytes match the sandbox-generated image
  • Preview click and Escape pass; stopped-container reload returns the same bytes

@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime size: S labels Oct 18, 2026
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 18, 2026
@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

Resolve managed sandbox screenshot references through their session worktree while preserving message access, mount containment, and ticket revocation.

Example: A managed project reply contains MEDIA:/workspace/.artifacts/proof/screenshot.png.

  • Before: The preview attempts to open the container path on the Gateway host and appears unavailable.
  • After: The preview serves the settled project image when the existing sandbox exposes the matching workspace bind.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A useful, focused repair with browser evidence and production-route authority coverage; no actionable source defect remains.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected browser screenshots show the real Gateway-generated image becoming available; supplied HTTP boundary validation covers metadata and exact bytes for authorized readers and rejection after unrelated access, visibility or role withdrawal, and workspace reassignment. The final relative-reference correction has reported HTTP coverage, while the unchanged absolute path retains browser proof.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: People cannot inspect screenshots generated by their sandboxed managed project in the conversation.
Reason: The maintainer-authored direction restores an existing preview capability without adding settings or permissions.

Merge readiness

✅ Ready for maintainer review

Keep open: this maintainer-authored PR fixes a current screenshot-preview failure. The earlier mount-backing finding is resolved, and no actionable defect remains in the reviewed changes; required CI is still pending.

Priority: P2
Reviewed head: 17df52c0ffed0a69285196d6139e5b6a401897ad

Before merge

None.

Findings

None.

Agent review details

How this fits together

The Gateway assistant-media route accepts saved attachment references and reader credentials, resolves session-owned files, and returns authorized metadata, tickets, and image bytes.

flowchart TD
  A[Saved message reference] --> B[Gateway media route]
  B --> C[Current reader and session policy]
  C --> D[Workspace settlement owner]
  D --> E[Sandbox mount verification]
  E --> F[Safe file reader]
  F --> G[Authorized metadata and bytes]
Loading

Technical review

Best possible solution:

Use the existing media, settlement, and mount owners to serve only the current conversation’s verified workspace backing.

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

Current main resolves an absolute container reference as a host path; the linked report and supplied before/after browser evidence demonstrate the resulting unavailable preview without a new reviewer-run reproduction.

Is this the best way to solve the issue?

The change repairs namespace resolution at the media owner, settles pending project edits through the existing owner, and verifies visible backing before disclosure; the added helpers and tests serve distinct containment and revocation failures.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 15ae101a0d85.

Provenance checked

  • Session-relative attachment resolution keeps the original intent (1cc13c1: Resolve relative attachments against the selected session directory while keeping filesystem policy and ticket identity.)
  • Message-bound guest attachment access keeps the original intent (7fffcbd: Permit narrow readers to open attachments of currently visible messages without granting arbitrary file access.)
  • Managed projection settlement and runtime custody keeps the original intent (28d8ee4: Keep sandbox execution in private managed projections and reconcile accepted changes under existing custody.)
  • Worker-owned projection persistence keeps the original intent (cd326f9: Move persistence off the Gateway thread while retaining one reconciliation owner and unchanged stored data.)
  • Visible sandbox mount backing keeps the original intent (0ab1513: File operations must follow realized visible mounts and reject hidden or unverifiable host backing.)
  • Required-sandbox preview containment keeps the original intent (2d0beb4: Keep required-sandbox images inside allowed roots even when the session selects Full Access.)

Testing

Proof path: shipped entry point.

Security

None.

Evidence

What I checked:

  • Current-main failure remains: Fetched main opens the supplied local reference directly; it has no managed sandbox path translation or workspace settlement in this reader. (src/gateway/control-ui-assistant-media-read.ts:53, 15ae101a0d85)
  • Existing owners perform the repair: The introduced patch uses the existing path mapper, workspace settlement operation, mount inspection, message association, and response-authority checks rather than introducing another persistence or authorization owner. (src/gateway/control-ui-assistant-media-read.ts:80, 17df52c0ffed)
  • Previous finding resolved: Mount verification now selects the deepest inspected mount, requires the expected workspace bind source, and checks runtime mount masks for running containers; stopped containers use retained mount metadata. (src/agents/sandbox/mount-plan.ts:291, 17df52c0ffed)
  • Final-response authority coverage: The supplied HTTP validation exercises actual metadata and byte responses with real session/profile owners, including unrelated readers, withdrawn visibility or roles, workspace reassignment, and obscured relative aliases; engine inspection is mocked in this fixture. (src/gateway/control-ui.response-authority.test.ts:598, 17df52c0ffed)
  • Inspected browser evidence: Downloaded before/after screenshots show the unavailable card becoming a rendered image. The body records real Gateway sandbox generation and exact-byte verification on 8aaf876; comparison confirms its absolute-reference mount/read path remains intact. Podman engine execution and representative latency are explicitly unclaimed. (8aaf876dfa09)
  • Media inspection limitation: The prepared video manifest reports 'ffprobe failed: spawnSync ffprobe ENOENT'; browser retrieval also failed with 'Cache miss'. The linked gist returned HTTP 403 through the repository integration and was unavailable through browser retrieval; neither artifact was treated as inspected proof.

Likely related people:

  • Vincent Koc: Raw commit 0ab1513 adds src/agents/sandbox/mount-plan.ts:132 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 0ab1513aaedf; files: src/agents/sandbox/mount-plan.ts)

PR surface

Source +250, Tests +323, Docs +8. Total +581 across 12 files. Added test files: 1.

View PR surface stats
Area Files Added Removed Net
Source 7 288 38 +250
Tests 4 354 31 +323
Docs 1 9 1 +8
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 12 651 70 +581

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. Replaced prior rating: 🧂 unranked krab.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove merge-risk: 🚨 security-boundary: Current PR review selected no merge-risk labels.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Screenshot previews fail in local managed sandbox conversations, with limited impact on the surrounding chat workflow.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit. Replaced prior rating: 🧂 unranked krab.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence.

Rating scale

6/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.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-18T12:23:13.521Z sha 1b4ee98 :: needs real behavior proof before merge. :: [P2] Honor visible sandbox mounts before mapping media to the worktree

Reviewed October 18, 2026, 10:10 AM ET / 14:10 UTC (Revision 2).

@github-actions

github-actions Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 17df52c0ffed0a69285196d6139e5b6a401897ad
  • Maintainer: @shakkernerd
  • Repository role: maintain

These security sensitive changes were made:

  • src/agents/sandbox/local-workspace-quiescence.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • src/agents/sandbox/mount-plan.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: L and removed size: S labels Oct 18, 2026
@shakkernerd

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 18, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 18, 2026
@shakkernerd
shakkernerd merged commit ca5ac6f into main Oct 18, 2026
158 checks passed
@shakkernerd
shakkernerd deleted the sandbox-screenshot-preview branch October 18, 2026 14:18
@shakkernerd

Copy link
Copy Markdown
Contributor Author

Fixed: managed project conversations can preview their authorized sandbox screenshots.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 19, 2026
…aw#176199)

Resolve saved screenshot references through the owning managed sandbox workspace while preserving message access and visible backing checks.

Refs openclaw#176188.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. docs Improvements or additions to documentation gateway Gateway runtime merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. security-sensitive-changed size: L status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Local sandbox screenshot previews are unavailable in project chats

1 participant