Skip to content

Control UI: parallelize session roster loads - #129175

Merged
steipete merged 1 commit into
mainfrom
perf/concurrent-session-roster-loads
Aug 25, 2026
Merged

steipete merged 1 commit into
mainfrom
perf/concurrent-session-roster-loads

Conversation

@steipete

@steipete steipete commented Aug 25, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The signed-in Control UI roster loaded its owner-only and shared session pages serially. On a normal Gateway connection, users paid both RPC round trips before the complete session roster was ready, making startup and reconnect hydration slower as session counts grew.

Why This Change Was Made

The canonical roster owner now starts the owner-only and shared sessions.list requests together. The shared request still waits for the provisional owner publication before it may publish, preserving the existing owner-first visual ordering, canonical membership rules, connection fencing, queued refresh ordering, pagination, and retained-pane behavior.

Non-primary queries and append requests remain single-load. This adds no protocol, config, polling, persistence, or compatibility surface.

User Impact

Signed-in roster request latency changes from approximately owner RTT + shared RTT to max(owner RTT, shared RTT). The owner roster still appears first, then the shared rows merge into it; repeated session switching and reconnect hydration retain their current behavior.

Control UI production delta is +15/-13 lines. Test/E2E delta is +15/-18 lines. The complete PR is +30/-31 lines (net -1), and the built startup bundle is 379 bytes below the committed gzip baseline.

Evidence

Focused verification on exact head 71f994f356695a56efda196035b5d28f923f7f5f:

  • node scripts/run-vitest.mjs run ui/src/lib/sessions/connection-hydration.test.ts — 18/18 passed.
  • node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/session-owner-first.e2e.test.ts ui/src/e2e/chat-retained-pane-hydration.e2e.test.ts — 2/2 passed, including concurrent dispatch with owner-first publication and reconnect hydration of a retained pane.
  • pnpm tsgo:ui — passed.
  • Focused oxlint and oxfmt --check — passed.
  • pnpm ui:build — all bundle budgets passed; startup JS 332.0 KiB gzip, 379 B below baseline.
  • Codex autoreview (gpt-5.6-sol, high) — clean, no accepted or actionable findings.

Live proof used an isolated non-default Gateway, the freshly built Control UI, and real OpenAI API credentials:

  • 18 sessions total: 12 OpenClaw proof sessions, 5 Codex-harness sessions, and the default session.
  • A real openai/gpt-5.6-sol OpenClaw turn returned its expected nonce.
  • Four openai/gpt-5.6-luna Codex sessions ran concurrently; every turn returned its unique nonce, reported agentHarnessId: "codex", and used a distinct session ID.
  • Chromium repeatedly switched across all 12 Performance sessions and both OpenClaw and Codex groups on the exact built head.
  • The served hashed entry asset matched dist/control-ui byte-for-byte.
  • The inspected 16.7-second video and final screenshot are published in the live proof comment; neither contains credentials or errors.

Codex contract inspection used sibling source at d52478c52ef09f001142a4b82339467c3880877f: app-server dispatches start and resume separately (codex-rs/app-server/src/message_processor.rs:1116-1149); fresh threads receive generated IDs and are rejected rather than aliased on collision (codex-rs/core/src/thread_manager.rs:128-155, codex-rs/core/src/thread_manager.rs:2008-2050); resume preserves the requested stored thread identity and auto-attaches its listener (codex-rs/app-server/src/request_processors/thread_processor.rs:3519-3637, thread_processor.rs:3780-3825); and each live thread owns an event loop whose translated notifications retain that thread ID, so events from concurrent threads can be demultiplexed after interleaving (codex-rs/app-server/src/request_processors/thread_lifecycle.rs:221-384, codex-rs/app-server/src/bespoke_event_handling.rs:143-187).

Known harness note: the repository's separate isolated Codex Vitest live wrapper stopped before provider admission because its temporary prepared runtime omitted bundled plugin registration. The production Gateway proof above exercised the Codex harness successfully; the wrapper setup remains a separate test-infrastructure follow-up.

@clawsweeper

clawsweeper Bot commented Aug 25, 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: S maintainer Maintainer-authored PR labels Aug 25, 2026

Copy link
Copy Markdown
Contributor Author

Live Control UI performance proof

Live-tested exact head 71f994f356695a56efda196035b5d28f923f7f5f through a freshly built Control UI served by an isolated, non-default real Gateway.

  • Seeded 12 OpenClaw proof sessions and 5 Codex-harness sessions (18 total including default).
  • A real openai/gpt-5.6-sol OpenClaw turn returned the expected nonce.
  • Four real openai/gpt-5.6-luna Codex turns ran concurrently. Each returned its unique nonce, reported agentHarnessId: "codex", and used a distinct session ID.
  • Drove repeated Chromium switching across all 12 Performance sessions and then across the OpenClaw and Codex groups.
  • Verified the Gateway-served hashed entry asset byte-for-byte against dist/control-ui.

The published 16.7-second video starts connected, rapidly switches the populated session roster, and ends on a real Codex response. The published final screenshot shows the connected exact build, Performance rows, Codex group, and real response. I inspected both captures; neither shows credentials or errors.

Codex contract source was inspected directly at openai/codex@d52478c: start/resume routing, generated and resumed thread identity, per-thread listeners, and thread-ID-bearing translated notifications support demultiplexing concurrent interleaved sessions. Exact file/line citations are in the PR body.

Focused local checks also passed: 18 unit tests, 2 browser E2E tests, UI typecheck, focused lint/format, bundle budgets, and high-effort Codex autoreview. The production diff is +15/-13 lines; total diff is net -1 line.

Known harness note: the separate isolated Codex Vitest live wrapper stopped before provider admission because its temporary runtime omitted bundled plugin registration. The production Gateway proof above exercised the Codex harness successfully; that wrapper setup is a separate test-infrastructure follow-up.

https://ampcode.com/user-content/artifacts/15f55d57b95e73ff659c481c7565fef277bb0f97b9f1ed1fb83a30af28775e60-file.mp4

Connected Control UI after repeated OpenClaw and Codex session switching

@clawsweeper clawsweeper Bot added 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. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. labels Aug 25, 2026
@clawsweeper

clawsweeper Bot commented Aug 25, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 25, 2026, 5:06 AM ET / 09:06 UTC.

ClawSweeper review

What this changes

The PR starts the owner-only and shared initial session-roster requests concurrently, while keeping the owner rows visible before shared rows merge.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

Keep open. No concrete patch defect was found; this maintainer-authored, maintainer-labeled PR needs normal exact-head CI and merge-refresh handling rather than closure or an automated repair.

Priority: P3
Reviewed head: 71f994f356695a56efda196035b5d28f923f7f5f

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A focused, owner-boundary implementation and targeted ordering coverage support a normal good-quality rating.
Proof confidence 🌊 off-meta tidepool Not applicable: The contributor-proof gate does not apply to this MEMBER-authored PR; the inspected screenshot nevertheless supports a connected after-fix Control UI state.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The contributor-proof gate does not apply to this MEMBER-authored PR; the inspected screenshot nevertheless supports a connected after-fix Control UI state.
Evidence reviewed 6 items Parallel dispatch and owner-first publication: The branch starts the shared request before waiting for the owner phase, but the shared phase waits for the owner load before it can publish.
Owner boundary and reconnect caller: The session capability owns roster publication and invokes the refresh during reconnect hydration; canonical-list updates remain limited to the non-provisional shared phase.
Regression coverage: The updated unit coverage establishes two requests before either response, owner-first publication, shared merge, and subsequent queued refresh; the browser test releases two deferred requests in the same order.
Findings None None.
Security None None.

Live Verification

Command: node scripts/run-vitest.mjs run --config test/vitest/vitest.ui-e2e.config.ts --configLoader runner ui/src/e2e/session-owner-first.e2e.test.ts

Result: FAIL (failed) — execution before step 1 run: live-proof package manager pnpm is unavailable after its official installer (curl -fsSL https://get.pnpm.io/install.sh | sh -): command failed without output

live-proof package manager pnpm is unavailable after its official installer (curl -fsSL https://get.pnpm.io/install.sh | sh -): command failed without output

Assertions:

  • FAIL expect_output: 1 passed

How this fits together

The Control UI obtains session pages from the Gateway and publishes them as the signed-in user’s roster. The change alters initial request timing while retaining the roster’s existing owner-first publication and shared-row merge.

flowchart LR
  A[Control UI connects] --> B[Build roster refresh plan]
  B --> C[Owner-only request]
  B --> D[Shared roster request]
  C --> E[Publish owner rows]
  D --> F[Merge shared rows]
  E --> F
  F --> G[Visible session roster]
Loading

Before merge

  • Resolve merge risk (P1) - The branch base predates current main and one exact-head check is still running; validate the actual merge result and refresh review after rebasing or creating the merge ref before landing.
  • Complete next step (P2) - No discrete repair is indicated; the remaining work is routine maintainer merge validation on a refreshed head.
Agent review details

Security

None.

PR surface

Source +2, Tests -3. Total -1 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 15 13 +2
Tests 2 15 18 -3
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 30 31 -1

Review metrics

Metric Value Why it matters
Production versus test delta production +15/-13; tests +15/-18 The two net production lines implement concurrent dispatch while the test changes cover ordering and reconnect behavior.

Stored data model

Persistent data-model change detected: serialized state: ui/src/e2e/session-owner-first.e2e.test.ts, serialized state: ui/src/lib/sessions/connection-hydration.test.ts, serialized state: ui/src/lib/sessions/session-roster-refresh.ts, unknown-data-model-change: ui/src/lib/sessions/session-roster-refresh.ts. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Decide the mitigation before merge
    Land the existing owner-boundary approach after a current-main merge refresh confirms the owner-first, queued-refresh, and reconnect tests still pass.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Technical review

Best possible solution:

Land the existing owner-boundary approach after a current-main merge refresh confirms the owner-first, queued-refresh, and reconnect tests still pass.

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

Not applicable; this PR improves an existing roster-loading path rather than reporting a separately reproducible failure.

Is this the best way to solve the issue?

Yes. Starting both existing Gateway requests at the roster owner while retaining the established publication dependency is the narrowest way to remove the serial round-trip cost.

AGENTS.md: found and applied where relevant.

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

Labels

Label changes:

  • add P3: This is a small Control UI responsiveness improvement with limited blast radius.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The contributor-proof gate does not apply to this MEMBER-authored PR; the inspected screenshot nevertheless supports a connected after-fix Control UI state.

Label justifications:

  • P3: This is a small Control UI responsiveness improvement with limited blast radius.
  • 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: The contributor-proof gate does not apply to this MEMBER-authored PR; the inspected screenshot nevertheless supports a connected after-fix Control UI state.

Evidence

What I checked:

  • Parallel dispatch and owner-first publication: The branch starts the shared request before waiting for the owner phase, but the shared phase waits for the owner load before it can publish. (ui/src/lib/sessions/session-roster-refresh.ts:268, 71f994f35669)
  • Owner boundary and reconnect caller: The session capability owns roster publication and invokes the refresh during reconnect hydration; canonical-list updates remain limited to the non-provisional shared phase. (ui/src/lib/sessions/index.ts:136, 71f994f35669)
  • Regression coverage: The updated unit coverage establishes two requests before either response, owner-first publication, shared merge, and subsequent queued refresh; the browser test releases two deferred requests in the same order. (ui/src/lib/sessions/connection-hydration.test.ts:188, 71f994f35669)
  • Current-main comparison: Current main still awaits the owner request before beginning the shared request, so the PR remains a distinct improvement rather than already implemented work. (ui/src/lib/sessions/session-roster-refresh.ts:268, e7dbd5089adf)
  • Feature provenance: The immediately preceding owner-first roster implementation dates to the merged feature commit; broader history routes this surface primarily to steipete. (ui/src/lib/sessions/session-roster-refresh.ts:389, b0e8a985ee11)
  • Live-proof artifact inspection: The prepared PNG visibly shows a connected Control UI with a Codex session and returned nonce. The downloaded video could not be independently inspected because ffprobe and ffmpeg are unavailable in this review environment.

Likely related people:

  • steipete: Current history shows repeated ownership, reconnect, and session-roster changes, including the architectural reconnect refactor and recent session fixes. (role: recent area contributor; confidence: high; commits: 7bae24760b09, 55ce95fac803, 91dc6e102a2c; files: ui/src/lib/sessions/session-roster-refresh.ts, ui/src/lib/sessions/index.ts)

Rank-up moves

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

  • Rebase or validate the merge ref against current main, then rerun the focused roster tests on the resulting head.

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.

Copy link
Copy Markdown
Contributor Author

Land-ready verification

Applied ClawSweeper's sole Rank-up moves: item from the final review:

  • Built a temporary, uncommitted integration candidate for PR head 71f994f356695a56efda196035b5d28f923f7f5f against current origin/main at c5d1cb38e2084095ea311b83c261d0de0fbd9cf2; it merged without conflicts.
  • On that integrated tree, connection-hydration.test.ts passed 18/18.
  • On that integrated tree, session-owner-first.e2e.test.ts passed 1/1.
  • Aborted the temporary merge afterward; the PR branch is clean and unchanged at 71f994f356695a56efda196035b5d28f923f7f5f.

Other land gates:

  • Exact-head hosted CI: 133 success, 39 expected skips, 0 failures.
  • OPENCLAW_TESTBOX=1 scripts/pr prepare-run 129175 completed and accepted the hosted exact-head/recent-parent gates; no separate Testbox lease was needed.
  • Public live-performance proof covers the real OpenAI Gateway run, 18-session browser switching, OpenClaw harness, and four concurrent Codex harness sessions.

Known non-blocking test-infrastructure caveat: a separate isolated Codex Vitest wrapper stopped before provider admission because its temporary runtime omitted bundled plugin registration. The production Gateway Codex harness path passed with four concurrent real-provider sessions, so this does not indicate a product-path failure.

Ready to land.

@steipete
steipete merged commit 6fb3303 into main Aug 25, 2026
181 checks passed
@steipete
steipete deleted the perf/concurrent-session-roster-loads branch August 25, 2026 09:17

Copy link
Copy Markdown
Contributor Author

Merged via squash.

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: S 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.

2 participants