Repository navigation
refactor(ui): deduplicate session menus and hovercards - #125478
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 17, 2026, 10:59 PM ET / August 18, 2026, 02:59 UTC. ClawSweeper reviewWhat this changesThe PR centralizes Control UI session-owner menus and portaled hovercard mechanics, disables privileged actions when required Gateway hello metadata is absent, and splits chat layout rendering to restore the line-limit margin. Merge readinessNo blocking correctness finding. Keep this maintainer-authored, maintainer-labeled PR open for an explicit landing decision and current-main refresh; its fail-closed handling of incomplete Gateway metadata matches the scoped Control UI policy. Priority: P2 Review scores
Verification
How this fits togetherThe Control UI consumes the Gateway hello response to decide which operator actions it can expose, and renders session menus and hovercards over chat and sidebar content. This change routes those inputs through shared UI helpers before producing accessible controls and previews. flowchart LR
A[Gateway hello response] --> B[Capability and scope checks]
B --> C[Session mutation controls]
D[Chat and sidebar triggers] --> E[Shared hovercard bootstrap]
E --> F[Portaled hovercard controller]
F --> G[Accessible preview dialog]
C --> H[Operator action request]
Decision needed
Why: The scoped UI policy supports the behavior, but this protected maintainer item is behind main and requires an explicit maintainer landing judgment. Before merge
Agent review detailsSecurityNone. PR surfaceSource -13, Tests +228. Total +215 across 54 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Retain the single shared menu/hovercard implementation and fail-closed metadata gate, then rebase or otherwise refresh the current-main merge result before landing. Do we have a high-confidence way to reproduce the issue? Not applicable: this is a refactor and policy-alignment PR rather than a standalone bug report; the PR supplies focused browser and unit coverage for the changed interactions. Is this the best way to solve the issue? Yes. Shared helpers replace three duplicated hovercard lifecycle implementations and two owner-menu implementations, while the required hello contract makes the removed legacy tolerance contrary to the scoped UI policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against aa8be5acf90e. LabelsLabel changes:
Label 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 (4 earlier review cycles)
|
4836ce1 to
d1e2cb5
Compare
d1e2cb5 to
f30f410
Compare
|
Land-ready at The red-main max-lines failure is repaired without a suppression: Verification:
ClawSweeper has no patch finding or technical P1 stop. Its P1 compatibility note is the intentional unsupported mixed-version UI/Gateway boundary documented in |
|
Merged via squash.
|
* refactor(ui): share session menu and hovercard mechanics * test(ui): align fixtures with gateway hello contract * fix(ui): close session access and focus gaps * test(ui): advertise sidebar custodian method * refactor(ui): split chat pane layout rendering * fix(ui): align rebased chat render checks
…ways canCallGatewayMethod hardened to strict advertisement+scope checks (#125478), which made the new ensureSchemaLoaded gate silently skip config.schema for legacy hellos without advertised scopes or a method list. Schema loads now skip only on a definitive denial (method advertised absent, or advertised scopes without operator.read), reusing the fail-open hasOperatorReadAccess semantics the rest of the non-admin UI uses; regression test pins the legacy snapshot path.
…ways canCallGatewayMethod hardened to strict advertisement+scope checks (#125478), which made the new ensureSchemaLoaded gate silently skip config.schema for legacy hellos without advertised scopes or a method list. Schema loads now skip only on a definitive denial (method advertised absent, or advertised scopes without operator.read), reusing the fail-open hasOperatorReadAccess semantics the rest of the non-admin UI uses; regression test pins the legacy snapshot path.
…ors (#125492) * test(control-ui): add --operator-scopes flag to the mock dev server * feat(control-ui): simplified settings experience for non-admin operators Non-admin browsers previously saw every settings page, many of which dead-ended or rendered enabled controls whose RPCs fail with 'missing scope: operator.admin'. - config.schema drops from operator.admin to operator.read: the schema is a static document describing options whose values are already readable via read-scoped config.get; admin-only schema only broke read-only settings rendering (Automation/Infrastructure/AI Agents/Communications showed 'Schema unavailable. Use Raw.'). - Settings sidebar and settings search hide admin-only routes (custodian, labs, updates, automation, infrastructure, mcp, security, secrets, cloud-workers, communications, ai-agents, model-setup) for non-admin viewers; legacy gateways without advertised scopes keep the full UI. - Channels, Devices, Worktrees, Memory Import, Profile gate their mutation controls on actual scopes with 'Browsing only…' notices instead of enabled-but-failing buttons; Devices no longer fires device.pair.list / exec.approvals.get without the scopes to call them (kills the two red error callouts on page load). - Scope-upgrade banner: dismissing it in the guidance phase (no in-app upgrade path) now hides it fully instead of leaving a permanent chip. - Config write coordinator surfaces scope refusals as a visible admin-required error instead of silently resolving false. * test(control-ui): advertise config.schema in the mock dev gateway ensureSchemaLoaded now checks method advertisement + scope before loading the schema; the mock harness must advertise config.schema like a real gateway does or schema-driven settings pages render empty in the mock. * fix(control-ui): close the worktree create draft on scope downgrade * perf(doctor): isolate memory health artifact Doctor lint loaded the broad Memory Core API barrel only to register health checks and read isolated check IDs. That synchronously pulled the full memory public graph into the first lint run, consuming most of the 120-second test budget. Load a dedicated doctor-health public artifact instead and verify it is packaged. The bisect boundary was 9de3ca5 (#125571); because that commit only adds upgrade-test assets, it exposed a pre-existing runner-sensitive cost rather than introducing the expensive import path. * test(control-ui): restore device lifecycle test boundary * perf(control-ui): lazy-load settings sidebar * fix(ui): recheck access after confirmations * fix(control-ui): gate presence-driven device reloads on pairing access The presence connectivity-change path still called device.pair.list without operator.pairing, the same invariant the pair-event and poller paths already guard; a limited browser got a doomed RPC on every connectivity change. * fix(control-ui): fail open on schema loads for legacy scope-less gateways canCallGatewayMethod hardened to strict advertisement+scope checks (#125478), which made the new ensureSchemaLoaded gate silently skip config.schema for legacy hellos without advertised scopes or a method list. Schema loads now skip only on a definitive denial (method advertised absent, or advertised scopes without operator.read), reusing the fail-open hasOperatorReadAccess semantics the rest of the non-admin UI uses; regression test pins the legacy snapshot path. * test(control-ui): split schema-access coverage into its own file runtime-config-capability.test.ts crossed the max-lines cap; the legacy fail-open regression and its denial counterpart move to a colocated schema-access test file. * fix(scripts): keep mapped Vitest lanes at their measured no-output floor The codex extension shard legitimately works in silence beyond 300s under the default reporter (measured 61s import + 293s testing at ~95% CPU); the CI-wide OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 env override shrank the lane below that and the watchdog killed healthy runs, flipping with incidental flake output (#125825). Per-config entries in VITEST_CONFIG_NO_OUTPUT_TIMEOUT_MS now act as measured silence floors: a global env value may widen a mapped lane's window but no longer shrinks it; unmapped configs and the explicit '0' disable keep env verbatim. Adds the codex extension lane to the map at the extra-long tier (same class as the discord entry from #123025).
…ors (openclaw#125492) * test(control-ui): add --operator-scopes flag to the mock dev server * feat(control-ui): simplified settings experience for non-admin operators Non-admin browsers previously saw every settings page, many of which dead-ended or rendered enabled controls whose RPCs fail with 'missing scope: operator.admin'. - config.schema drops from operator.admin to operator.read: the schema is a static document describing options whose values are already readable via read-scoped config.get; admin-only schema only broke read-only settings rendering (Automation/Infrastructure/AI Agents/Communications showed 'Schema unavailable. Use Raw.'). - Settings sidebar and settings search hide admin-only routes (custodian, labs, updates, automation, infrastructure, mcp, security, secrets, cloud-workers, communications, ai-agents, model-setup) for non-admin viewers; legacy gateways without advertised scopes keep the full UI. - Channels, Devices, Worktrees, Memory Import, Profile gate their mutation controls on actual scopes with 'Browsing only…' notices instead of enabled-but-failing buttons; Devices no longer fires device.pair.list / exec.approvals.get without the scopes to call them (kills the two red error callouts on page load). - Scope-upgrade banner: dismissing it in the guidance phase (no in-app upgrade path) now hides it fully instead of leaving a permanent chip. - Config write coordinator surfaces scope refusals as a visible admin-required error instead of silently resolving false. * test(control-ui): advertise config.schema in the mock dev gateway ensureSchemaLoaded now checks method advertisement + scope before loading the schema; the mock harness must advertise config.schema like a real gateway does or schema-driven settings pages render empty in the mock. * fix(control-ui): close the worktree create draft on scope downgrade * perf(doctor): isolate memory health artifact Doctor lint loaded the broad Memory Core API barrel only to register health checks and read isolated check IDs. That synchronously pulled the full memory public graph into the first lint run, consuming most of the 120-second test budget. Load a dedicated doctor-health public artifact instead and verify it is packaged. The bisect boundary was 76e459a (openclaw#125571); because that commit only adds upgrade-test assets, it exposed a pre-existing runner-sensitive cost rather than introducing the expensive import path. * test(control-ui): restore device lifecycle test boundary * perf(control-ui): lazy-load settings sidebar * fix(ui): recheck access after confirmations * fix(control-ui): gate presence-driven device reloads on pairing access The presence connectivity-change path still called device.pair.list without operator.pairing, the same invariant the pair-event and poller paths already guard; a limited browser got a doomed RPC on every connectivity change. * fix(control-ui): fail open on schema loads for legacy scope-less gateways canCallGatewayMethod hardened to strict advertisement+scope checks (openclaw#125478), which made the new ensureSchemaLoaded gate silently skip config.schema for legacy hellos without advertised scopes or a method list. Schema loads now skip only on a definitive denial (method advertised absent, or advertised scopes without operator.read), reusing the fail-open hasOperatorReadAccess semantics the rest of the non-admin UI uses; regression test pins the legacy snapshot path. * test(control-ui): split schema-access coverage into its own file runtime-config-capability.test.ts crossed the max-lines cap; the legacy fail-open regression and its denial counterpart move to a colocated schema-access test file. * fix(scripts): keep mapped Vitest lanes at their measured no-output floor The codex extension shard legitimately works in silence beyond 300s under the default reporter (measured 61s import + 293s testing at ~95% CPU); the CI-wide OPENCLAW_VITEST_NO_OUTPUT_TIMEOUT_MS=300000 env override shrank the lane below that and the watchdog killed healthy runs, flipping with incidental flake output (openclaw#125825). Per-config entries in VITEST_CONFIG_NO_OUTPUT_TIMEOUT_MS now act as measured silence floors: a global env value may widen a mapped lane's window but no longer shrinks it; unmapped configs and the explicit '0' disable keep env verbatim. Adds the codex extension lane to the map at the extra-long tier (same class as the discord entry from openclaw#123025).
What Problem This Solves
The Control UI carried two independent implementations of session-owner assignment menus and three copies of portaled-hovercard lifecycle/bootstrap behavior. Those copies already encoded subtle, surface-specific focus rules and were vulnerable to drifting independently. The Gateway method gate also retained an older-version tolerance for missing method/scopes metadata even though the bundled UI and Gateway ship as one version and the current hello protocol requires both fields.
Why This Change Was Made
This extracts canonical session-owner menu rendering/parsing, lazy hovercard definition, and portaled hovercard intent/placement mechanics. Domain data loading and focus policy remain in each hovercard runtime: GitHub keeps its pointer-vs-focus release behavior, session links remain noninteractive, and progress cards retain store/revision ownership. Gateway method gating now fails closed when the current required metadata is absent while preserving the explicit registered-but-unadvertised method escape hatch.
The same required-metadata rule now owns session-specific mutation access too. Session-link focus intent is recorded across pointer-to-keyboard transitions, so a focused trigger continues holding its card open after the pointer leaves.
Protocol claims were checked against
packages/gateway-protocol/src/schema/frames.tsandsrc/gateway/server/ws-connection/connect-hello.ts:features.methods,auth.role, andauth.scopesare required and emitted by the current producer.Red-main repair
While this PR was being prepared, canonical main CI run 32092049192 failed
eslint(max-lines):ui/src/pages/chat/chat-pane-render.tswas 715 physical lines and 702 lint-counted lines. Clear provenance: commit47399310a08efrom PR #125231 added four task-suggestion properties, moving the effective count from 698 to 702; the code/PR author and merger were @vyctorbrzezowski on August 17, 2026.This PR repairs main without a suppression by extracting the final header/board/sidebar/lightbox frame into the concept-owned
chat-pane-layout-render.tssibling.chat-pane-render.tsis now 640 physical lines, leaving comfortable headroom while keeping render order and behavior unchanged.User Impact
Normal current-version behavior is unchanged, with one shared implementation now protecting menu semantics, hovercard accessibility, traversal grace, viewport clamping, and lazy property restoration. Unsupported or malformed Gateway hello payloads no longer enable gated actions by omission.
Production LOC: +773/-827 (net -54) | Tests/test support: +631/-362 (net +269) | Tooling: +0/-0
AI-assisted: yes. I reviewed the implementation and verified the source contracts directly.
Evidence
node scripts/run-vitest.mjs ui/src/components/session-menu.test.ts ui/src/pages/chat/components/chat-header-session-menu.test.ts ui/src/components/github-link-hovercard.test.ts ui/src/components/session-link-hovercard.test.ts ui/src/app/native-link-routing.test.ts ui/src/lib/gateway-methods.test.ts— 92 tests passed.OPENCLAW_CAPTURE_UI_PROOF=1 node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/session-progress-hovercard.e2e.test.ts ui/src/e2e/github-link-hovercard.e2e.test.ts— 7 real-browser mocked-Gateway tests passed, including pointer traversal, dialog ARIA, keyboard focus, viewport bounds, and lazy registration.pnpm test:ui— full Control UI suite passed: 687 files, 9,828 tests, 1 intentional skip.node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/operator-admin.e2e.test.ts— 4 tests passed; missing method metadata now disables admin mutations without dispatch.node scripts/run-vitest.mjs ui/src/lib/gateway-methods.test.ts ui/src/lib/session-method-access.test.ts ui/src/components/session-link-hovercard.test.ts— 27 tests passed, including missing metadata and hover-to-focus regressions.node scripts/run-vitest.mjs ui/src/pages/chatafter rebasing onto main — 138 files passed, 2,931 tests passed, 2 files/11 tests intentionally skipped.pnpm tsgo:ui, and targetedoxfmt --checkpassed.node scripts/check-changed.mjsafter the final commit — passed formatting, guards, max-lines, dead-export scans, UI/core test typechecks, lint/style checks, and Control UI i18n verification..agents/skills/autoreview/scripts/autoreview --mode branch --base origin/main --stream-engine-outputplus the focused CI-repair autoreview — clean; no accepted/actionable findings.Portaled progress card after lazy pointer activation:
Keyboard focus visibly transferred into the portaled card link: