Skip to content

fix(ui): keep the archive Undo working after leaving the Sessions page - #123749

Merged
steipete merged 2 commits into
mainfrom
codex/autoqa-archive-undo
Aug 14, 2026
Merged

steipete merged 2 commits into
mainfrom
codex/autoqa-archive-undo

Conversation

@steipete

Copy link
Copy Markdown
Contributor

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 (isConnected false, pageEpoch bumped in disconnectedCallback). 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.ts archiveSessionWithUndo) 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 calls scope.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 durable expectedSessionId identity 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

  • New regression test (archive → unmount page → click Undo → un-archive patch issued) fails pre-fix (1 failed | 28 passed), passes post-fix (29 passed); full sessions-page.test.ts green.
  • pnpm tsgo:ui clean; oxfmt/oxlint clean.
  • Autoreview (Codex, commit mode): clean, overall 0.99.

Production LOC delta: −1 (10 added incl. invariant comment, 11 removed); tests +34.

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.
@clawsweeper

clawsweeper Bot commented Aug 14, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 14, 2026 16:43
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: S maintainer Maintainer-authored PR labels Aug 14, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 14, 2026
@clawsweeper

clawsweeper Bot commented Aug 14, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 14, 2026, 1:50 PM ET / 17:50 UTC.

ClawSweeper review

What this changes

The PR changes the Sessions archive toast’s Undo action to call shared session mutations after the Sessions page has unmounted.

Regression provenance

Possible 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
Reviewed head: dd17815d1da62820831fecf1fe7a7f8a35c120cd

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) PR readiness rating was derived from proof quality, review findings, security review, and reviewer confidence.
Proof confidence 🌊 off-meta tidepool Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🧂 unranked krab (1/6) Security review found an item that needs attention.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
Evidence reviewed 7 items Current-main failure path: The page invalidates work on disconnect, and the current Undo handler returns when its request scope is no longer current, so navigation can make the toast action a no-op.
PR bypasses the page mutation boundary: The proposed handler directly invokes the shared patch method, skipping requireMutationAccess and the surrounding failure handling retained by ordinary page mutations.
Access policy is intentional: The access helper resolves the same mutation policy enforced by the Gateway and returns an operator-facing reason for unavailable methods, disconnected clients, or missing scope.
Findings 1 actionable finding [P1] Preserve access and failure handling for detached Undo
Security Needs attention Detached Undo skips the UI access gate: The new handler invokes the session mutation directly instead of using the established access check that mirrors Gateway policy, leaving denied or failed Undo actions without the expected client-side handling.

How this fits together

Archiving 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]
Loading

Before merge

  • Preserve access and failure handling for detached Undo (P1) - The direct void scope.sessions.patch(...) bypasses requireMutationAccess and the existing error path. A read-only/method-unavailable or rejected restore after navigation therefore has no owner that can show its failure; use a detached-safe helper that retains the access check and shared visible error outcome.
  • Resolve security concern: Detached Undo skips the UI access gate - The new handler invokes the session mutation directly instead of using the established access check that mirrors Gateway policy, leaving denied or failed Undo actions without the expected client-side handling.
  • Resolve merge risk (P1) - A read-only, disconnected, or failed detached Undo can now send or reject a request without the existing operator-facing access reason or a caught failure outcome.
  • Resolve merge risk (P1) - The PR body provides mocked regression coverage and static checks, but no after-fix Control UI proof of archive, navigation, and Undo.
  • Complete next step (P2) - The concrete P1 repair and real Control UI proof are needed before this maintainer-labeled PR can be reconsidered.
  • Improve patch quality - Resolve the security review concern or explain why the changed path is safe.
  • Improve patch quality - Address the highest-priority review finding and re-run the changed-surface validation.

Findings

  • [P1] Preserve access and failure handling for detached Undo — ui/src/pages/sessions/sessions-page.ts:1205-1209
  • [low] Detached Undo skips the UI access gate — ui/src/pages/sessions/sessions-page.ts:1205
Agent review details

Security

Needs 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 surface

Source -1, Tests +34. Total +33 across 2 files.

View PR surface stats
Area Files Added Removed Net
Source 1 10 11 -1
Tests 1 34 0 +34
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 2 44 11 +33

Review metrics

Metric Value Why it matters
Production versus test LOC production −1, tests +34 The patch is net-negative in production code and adds focused lifecycle coverage, but the new production path still omits the established mutation boundary.

Stored data model

Persistent data-model change detected: serialized state: ui/src/pages/sessions/sessions-page.test.ts, serialized state: ui/src/pages/sessions/sessions-page.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Restore the detached Undo boundary (recommended)
    Keep the shared mutation path, but retain its access check and a page-independent failure outcome before merging.

Technical review

Best 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:

  • [P1] Preserve access and failure handling for detached Undo — ui/src/pages/sessions/sessions-page.ts:1205-1209
    The direct void scope.sessions.patch(...) bypasses requireMutationAccess and the existing error path. A read-only/method-unavailable or rejected restore after navigation therefore has no owner that can show its failure; use a detached-safe helper that retains the access check and shared visible error outcome.
    Confidence: 0.98

Overall correctness: patch is incorrect
Overall confidence: 0.98

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against a8a986af1d6f.

Labels

Label changes:

  • add merge-risk: 🚨 security-boundary: The detached Undo directly bypasses the Control UI access gate that mirrors Gateway session-mutation policy.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🌊 off-meta tidepool and patch quality is 🧂 unranked krab.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.
  • remove rating: 🦪 silver shellfish: Current PR rating is rating: 🧂 unranked krab, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: ⏳ waiting on author.

Label justifications:

  • P2: The bug affects a bounded but user-visible Sessions archive Undo workflow.
  • merge-risk: 🚨 security-boundary: The detached Undo directly bypasses the Control UI access gate that mirrors Gateway session-mutation policy.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🌊 off-meta tidepool and patch quality is 🧂 unranked krab.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: Real behavior proof is not required for maintainer- or bot-authored pull requests.

Evidence

Security concerns:

  • [low] Detached Undo skips the UI access gate — ui/src/pages/sessions/sessions-page.ts:1205
    The new handler invokes the session mutation directly instead of using the established access check that mirrors Gateway policy, leaving denied or failed Undo actions without the expected client-side handling.
    Confidence: 0.96

What I checked:

Likely related people:

  • steipete: Current access-boundary lines, the preexisting Undo feature, and the proposed repair all trace to Peter Steinberger's recent Sessions UI history. (role: original feature and recent UI-area contributor; confidence: high; commits: 5972b36b141d, 5a5db64ffab6, 39ddf710f0f3; files: ui/src/pages/sessions/sessions-page.ts, ui/src/components/session-organizer-operations.runtime.ts)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-14T16:49:13.189Z sha 5a5db64 :: needs real behavior proof before merge. :: [P1] Retain the mutation access and error boundary

@clawsweeper clawsweeper Bot added 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: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Aug 14, 2026
@steipete
steipete merged commit 3292ff1 into main Aug 14, 2026
165 checks passed
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

@steipete
steipete deleted the codex/autoqa-archive-undo branch August 14, 2026 18:09
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 15, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: S status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant