Repository navigation
fix(ui): stop duplicate Sessions page queries - #125018
Conversation
Make the Sessions route and page share the managed session-list owner so startup hydration, reconnects, filters, and mutations cannot schedule duplicate raw roster requests. Preserve last-good rows and retire stale query epochs.
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs changes before merge. Reviewed August 16, 2026, 11:51 PM ET / August 17, 2026, 03:51 UTC. ClawSweeper reviewWhat this changesThe PR routes the Sessions page through a shared managed session-list query to eliminate duplicate Gateway requests during startup and refreshes. Regression provenancePossible regression — suspected (reviewed change). No predecessor PR is attributed. Merge readinessKeep this maintainer-owned PR open: the new managed Sessions query is not refreshed after a terminal Priority: P1 Review scores
Verification
How this fits togetherThe Control UI fetches session rosters from the Gateway through a shared session capability. The Sessions route seeds its exact query and the page subscribes to updates while Gateway events refresh matching lists. flowchart LR
A[Gateway session events] --> B[Session capability]
B --> C[Canonical roster]
B --> D[Managed Sessions query]
E[Sessions route] --> D
D --> F[Sessions page]
C --> G[Sidebar and other consumers]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +53, Tests +511. Total +564 across 11 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Copy recommended automerge instructionTechnical reviewBest possible solution: Extend the session-event owner so terminal messages schedule matching subscribed managed lists, then add a regression for the Sessions-style query without restoring page-local raw loads or canonical-revision reloads. Do we have a high-confidence way to reproduce the issue? Yes, from source: load a Sessions-style managed query, emit a terminal Is this the best way to solve the issue? No: sharing the managed query is the right direction, but the event owner must refresh that managed query on terminal messages before this can replace the prior canonical-completion reload. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5ac88c5f207a. LabelsLabel changes:
Label justifications:
EvidenceAcceptance criteria:
What 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
|
|
Land-ready proof for
Root cause and owner boundary: the route/page raw loader and canonical-state invalidation bridge independently reloaded one roster demand. The repair makes the shared session capability the single keyed |
|
Merged via squash.
|
Make the Sessions route and page share the managed session-list owner so startup hydration, reconnects, filters, and mutations cannot schedule duplicate raw roster requests. Preserve last-good rows and retire stale query epochs.
Related: #124968
AI-assisted: yes
What Problem This Solves
The Sessions route, page, and canonical session state multiplied one roster demand into two identical page requests before startup hydration completed and a third request afterward. That caused avoidable Gateway work and allowed late canonical completion to trigger another page reload even though the exact Sessions query had already completed.
Why This Change Was Made
The shared session capability now owns one exact managed query for the page. The route seeds that query, the page subscribes to its snapshot, and filter changes, mutation tails, and reconnects refresh the same owner. The old raw page load and canonical-invalidation reload machinery is removed rather than retained as a compatibility path.
User Impact
Sessions now loads and refreshes once per exact query, keeps last-good rows visible when a refresh fails, and preserves active-minutes/limit/global/unknown/status filters, deep links, selected/all-agent scope, local search/sort/pagination, transcript search, destructive archived pagination, mutation ordering, stale-request retirement, and checkpoint reconciliation. There is no visual design change.
Evidence
/sessionsstartup issued two identical exact page queries before canonical startup completion, then a third after completion (2 -> 3).1 -> 1).OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs ui/src/lib/sessions/index-list.test.ts ui/src/pages/sessions/route.test.ts ui/src/pages/sessions/sessions-page.test.ts ui/src/pages/sessions/sessions-page.roster.test.ts ui/src/pages/sessions/sessions-page.archived.test.ts ui/src/pages/sessions/agent-scope.test.ts— 6 files across 2 shards, 62 tests passed.node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/session-list-filter.e2e.test.ts— 1 file, 4 tests passed.node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/agent-page-scope.e2e.test.ts— 1 file, 4 tests passed.node_modules/.bin/oxfmt --checkover all 11 changed paths andgit diff --check origin/main...HEAD— clean.AGENTS_HOME="$HOME/.claude" "$HOME/.claude/skills/autoreview/scripts/autoreview" --mode branch --base origin/main— clean, no accepted/actionable findings; patch-correct score 0.97.run_5edb94ba28d6on stopped leasecbx_4d3e65ef283e— https://crabbox.openclaw.ai/portal/runs/run_5edb94ba28d6. The earlier Blacksmith Testbox preflight did not execute remote code because theblacksmithbinary was missing; AWS was the successful fallback.8b7cc0e6dcca5e04cad1278a8ef92c0bb2bc5263has the same stable patch ID as reviewed source commit9d98a69574e0fc7ef46a0ae3ebbab416dcc7c070.+215/-222(net-7); tests/support+685/-114.Visual parity (sanitized mocked Gateway data; same Writer-scoped Sessions UI before and after):