Skip to content

fix(ui): stabilize the sidebar session list with a single projection owner - #129150

Merged
steipete merged 4 commits into
mainfrom
steipete/sidebar-flickering-stability-8df577
Aug 25, 2026
Merged

steipete merged 4 commits into
mainfrom
steipete/sidebar-flickering-stability-8df577

Conversation

@steipete

Copy link
Copy Markdown
Contributor

What Problem This Solves

The sidebar session list visibly flickers as gateway events arrive: rows pop out of the visible page the moment their run ends, rows jump within createdAt ties after paging, child session trees auto-collapse on their own when a descendant run finishes, and a running row's status line blank-flashes and swaps text at event rate. Operators watching a busy sidebar (the normal state on team gateways) see constant churn that carries no information.

Four scattered mechanisms each independently re-derived presentation state per render:

  1. Page membership churn — limitSidebarSessionRows force-included active/pinned rows, so a session dropped off the page when its run ended, shifting every row below.
  2. Created-order tiebreak instability — the observation-order map was pruned on every publish; a row that paged out and returned was reassigned max+1 and jumped to the bottom of its tie group.
  3. Auto-expand flap — expansion was derived per render from containsActiveDescendant, so trees collapsed themselves when the child run went idle.
  4. Subtitle blank flashes — the running row's subtitle could transiently resolve to nothing between observer/narration updates, collapsing row height; racing ambient sources also swapped the line A→B→A within a second.

Why This Change Was Made

Rather than patching each symptom, presentation stability now has one owner: SidebarSessionProjection (sidebar-lifetime state, consumed once per render pass via the existing willUpdate snapshot). It owns:

  • Sticky membership — once a row is visible in a section it stays visible until a user-initiated boundary (sort/filter change, section collapse, agent switch, reconnect, list-scope replacement). Sticky rows keep natural sort position and are slot-exempt.
  • Stable created-order registry — monotonic observation indices for the sidebar lifetime, pruned only above a 1,000-entry cap and only for keys absent from all retained results.
  • Latched expansion — one closed per-key mode (collapsed-by-user / expanded / expanded-fully) replaces three parallel key sets; auto-expansion latches after the descendant idles, and an explicit user collapse sticks.
  • Held subtitles — a running row keeps its last non-empty subtitle across transient gaps and run-id rotation (queued→running), with a 2s minimum display floor for ambient replacements (matching the narration throttle); attention, agent status, and the queued explanation bypass the floor.

The mechanisms it replaces are deleted: limitSidebarSessionRows, partitionSidebarVisibleSections, promoteSidebarSessionCreatedOrder, per-publish created-order pruning, and the three expansion key sets. Sort semantics (created/updated/people) are unchanged; updated mode still reorders on activity by design.

User Impact

The sidebar only changes when something meaningful changes: new sessions appear, user actions re-page or re-sort, and run state renders in place. No more rows vanishing when a run completes, trees snapping shut mid-read, or status lines strobing.

Evidence

  • Regression e2e (ui/src/e2e/sidebar-session-stability.e2e.test.ts, mocked-gateway browser run): asserts the visible row set, order, and expansion survive run start→events→completion→navigation. Reproduced failing on pre-fix code for the intended reason (tree auto-collapsed after run completion).
  • Live dev gateway A/B (isolated OPENCLAW_STATE_DIR, own port 19807, real anthropic/claude-haiku-4-5 runs over 12 sessions, sidebar sampled at 300–500ms):
    • Pre-fix: running row's subtitle went "Waiting for a concurrency slot" → blank → then flip-flopped between two text sources within 600ms.
    • Post-fix: across 47 samples during two concurrent runs + one new session, the row set had exactly 2 states (initial page; new session prepended) with zero reorders/pop-outs; subtitle timeline shows 0 mid-run blanks and ambient swaps at the 2s floor, ending with the legitimate run-end transition.
  • Unit coverage: 27 projection-owner tests (sticky membership boundaries, created-order cap, expansion latch/toggle, subtitle hold incl. run-rotation, display floor, critical bypass).
  • Suites: ui/src/components + ui/src/lib/sessions (162 files, 2147 passed), changed-file gates (format, tsgo UI typecheck, lint, styles) green.
  • Autoreview (Codex, gpt-5.6-sol, high): clean, twice (after each commit).
  • Production LOC +451/−199 (net +252): four previously per-render-derived invariants now need one durable owner; the growth is the owner class plus its state boundaries, with all scattered predecessors deleted. Tests +676/−64.

Live proof videos and captures attached below (mock fixture + dev-gateway proof-* sessions only; no personal data).

sidebar-live-before.webm
sidebar-live-after.webm

sidebar-session-stability-running

sidebar-session-stability-completed

The sidebar flickered as gateway events arrived: rows popped out when runs
ended (active/pinned page bypass), rows jumped within createdAt ties after
paging (per-publish created-order pruning), child trees auto-collapsed when
a descendant went idle (per-render derivation), and running-row subtitles
blank-flashed between observer/narration updates.

SidebarSessionProjection now owns all presentation stability for the
sidebar lifetime: sticky page membership with user-action reset boundaries,
a monotonic bounded created-order registry, latched child expansion with an
explicit collapsed-by-user mode, and a last-subtitle hold per active run.
The scattered mechanisms it replaces are deleted (limitSidebarSessionRows,
partitionSidebarVisibleSections, per-publish order pruning, three expansion
key sets).
…y floor

Live A/B on a dev gateway showed two residual subtitle defects: the hold
was keyed to the exact active-run-id set, so the queued->running rotation
still blanked the row, and racing ambient sources (observer digest,
narration, work path) swapped the line A->B->A within a second.

The hold now lives for the session's running lifetime and ambient
replacements respect a 2s minimum display floor (matching the narration
throttle); attention, agent status, and the queued explanation bypass the
floor because the operator must act on them.
@clawsweeper

clawsweeper Bot commented Aug 25, 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 25, 2026 08:12
@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XL maintainer Maintainer-authored PR labels Aug 25, 2026
@clawsweeper clawsweeper Bot added merge-risk: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed August 25, 2026, 4:18 AM ET / 08:18 UTC.

ClawSweeper review

What this changes

The PR moves sidebar session pagination, creation-order ties, child expansion, and running-row subtitle state into a sidebar-lifetime projection.

Regression provenance

Possible regression — probable (reviewed change; reproduction). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open: the projection centralizes the intended stability rules, but it fails to reset sticky page membership when the operator changes sidebar grouping, leaving an old overflow page visible across that user-initiated boundary.

Priority: P2
Reviewed head: 35545491c7643ae48888af76b62a03db1e261476

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The architectural direction and focused tests are strong, but a concrete grouping-transition regression blocks a higher rating.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless provides claimed mocked-browser and isolated-gateway after-fix evidence.
Patch quality 🦐 gold shrimp (3/6) 1 actionable review finding remain.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless provides claimed mocked-browser and isolated-gateway after-fix evidence.
Evidence reviewed 6 items Missing grouping reset: The projection clears sticky membership for scope, sort, and status changes, but its stored prior input excludes grouping.
Operator action path: The grouping menu delegates to setSessionsGrouping, which changes the host grouping without resetting the projection; the next render therefore retains sticky keys for any section ID shared by both groupings, such as ungrouped.
Shared-section behavior: Category, person, and no-grouping modes can all emit the ungrouped section, so stale membership is not automatically discarded merely by changing grouping.
Findings 1 actionable finding [P2] Reset sticky membership when the grouping changes
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/sidebar-session-stability.e2e.test.ts

Result: FAIL (failed) — step 1 run node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/sidebar-session-stability.e2e.test.ts: terminal command did not produce output within 20 seconds: "node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/sidebar-session-stability.e2e.test.ts"

node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/sidebar-session-stability.e2e.test.ts
runner@runnervm76f27:/tmp/clawsweeper-live-proof-129150-fISjDT/target$ node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoad
er runner ui/src/e2e/sidebar-session-stability.e2e.test.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129150-fISjDT/target

node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/sidebar-session-stability.e2e.test.ts












































Assertions:

  • FAIL expect_output: keeps visible sessions ordered and an active child expanded across run completion

How this fits together

Gateway session updates are normalized into sidebar rows, then grouped and paginated for the Control UI. The new projection owns which rows remain visible, tree expansion, and displayed run activity before the sidebar renders them.

flowchart LR
  A[Gateway session updates] --> B[Session data cache]
  B --> C[Sidebar projection]
  C --> D[Grouping and paging]
  C --> E[Expansion and subtitles]
  D --> F[Sidebar session list]
  E --> F
Loading

Before merge

  • Reset sticky membership when the grouping changes (P2) - project resets retained rows for sort, filter, agent, connection, and source changes, but not for grouping. The grouping menu updates that input directly, and modes share section IDs such as ungrouped; after retaining an overflow row, changing grouping therefore keeps the old page instead of honoring the new list boundary. Include grouping in the reset predicate and add that transition to the boundary tests.
  • Resolve merge risk (P1) - Until grouping clears sticky membership, switching grouping can retain an overflow row from the old page even though the operator requested a new list organization.
  • Resolve merge risk (P1) - The bug-fix has production growth of net +252 lines; the projection owner explains most of it, but the boundary repair should stay within that owner rather than add another caller-side reset path.

Findings

  • [P2] Reset sticky membership when the grouping changes — ui/src/components/app-sidebar-session-projection.ts:158-162
Agent review details

Security

None.

PR surface

Source +241, Tests +623. Total +864 across 13 files.

View PR surface stats
Area Files Added Removed Net
Source 9 456 215 +241
Tests 4 671 48 +623
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 13 1127 263 +864

Review metrics

Metric Value Why it matters
Production versus test LOC production +451/-199 (net +252); tests +676/-64 (net +612) The new durable projection owner is substantial for a bug fix; its added state is partly offset by deletion of the former scattered derivations.

Stored data model

Persistent data-model change detected: serialized state: ui/src/components/session-data-controller-events.test.ts, serialized state: ui/src/components/session-data-controller-events.ts, serialized state: ui/src/components/session-data-controller.event-refresh.test.ts, serialized state: ui/src/test-helpers/app-sidebar-cases/sessions.ts, unknown-data-model-change: ui/src/components/session-data-controller-events.test.ts, unknown-data-model-change: ui/src/components/session-data-controller-events.ts, and 1 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Reset on grouping changes (recommended)
    Add the effective grouping to the projection boundary and cover switching among grouping modes before merging.
Copy recommended automerge instruction
@clawsweeper automerge

Special instructions:
Reset sidebar sticky membership when effective grouping changes and add a projection regression covering a shared ungrouped section.

Technical review

Best possible solution:

Make effective grouping part of the projection’s reset boundary and add a focused regression that verifies the newly selected grouping starts from its normal page while preserving the single projection owner.

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

Yes, from source: retain an overflow ungrouped row, then switch category/person/none grouping; the projection does not reset that section’s sticky set.

Is this the best way to solve the issue?

No. The single projection owner is the right layer, but its reset predicate must include effective grouping rather than relying on callers or section-ID cleanup.

Full review comments:

  • [P2] Reset sticky membership when the grouping changes — ui/src/components/app-sidebar-session-projection.ts:158-162
    project resets retained rows for sort, filter, agent, connection, and source changes, but not for grouping. The grouping menu updates that input directly, and modes share section IDs such as ungrouped; after retaining an overflow row, changing grouping therefore keeps the old page instead of honoring the new list boundary. Include grouping in the reset predicate and add that transition to the boundary tests.
    Confidence: 0.99

Overall correctness: patch is incorrect
Overall confidence: 0.96

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P2: The defect affects an explicit sidebar organization action and can show an unexpected extra row, but does not block core operation.
  • add merge-risk: 🚨 other: Merging would preserve old pagination membership across a newly selected grouping, a user-visible list-state regression not covered by the specialized risk labels.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless provides claimed mocked-browser and isolated-gateway after-fix evidence.

Label justifications:

  • P2: The defect affects an explicit sidebar organization action and can show an unexpected extra row, but does not block core operation.
  • merge-risk: 🚨 other: Merging would preserve old pagination membership across a newly selected grouping, a user-visible list-state regression not covered by the specialized risk labels.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Not applicable: This maintainer-authored PR is exempt from the external-contributor proof gate; its body nevertheless provides claimed mocked-browser and isolated-gateway after-fix evidence.

Evidence

What I checked:

Likely related people:

  • steipete: Authored the current PR and the recent person-grouping and per-section-pagination history that defines this interaction. (role: feature owner and recent area contributor; confidence: high; commits: 3ea90bdcdb30, 44c3ec10edc7, 35545491c764; files: ui/src/components/app-sidebar-session-navigation.ts, ui/src/components/session-organizer-controller.ts, ui/src/lib/sessions/grouping.ts)

Rank-up moves

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

  • Reset sticky membership on effective grouping changes and add the focused projection regression.
  • Rerun the existing mocked-browser sidebar stability flow on the updated head.

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.

The run-rotation and critical-replacement tests asserted the localized
queued string through the shared i18n singleton; in the striped ui CI lane
(shared module graph, isolate=false) that resolution is environment-
sensitive and failed in checks-node-compact-large-11. Narration and
agentStatusNote exercise the same hold invariants with raw strings.
ClawSweeper finding: grouping switches can re-emit the same section id
(e.g. ungrouped) with a different row population, so sticky keys must not
carry across; grouping now joins the membership reset boundary with a
regression row in the boundary table. The created-sort e2e migrates to the
sticky contract: an externally discovered newest session still lands on
top, and the previously visible page is retained instead of evicted.
@steipete
steipete merged commit 7e8412e into main Aug 25, 2026
147 checks passed
@steipete
steipete deleted the steipete/sidebar-flickering-stability-8df577 branch August 25, 2026 09:12
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 26, 2026
…owner (openclaw#129150)

* fix(ui): stabilize sidebar session list with a single projection owner

The sidebar flickered as gateway events arrived: rows popped out when runs
ended (active/pinned page bypass), rows jumped within createdAt ties after
paging (per-publish created-order pruning), child trees auto-collapsed when
a descendant went idle (per-render derivation), and running-row subtitles
blank-flashed between observer/narration updates.

SidebarSessionProjection now owns all presentation stability for the
sidebar lifetime: sticky page membership with user-action reset boundaries,
a monotonic bounded created-order registry, latched child expansion with an
explicit collapsed-by-user mode, and a last-subtitle hold per active run.
The scattered mechanisms it replaces are deleted (limitSidebarSessionRows,
partitionSidebarVisibleSections, per-publish order pruning, three expansion
key sets).

* fix(ui): hold running-row subtitles across run rotation with a display floor

Live A/B on a dev gateway showed two residual subtitle defects: the hold
was keyed to the exact active-run-id set, so the queued->running rotation
still blanked the row, and racing ambient sources (observer digest,
narration, work path) swapped the line A->B->A within a second.

The hold now lives for the session's running lifetime and ambient
replacements respect a 2s minimum display floor (matching the narration
throttle); attention, agent status, and the queued explanation bypass the
floor because the operator must act on them.

* test(ui): assert subtitle holds on non-localized sources

The run-rotation and critical-replacement tests asserted the localized
queued string through the shared i18n singleton; in the striped ui CI lane
(shared module graph, isolate=false) that resolution is environment-
sensitive and failed in checks-node-compact-large-11. Narration and
agentStatusNote exercise the same hold invariants with raw strings.

* fix(ui): reset sticky sidebar membership when grouping changes

ClawSweeper finding: grouping switches can re-emit the same section id
(e.g. ungrouped) with a different row population, so sticky keys must not
carry across; grouping now joins the membership reset boundary with a
regression row in the boundary table. The created-sort e2e migrates to the
sticky contract: an externally discovered newest session still lands on
top, and the previously visible page is retained instead of evicted.
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: 🚨 other 🚨 Merging this PR has meaningful risk outside the owned taxonomy. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL 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