Repository navigation
feat(ui): archive and delete sessions while the Gateway reconnects - #182292
Conversation
Queue archive, unarchive, and delete through the existing Gateway deferred-intent owner during same-identity recovery. Coalesce lifecycle choices in place and discard superseded metadata and reactions before hiding a deleted row. Reuse session-owned optimistic rows, confirmation dialogs, durable identity guards, and chat transitions. Roll back rejected or discarded work, confirm already-missing deletes, and retire old in-flight receipts when their connection owner changes. Keep placement, pinning, sharing, and other consequential operations connection-gated. Load preserved-worktree notices only when needed, document the memory-only queue, and regenerate the boot manifest.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: a172a389af
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Codex review: needs real behavior proof before merge. What this changesThis PR queues session archive, unarchive, and delete actions while the Gateway reconnects. Example: Archive agent:main:notes while reconnecting.
Review scores
ProductKind: Feature · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Blocked before merge - 4 items remain Keep open: the final CI repair is coherent, but the previously reported shared-pin Undo defect remains unresolved. Priority: P2 Before merge
Findings
Provenance
Tests
Agent review detailsHow this fits togetherControl UI actions enter the existing deferred-intent owner, replay through Gateway session handlers, and reconcile optimistic session rows with server results. flowchart TD
A[Session menus and Sessions page] --> B[Session access checks]
B --> C[Deferred intent owner]
C --> D[Session mutation owner]
D --> E[Gateway authorization and lifecycle]
E --> F[Session and transcript storage]
D --> G[Optimistic rows and Undo]
Technical reviewBest possible solution: Keep the existing queue and mutation owners, restoring captured shared pins after deferred Undo succeeds under current authority. Do we have a high-confidence way to reproduce the issue? Current-main source confirms connection-gated lifecycle actions, and the introduced deferred Undo branch omits shared-pin restoration; no target code was executed. Is this the best way to solve the issue? Extending the existing deferred owner is appropriate, and lazy runtime extraction addresses the measured boot constraint, but Undo must preserve its existing restoration contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against ab42578ad8b6. Provenance checked
TestingProof path: shipped entry point. SecurityNeeds attention: Source retains server-owned authorization checks; no concrete bypass was found, but destructive replay authority remains unproven. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +824, Tests +1455, Docs +15. Total +2294 across 66 files. Added test files: 4. View PR surface stats
LabelsLabel changes: No label changes. Label justifications:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReview history (2 earlier review cycles)
Reviewed October 24, 2026, 7:06 AM ET / 11:06 UTC (Revision 3). |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 22bfe424ff
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: fe4424d528
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Live integration proofCurrent main (5e0b786) merged locally with #182334 (send reconciliation), #182292 (offline archive/delete) and #182336 (deferred-chunk precache), plus #182336's sidecar-race fix. One full build on Node 26.12.1, served by an isolated Gateway behind a TCP fault proxy, and driven by real headless Chromium with fresh browser contexts and nothing pre-warmed.
No "Delivery unconfirmed" state appeared in any scenario. |
Move offline previews, replay, archive projections, and mutation receipt work into the session interaction runtime. Keep native queue admission and durable delete identity capture synchronous, and prepare optional code before RPC dispatch so a failed download cannot misreport a committed mutation. Isolate the runtime and its receipt/copy dependencies from captured route chunks. Budgets and baselines are unchanged. Validation: paired main comparison passes; matched local startup gzip drops from 281214 to 280929 bytes, leaving 880 bytes under the 281809-byte enforced limit. Main comparator is 280590 bytes. All 331 focused behavioral tests and six chunking tests pass, including a red-to-green indirect boot-dependency regression. UI typecheck, scoped oxfmt check, git diff check, and independent review pass.
Move session creation requests and receipt handling into the optional mutation runtime. Keep connection capture, error publication, model overrides, prepared work-session placement, and reconciliation with their existing owners. Recheck the captured connection and abort signal before dispatch after a cold import. Keep the creation helper in the mutation chunk so captured boot groups cannot pull it back into startup. Extend cold-disconnect and chunk-isolation coverage, and wait for real request dispatch in the background creation tests. Paired local performance: startup gzip 280421 B versus main 280590 B and the unchanged 281809 B enforcement limit. The original branch measured 281214 B with the same local toolchain. Focused tests: 70 plus 30 passed. UI typecheck, scoped oxfmt check, and git diff --check passed.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: dff6d12813
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
@clawsweeper re-review The Undo replay and offline Sessions-page repairs are pushed, the review thread is resolved, and main conflicts are repaired in cadb930. The PR body now records the final frozen-dependency browser proof and distinguishes pending exact-head CI/performance from prior-head evidence. |
|
🦞👀 Re-review progress:
|
|
Final repair acceptance: preserve the existing startup and route-boot byte/request budgets, measured by The repair removes the eager header import and stops grouping shared session copy with the mutation runtime. Mutation execution retains its existing lazy action owner. A production-browser regression withholding that runtime fails initial roster readiness before the repair. The other CI failures share a missing sidebar host method: spreading a class instance lost the prototype method and suppressed archive success/Undo after the write. Explicit delegation fixes the exact unit regression without changing its assertions; all 102 affected owner/sidebar tests pass. Final paired-build and affected browser proof are in progress; no CI rerun, timeout, assertion, or budget change is used. |
|
@clawsweeper re-review Final CI repair is pushed as 8d4349d. The body records archive host delegation, lazy mutation loading, red/green regressions, 45 passing affected browser scenarios, and the passing paired build measurement with unchanged budgets. Current-head hosted CI remains pending. |
|
🦞👀 Re-review progress:
|
|
Landing stopped at the authorized repair-round limit. Current head: 8d4349d. Exact-head run 40088243668 passes control-ui-performance, but all three UI shards fail nine tests. All three failed job logs were fetched once; these are treated as branch-caused, not inherited or diagnosed flakes, and no CI rerun or further repair push is being used. Remaining failures:
Source inspection points to cold mutation initialization: patchNow waits for projectSessionPatchRowFields before dispatch/optimistic setup, and deferred admission publishes its queue entry before asynchronous runtime preparation installs the preview. The final removal of eager header loading exposes these timing assumptions. This has not been repaired or relabeled as main-owned. Completed proof remains valid for its scope: 214 focused owner/creation/header tests, 45 affected production-browser scenarios, source/affected test types, lint/format, fresh Codex review through P2, and the paired local size check. The prior auto-merge request was retired through native recovery; preserve outcome 1cf34d186b309e8ee942f0b61484c101b4ec5262 and the retained review checkout for continuation. Final remote verification: PR OPEN at the stated head, autoMergeRequest null, mergeCommit null. Source checkout clean on pr-182292-prep. Native reconciliation exited without submitting a replacement; it reports head drift from the retained cancelled attempt, and released its operation lock. Several browser CI shards were still running at the stop. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b052f1958c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| rows.map(async (session) => { | ||
| const receipt = Promise.withResolvers<boolean>(); | ||
| const result = await patchSession(host, session, { archived: false }, scope, { |
There was a problem hiding this comment.
Restore shared pins after deferred Undo is confirmed
If a previously shared-pinned session's queued archive is already in flight when Undo is clicked, this branch queues only { archived: false } and never uses the captured pinned value. The Gateway's archive handler clears pinnedAt, whereas unarchiving does not restore it (src/gateway/sessions-patch-lifecycle-flags.ts), so both requests can succeed while Undo permanently loses the original shared pin. The online branches below explicitly restore those pins, but this early return bypasses them. Keep pin writes unavailable while offline if necessary, but restore eligible captured shared pins after the deferred unarchive is confirmed.
Useful? React with 👍 / 👎.
|
Merged via squash.
|
…penclaw#182292) * feat(ui): support offline session archive and delete Queue archive, unarchive, and delete through the existing Gateway deferred-intent owner during same-identity recovery. Coalesce lifecycle choices in place and discard superseded metadata and reactions before hiding a deleted row. Reuse session-owned optimistic rows, confirmation dialogs, durable identity guards, and chat transitions. Roll back rejected or discarded work, confirm already-missing deletes, and retire old in-flight receipts when their connection owner changes. Keep placement, pinning, sharing, and other consequential operations connection-gated. Load preserved-worktree notices only when needed, document the memory-only queue, and regenerate the boot manifest. * fix(ui): preserve offline lifecycle controls and startup budget * fix(ui): defer deletion runtime and retain offline archive undo * fix(ui): preserve offline deletion prerequisites and local pins * perf(ui): lazy-load session mutation operations Move offline previews, replay, archive projections, and mutation receipt work into the session interaction runtime. Keep native queue admission and durable delete identity capture synchronous, and prepare optional code before RPC dispatch so a failed download cannot misreport a committed mutation. Isolate the runtime and its receipt/copy dependencies from captured route chunks. Budgets and baselines are unchanged. Validation: paired main comparison passes; matched local startup gzip drops from 281214 to 280929 bytes, leaving 880 bytes under the 281809-byte enforced limit. Main comparator is 280590 bytes. All 331 focused behavioral tests and six chunking tests pass, including a red-to-green indirect boot-dependency regression. UI typecheck, scoped oxfmt check, git diff check, and independent review pass. * perf(ui): defer session creation outside startup Move session creation requests and receipt handling into the optional mutation runtime. Keep connection capture, error publication, model overrides, prepared work-session placement, and reconciliation with their existing owners. Recheck the captured connection and abort signal before dispatch after a cold import. Keep the creation helper in the mutation chunk so captured boot groups cannot pull it back into startup. Extend cold-disconnect and chunk-isolation coverage, and wait for real request dispatch in the background creation tests. Paired local performance: startup gzip 280421 B versus main 280590 B and the unchanged 281809 B enforcement limit. The original branch measured 281214 B with the same local toolchain. Focused tests: 70 plus 30 passed. UI typecheck, scoped oxfmt check, and git diff --check passed. * fix(ui): retain offline undo receipts and admit session page actions * fix(ui): preserve archive hosts and defer mutation loading * fix(ui): keep offline session previews synchronous
What Problem This Solves
Archive, unarchive, and delete were unavailable while the same Gateway connection recovered. This PR lets users queue those actions alongside offline renames and reactions (#177558).
The startup-size repair then put optimistic session previews behind the optional mutation chunk. A cold rename could increment the queued count while leaving the old title visible. This repair restores the synchronous presentation contract without changing any budget.
Solution
The existing application Gateway outbox remains the only queue. Admission captures the session incarnation and recovery scope synchronously. Archive, restore, and delete share one lifecycle slot and retain its FIFO position; the newest choice wins. Deleting a session retires its unsent metadata and reaction intents.
Preview tokens, row movement/hiding, title changes, queued counts, and predecessor-preview release remain eager and data-only. Replacing a queued delete with an archive immediately restores and projects the retained row. Network replay, receipts, failure handling, delete absence confirmation, creation work, and post-write refresh/warning handling stay in the optional mutation runtime. Replay revalidates the captured connection before sending requests. The asynchronous preview-initialization machinery was removed. Direct patch execution and its refresh helpers now share the lazy runtime; the eager owner keeps only captured targets and projection claims. Receipt subscriptions are admitted synchronously, and execution reads the target again after acknowledgement because the receipt can bind a previously unbound session.
The Gateway still checks permissions and session identity. Archive-only deletion replays a superseded archive prerequisite in the same slot. Missing deletion identities produce a batch error while valid selections queue. Confirmations, personal pins, Undo ownership, generation fences, and preserved-worktree handling retain their existing contracts. Rejected changes restore the appropriate projection; already-gone deletion succeeds only after authoritative absence confirmation.
The completed CI run also exposed two browser issues: failure-attention presentation ignored
suppressErrorNotice, and a workspace-retry assertion matched both the Details panel and the composer banner. The shared attention owner now honors suppression; the assertion targets its existing Details panel. The global suppressed-error assertion remains unchanged.Evidence
pnpm test <files> --maxWorkers=1(592 normal including receipt ownership, 21 isolated read-marker, 23 browser-component tests).a6ce7b060cff0a862a3222b25d47c02776d3de3f: 281,114 B startup gzip / 281,809 B limit (695 B headroom; 7 requests). Chat boot 1,275,591 B / 1,275,713 B limit (122 B headroom; 19 requests). All checked budgets passed under Node v26.12.1; no limits changed.pnpm tsgo:ui, scopedoxlint,oxfmt --check, andgit diff --check: passing.All nine reported failures retain their assertions. Network expectations await the existing lazy-load seam, while optimistic assertions execute synchronously. The settings-error fixture now supplies IndexedDB for the authenticated pane's durable-draft restoration. A receipt regression also covers a failed predecessor followed by a successful unbound write, failed roster readback, and later stale roster publication. Codex review identified the missing fact capture for a target first bound by its ACK; the stale roster assertion reproduced the reversal before the correction and passes with it. New synchronous rename/archive/delete and coalescing assertions failed on the original head; the suppressed failed/timeout attention assertions failed before their owner fix.
The repair removes the async preview initializer and the now-unused row-projection runtime export. Production delta for this repair is +460/-417 lines, predominantly moving existing execution behind the lazy boundary; the full PR is +1559/-676 production lines and +1776/-258 test lines against its merge base.
No budgets, baselines, timeouts, snapshots, or failure exclusions changed. This repair used synthetic fixtures and did not operate a live Gateway or live state. Exact-head hosted CI remains separate from local proof.
Earlier live evidence
Earlier branch work exercised real Chromium against an isolated Gateway behind a TCP fault proxy. The session menu/organizer chunks were loaded while online. Offline actions updated the UI immediately, drained after reconnection, and remained committed after reload. These retained captures are synthetic; they are earlier-branch live evidence, not a new live run for this repair.
The earlier live run also identified a separate service-worker precache gap for menu chunks not loaded before going offline. This repair removes the mutation-runtime dependency from optimistic admission; it does not change that precache owner. The queue remains memory-only, as documented in
docs/web/control-ui/offline-and-reconnect.md.