Repository navigation
refactor(ui): tidy the roster refresh owner and session test harnesses - #129757
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
35e5c5d to
d524e80
Compare
|
Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 10:33 PM ET / August 26, 2026, 02:33 UTC. ClawSweeper reviewWhat this changesThe 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 provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessNo 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 Review scores
Verification
Live VerificationCommand: Result: FAIL (partial) — step 2 Assertions:
How this fits togetherThe 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
Decision needed
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
Agent review detailsSecurityNone. PR surfaceSource +35, Tests -45. Total -10 across 7 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest 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. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
…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.
d524e80 to
7021d92
Compare
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.
|
Merged via squash.
|
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.
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 thatsession-capability.test-support.tsalready 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:
preserveCurrentSessionRowandretainSessionPaginationWindoware named extractions ofload()'s decision blocks (its spine now reads normalize → loading publish → request+owner merge → provisional return → decide → publish);hasForegroundListOptions/hasSeededListOptionscollapse into one closedlistOptionsSourcemode per house style. The test-support module gainsselfUsersupport,sessionChangedEvent, andcreateSessionCapabilityHarness, and the duplicated local copies die. The attention-panel invariant (panel opens insideopenclaw-menu-surface) moves tosidebar-attention.test.tsagainst 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.tsruns that match CI instead of failing by construction.Evidence
pnpm check:changedexit 0.node scripts/run-vitest.mjs ui/src/components/app-sidebar.test.ts --run -t "transient menus".load(); tests net −50 from harness dedup; the moved attention test keeps its exact assertion set.