Skip to content

fix(control-ui): restore sandbox media previews - #117689

Merged
steipete merged 5 commits into
mainfrom
codex/fix-sandbox-media-transcript-preview
Aug 2, 2026
Merged

steipete merged 5 commits into
mainfrom
codex/fix-sandbox-media-transcript-preview

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes #108174: sandbox-staged inbound images can be analyzed by the agent but render as broken previews in Control UI because the persisted transcript retains a workspace-relative media path.

Why This Change Was Made

  • Resolve persisted sandbox-relative media paths against the existing per-fact workspace anchor at the transcript owner boundary.
  • Preserve unanchored relative paths, original URLs, and existing workspace-relative history-pruning ownership.
  • Extend the existing real Chromium regression to cover both canonical inbound media and an absolute sandbox-staged attachment.

User Impact

Sandboxed inbound image attachments now render through the existing authenticated assistant-media route in Control UI session history without introducing a separate UI-side path reconstruction rule.

Evidence

  • Original focused Blacksmith Testbox proof: pnpm test src/sessions/user-turn-transcript.media.test.ts src/agents/embedded-agent-runner/run/history-image-prune.test.ts passed 56/56.
  • Actual Chromium browser proof: Blacksmith Testbox run 30727650215, lease tbx_01kz02d20s9t5vasjh6q2wchbd, executed the exact parent d5afd92f0c6209d8b361fd802c921e66db8b72f0 with synced E2E blob ba19112cabd3da442d5af837c35e2d4da8ad031b; committed PR head d41a4a01e2b20e7f1586076d4b9fae906fb796ea contains that exact identical blob.
  • Command: OPENCLAW_UI_E2E_ARTIFACT_DIR=/tmp/openclaw-ui-pr117689 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/chat-flow.media-files.e2e.test.ts --testNamePattern "ticketed media route" --reporter=verbose.
  • Result: Test Files 1 passed; Tests 2 passed | 12 skipped; both canonical media://inbound/telegram-photo.png and sandbox /workspace/media/inbound/fabricated-sandbox.png assert the exact source query, authenticated Bearer metadata request, ticketed image-body request without Bearer authorization, and a visibly decoded image with naturalWidth = 1.
  • The remote browser generated canonical-inbound-image.png (30139 bytes) and sandbox-inbound-image.png (30758 bytes). These screenshots stayed on the ephemeral Testbox and were not uploaded as public artifacts.
  • The trusted wrapper returned timing JSON {"exitCode":0,"runStatus":"succeeded"} and stopped its one-shot lease. Its backing Actions run may show canceled during externally managed lease cleanup; the remote command output and wrapper exit code are the authoritative delegated Testbox result.
  • Final independent Codex autoreview on the complete committed branch: gpt-5.6-sol, reasoning xhigh, 12143-byte bundle, TruffleHog clean, exit 0, no accepted or actionable findings.
  • Exact-head hosted CI now includes Control UI checks and all four Control UI E2E shards because the browser regression is checked in.

Closes #108174

@openclaw-barnacle openclaw-barnacle Bot added size: XS maintainer Maintainer-authored PR labels Aug 1, 2026
@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 1, 2026
@steipete
steipete force-pushed the codex/fix-sandbox-media-transcript-preview branch from 52afe80 to 14a4b51 Compare August 1, 2026 23:40
@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S and removed size: XS labels Aug 1, 2026
@clawsweeper clawsweeper Bot added the P2 Normal backlog priority with limited blast radius. label Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed August 1, 2026, 10:01 PM ET / August 2, 2026, 02:01 UTC.

ClawSweeper review

What this changes

The branch converts workspace-anchored relative media paths into stable persisted transcript paths, keeps history-pruning recognition for the old relative marker text, and extends the Control UI Chromium test for sandbox-staged inbound images.

Merge readiness

⛔ Blocked until real behavior proof from a real setup is added - 5 items remain

Keep this PR open for maintainer review. Current main still preserves a workspace-relative MediaPath in structured transcript media, while this branch anchors that path at the transcript boundary and preserves old prompt-marker pruning through explicit aliases; that is the right architectural boundary. The branch is not obsolete, but its browser evidence is a mocked Control UI flow rather than an integrated sandbox-to-transcript-to-Control UI run, and the maintainer label requires a human call on the persisted-session upgrade boundary.

Priority: P2
Reviewed head: d41a4a01e2b20e7f1586076d4b9fae906fb796ea
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation is focused and well-covered, but real end-to-end proof of the sandbox persistence path is still missing.
Proof confidence 🦐 gold shrimp (3/6) Needs real behavior proof before merge: The PR records successful Chromium execution and visible image decoding, but its Gateway and assistant-media responses are mocked; add a redacted integrated sandbox-to-transcript-to-Control UI run before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Patch quality 🦞 diamond lobster (5/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Needs proof Needs real behavior proof before merge: The PR records successful Chromium execution and visible image decoding, but its Gateway and assistant-media responses are mocked; add a redacted integrated sandbox-to-transcript-to-Control UI run before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed 6 items Current-main gap: Current main's structured transcript normalizer returns mediaPath unchanged even when workspaceDir is recorded, leaving sandbox-relative media unusable by a later Control UI session reader. The PR changes that owner boundary to call the existing resolver.
Canonical persistence repair: The branch preserves URLs and unanchored paths, while resolving only a relative path with a recorded workspace directory; this avoids adding a separate Control UI reconstruction rule.
Sibling invariant retained: History pruning compares legacy prompt marker text with the newly absolute persisted fact through workspace-derived aliases, so old relative marker text remains owned and removable after the persistence repair.
Findings None None.
Security None None.

How this fits together

Sandbox staging supplies media facts to the user-turn transcript recorder. Control UI later reads those persisted facts and requests media through its authenticated, ticketed preview route, so a path that is only meaningful inside the sandbox must be made stable before transcript persistence.

flowchart LR
  A[Inbound attachment] --> B[Sandbox media staging]
  B --> C[User-turn transcript]
  C --> D[Persisted media fact]
  D --> E[Control UI session history]
  E --> F[Authenticated media preview]
Loading

Decision needed

Question Recommendation
Should this persisted-session repair merge after an integrated sandbox-to-Control UI proof, or do maintainers explicitly accept the mocked Chromium route coverage as sufficient for this upgrade-sensitive path? Require integrated proof: Capture a redacted live/Testbox run that stages sandbox media, persists the turn, reloads session history, and shows the ticketed Control UI preview; this is the recommended path.

Why: The code changes the canonical persisted representation for newly recorded workspace-anchored media, while the available browser evidence simulates Gateway and assistant-media responses rather than exercising the complete sandbox persistence path.

Before merge

  • Add real behavior proof - Needs real behavior proof before merge: The PR records successful Chromium execution and visible image decoding, but its Gateway and assistant-media responses are mocked; add a redacted integrated sandbox-to-transcript-to-Control UI run before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Resolve merge risk (P1) - New workspace-anchored transcript facts will persist absolute paths for future turns; maintainers should confirm fresh and upgraded session-history behavior, including that legacy relative prompt markers remain prunable.
  • Resolve merge risk (P1) - The provided Chromium run exercises the renderer with mocked Gateway and media-route responses. It does not independently demonstrate one real sandbox-staged turn being persisted and then retrieved by Control UI.
  • Complete next step (P2) - The remaining merge blocker is maintainer proof sufficiency and upgrade-boundary acceptance, not a narrow mechanical code repair suitable for an automated worker.
Agent review details

Security

None.

PR surface

Source +26, Tests +36. Total +62 across 4 files.

View PR surface stats
Area Files Added Removed Net
Source 2 32 6 +26
Tests 2 103 67 +36
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 4 135 73 +62

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: src/agents/embedded-agent-runner/run/history-image-prune.ts, serialized state: src/sessions/user-turn-transcript.media-normalize.ts, serialized state: src/sessions/user-turn-transcript.media.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #108174
Summary: This PR is the concrete candidate repair for the linked sandbox-media Control UI preview defect; it should remain open until it is reviewed and merged.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Add integrated sandbox preview proof (recommended)
    Before merge, demonstrate a sandbox-staged attachment surviving transcript persistence and rendering after Control UI reload, with redacted terminal output or screenshots.
  2. Accept the persistence risk
    Merge with the checked-in unit and mocked Chromium coverage if maintainers explicitly accept that it is sufficient for the changed persisted-media representation.
  3. Pause pending product boundary confirmation
    Do not merge if maintainers want workspace-relative transcript paths retained until a different persistence migration is designed.

Technical review

Best possible solution:

Keep path canonicalization at transcript persistence, retain the pruning alias bridge, and land only after an integrated sandbox-to-persisted-transcript-to-Control-UI proof confirms both new and existing session behavior.

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

Yes, from source: on current main a structured media entry with path: "media/inbound/a.png" and workspaceDir: "/workspace" is persisted with the relative path unchanged, while Control UI receives the transcript later without that sandbox-relative base. The PR's focused tests and Chromium regression exercise the intended repaired representation, though no integrated live sandbox run was supplied.

Is this the best way to solve the issue?

Yes for the code shape: transcript persistence owns the authoritative workspace anchor, so resolving there is preferable to a Control UI-specific path reconstruction rule. The associated history-pruning alias handling is necessary to keep the existing relative marker contract intact.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against b2da7aa106dc.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • add status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR records successful Chromium execution and visible image decoding, but its Gateway and assistant-media responses are mocked; add a redacted integrated sandbox-to-transcript-to-Control UI run before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • remove proof: sufficient: Current real behavior proof status is mock_only, not sufficient.
  • remove rating: 🦞 diamond lobster: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status label is status: 📣 needs proof.

Label justifications:

  • P2: Broken media previews impair Control UI session inspection, but the agent can still analyze the attachment and no core runtime outage is shown.
  • merge-risk: 🚨 session-state: The branch changes the canonical persisted path for new workspace-anchored transcript media and must preserve replay/pruning behavior across session history.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🦞 diamond lobster.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs real behavior proof before merge: The PR records successful Chromium execution and visible image decoding, but its Gateway and assistant-media responses are mocked; add a redacted integrated sandbox-to-transcript-to-Control UI run before merge. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Evidence

What I checked:

  • Current-main gap: Current main's structured transcript normalizer returns mediaPath unchanged even when workspaceDir is recorded, leaving sandbox-relative media unusable by a later Control UI session reader. The PR changes that owner boundary to call the existing resolver. (src/sessions/user-turn-transcript.media-normalize.ts:68, b2da7aa106dc)
  • Canonical persistence repair: The branch preserves URLs and unanchored paths, while resolving only a relative path with a recorded workspace directory; this avoids adding a separate Control UI reconstruction rule. (src/sessions/user-turn-transcript.media-normalize.ts:37, d41a4a01e2b2)
  • Sibling invariant retained: History pruning compares legacy prompt marker text with the newly absolute persisted fact through workspace-derived aliases, so old relative marker text remains owned and removable after the persistence repair. (src/agents/embedded-agent-runner/run/history-image-prune.ts:104, d41a4a01e2b2)
  • Feature provenance: git blame attributes the existing transcript-path resolver to the current-main media work in commit 107e116bfd988a7ec99bb85c986111ed2af8eab2, tying this PR to the same persistence surface rather than a UI-side workaround. (src/sessions/user-turn-transcript.media-normalize.ts:37, 107e116bfd98)
  • Checked-in regression scope: The branch adds structured-media expectations for anchored and unanchored paths, plus a two-case Chromium Control UI regression that checks ticketed fetching and decoded image rendering. (ui/src/e2e/chat-flow.media-files.e2e.test.ts:402, d41a4a01e2b2)
  • Supplied execution evidence: The PR body records a successful exact-head Chromium run with both canonical and sandbox-staged media assertions; the supplied check context also shows Control UI E2E shards and the Real behavior proof check succeeding. The test uses mock Gateway/media responses, so it is strong regression coverage but not integrated live-path proof. (d41a4a01e2b2)

Likely related people:

  • steipete: Current-main blame attributes the existing transcript media-path resolver to Peter Steinberger, and this PR continues that same persistence and Control UI media path. (role: recent transcript-media contributor; confidence: high; commits: 107e116bfd98, d41a4a01e2b2; files: src/sessions/user-turn-transcript.media-normalize.ts, src/agents/embedded-agent-runner/run/history-image-prune.ts, ui/src/e2e/chat-flow.media-files.e2e.test.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Provide a redacted integrated run showing sandbox staging, persisted session history, and the Control UI preview after reload.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (6 earlier review cycles)
  • reviewed 2026-08-01T23:53:50.929Z sha d0ed7d0 :: needs real behavior proof before merge. :: [P3] Remove the release-owned changelog entry
  • reviewed 2026-08-02T00:11:31.995Z sha d5afd92 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-02T00:21:00.292Z sha d5afd92 :: needs real behavior proof before merge. :: none
  • reviewed 2026-08-02T01:09:39.630Z sha d5afd92 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T01:45:21.639Z sha d5afd92 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-02T01:55:55.830Z sha d41a4a0 :: needs maintainer review before merge. :: none

@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Exact-head proof is now in the PR body. The release-owned changelog entry is removed, and a fabricated-only Control UI browser proof passed on Testbox run 30724759179: absolute sandbox source, authenticated metadata request, ticketed image fetch, and rendered image width 128. The captured screenshot was manually inspected and contains no real/private data.

@clawsweeper

clawsweeper Bot commented Aug 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞🧹
ClawSweeper re-review requested.

I asked ClawSweeper to review this item again.
Action: item re-review queued (workflow sweep.yml, event repository_dispatch).
Result: when the review finishes, ClawSweeper will create the durable review comment if needed or update the existing comment in place.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Aug 2, 2026
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

Exact-head inspectable browser proof is now in the PR body and the fresh Real behavior proof check is green.

{"proof":"control-ui-sandbox-transcript-media","source":"/workspace/media/inbound/fabricated-sandbox.png","metadataAuthenticated":true,"ticketScoped":true,"rawRequestHasBearer":false,"renderedNaturalWidth":128}

The 1280x900 capture was manually inspected and contains only stock Control UI chrome plus the fabricated SANDBOX tile and caption; no real/private data.

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 2, 2026
@steipete steipete removed the status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. label Aug 2, 2026
@clawsweeper clawsweeper Bot added rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Aug 2, 2026
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M and removed size: S labels Aug 2, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦞 diamond lobster Very strong PR readiness with only minor maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 2, 2026
@steipete
steipete merged commit 1becbdc into main Aug 2, 2026
141 of 155 checks passed
@steipete
steipete deleted the codex/fix-sandbox-media-transcript-preview branch August 2, 2026 02:02
@steipete

steipete commented Aug 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 2, 2026
* fix(control-ui): restore sandbox media previews

* fix(media): preserve anchored history pruning

* style: format anchored history pruning

* chore: drop release-owned changelog entry

* test(ui): cover sandboxed inbound image previews
llwijvbw123 pushed a commit to llwijvbw123/openclaw that referenced this pull request Aug 28, 2026
…elf-release

* commit '10a390ed7fa88d09da0d4523c3ed1e3550ece5c6': (4646 commits)
  fix(release): allow larger npm plugin artifacts (openclaw#117745)
  refactor(macos): consolidate gateway process fixtures (openclaw#117740)
  fix(ui): preserve complete persisted log messages (openclaw#117666)
  fix(ui): decode artifact previews as UTF-8 (openclaw#117657)
  fix(control-ui): restore sandbox media previews (openclaw#117689)
  fix(plugins): link host declared as direct dependency (openclaw#117738)
  fix(macos): avoid self-named defaults suite (openclaw#117690)
  fix(inference): preserve run ownership and completion delivery (openclaw#117731)
  test(talk): align browser E2E tool completion
  test: consolidate OpenClaw E2E fixtures (openclaw#117701)
  fix(release): ignore bundle fields in npm locks (openclaw#117730)
  fix(meeting-bot): keep configured host options internal
  refactor(line): remove dead card helpers (openclaw#117729)
  perf(cli): attribute command startup stages (openclaw#117720)
  refactor(whatsapp): deduplicate reply delivery test fixtures (openclaw#117710)
  docs(changelog): note bounded WebRTC tool calls
  docs(changelog): note meeting audio bounds
  fix(meeting-bot): preserve node host SDK surface
  test(talk): split WebRTC tool lifecycle coverage
  fix(meeting-bot): break node host import cycle
  ...

# Conflicts:
#	package.json
#	src/agents/model-auth.ts
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 maintainer Maintainer-authored PR merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: M 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.

Sandboxed inbound images render as broken links in Control UI

1 participant