Skip to content

feat(media): recover image reception and publish ordered ACP results - #6230

Draft
Sun-GLiang wants to merge 18 commits into
apache:mainfrom
Sun-GLiang:refactor/session-media-preview
Draft

Sun-GLiang wants to merge 18 commits into
apache:mainfrom
Sun-GLiang:refactor/session-media-preview

Conversation

@Sun-GLiang

@Sun-GLiang Sun-GLiang commented Oct 22, 2026 •

Copy link
Copy Markdown
Member

Summary

Images can outlive their temporary sources, but the existing receive queue is in memory and message completion does not guarantee image persistence. Structured ACP image results also need durable publication and ordered mixed content. Make Host-owned image reception recoverable and distinguish reception, saved originals, preview limits and actual failures.

  • Publish ACP image/resource output through the shared Host image-delivery service. Persist Artifact references rather than base64 in canonical events; preserve ordered text/image/diff blocks and accepted output during cancellation or transport loss.
  • Persist reception jobs and bounded received bytes in storage. Retry transient failures at most three times, retire permanent failures, retain useful quota-failed bytes within the spool budget, and clean up with session deletion.
  • On startup, archive already-received bytes before sealing interrupted runs. Recover missing ACP publication references with exact run ownership and idempotent, explicitly marked hidden-to-model recovery messages; rediscover committed Markdown whose reception registration was interrupted. Sealed runs remain sealed.
  • Start reception independently of viewport rendering. Admit originals up to 8 MiB while keeping previews at 2 MiB; saved larger originals expose an open-original action instead of appearing unsaved. Message reception status handles repeated references correctly.
  • Advance Artifact SQLite schema 4→5 and Host compatibility epoch 229→230. Existing storage owns the migration. Document budgets, recovery and failure boundaries in docs/architecture/session-media-preview.zh-CN.md.

SVG parsing, SVG/XML code previews and preview caches remain in independent #6292. This PR uses raster rendering.

Verification

Tested head: 7a3265cd7669a333cc93baf7077fd9613bac9c57; build/test baseline: 222a06fe316f12df3129eff1c16ab3bfaf85c479.

  • Independent branch: 214 focused tests and 24 Chromium image tests passed; full workspace typecheck, lint, changed-file format and ASF headers passed; desktop rebuilt.
  • Combined with feat(ui): add bounded static SVG image and code previews #6292: full workspace build, typecheck, lint, headers, format, renderer architecture (168 checks) and surface inventory passed. All 417 tests in changed test files and 35 Chromium image/SVG tests passed. The 276-test focused subset also passed; these counts overlap.
  • Coverage includes process death after receiving bytes, missing sources, publication crash gaps, retry persistence, spool pressure, session-deletion races, exact 8 MiB base64 admission, saved oversized originals and duplicate mounted references.
  • Real Antigravity ACP 1.1.1 with the existing Google login and Gemini 3.8 Flash High generated a native 437,559-byte JPEG plus a body PNG. The live run confirmed byte-exact archives and reference-only tool publication. Final independent and combined binaries replayed those same real outputs, then hid the native source, removed the task-owned body source, fully restarted Electron, and verified rendering and original SHA-256 values. Eight assertions passed for each replay. No new generation was requested during final replay.
  • The live native result contained one image part. Mixed text/image/diff/text, cancellation, transport loss and crash injection remain deterministic coverage. Generic conversation-copy reference rewriting is tested; provider-owned ACP conversation cloning remains unsupported. Packaged Windows/Linux checks were not run.

Governance acceptance report · Assertion records, merge simulations and checksums. Earlier before/after and performance evidence remains in the acceptance release.

Actual Antigravity native image displayed from its archive

Persistence boundaries

A source that disappears before bytes are received cannot be recovered. Invalid content, denied access, full disk and archive quota failures remain explicit failures. The 512-job / 32 MiB receive spool is bounded and may reclaim old quota-failed payloads while retaining their failure metadata. Recovery does not reopen sealed runs or publish late cancelled-run output. A canonical record beyond the recovery scan bound is skipped with a warning. These limits are covered in the architecture document rather than hidden by success wording.

Merge independence

Both PRs target main and can land in either order. They share a behavior-preserving image presentation/admission foundation; neither requires the other feature. Normal Git merges produce identical trees in both orders. This repository permits squash merges only: after either lands, sync the other with main and reconcile packages/core/src/image-delivery.ts, packages/ui/src/attachment-image.tsx, and packages/ui/src/session-media-image.tsx. Both squash orders were simulated against main a4b5f86c5256044d063a62045754e4a3411a8426; the reconciled trees are identical and retain the tested combined implementation. There is no prescribed merge order.

AI use

  • No generative tool made a substantive contribution
  • Generative tooling made a substantive contribution

Tool(s) and scope: Codex implemented the split and reception governance, added regression tests, performed real-account Electron acceptance, and updated documentation. Retain Generated-by: Codex in the squash commit.

Checklist

  • Tests cover the change and fail without it
  • Lint, format, typecheck and the affected suites pass locally

Does this PR entail a change in behavior?

  • Yes — described under Summary above
  • No

…output

Route external media through the Host artifact pipeline and reuse bounded image/SVG previews across chat, tools and artifacts. Bump the compatibility epoch for mixed-content tool results.

Generated-by: Codex
@github-actions github-actions Bot added the effort/XL Under 2500 readable lines label Oct 22, 2026
Merge the upstream dependency security fixes and register the SVG runtime dependency and extracted UI surfaces in the generated inventories.

Generated-by: Codex
The filesystem worker now imports the shared SVG validator. Include that source in the Windows release filter so its trigger matches the actual dependency closure.

Generated-by: Codex
Keep avatar size and pixel limits shared with previews while admitting SVG only for chat. Validate both the Host capture boundary and avatar persistence so custom loaders cannot bypass the raster policy.

Generated-by: Codex
Refresh the two transitive dependency versions blocking the shipped-closure and CLI production audits, and regenerate their third-party notices.

Generated-by: Codex
Record the audited ip-address 10.7.4 production dependency. Merge current main, retain streaming syntax highlighting with SVG previews, and advance the media protocol epoch to 229 after the executor catalog change.

Generated-by: Codex
Resolve UI inventory totals and assign mixed media results epoch 230 after main introduced session check-in at epoch 229.

Generated-by: Codex
Budget parsed diagram nodes across quotes and lists. Recognize SVG-root XML fences, retain manual preview bounds across content changes, and drain accepted ACP updates after transport failure while rejecting late notifications.

Cover the Antigravity SVG reply, nested preview budgets, and message/tool media failures with regressions.

Generated-by: Codex
Keep transport failure observable until ACP media queues finish, account for audio payloads in media budgets, and parse static SVG CSS in linear time. Add regression matrices and malformed CSS CPU bounds.

Generated-by: Codex
Validate all SVG input nodes before mutation, retain legacy tool text and diff output, and report truncated mixed results. Drop unsupported thought media before queuing. Add regressions for complexity, snapshot boundaries, media retention and browser recovery.

Generated-by: Codex
Keep structured ACP publication, ordered mixed tool results and existing raster preview support. Move SVG validation, saved-image and code-fence previews, caches and their tests to the dedicated SVG branch. Document the existing provider-owned conversation copy restriction.

Generated-by: Codex
@Sun-GLiang Sun-GLiang changed the title refactor(media): share session image rendering across native and ACP output feat(acp): publish archived images and ordered tool results Oct 25, 2026
Preserve mixed tool evidence in Goal evaluation, capture mutable sources independently, and discard unused media payloads before queueing. Cover overwritten and concurrent sources, archival replay, metadata retention, and evidence redaction.

Generated-by: Codex
Persist bounded receive jobs and staged bytes, recover unpublished images before sealing interrupted runs, separate archival from preview limits, and report attachment reception independently of text completion.

Generated-by: Codex
Keep the existing limits and UI behavior while extracting the shared image component, retaining structured loader outcomes, and separating avatar and chat admission policies for independent media changes.

Generated-by: Codex
@Sun-GLiang Sun-GLiang changed the title feat(acp): publish archived images and ordered tool results feat(media): recover image reception and publish ordered ACP results Oct 25, 2026
@github-actions github-actions Bot added effort/XXL Over 2500 readable lines and removed effort/XL Under 2500 readable lines labels Oct 26, 2026

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

effort/XXL Over 2500 readable lines

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant