Skip to content

refactor(ui): tidy the roster refresh owner and session test harnesses - #129757

Merged
steipete merged 3 commits into
mainfrom
steipete/sidebar-roster-cleanup
Aug 26, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/sidebar-roster-cleanup

Conversation

@steipete

Copy link
Copy Markdown
Contributor

Related: #129558
Related: #129517

What Problem This Solves

Follow-up cleanup to the sidebar-flicker landings. load() in the roster refresh had grown to ~140 lines with two dense inline decision blocks; two parallel booleans tracked one three-state fact; two test suites hand-rolled copies of harness helpers that session-capability.test-support.ts already owns; and one app-sidebar case asserted the real attention panel renders under a harness that mocks the attention module away — import-order dependent, deterministically failing in local single-file runs on clean main while CI's worker mix passes.

Why This Change Was Made

Behavior-neutral: preserveCurrentSessionRow and retainSessionPaginationWindow are named extractions of load()'s decision blocks (its spine now reads normalize → loading publish → request+owner merge → provisional return → decide → publish); hasForegroundListOptions/hasSeededListOptions collapse into one closed listOptionsSource mode per house style. The test-support module gains selfUser support, sessionChangedEvent, and createSessionCapabilityHarness, and the duplicated local copies die. The attention-panel invariant (panel opens inside openclaw-menu-surface) moves to sidebar-attention.test.ts against the real component, and the harness mock now documents where attention rendering coverage belongs.

User Impact

None at runtime. Developers get a readable roster owner, one canonical session-capability test harness, and local app-sidebar.test.ts runs that match CI instead of failing by construction.

Evidence

  • Full session-lib + sidebar + attention sweep: 712 files / 10,358 tests green; both owner-first e2e specs green; pnpm check:changed exit 0.
  • Previously flaky-local invocation now green: node scripts/run-vitest.mjs ui/src/components/app-sidebar.test.ts --run -t "transient menus".
  • Production delta +24/−50 in the refactor commit is signature/plumbing cost of the two named extractions against a 140→85 line load(); tests net −50 from harness dedup; the moved attention test keeps its exact assertion set.
  • Codex autoreview (gpt-5.6-sol, high) on the branch diff: clean, no findings.

@clawsweeper

clawsweeper Bot commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Aug 26, 2026
@steipete
steipete marked this pull request as ready for review August 26, 2026 01:50
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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. labels Aug 26, 2026
@steipete
steipete force-pushed the steipete/sidebar-roster-cleanup branch from 35e5c5d to d524e80 Compare August 26, 2026 02:09
@clawsweeper

clawsweeper Bot commented Aug 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 10:33 PM ET / August 26, 2026, 02:33 UTC.

ClawSweeper review

What this changes

The PR extracts sidebar roster-refresh decisions, centralizes duplicated session test harnesses, and moves an attention-panel assertion into the component suite that renders it.

Regression provenance

Possible regression — suspected (reviewed change). No predecessor PR is attributed.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

No blocking correctness findings. This maintainer-authored, behavior-neutral Control UI cleanup should remain open for explicit maintainer acceptance after exact-head checks finish.

Priority: P3
Reviewed head: 26bd0a4b94e1aa91970cbe1a476c817f0d5d70bb
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, source-supported refactor with no discrete correctness or security finding.
Proof confidence 🌊 off-meta tidepool Not applicable: Not applicable: repository state identifies the author as a MEMBER; the PR body also records post-change terminal validation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: Not applicable: repository state identifies the author as a MEMBER; the PR body also records post-change terminal validation.
Evidence reviewed 6 items Roster owner boundary: The session capability creates the roster refresh owner with the Gateway connection lifecycle, published state, decoration, and canonical-list callback, so the extracted helpers remain at the correct owner boundary.
Behavior-preserving extraction: The current-main comparison shows the two new helpers are direct extractions of existing current-row preservation and pagination-window logic, while the two booleans become one closed source mode.
Correct test owner: The old sidebar harness explicitly mocks the attention component, while the new component-suite test mounts the real component and verifies its rendered menu surface.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs ui/src/components/sidebar-attention.test.ts --run -t "top-layer menu surface"

Result: FAIL (partial) — step 2 expect_output top-layer menu surface: expected terminal output was not visible within 30 seconds: "top-layer menu surface"

[test] starting test/vitest/vitest.ui.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129757-OC1os0/target

 ✓  ui  ui/src/components/sidebar-attention.test.ts (33 tests | 32 skipped) 236ms

 Test Files  1 passed (1)
      Tests  1 passed | 32 skipped (33)
   Start at  02:34:33
   Duration  2.32s (transform 1.20s, setup 114ms, import 972ms, tests 236ms, environment 613ms)

[test] passed 1 Vitest shard in 2.85s
[test] starting test/vitest/vitest.ui.config.ts

 RUN  v4.1.10 /tmp/clawsweeper-live-proof-129757-OC1os0/target

 ✓  ui  ui/src/components/sidebar-attention.test.ts (33 tests | 32 skipped) 175ms

 Test Files  1 passed (1)
      Tests  1 passed | 32 skipped (33)
   Start at  02:34:37
   Duration  1.59s (transform 500ms, setup 53ms, import 486ms, tests 175ms, environment 602ms)

[test] passed 1 Vitest shard in 2.10s

Assertions:

  • FAIL expect_output: top-layer menu surface

How this fits together

The Control UI turns Gateway session lists and events into sidebar roster state, then renders sidebar and attention-panel controls. The changed code owns roster refresh decisions and the test fixtures that exercise those UI boundaries.

flowchart LR
  A[Gateway session list] --> B[Roster refresh owner]
  C[Gateway session events] --> B
  B --> D[Sidebar roster state]
  D --> E[Sidebar UI]
  F[Attention component] --> E
  G[Shared session test harness] --> B
Loading

Decision needed

Question Recommendation
Should this maintainer-labeled roster and test-harness cleanup be accepted after its exact-head checks complete? Accept after checks: Accept the behavior-neutral refactor if the exact-head required checks complete successfully.

Why: The patch is clean on source review, but the author association and protected maintainer label require explicit human handling rather than automated closure or merge.

Before merge

  • Resolve merge risk (P1) - Exact-head checks are still running, and GitHub reports the branch behind current main; a rebase is only needed if required by GitHub, but behavior-changing refreshes need another review.
  • Complete next step (P2) - Await exact-head checks and explicit maintainer handling; there is no concrete repair finding for an automated work lane.
Agent review details

Security

None.

PR surface

Source +35, Tests -45. Total -10 across 7 files.

View PR surface stats
Area Files Added Removed Net
Source 4 106 71 +35
Tests 3 117 162 -45
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 7 223 233 -10

Review metrics

Metric Value Why it matters
Production versus test delta production +74/−50 (net +24); tests +117/−182 (net −65); test support +32/−1 (net +31) The small production increase is confined to named extractions of existing roster decisions, while duplicated test setup is reduced overall.

Stored data model

Persistent data-model change detected: serialized state: ui/src/lib/sessions/index.event-refresh.test.ts, serialized state: ui/src/lib/sessions/owner-first-roster.test.ts, serialized state: ui/src/lib/sessions/session-capability.test-support.ts, serialized state: ui/src/lib/sessions/session-roster-refresh.ts, unknown-data-model-change: ui/src/lib/sessions/index.event-refresh.test.ts, unknown-data-model-change: ui/src/lib/sessions/owner-first-roster.test.ts, and 2 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Keep the roster decisions in their named owner helpers and the attention-panel invariant in its real component suite, then accept the cleanup once the exact head is validated.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Keep the roster decisions in their named owner helpers and the attention-panel invariant in its real component suite, then accept the cleanup once the exact head is validated.

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

Yes—source-reproducible: the current-main sidebar harness mocks the attention component while the removed test expected that component's panel. The PR moves that assertion to the real component suite; no test was executed in this read-only review.

Is this the best way to solve the issue?

Yes. Relocating the DOM assertion to the component that renders it removes the import-order dependency while retaining the sidebar harness’s focused call-order boundary.

AGENTS.md: found and applied where relevant.

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

Labels

Label justifications:

  • P3: This is a low-risk Control UI refactor and test-harness cleanup with no intended runtime behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: Not applicable: repository state identifies the author as a MEMBER; the PR body also records post-change terminal validation.

Evidence

What I checked:

Likely related people:

  • steipete: Current touched lines blame to this PR head, and the related merged roster-refresh work was also authored by steipete. (role: recent area contributor; confidence: high; commits: 26bd0a4b94e1, e2c8dae7852d; files: ui/src/lib/sessions/session-roster-refresh.ts, ui/src/components/sidebar-attention.test.ts)

Rank-up moves

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

  • Let exact-head required checks finish; request a fresh review only if a required rebase changes behavior.

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-26T01:57:02.382Z sha 35e5c5d9390583b5b4f295e55218430bc21183fe :: needs maintainer review before merge. :: none

@openclaw-barnacle openclaw-barnacle Bot added scripts Repository scripts size: L and removed size: M labels Aug 26, 2026
…rnesses

Extract preserveCurrentSessionRow and retainSessionPaginationWindow from
load()'s 140-line body so its spine reads as normalize -> loading publish ->
request+owner merge -> provisional return -> decide -> publish; collapse the
hasForegroundListOptions/hasSeededListOptions boolean pair into one closed
listOptionsSource mode. Behavior-neutral.

The event-refresh and owner-first suites hand-rolled copies of
sessionsResult/createHarness/sessionChangedEvent; session-capability
test-support already owned the canonical versions, so it gains selfUser
support plus createSessionCapabilityHarness and the copies are deleted.
The app-sidebar harness mocks sidebar-attention.ts away (health RPCs must
stay out of client call-order assertions), so the transient-menus case
asserting the real attention panel renders was import-order dependent:
deterministic-fail in local single-file runs on clean main, pass in CI's
worker mix. The invariant (panel opens inside openclaw-menu-surface) now
lives in sidebar-attention.test.ts against the real component, and the
harness mock documents where attention rendering coverage belongs.
@steipete
steipete force-pushed the steipete/sidebar-roster-cleanup branch from d524e80 to 7021d92 Compare August 26, 2026 02:16
@openclaw-barnacle openclaw-barnacle Bot added size: M and removed scripts Repository scripts size: L labels Aug 26, 2026
sidebar-attention reads context.agentSelection.state during refresh
ownership; CI's striped worker mix exercised that path and crashed the
render, leaving the trigger unrendered.
@steipete
steipete merged commit 03262df into main Aug 26, 2026
110 checks passed
@steipete
steipete deleted the steipete/sidebar-roster-cleanup branch August 26, 2026 03:05
@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
openclaw#129757)

* refactor(ui): name the roster load decision blocks and dedupe test harnesses

Extract preserveCurrentSessionRow and retainSessionPaginationWindow from
load()'s 140-line body so its spine reads as normalize -> loading publish ->
request+owner merge -> provisional return -> decide -> publish; collapse the
hasForegroundListOptions/hasSeededListOptions boolean pair into one closed
listOptionsSource mode. Behavior-neutral.

The event-refresh and owner-first suites hand-rolled copies of
sessionsResult/createHarness/sessionChangedEvent; session-capability
test-support already owned the canonical versions, so it gains selfUser
support plus createSessionCapabilityHarness and the copies are deleted.

* test(ui): move the attention-panel surface test to its component suite

The app-sidebar harness mocks sidebar-attention.ts away (health RPCs must
stay out of client call-order assertions), so the transient-menus case
asserting the real attention panel renders was import-order dependent:
deterministic-fail in local single-file runs on clean main, pass in CI's
worker mix. The invariant (panel opens inside openclaw-menu-surface) now
lives in sidebar-attention.test.ts against the real component, and the
harness mock documents where attention rendering coverage belongs.

* test(ui): give the moved attention-panel test its agent selection

sidebar-attention reads context.agentSelection.state during refresh
ownership; CI's striped worker mix exercised that path and crashed the
render, leaving the trigger unrendered.
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M 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