Skip to content

fix(ui): preserve session, tool, archive, and focus ownership - #117191

Merged
steipete merged 3 commits into
mainfrom
codex/qa400-ui-chat
Aug 1, 2026
Merged

steipete merged 3 commits into
mainfrom
codex/qa400-ui-chat

Conversation

@steipete

@steipete steipete commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The Control UI had independently reproducible bugs in streamed tool evidence, destructive archive pagination, selected-agent scope, session action accessibility, menu dismissal, keyboard context menus, popup lifecycle, and cross-route focus handoff. Exact-current-main owner regressions failed 28 times across ten focused files, including silent incomplete destructive deletion and independently verified real-Chromium focus loss.

Why This Change Was Made

  • Match tool calls and results by their authoritative invocation IDs; do not mistake persisted transcript-row IDs for provider invocation IDs.
  • Invalidate the Lit host when deferred tool projections or expiring fallback status actually change visible state.
  • Reuse one authoritative paginated-session owner, deduplicate moving rows, retain the maximum observed optional roster total across pages and passes, and make destructive archive enumeration fail closed on incomplete results.
  • Snapshot the actual selected/all-agent scope and remove route deep-link narrowing from “delete all archived.”
  • Restore durable keyboard focus only for this menu's actual dropdown items; keep nested dialogs and outside elements in control of their own Tab order.
  • Record sidebar context-menu focus ownership at the originating row before rendering can invalidate the active element.
  • Replace two duplicated Web Awesome dropdown implementations with one persistent dropdown whose menu/picker body changes in place. This removes the real popup-animation focus races when opening and leaving the icon picker.
  • Preserve the initiating hub-tab focus owner and the latest navigation generation during deferred route handoff.
  • Give per-row session action buttons unique, localized names.

The persistent dropdown removes an obsolete duplicate owner. The follow-up cleanly extracts the entire destructive-archive regression group and its shared page fixture into focused owners, reducing the formerly oversized lifecycle test from 1,158 to 704 lines without removing one assertion. Overall production change remains +17 lines across nine owners; every additional production line enforces concrete authoritative pagination, destructive-operation safety, focus ownership, or accessible labeling rather than introducing configuration, compatibility stacks, or new dependencies.

Canonical Vitest Mock-Registry Root Cause

The memory settings and memory mutation suites both own module-global mocks for the same plugin API. Their previous placement in Vitest's shared isolate: false graph made results depend on worker packing: the existing hosted three-worker check exposed genuine cross-suite mock contamination.

  • Exact immutable pre-fix reproduction: running both unchanged suites together produced 8 failed / 56 total tests; each suite passed alone.
  • Canonical repair: register both existing suites in test/vitest/vitest.ui-isolated-paths.mjs. Both the root and package runners already exclude these entries from their shared graph and include them in their existing isolate: true projects.
  • Identical focused rerun: 56 / 56 passed without changing any production code, test assertions, timeouts, retries, or mocks.
  • Hosted-equivalent adversarial run: pnpm --dir ui test --maxWorkers 3 passed 530 files / 7,749 tests, including both isolated memory suites and real Chromium browser coverage.

Protected Maintainer Acceptance: Destructive Archived Deletion

This protected-maintainer change intentionally defines Delete all archived as a complete, selected-scope, fail-closed destructive operation:

  • Snapshot agentSelection.state.scopeId at the action owner. A selected agent limits enumeration to exactly that agent; the explicit all-agents scope omits agentId and includes every agent. A route deep-link or linked thread must never silently narrow either scope.
  • Re-enumerate the complete archived roster through the canonical paginated session owner before showing confirmation or deleting anything. Retain the greatest reported authoritative total across every page/retry pass and deduplicate stable session keys even when updated-at ordering moves rows between pages.
  • If any page fails, its offset stalls, or the complete roster remains below the greatest authoritative total, expose the concrete enumeration error and stop before confirmation and before any deletion. Partial destructive success is explicitly rejected.
  • Delete only confirmed archived rows, exactly once, with transcript removal and archivedOnly: true. Both selected-agent and all-agent contracts, moving rows, missing pages, omitted later totals, and incomplete rosters have focused regression coverage and actual mocked-Gateway Chromium proof.

Maintainer decision: ACCEPTED — require complete selected/all-agent archived-roster enumeration and fail closed before confirmation or deletion when enumeration is incomplete. Preserve selected/all-agent scope and approve the persistent Web Awesome dropdown ownership model as one reviewed landing unit; this records the protected-maintainer acceptance requested by the latest ClawSweeper review.

Inspected Upstream Dropdown/Dialog Contract

The installed dependency is pinned to @awesome.me/webawesome 3.10.0 (ui/package.json:12; installed node_modules/@awesome.me/webawesome/package.json:7). Maintainer review personally inspected the actual installed implementation, not only OpenClaw wrappers:

  • node_modules/@awesome.me/webawesome/dist-cdn/chunks/chunk.YEKDZDVC.js:81: the dropdown installs a document-level keydown owner; Escape restores its trigger.
  • node_modules/@awesome.me/webawesome/dist-cdn/chunks/chunk.YEKDZDVC.js:166: Tab unconditionally invokes asynchronous hideMenu(), explaining why an inaccessible transient trigger otherwise loses keyboard ownership.
  • node_modules/@awesome.me/webawesome/dist-cdn/chunks/chunk.YEKDZDVC.js:360: showMenu() registers document handlers, animates, and focuses the first dropdown item; recreating the popup therefore replays its lifecycle and can steal icon-picker focus.
  • node_modules/@awesome.me/webawesome/dist-cdn/chunks/chunk.YEKDZDVC.js:391: hideMenu() removes document handlers and completes asynchronously; :545 restores the trigger after normal item selection.
  • node_modules/@awesome.me/webawesome/dist-cdn/chunks/chunk.ED2QTHPZ.js:71: nested dialogs own Escape; :91 closes asynchronously and restores their original trigger. The Control UI therefore redirects Tab only for an actual dropdown item contained by the current owner, leaving nested dialogs and unrelated outside targets untouched.

These inspected contracts directly support the persistent keyed dropdown, contained-item-only capture, icon-picker initial focus, Back focus restoration, and nested-dialog keyboard regression coverage.

User Impact

Operators see accurate live tool output, error, and canvas evidence; destructive archive actions either enumerate the complete selected scope or visibly refuse; duplicate/moving sessions are deleted once; screen-reader actions identify their owning thread; nested icon dialogs retain keyboard focus; Back restores the correct action; normal and keyboard context menus hand off focus to the next visible thread; cross-route keyboard navigation does not steal intentional focus.

Evidence

  • Immutable candidate: ca5851447ea2e2a30082853f7f4ba665bfea445c; original frozen parent: 865a7286c8a5073c25822e1859c6431ef42471b5; reviewed first commit c1ae8280a2518e7e876ab60aa1659996b3d7e0b6.
  • Latest checked canonical main: 4fb19fb8c586b2d7801d1c512a4ac21e4d826505; the complete UI tree and canonical Vitest registry remain byte-identical to the original reviewed parent; the synthetic merge preserves the exact reviewed candidate UI/registry and the exact latest-main Gateway, agents, session-config, and protocol trees; clean synthetic merge tree e230a10f67e6a7ab39614cb988957302f88dddb9.
  • Fresh-main cross-owner audit: Gateway session-store changes add only count-bounded optional startup prewarm and preserve request-time selected/all-agent listing; the new server regression explicitly proves sessions.list remains available above 2,000 rows. Chat-send/session-steer changes move admission/idempotency ownership before abort/dispatch without changing the UI's session keys, run IDs, tool-event identity, pagination fields, protocol, or destructive archive contract. The newer sandbox-browser change filters user-supplied Docker mounts conflicting with protected read-only skill overlays and leaves the Control UI browser panel, browser API, session owner, and Gateway contract unchanged. Synthetic merged trees preserve the reviewed UI byte-for-byte and preserve latest-main Gateway, sandbox-browser, session-config, agents, and protocol byte-for-byte.
  • Authentic frozen-main RED with committed candidate regression tests: 28 failures / 374 passes across ten owner and sibling files.
  • Exact-candidate focused GREEN: 12 files / 408 tests passed across tool cards, stream reconciliation, fallback/partial repaint, sessions page, transcript search, sidebar, hub tabs, native/catalog/session menus, and child pagination.
  • Actual Chromium: 2 full mocked-Gateway suites / 18 tests passed / zero skipped. Includes moving archived rows deleted exactly once, nested icon focus/Tab/Back, actual Shift+F10 context-menu handoff, reconnect, selection, and touch.
  • Exact-head hosted-equivalent pnpm --dir ui test --maxWorkers 3: 530 files / 7,749 tests passed / zero skipped, including both correctly isolated memory plugin suites.
  • Exact-head full repository pnpm lint: core 15,214 files, plugins 8,110 files, scripts 877 files, zero warnings/errors; generated-locale verification passes (4,652 source keys; 98 baseline entries).
  • Exact-head production and test typechecks: pnpm tsgo:ui and pnpm tsgo:test:ui, both green. The host already explicitly declares planStatus at ui/src/pages/chat/tool-stream.ts:69; both typechecks independently disprove an earlier automated-review false positive.
  • All 24 changed files pass targeted formatting and lint; generated-locale ownership remains untouched.
  • Fresh exact-head complete-branch Codex Sol/high structured review through P3, genuine TruffleHog clean; direct source-owner and canonical message-schema contracts inspected: zero accepted P0/P1/P2/P3 findings; patch correct; confidence 0.91.
  • At least four independent exact-SHA specialist/blind owner/caller/dependency reviews: clean P0–P3.
  • Blacksmith Testbox: exact-head workflow run; lease tbx_01kyxszr9a12dpcqp6jdym18ep independently verified stopped/completed after lint, both typechecks, the full UI suite, and real Chromium proof.
  • No public config, plugin SDK, Gateway protocol, auth, provider routing, persistent storage, SQLite schema, migration, generated translation memory, dependency, shared-checkout, or GitHub mutation.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: XL maintainer Maintainer-authored PR labels Aug 1, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. 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. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels Aug 1, 2026
@clawsweeper

clawsweeper Bot commented Aug 1, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 1, 2026, 1:32 AM ET / 05:32 UTC.

ClawSweeper review

What this changes

The branch centralizes Control UI ownership for tool-stream identity, archived-session deletion, selected-agent scope, accessible session actions, dropdown focus, route focus handoff, and isolated UI mock registries.

Merge readiness

⚠️ Ready for maintainer review - 5 items remain

Keep this PR open for protected maintainer review. Current main has not incorporated the PR’s Control UI changes, and the branch has focused source coverage plus supplied Chromium/CI proof with no concrete patch defect found; however, the intentional fail-closed destructive-session behavior and dropdown lifecycle contract still require confirmation on the exact merge result.

Priority: P2
Reviewed head: ca5851447ea2e2a30082853f7f4ba665bfea445c
Owner decision: Required. See Decision needed.

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) Strong focused proof and a coherent repair support a good merge candidate, with protected destructive-session semantics still requiring a human decision.
Proof confidence 🦞 diamond lobster (5/6) ✨ media proof bonus Sufficient (linked_artifact): The PR provides after-fix mocked-Gateway Chromium evidence for the visible archive and focus paths, and the supplied check context records successful UI E2E and real-behavior-proof runs.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Verified Sufficient (linked_artifact): The PR provides after-fix mocked-Gateway Chromium evidence for the visible archive and focus paths, and the supplied check context records successful UI E2E and real-behavior-proof runs.
Evidence reviewed 8 items Current-main comparison: The merge base is 865a7286c8a5073c25822e1859c6431ef42471b5; comparing it with current main produced no changed paths under ui/ or the isolated-test registry, so current main does not already contain this PR’s central UI repair.
Fail-closed archive owner: The proposed archive action snapshots selected-agent scope, drops route-only search and agent narrowing, uses the shared paginator, and stops before confirmation when enumeration is incomplete.
Shared pagination invariant: The helper preserves the maximum authoritative optional total across pages and throws on an incomplete roster when the destructive caller requests that guarantee; its non-destructive child-session and transcript-search callers retain their existing contracts.
Findings None None.
Security None None.

How this fits together

The Control UI consumes Gateway session listings and streamed tool events, then renders chat, session actions, and keyboard-driven menus. This branch changes the owners that reconcile those inputs into visible tool evidence, destructive archive operations, and focus behavior.

flowchart LR
  Gateway[Gateway session and tool events] --> Owners[Control UI state owners]
  Owners --> ToolIdentity[Tool invocation identity]
  Owners --> SessionRoster[Paginated session roster]
  Owners --> MenuFocus[Menu and route focus]
  ToolIdentity --> ChatEvidence[Accurate tool evidence]
  SessionRoster --> ArchiveDelete[Fail-closed archive deletion]
  MenuFocus --> AccessibleUI[Accessible keyboard interaction]
Loading

Decision needed

Question Recommendation
Does the protected acceptance apply to this exact branch and merge result: selected/all-agent scoped archive deletion must enumerate the complete roster and visibly refuse deletion when enumeration is incomplete? Confirm the protected deletion semantics: Accept complete selected-scope enumeration and fail-closed behavior as the intended operator contract, then review the rebased merge result.

Why: This is an intentional user-visible destructive-operation policy, not a mechanically provable implementation detail; the maintainer label requires explicit human handling despite the supplied proof and clean patch review.

Before merge

  • Resolve merge risk (P1) - This protected change intentionally makes “Delete all archived” fail closed when a complete selected-scope roster cannot be established; a maintainer must confirm that semantic on the exact merge result.
  • Resolve merge risk (P1) - The checkout lacks installed Web Awesome source, so the dependency lifecycle rationale behind the focus fix could not be independently verified in this review.
  • Resolve merge risk (P1) - GitHub reports the branch as cleanly mergeable but behind current main; refresh the protected review against the actual merged tree before landing.
  • Complete next step (P2) - The remaining blocker is explicit maintainer confirmation of an intentional destructive-session policy and its exact current-main merge behavior, not a narrow automated repair.
Agent review details

Security

None.

PR surface

Source +224, Tests +573. Total +797 across 24 files.

View PR surface stats
Area Files Added Removed Net
Source 11 484 260 +224
Tests 13 864 291 +573
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 24 1348 551 +797

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: ui/src/components/session-menu.test.ts, serialized state: ui/src/components/session-menu.ts, serialized state: ui/src/components/sessions-hub-tabs.test.ts, serialized state: ui/src/e2e/session-management.archive.e2e.test.ts, serialized state: ui/src/e2e/session-management.sidebar.e2e.test.ts, serialized state: ui/src/lib/sessions/paged-session-rows.ts, and 14 more. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Accept the complete-roster contract (recommended)
    Confirm that an incomplete archived roster must stop before confirmation and deletion, then recheck the exact merge result against current main.
  2. Pause the destructive-operation change
    Hold or split the archive-deletion portion if maintainers do not want incomplete pagination to block the action.

Technical review

Best possible solution:

Keep one canonical paginated-session owner and land the focused UI repairs only after a maintainer confirms the selected/all-agent, complete-roster, fail-closed archive contract and the dropdown focus behavior on the current-main merge result.

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

Yes: the proposed head contains focused regression tests for the archive, tool-identity, and focus paths, and the supplied PR context reports after-fix mocked-Gateway Chromium proof. This read-only review did not execute those tests.

Is this the best way to solve the issue?

Unclear: shared pagination and owner-boundary repair are the narrowest source-level shape found, but the Web Awesome lifecycle contract was unavailable for direct dependency inspection and the destructive-operation policy remains a protected maintainer choice.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 0892684551fd.

Labels

Label justifications:

  • P2: The PR fixes bounded but user-visible Control UI session, tool-evidence, and keyboard-interaction regressions.
  • merge-risk: 🚨 session-state: Merging changes selected-agent session enumeration and the behavior of destructive archived-session deletion.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (linked_artifact): The PR provides after-fix mocked-Gateway Chromium evidence for the visible archive and focus paths, and the supplied check context records successful UI E2E and real-behavior-proof runs.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR provides after-fix mocked-Gateway Chromium evidence for the visible archive and focus paths, and the supplied check context records successful UI E2E and real-behavior-proof runs.

Evidence

What I checked:

  • Current-main comparison: The merge base is 865a7286c8a5073c25822e1859c6431ef42471b5; comparing it with current main produced no changed paths under ui/ or the isolated-test registry, so current main does not already contain this PR’s central UI repair. (ui/src/pages/sessions/sessions-page.ts:788, 0892684551fd)
  • Fail-closed archive owner: The proposed archive action snapshots selected-agent scope, drops route-only search and agent narrowing, uses the shared paginator, and stops before confirmation when enumeration is incomplete. (ui/src/pages/sessions/sessions-page.ts:809, c1ae8280a251)
  • Shared pagination invariant: The helper preserves the maximum authoritative optional total across pages and throws on an incomplete roster when the destructive caller requests that guarantee; its non-destructive child-session and transcript-search callers retain their existing contracts. (ui/src/lib/sessions/paged-session-rows.ts:35, c1ae8280a251)
  • Tool-stream identity boundary: The proposed extractor explicitly excludes a transcript row’s top-level id before resolving the tool-use identifier, preventing persisted message identity from being treated as provider invocation identity. (ui/src/pages/chat/tool-stream-identity.ts:68, c1ae8280a251)
  • Focused regression coverage: The branch adds archived-session tests for complete enumeration, moving rows, omitted later totals, incomplete pagination, and selected/all-agent scope; the supplied PR context also reports mocked-Gateway Chromium coverage and green UI CI. (ui/src/pages/sessions/sessions-page.archived.test.ts:1, ca5851447ea2)
  • Area provenance: The existing archive behavior and moving-roster paginator date to adjacent July 31 fixes by Peter Steinberger; this branch continues that owner boundary rather than introducing a parallel deletion path. (ui/src/pages/sessions/sessions-page.ts:795, 89394978e0a6)

Likely related people:

  • Peter Steinberger: Git history attributes the adjacent hidden-selection and moving-roster fixes, the proposed paginator/destructive-owner changes, and the UI session-menu work to Peter Steinberger. (role: feature owner and recent area contributor; confidence: high; commits: 0ae516da1fa3, 89394978e0a6, c1ae8280a251; files: ui/src/pages/sessions/sessions-page.ts, ui/src/lib/sessions/paged-session-rows.ts, ui/src/components/session-menu.ts)
  • Alix-007: History identifies Alix-007 on the earlier Control UI session-management path that this repair extends, but the direct archive and dropdown ownership trail is primarily Peter Steinberger’s. (role: adjacent UI contributor; confidence: low; commits: 5c97107c7ace; files: ui/src/pages/sessions/sessions-page.ts, ui/src/components/session-menu.ts)

Rank-up moves

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

  • Confirm the protected selected/all-agent fail-closed archive contract on the exact current-main merge result.
  • Recheck the Web Awesome dropdown lifecycle from the installed dependency source or an equivalent reproducible runtime artifact before final merge approval.

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 (3 earlier review cycles)
  • reviewed 2026-08-01T03:49:12.632Z sha c1ae828 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T04:24:33.845Z sha 6e71dd8 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-01T05:02:57.709Z sha ca58514 :: needs maintainer review before merge. :: none

@steipete
steipete merged commit ad409a8 into main Aug 1, 2026
182 of 184 checks passed
@steipete
steipete deleted the codex/qa400-ui-chat branch August 1, 2026 05:45
@steipete

steipete commented Aug 1, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 1, 2026
…aw#117191)

* fix(ui): unify tool, session, and keyboard interaction owners

* refactor(ui): separate archived session regression coverage

* test(ui): isolate memory plugin mutation mock registries

---------

Co-authored-by: Peter Steinberger <[email protected]>
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: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: XL 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