Repository navigation
fix(tui): hide stale overlays after remembered session restore - #125086
Conversation
Centralize TUI session identity in state so remembered-session restores use the same invalidation path as interactive switches. Fixes #125013.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 1:49 AM ET / 05:49 UTC. ClawSweeper reviewWhat this changesThe PR centralizes TUI session identity and makes remembered-session restoration notify approval and task-suggestion overlays when the visible session changes. Regression provenancePossible regression — probable (reviewed change; failure trace). No predecessor PR is attributed. Merge readinessKeep open. Current main still restores a remembered session by bypassing its notifying session setter, while this branch moves all post-bootstrap session changes through the canonical state owner and adds a visible PTY regression. The protected Priority: P2 Review scores
Verification
How this fits togetherThe TUI restores a remembered session during startup, then loads history and session-scoped approval or task-suggestion overlays. Session identity changes must invalidate overlays from the prior session before the terminal UI presents the restored session. flowchart LR
A[Remembered session] --> B[TUI startup]
B --> C[Session identity state]
C --> D[Approval overlay]
C --> E[Task suggestion overlay]
C --> F[History and header]
D --> G[Visible terminal UI]
E --> G
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +13, Tests +63. Total +76 across 4 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Preserve the single post-bootstrap session-transition path so startup restoration and interactive switching both invalidate session-scoped overlays before rendering the restored session. Do we have a high-confidence way to reproduce the issue? Yes, source-reproducible with high confidence: persist a target session, emit a pending approval for the default session before connection, and start the fake-backend PTY. Current main restores the target through a direct assignment, leaving the already-open default-session overlay intact; this read-only review did not execute the test. Is this the best way to solve the issue? Yes. Reusing the existing session-state setters keeps approval and task-suggestion invalidation at their controller boundary; directly closing overlays inside remembered restore would duplicate that policy and miss a sibling surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d6be4f355203. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
|
|
Land-ready proof for exact head
Proof gaps: none known. |
|
Merged via squash.
|
Centralize TUI session identity in state so remembered-session restores use the same invalidation path as interactive switches. Fixes openclaw#125013.
Closes #125013
What Problem This Solves
Fixes an issue where TUI startup could restore a remembered session while leaving a plugin-approval or task-suggestion overlay from the initial/default session visible. The header and transcript would show the restored session, but the overlay still belonged to the previous session.
Why This Change Was Made
Session identity now has one canonical owner inside TUI state. Agent, session-key, session-ID, and generation reads and mutations flow through that state; remembered-session restoration uses the same session-change notification path as interactive switching. The only notification-free assignment is the documented bootstrap selection before overlay controllers exist.
AI-assisted: yes. I reviewed the complete owner boundary, mutation paths, regression behavior, and generated changes.
User Impact
Operators who relaunch the TUI into a remembered session no longer see or act on stale session-scoped approvals or task suggestions from the initial session. Interactive switching, reset/new-session transitions, reconnect handling, and session event identity behavior remain unchanged.
Evidence
picker-targetin the visible session while the staleworkspace skill approvaloverlay remains; it passes with the fix.node scripts/run-vitest.mjs run --config test/vitest/vitest.tui-pty.config.ts src/tui/tui-session-identity-pty.e2e.test.ts— 1 test passed on the rebased head.node scripts/run-vitest.mjs run src/tui— 44 files / 1,184 tests passed on the rebased head.--mode branch --base origin/main) — clean, no accepted/actionable findings.node scripts/check-changed.mjs -- <touched files>— passed on Testboxtbx_01m072sstjfnjmsqgq8tte6t51.Before / after
Before: the TUI has restored
picker-target, but still presents the default session's workspace-skill approval.After: the restored session owns the viewport and the stale overlay is gone.
Final rebased-head proof
Verified commit:
446491c69e09ca9dab5b6216dac165e9315bba1dtbx_01m072sstjfnjmsqgq8tte6t51