Skip to content

fix(ui): keep sidebar selection on archived sessions and replace the composer with an archived notice - #113882

Merged
steipete merged 4 commits into
mainfrom
steipete/sidebar-selection-reload-95119b
Jul 26, 2026
Merged

steipete merged 4 commits into
mainfrom
steipete/sidebar-selection-reload-95119b

Conversation

@steipete

@steipete steipete commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Archiving the currently open session force-jumped the sidebar selection to the agent main session (both from the sidebar thread menu / multi-select batch and from the Sessions page). Combined with the list reloads that archiving triggers, this read as the UI "randomly losing the sidebar selection". The archived session also kept rendering a live-looking (but disabled) composer under the archived banner.

Why This Change Was Made

Selection is route/state owned and should never move because an entry changed archive state. The sidebar projection already synthesizes a visible row for a selected session that falls out of the active-filtered list, so the right fix is to delete the navigation-on-archive code paths and make the archived state explicit at the composer seam instead.

  • patchSession and the Sessions page no longer navigate to the agent main session on archive; the undo paths no longer re-select (nothing moved).
  • The sidebar per-agent projection now admits the selected lineage root even when it is archived, and promotes the selected fallback row so the archived entry stays rendered and selectable under the default "active" filter.
  • When the selected session is archived, the archived notice (with Unarchive) now replaces the composer via a typed ChatComposerDisabledBanner placement variant instead of stacking above a disabled input; Stop stays available while a run is still draining. Other disabled states (read-only share, catalog view-only, offline, question takeover) are unchanged.

User Impact

Archiving a session — including the one you are looking at — never moves your selection. The archived entry remains in the sidebar with the archive glyph, stays selectable, and the chat shows "This session is archived. Unarchive it to continue the conversation." in place of the composer. Unarchiving restores the composer in place.

Before After
before after

Evidence

  • New load-shaped E2E: 15 sessions, batch-archive several rows with a sessions.changed refresh after each patch, then archive the selected session — asserts the selected route and active sidebar row never change, the composer is replaced by the archived notice, and unarchive restores it (ui/src/e2e/session-management.e2e.test.ts).
  • Unit coverage: selected archived session absent from an active-filtered list still resolves as the active row (ui/src/lib/sessions/navigation.test.ts); sidebar archive + undo never call setSessionKey/navigate (ui/src/test-helpers/app-sidebar-cases/sessions.ts, ui/src/pages/sessions/sessions-page.test.ts); composer replacement + unarchive action (ui/src/pages/chat/chat-composer.test.ts); archived cross-agent children and filtered archived parents (ui/src/test-helpers/app-sidebar-cases/child-sessions.ts).
  • Local proof: node scripts/run-vitest.mjs ui/src/lib/sessions/navigation.test.ts ui/src/components/app-sidebar.test.ts ui/src/pages/chat/chat-composer.test.ts ui/src/pages/sessions/sessions-page.test.ts ui/src/e2e/session-management.e2e.test.ts — 2 shards, all passed (navigation 14, sidebar 170, composer 30, sessions page 22, e2e 20).
  • Autoreview (Codex gpt-5.6-sol, xhigh): clean, no accepted findings.
  • Screenshots above captured from the mocked-gateway e2e harness (deterministic fixtures, no real data).

Real-Setup Proof (live scratch gateway)

Verified against a real gateway run from this branch head (ee85007295c): isolated OPENCLAW_STATE_DIR, token auth on loopback port 19790, gateway-served production UI build, 15 real sessions created via sessions.create/sessions.patch RPC.

Live flow exercised in the browser: selected "Load test 11", archived several other sessions one by one (each triggering sessions.changed list reloads) — selection never moved; then archived the selected session via its thread menu — the row stayed selected in the sidebar with the archive glyph and the composer was replaced by the archived notice; Unarchive restored the composer in place.

This live testing surfaced a cold-load gap (fixed in ee85007295c): a fresh page load deep-linked to an archived session rendered a live composer because the session is absent from the active-filtered list and neither history sessionInfo nor list rows carried archived. The sidebar's existing sessions.describe lineage row is now published through the sessions store's reconcile seam, so the chat pane and header share the sidebar's cold-load truth; navigating away evicts the injected row via the normal active filter.

Live: cold-load of archived selected session Live: after clicking Unarchive
live archived live restored

Additional evidence for the new commit: cold-load unit coverage in ui/src/pages/chat/chat-pane-state.test.ts, new cold-load E2E scenario in ui/src/e2e/session-management.e2e.test.ts (21/21 on the archive scenarios), fresh clean autoreview. The pages sidebar sessions and supports complete drag-managed groups E2E test is flaky on the local runner independent of this branch — the origin/main version of the file fails the same test (plus one more) on the same machine; the e2e lane is not part of PR CI.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Jul 25, 2026
@steipete
steipete marked this pull request as ready for review July 25, 2026 21:53
@clawsweeper clawsweeper Bot added proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jul 25, 2026
@clawsweeper

clawsweeper Bot commented Jul 25, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed July 25, 2026, 9:57 PM ET / July 26, 2026, 01:57 UTC.

ClawSweeper review

What this changes

The PR keeps an archived routed session selected in the Control UI sidebar and replaces its disabled composer with an archived-session notice that can restore the session.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this PR open for explicit maintainer handling: it addresses a bounded Control UI regression, includes focused coverage and stated live-gateway proof, and the review found no discrete correctness defect in the submitted change. The protected maintainer label prevents automated cleanup; refresh it against current main before landing.

Priority: P2
Reviewed head: 498a6080ef26b31f6c00b02ed441eb613c93cb10
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The PR presents focused implementation and coverage with concrete real-setup behavior evidence, subject to the normal final refresh against current main.
Proof confidence 🐚 platinum hermit (4/6) ✨ media proof bonus Sufficient (screenshot): The PR body provides an after-fix real scratch-gateway flow with real session RPC mutations, observed browser behavior, and linked before/after live UI evidence; mocks and tests are supplemental.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (screenshot): The PR body provides an after-fix real scratch-gateway flow with real session RPC mutations, observed browser behavior, and linked before/after live UI evidence; mocks and tests are supplemental.
Evidence reviewed 6 items Route selection is no longer changed by archiving: The submitted Sessions page patch removes the branch that changed the gateway session key when the archived row was currently selected, preserving route-owned selection.
Archived selection is projected back into navigation: The navigation resolver accepts an active lineage row when the active-filtered session result no longer contains the routed archived session; the focused unit test asserts it remains the active row.
Cold-load state is carried into the chat pane: The added lineage publication reconciles the fetched routed row into the sessions capability so the chat pane can observe archival state even when the normal active list omits that row.
Findings None None.
Security None None.

How this fits together

The Control UI derives the visible sidebar rows and chat-pane state from session-list updates, route selection, and fetched lineage data. Archiving changes a session's list membership; this change preserves the route-selected row through that transition and makes the chat input reflect the archived state.

flowchart LR
  A[Archive or unarchive action] --> B[Session patch and refresh]
  B --> C[Session list and lineage reconciliation]
  C --> D[Sidebar selection projection]
  C --> E[Chat pane state]
  D --> F[Archived row stays selected]
  E --> G[Archived notice or restored composer]
Loading

Decision needed

Question Recommendation
Should this protected Control UI change be approved after it is refreshed against current main? Refresh and approve: Rebase or update the branch onto current main, confirm the focused archive-selection behavior still passes, then land the bounded regression fix.

Why: The patch has no supported line-level defect in this review, but the maintainer label requires an explicit human decision rather than automated closure or landing.

Before merge

  • Resolve merge risk (P1) - The PR is cleanly mergeable but behind current main; refresh the merge result and rerun the focused UI boundary checks before landing so the final review applies to the actual merge commit.
  • Complete next step (P2) - No mechanical repair is indicated; explicit maintainer approval and a refreshed merge-base check are the remaining actions because the PR has the protected maintainer label.
Agent review details

Security

None.

PR surface

Source +138, Tests +287. Total +425 across 19 files.

View PR surface stats
Area Files Added Removed Net
Source 14 214 76 +138
Tests 5 298 11 +287
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 19 512 87 +425

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: ui/src/components/session-organizer-operations.runtime.ts, serialized state: ui/src/e2e/session-management.e2e.test.ts, serialized state: ui/src/lib/sessions/navigation.test.ts, serialized state: ui/src/lib/sessions/navigation.ts, serialized state: ui/src/pages/sessions/sessions-page.ts, serialized state: ui/src/test-helpers/app-sidebar-cases/sessions.ts, and 1 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Preserve route-owned selection across archive refreshes, publish the routed lineage row only for the active selection, and land the refreshed branch after explicit maintainer approval.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Preserve route-owned selection across archive refreshes, publish the routed lineage row only for the active selection, and land the refreshed branch after explicit maintainer approval.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: archiving the currently routed session causes an active-filtered list refresh, and the changed navigation, sidebar, and chat paths directly cover that transition. The provided real-gateway account is detailed, but this read-only review could not independently execute it.

Is this the best way to solve the issue?

Yes. Keeping selection route-owned while injecting the selected lineage row into the existing reconciliation path is narrower and less error-prone than redirecting to an agent main session or adding a separate archived-session navigation mode.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an after-fix real scratch-gateway flow with real session RPC mutations, observed browser behavior, and linked before/after live UI evidence; mocks and tests are supplemental.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The PR body provides an after-fix real scratch-gateway flow with real session RPC mutations, observed browser behavior, and linked before/after live UI evidence; mocks and tests are supplemental.
  • remove rating: 🧂 unranked krab: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: 📣 needs proof: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This is a bounded Control UI session-selection regression with a clear user-visible effect but no evidence of data loss, security impact, or core-runtime unavailability.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (screenshot): The PR body provides an after-fix real scratch-gateway flow with real session RPC mutations, observed browser behavior, and linked before/after live UI evidence; mocks and tests are supplemental.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body provides an after-fix real scratch-gateway flow with real session RPC mutations, observed browser behavior, and linked before/after live UI evidence; mocks and tests are supplemental.
  • proof: 📸 screenshot: Contributor real behavior proof includes screenshot evidence. The PR body provides an after-fix real scratch-gateway flow with real session RPC mutations, observed browser behavior, and linked before/after live UI evidence; mocks and tests are supplemental.

Evidence

What I checked:

  • Route selection is no longer changed by archiving: The submitted Sessions page patch removes the branch that changed the gateway session key when the archived row was currently selected, preserving route-owned selection. (ui/src/pages/sessions/sessions-page.ts:904, 498a6080ef26)
  • Archived selection is projected back into navigation: The navigation resolver accepts an active lineage row when the active-filtered session result no longer contains the routed archived session; the focused unit test asserts it remains the active row. (ui/src/lib/sessions/navigation.ts:296, 498a6080ef26)
  • Cold-load state is carried into the chat pane: The added lineage publication reconciles the fetched routed row into the sessions capability so the chat pane can observe archival state even when the normal active list omits that row. (ui/src/components/app-sidebar-child-session-data.ts:89, 498a6080ef26)
  • Composer replacement preserves active-run Stop controls: The composer view hides the text input for the typed replacement banner while still rendering primary run actions when abortable UI is active; the corresponding composer test covers Unarchive and Stop. (ui/src/pages/chat/components/chat-composer-view.ts:102, 498a6080ef26)
  • After-fix behavior proof and CI: The PR body documents a real loopback scratch-gateway run with real session RPC mutations, archived-selection and unarchive observations, plus linked live UI images; the provided check summary shows the dedicated Real behavior proof check and UI/check lanes succeeding at review time. (498a6080ef26)
  • Feature-history signal: The PR's four commits show a focused progression from the archive-selection behavior, through narrowed lineage lookup, to the cold-load reconciliation fix; the latest cleanup commit is the reviewed head. (ui/src/components/session-data-controller.ts:606, 498a6080ef26)

Likely related people:

  • steipete: The supplied PR history attributes the archive-selection implementation, lineage refinement, and cold-load correction commits to this contributor; no separate current-main ownership trail was available in the read-only inspection environment. (role: recent contributor to the affected Control UI session-state path; confidence: low; commits: f21e5fa51d81, dce43c4c3f34, ee85007295ce; files: ui/src/components/session-data-controller.ts, ui/src/lib/sessions/navigation.ts, ui/src/pages/chat/components/chat-composer-view.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Refresh the branch against current main and confirm the focused Control UI archive-selection checks on the resulting merge commit.

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-07-25T22:18:06.207Z sha dce43c4 :: needs real behavior proof before merge. :: none

@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Jul 26, 2026
@steipete
steipete merged commit a328e90 into main Jul 26, 2026
117 of 125 checks passed
@steipete
steipete deleted the steipete/sidebar-selection-reload-95119b branch July 26, 2026 02:07
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 26, 2026
…composer with an archived notice (openclaw#113882)

* fix(ui): keep sidebar selection on archived sessions and replace composer with archived notice

* fix(ui): narrow lineage-row lookup and restructure fallback projection scan

* fix(ui): publish routed lineage row so cold-loaded archived sessions replace the composer

* chore(ui): drop unused mergeChildSessionRows export
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 P2 Normal backlog priority with limited blast radius. proof: 📸 screenshot Contributor real behavior proof includes screenshot evidence. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant