Skip to content

fix: show retained computer screenshots in chat - #153249

Merged
steipete merged 7 commits into
mainfrom
codex/restore-chat-screenshot-previews
Sep 20, 2026
Merged

steipete merged 7 commits into
mainfrom
codex/restore-chat-screenshot-previews

Conversation

@steipete

@steipete steipete commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Computer screenshots appeared as “Omitted from history” even when their pixels were still saved, and active chats ignored the persisted tool result needed to restore the preview.

User Impact

Retained screenshots display inline during a run and after reloading the conversation, with the existing image viewer, copy, download, and retry controls. Images with only omission metadata retain the honest placeholder. No migration or configuration change is required.

Why This Change Was Made

History now carries a reference to the exact persisted image instead of its base64 payload. The existing artifact API retrieves that image and rechecks current session access immediately before responding. Preview caches follow the session and connection, and durable tool-result images replace temporary omission cards in either event order. Computer observations remain separate from outgoing attachment delivery.

Evidence

  • The browser regression failed on the original code because no image rendered; the inspected synthetic before/after captures below show the result.
  • All five screenshot browser cases pass, covering history reload, the image viewer, both live-event orders, unrecoverable omission metadata, and existing URL-backed images.
  • Focused Gateway and UI regressions cover exact stored bytes, larger image payloads, session replacement, sharing revocation, cache isolation, and existing artifact/media behavior.
  • The imported-history regression failed before correction and all six final recovery cases pass; repeated message IDs resolve distinct pixels without scanning the full transcript, and replacing runtime disclosure policy during the read blocks the payload.
  • Image lifecycle/gallery coverage passes 36 cases, including byte-backed artifacts that also have a managed URL. Auth-invalidation coverage passes 22 cases. The rebase preserves immediate preview opening, decoded full-resolution promotion, and current thumbnail renditions.
  • The real-Gateway regression covers exact artifact download bytes, decoded preview, lightbox, reload, metadata-only omissions, and URL-backed pixels using isolated state and a mock provider. Hosted CI passed this real-Gateway flow on the screenshot implementation; the final pushed head is checked again before landing.
  • CI also exposed a QA fixture race: the child result arrived before the independently queued parent acknowledgement. The existing readiness wait now includes the live parent acknowledgement, with its 60-second timeout and exact-once assertion unchanged. The regression fails on the original fixture; all 34 relevant tests pass.
  • Independent review is clean through P2. Scoped checks, core/UI type checks, and targeted lint passed; required CI is checked on the pushed head before landing.

Before: retained screenshot appears omitted

After: saved screenshot renders in chat

After: screenshot remains visible during an active run

@clawsweeper

clawsweeper Bot commented Sep 19, 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: XL maintainer Maintainer-authored PR labels Sep 19, 2026
@steipete
steipete marked this pull request as ready for review September 19, 2026 23:30
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. 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. labels Sep 19, 2026
@clawsweeper

clawsweeper Bot commented Sep 19, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge. Reviewed September 20, 2026, 1:36 AM ET / 05:36 UTC (Revision 9).

ClawSweeper review

What this changes

The PR restores retained screenshot previews through authenticated transcript artifact downloads, updates image cache and live-event handling, and repairs a QA acknowledgement race.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep open. The work remains useful, but the previously reported duplicate-image defect is still present in the reviewed head.

Priority: P2
Reviewed head: 0e73b3c8dfcae1e58e78a319c8cb15234d676fc8

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Useful implementation and convincing visible proof are limited by one unresolved attachment-identity defect.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): Inspected before/after browser captures demonstrate restored history and active-run previews. The unchanged screenshot implementation also has a successful real-Gateway E2E check covering artifact bytes, decoded preview, lightbox, and reload; its raw logs were inaccessible to this reviewer. Screenshots are not used as authorization proof.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): Inspected before/after browser captures demonstrate restored history and active-run previews. The unchanged screenshot implementation also has a successful real-Gateway E2E check covering artifact bytes, decoded preview, lightbox, and reload; its raw logs were inaccessible to this reviewer. Screenshots are not used as authorization proof.
Evidence reviewed 8 items Introduced change and review continuity: The pinned merge-base comparison establishes the introduced changes. Comparing the previous reviewed head with this head shows only the QA scenario and its new test changed; the image projection finding remains unchanged.
Duplicate attachment mechanism: The artifact-only branch omits the computed factIndex. The subsequent persisted-media loop constructs the matching image with factIndex and appends it because the recovered image has no matching slot identity. Image normalization marks these blocks as inline slots, so valid mediaImageLayout metadata reaches this path.
Current-main necessity: The inspected main revision still only appends image content when a URL is available and lacks the new transcript-image recovery module. The same module is absent from the latest release tag, v2026.9.5; no merged replacement establishing this requested behavior was identified.
Findings 1 actionable finding [P2] Preserve the attachment slot index for recovered images
Security None None.

How this fits together

The Gateway projects saved conversation messages into chat history and live events without embedding screenshot pixels. The Control UI retrieves those pixels through the artifact API and displays them as previews and lightbox images.

flowchart TD
  A[Saved conversation images] --> B[Gateway display projection]
  B --> C[Image references in chat]
  C --> D[Artifact download request]
  D --> E[Current session access check]
  E --> F[Saved image bytes]
  F --> G[Chat preview and image viewer]
Loading

Before merge

  • Preserve the attachment slot index for recovered images (P2) - The prior finding remains unfixed. When an artifact-only image has matching __openclaw.media and a valid inline mediaImageLayout, this branch drops the factIndex computed above. The later media-fact loop therefore appends the canonical image again, producing two tiles for one attachment. Carry factIndex as the URL-backed branch does and cover recovery with matching media metadata.
  • Complete next step (P2) - Carry factIndex into the artifact-only image branch and add a regression showing one preview when recovered content matches persisted media metadata.

Findings

  • [P2] Preserve the attachment slot index for recovered images — ui/src/pages/chat/components/chat-message-media.ts:567-568
Agent review details

Security

None.

PR surface

Source +349, Tests +746, Docs +6, Other +10. Total +1111 across 20 files.

View PR surface stats
Area Files Added Removed Net
Source 12 521 172 +349
Tests 6 787 41 +746
Docs 1 6 0 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 1 11 1 +10
Total 20 1325 214 +1111

Review metrics

Metric Value Why it matters
Production versus validation growth Production net +349 lines; tests and QA scenarios net +756 lines Production growth supports bounded transcript recovery and scoped image loading; the larger validation delta covers rendering, identity, authorization, and event ordering.

Technical review

Best possible solution:

Preserve the canonical attachment slot when recovering an image so its saved pixels and matching media metadata produce one preview.

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

Yes, from source: an artifact-only image with matching persisted media and a valid inline layout produces two image entries because the recovered entry loses factIndex. This review did not execute repository code.

Is this the best way to solve the issue?

The approach is appropriate: it reuses artifact access and existing transcript storage without migration or new configuration. The artifact-only projection must preserve the same attachment identity as the URL-backed branch.

Full review comments:

  • [P2] Preserve the attachment slot index for recovered images — ui/src/pages/chat/components/chat-message-media.ts:567-568
    The prior finding remains unfixed. When an artifact-only image has matching __openclaw.media and a valid inline mediaImageLayout, this branch drops the factIndex computed above. The later media-fact loop therefore appends the canonical image again, producing two tiles for one attachment. Carry factIndex as the URL-backed branch does and cover recovery with matching media metadata.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.97

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 9343ea4099ba.

Labels

Label justifications:

  • P2: This repairs a bounded chat-image display failure, with one remaining duplicate-preview defect.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🐚 platinum hermit and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (screenshot): Inspected before/after browser captures demonstrate restored history and active-run previews. The unchanged screenshot implementation also has a successful real-Gateway E2E check covering artifact bytes, decoded preview, lightbox, and reload; its raw logs were inaccessible to this reviewer. Screenshots are not used as authorization proof.
  • proof: sufficient: Contributor real behavior proof is sufficient. Inspected before/after browser captures demonstrate restored history and active-run previews. The unchanged screenshot implementation also has a successful real-Gateway E2E check covering artifact bytes, decoded preview, lightbox, and reload; its raw logs were inaccessible to this reviewer. Screenshots are not used as authorization proof.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. Inspected before/after browser captures demonstrate restored history and active-run previews. The unchanged screenshot implementation also has a successful real-Gateway E2E check covering artifact bytes, decoded preview, lightbox, and reload; its raw logs were inaccessible to this reviewer. Screenshots are not used as authorization proof.

Evidence

What I checked:

  • Introduced change and review continuity: The pinned merge-base comparison establishes the introduced changes. Comparing the previous reviewed head with this head shows only the QA scenario and its new test changed; the image projection finding remains unchanged. (ui/src/pages/chat/components/chat-message-media.ts:568, 0e73b3c8dfca)
  • Duplicate attachment mechanism: The artifact-only branch omits the computed factIndex. The subsequent persisted-media loop constructs the matching image with factIndex and appends it because the recovered image has no matching slot identity. Image normalization marks these blocks as inline slots, so valid mediaImageLayout metadata reaches this path. (ui/src/pages/chat/components/chat-message-media.ts:567, 0e73b3c8dfca)
  • Current-main necessity: The inspected main revision still only appends image content when a URL is available and lacks the new transcript-image recovery module. The same module is absent from the latest release tag, v2026.9.5; no merged replacement establishing this requested behavior was identified. (ui/src/pages/chat/components/chat-message-media.ts, 9343ea4099ba)
  • Release comparison: The latest release tree contains no src/gateway/transcript-image-artifacts.ts entry. This is supporting release comparison, not a claim that any fix has shipped. (ec9c1a13db89)
  • Authorization and identity checks: Recovery uses the existing session authorization owner, reads one referenced transcript message, verifies its physical identity, and returns a synchronous guard that rechecks current sharing policy and session incarnation immediately before the RPC publishes bytes. Regression cases exercise cross-session references, replacement sessions, and revocation during awaited reads and lookup completion. (src/gateway/server-methods/artifacts-transcript-images.ts:74, 0e73b3c8dfca)
  • Inspected visual proof: All three prepared PNGs were inspected: the before image shows the omission card; the after images show the synthetic screenshot in history and during an active run. These demonstrate visible rendering, not authorization correctness. The captured body sourceRevision is d1af93f942e0e4a3f0e495292293ee3d0e98cde0407d742188d05f70cdb62918.

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • vyctorbrzezowski: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

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

  • Preserve factIndex for artifact-only images and verify matching content and media metadata render exactly one attachment.

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 (8 earlier review cycles)
  • reviewed 2026-09-19T23:42:01.749Z sha 05eee29 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-19T23:57:49.410Z sha 0756bc5 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-20T01:14:41.517Z sha ada11543e2184089869240a93ea418ce1903d197 :: needs maintainer review before merge. :: none
  • reviewed 2026-09-20T02:05:42.464Z sha 822670f :: needs changes before merge. :: [P2] Preserve the attachment slot index for recovered images
  • reviewed 2026-09-20T03:49:50.536Z sha 96bd019 :: blocked before merge. :: [P2] Preserve the attachment slot index for recovered images
  • reviewed 2026-09-20T04:23:27.144Z sha 7dd31bbf3c764d55e12eab746d3a1d599f55248a :: blocked before merge. :: [P2] Preserve the attachment slot index for recovered images
  • reviewed 2026-09-20T04:37:38.866Z sha 7dd31bbf3c764d55e12eab746d3a1d599f55248a :: blocked before merge. :: [P2] Preserve the attachment slot index for recovered images
  • reviewed 2026-09-20T05:07:21.750Z sha 8474607 :: blocked before merge. :: [P2] Preserve the attachment slot index for recovered images

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 19, 2026
@steipete
steipete force-pushed the codex/restore-chat-screenshot-previews branch from 0756bc5 to ada1154 Compare September 20, 2026 01:07
@openclaw-barnacle openclaw-barnacle Bot added the extensions: memory-core Extension: memory-core label Sep 20, 2026
@steipete
steipete force-pushed the codex/restore-chat-screenshot-previews branch from ada1154 to 822670f Compare September 20, 2026 01:56
@openclaw-barnacle openclaw-barnacle Bot added extensions: qa-lab and removed extensions: memory-core Extension: memory-core labels Sep 20, 2026
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed 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. labels Sep 20, 2026
@steipete
steipete force-pushed the codex/restore-chat-screenshot-previews branch from 96bd019 to 7dd31bb Compare September 20, 2026 04:16
@steipete
steipete force-pushed the codex/restore-chat-screenshot-previews branch from 7dd31bb to 8474607 Compare September 20, 2026 04:59
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Sep 20, 2026
@steipete
steipete merged commit 6f3aa8d into main Sep 20, 2026
224 checks passed
@steipete
steipete deleted the codex/restore-chat-screenshot-previews branch September 20, 2026 06:10
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 21, 2026
* fix: show retained computer screenshots in chat

* test: verify image auth rebinding through observable behavior

* fix(ui): defer context menu focus until input completes

* test(ui): wait for model slider and use upstream menu repair

* test(ui): verify retained screenshots through the real Gateway

* test(ui): open retained screenshot proof with keyboard

* test(qa): wait for parent acknowledgement before terminal assertions
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui docs Improvements or additions to documentation extensions: qa-lab gateway Gateway runtime maintainer Maintainer-authored PR P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant