Repository navigation
fix(ui): release losing fallback payloads on composer adoption - #124391
Conversation
Global-scope composer fallback adoption coalesces sibling candidates (bare-global, default-main, qualified-main) into one winner and deletes the losers from chatComposerFallbackByScope — but never released their attachment payload-store entries, unlike every clearChatComposerMemory- Fallback caller. The dropped data URLs and object URLs leaked for the pane's lifetime. Release dropped candidates' payloads at the adoption site, retaining ids still referenced by the live composer or any surviving fallback (the same retention rule the pane-handoff owner uses).
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 15, 2026, 11:46 PM ET / August 16, 2026, 03:46 UTC. ClawSweeper reviewWhat this changesThe PR releases payload-store entries for composer-fallback drafts discarded during global-scope adoption while retaining attachments still referenced by the active composer or surviving fallback drafts. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep open. Current main deletes coalesced fallback drafts without releasing their attachment payloads; this branch repairs that owner boundary with the same retained-ID rule already used for pane handoff. The Priority: P2 Review scores
Verification
How this fits togetherControl UI chat panes retain unsent drafts and attachment payloads while users switch sessions or global agent targets. Fallback adoption coalesces equivalent drafts, and the payload store owns revoking data and object URLs once no live draft references them. flowchart LR
A[Pane or agent target change] --> B[Composer fallback drafts]
B --> C[Fallback adoption]
C --> D[Retained composer state]
C --> E[Discarded fallback drafts]
D --> F[Attachment payload store]
E --> F
F --> G[Released data and object URLs]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +22, Tests +105. Total +127 across 4 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land one shared retained-ID release rule in the payload-store owner after exact-head CI completes, so fallback adoption and pane handoff cannot drift into different attachment-lifetime policies. Do we have a high-confidence way to reproduce the issue? Yes—current main's adoption path deletes fallback records at Is this the best way to solve the issue? Yes. Adoption is the deletion owner, and reusing the pane-handoff retained-ID invariant in the payload store is safer than maintaining two hand-built retention sets. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 148229b6dd21. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Merged via squash.
|
…law#124391) Global-scope composer fallback adoption coalesces sibling candidates (bare-global, default-main, qualified-main) into one winner and deletes the losers from chatComposerFallbackByScope — but never released their attachment payload-store entries, unlike every clearChatComposerMemory- Fallback caller. The dropped data URLs and object URLs leaked for the pane's lifetime. Release dropped candidates' payloads at the adoption site, retaining ids still referenced by the live composer or any surviving fallback (the same retention rule the pane-handoff owner uses).
What Problem This Solves
Global-scope composer fallback adoption (
resolveChatComposerMemoryFallback) coalesces sibling candidates — bare-global, default-main alias, qualified-main — into one winner and deletes the losers fromchatComposerFallbackByScope. Unlike everyclearChatComposerMemoryFallbackcaller, it never released the losers' attachment payload-store entries, so their data URLs and object URLs (up to 5 MiB each) leaked for the pane's lifetime.Why This Change Was Made
The payload store is ref-by-id with explicit release; every other drop point (clear, pane handoff, queue drain, editor replace) releases what it drops. Adoption was the one owner that didn't. The fix releases dropped candidates' payloads at the adoption site with the same retention rule the pane-handoff owner already uses (ids still referenced by the live composer or any surviving fallback stay retained) — and that shared rule is now one helper,
releaseDisplacedChatAttachmentPayloads, used by both owners instead of two hand-rolled retained-id set builders.User Impact
Long-lived Control UI panes that flip between global agent targets with attachment drafts no longer accumulate leaked attachment payloads and un-revoked object URLs.
Evidence
releases losing sibling fallback payloads when adoption drops themfails pre-fix (stash proof) and passes post-fix; companion test proves ids shared with the live composer survive a sibling drop.node scripts/run-vitest.mjs run ui/src/pages/chat/chat-composer-memory-fallback.test.ts ui/src/pages/chat/chat-pane-attachment-handoff.test.ts ui/src/pages/chat/chat-send.test.ts ui/src/pages/chat/chat-pane-retained-presentation.test.ts— all green.tsgo:uiclean; oxfmt/oxlint clean.