Repository navigation
fix(ui): keep the archive Undo working after leaving the Sessions page - #123749
Conversation
The archive toast outlives the Sessions page (toast host is app-shell level), but its Undo action was gated on the page's request scope, which dies the moment the operator navigates away — clicking Undo within the 6s window then silently did nothing. Run the un-archive through the shared sessions mutations store directly (it already fails closed on connection replacement and publishes errors), mirroring the always-mounted sidebar undo sibling.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: found issues before merge. Reviewed August 14, 2026, 1:50 PM ET / 17:50 UTC. ClawSweeper reviewWhat this changesThe PR changes the Sessions archive toast’s Undo action to call shared session mutations after the Sessions page has unmounted. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readiness⛔ Blocked by patch quality or review findings - 7 items remain Keep this PR open. It fixes the detached-page no-op, but the new Undo call still bypasses the existing session-mutation access check and its visible error handling; the prior P1 blocker remains unchanged at the current head. Priority: P2 Review scores
Verification
How this fits togetherArchiving on the Sessions page creates an app-wide Undo toast that may outlive the page. The handler must preserve both durable session identity and the Control UI’s authorization and failure-reporting behavior while it uses the shared mutation capability. flowchart LR
A[Sessions page] --> B[Archive session]
B --> C[App-wide Undo toast]
C --> D[Access and error boundary]
D --> E[Shared session mutations]
E --> F[Gateway session update]
Before merge
Findings
Agent review detailsSecurityNeeds attention: The patch does not bypass Gateway authorization, but it removes the Control UI’s mutation-access guard and failure boundary for this detached action. PR surfaceSource -1, Tests +34. Total +33 across 2 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Use a page-independent Undo helper that rechecks session-mutation access and reports rejected or failed restores through an always-mounted visible error surface, then prove archive → navigation → Undo in the Control UI. Do we have a high-confidence way to reproduce the issue? Yes, from source: disconnect invalidates the page request scope, and current main returns before restoring the session; the new test models the same archive → unmount → Undo sequence. Is this the best way to solve the issue? No. Moving Undo off the page scope is necessary, but directly calling the mutation store is not the best fix because it drops the existing access and error boundary. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a8a986af1d6f. LabelsLabel changes:
Label justifications:
EvidenceSecurity concerns:
What I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
openclaw#123749) The archive toast outlives the Sessions page (toast host is app-shell level), but its Undo action was gated on the page's request scope, which dies the moment the operator navigates away — clicking Undo within the 6s window then silently did nothing. Run the un-archive through the shared sessions mutations store directly (it already fails closed on connection replacement and publishes errors), mirroring the always-mounted sidebar undo sibling.
What Problem This Solves
Archiving a session on the Sessions page shows a 6-second toast with an Undo action. The toast host lives at app-shell level and survives navigation, but Undo was gated on the page's request scope — which dies the moment the operator leaves the Sessions page (
isConnectedfalse,pageEpochbumped indisconnectedCallback). Clicking Undo after navigating away silently did nothing: session stays archived, no error, no toast change. The worst bug class per repo doctrine: a user action with no visible outcome and no recorded reason.Why This Change Was Made
The un-archive is a capability-level operation, not page UI state. The always-mounted sidebar sibling (
session-organizer-operations.runtime.tsarchiveSessionWithUndo) already proves the intended product behavior: undo works from anywhere because it runs against the shared mutations store. The page variant now does the same — the Undo action callsscope.sessions.patch(key, {archived:false, ...pinned}, {agentId, expectedSessionId})directly, dropping the page-scope pre-check. The mutations store already fails closed on connection replacement and publishes errors to shared state, so no safety is lost; the durableexpectedSessionIdidentity check still guards against key reuse.User Impact
Undo on the archive toast works even after switching to Chat or any other page within the toast window.
Evidence
1 failed | 28 passed), passes post-fix (29 passed); fullsessions-page.test.tsgreen.pnpm tsgo:uiclean; oxfmt/oxlint clean.Production LOC delta: −1 (10 added incl. invariant comment, 11 removed); tests +34.