Skip to content

fix(media): show retained generated images after delivery is blocked - #184640

Open
sunlit-deng wants to merge 1 commit into
openclaw:mainfrom
sunlit-deng:sunlit/fix/issue-184585
Open

sunlit-deng wants to merge 1 commit into
openclaw:mainfrom
sunlit-deng:sunlit/fix/issue-184585

Conversation

@sunlit-deng

@sunlit-deng sunlit-deng commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes generated images from blocked completion deliveries appearing only as filenames after users reopen the original session.

Fixes #184585

Why This Change Was Made

Blocked completions prepare images independently, so an invalid image does not discard valid ones. If media ownership attachment fails after the transcript commit, a retry reconciles ownership without adding another completion message.

User Impact

Users can reopen the original session and download generated images after completion delivery fails.

Evidence

Validated on exact head 517b8fd84a202fce943b1f840851431ba092fcfe after rebasing onto ef5d3dcefec4c343a8429f5e9decf7356d9d65bc. The deterministic local PNG provider fixture used no external provider credentials; I reran the production-path proof on this final head.

  • Real production path: OPENCLAW_MEDIA_RETENTION_PROOF=1 node --import ./scripts/tsx.mjs test/proofs/media-retention-live-proof.mts exercised the image_generate tool, delivery wake and queue admission, blocked-completion persistence, WSS chat.history, and authenticated HTTPS artifact download. Changing the session-store path after generation makes production queue admission dead-letter delivery.
  • The recorded pre-feature run on base a3805cb6a2f413fbe17ac4470b20e1edf1c53483 had zero image blocks; rerunning the same command on exact head 517b8fd84a202fce943b1f840851431ba092fcfe produced one. The head download returned HTTP 200 with 68 matching PNG bytes. A reader without operator.read is denied; the e2e test also verifies the revoked ticket returns 404 before file I/O.
  • Rebase resolved the import conflict in src/agents/tools/media-generate-background-completion.ts, preserving main's queue/runtime imports with the PR's transcript and managed-media imports. The exact-head conflict receipt passed; focused tests passed 2 files and 30 tests.
  • Canonical precedent: Gateway transcript media uses createManagedOutgoingMediaBlocks and attachManagedOutgoingMediaToMessage.
$ OPENCLAW_MEDIA_RETENTION_PROOF=1 node --import ./scripts/tsx.mjs test/proofs/media-retention-live-proof.mts
entrypoint: image_generate -> production completion wake -> enqueueClaimedSessionDelivery -> blocked retention -> WSS chat.history -> artifacts.download -> HTTPS artifact route
base a3805cb6a2f413fbe17ac4470b20e1edf1c53483 => before-fix: blocked, image_blocks=0, missing-image assertion failed (exit 1)
head 517b8fd84a202fce943b1f840851431ba092fcfe => after-fix: blocked, image_blocks=1, HTTP 200, 68 PNG bytes
negative-control: missing operator.read rejected; revoked ticket 404; e2e confirms no file read

Tested head SHA: 517b8fd84a202fce943b1f840851431ba092fcfe.

AI-assisted: built with Codex

@clawsweeper

clawsweeper Bot commented Oct 26, 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 agents Agent runtime and tooling size: M labels Oct 26, 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. 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. labels Oct 26, 2026
@clawsweeper

clawsweeper Bot commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR adds displayable managed image blocks to generated-media completion messages retained after delivery is blocked.

Example: Generation produces generated.png, but completion delivery is blocked.

  • Before: Reopened history contains text and a filename without a displayable image.
  • After: Reopened history contains an image artifact that an authorized reader can download.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The focused patch is review-clean and has production-owner transport proof, although generation is driven by an in-process provider fixture rather than a user/model session.
Proof confidence 🦐 gold shrimp (3/6) Sufficient (terminal): The exact-head terminal evidence exercises the production image tool and completion owner against an injected queue-admission failure in an isolated running TLS Gateway, then uses real WSS and HTTPS clients to recover one image and download matching PNG bytes; scope denial and ticket revocation cover forbidden access, resolving the previous generation-to-retention proof gap.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Users cannot view or download a generated image from reopened history when its completion delivery is blocked.
Reason: The patch restores the existing image-history contract without adding configuration, public APIs, or a competing recovery system.

Merge readiness

✅ Ready for maintainer review

This PR fixes a current-main image-retention bug, and no introduced correctness or security blockers were found.

Priority: P2
Reviewed head: fb44a1613e4170b7c5691f3d1b5d1ad30028e7e6

Before merge

None.

Findings

None.

Agent review details

How this fits together

The background media completion owner receives generated attachments and delivery outcomes, persists retained results through the session transcript owner, and exposes images through existing Gateway history and managed-media download APIs.

flowchart LR
  A[Image generation] --> B[Completion delivery]
  B --> C[Blocked completion retention]
  C --> D[Managed media owner]
  C --> E[Session transcript]
  E --> F[Gateway history]
  F --> G[Authorized image download]
  D --> G
Loading

Technical review

Best possible solution:

Retain image display blocks through the existing completion, transcript, and managed-media owners while preserving original-session binding and idempotency.

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

Current-main source confirms that blocked retention records media references without image display blocks; the contributor also supplies a failing baseline trace, which was inspected but not rerun during this read-only review.

Is this the best way to solve the issue?

The repair addresses the producer-side omission using established managed-media APIs, preserves valid images when another preparation fails, and reconciles ownership without duplicating the retained message.

AGENTS.md: found and applied where relevant.

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

Provenance checked

  • Blocked generated-media retention keeps the original intent (6652f7e: Tasks removal transferred retained completion responsibility to the existing session owner; subsequent transcript work retained commit-time authority checks.)
  • Authenticated artifact HTTPS coverage keeps the original intent (97dd4d2: Serve artifact bytes over HTTPS with fresh connection, session, and artifact authority while preserving existing RPC delivery.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +102, Tests +488. Total +590 across 5 files. Added test files: 2.

View PR surface stats
Area Files Added Removed Net
Source 1 119 17 +102
Tests 4 489 1 +488
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 608 18 +590

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • 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: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: Generated images become unavailable in reopened history after blocked completion delivery, with impact limited to that recovery path.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 (3 earlier review cycles)
  • reviewed 2026-10-26T13:11:04.369Z sha e3e0bd03a3500a86d65a4e4dbd318bf4eb618386 :: needs real behavior proof before merge. :: [P2] Keep successfully prepared images when another image fails | [P2] Reconcile image ownership before skipping an existing message
  • reviewed 2026-10-26T14:29:23.856Z sha 956e411aa2d7ab523cc7d5340c5d74bc2cfc29d4 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-26T14:37:36.816Z sha 956e411aa2d7ab523cc7d5340c5d74bc2cfc29d4 :: needs real behavior proof before merge. :: none

Reviewed October 26, 2026, 9:18 PM ET / October 27, 2026, 01:18 UTC (Revision 4).

@sunlit-deng sunlit-deng changed the title fix: show retained generated images after delivery is blocked fix(media): show retained generated images after delivery is blocked Oct 26, 2026
@sunlit-deng

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 26, 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-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. and removed merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. 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 26, 2026
@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime and removed size: M labels Oct 27, 2026
@sunlit-deng

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 27, 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-environment Preliminary submission classification; full source review pending. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed 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. clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. labels Oct 27, 2026
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-184585 branch from fb44a16 to 16d6f1d Compare November 3, 2026 11:45
@sunlit-deng
sunlit-deng force-pushed the sunlit/fix/issue-184585 branch from 16d6f1d to 517b8fd Compare November 21, 2026 03:50

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Retained generated media shows only a file name, not the image

1 participant