Repository navigation
perf(ui): bootstrap session rosters in one request - #130294
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
Maintainer review and live proofThe bootstrap stays at the Gateway owner: register the observer, then reuse the canonical authorized list projection. The repair scopes cached results to the authenticated profile (including administrators), applies the same startup admission to both roster entry points, and retains a separate 60-row owner window without consuming the shared transcript budget. The old duplicate UI request construction is removed. Generated Swift models and protocol/client docs are current. The four new roster regressions failed on the incoming head for the intended reasons, then passed after repair. I also reproduced the original CI JSON5 failure in both test fixture writers and replaced their truncating writes with the existing atomic JSON writer; the original chat test order passes. No runtime retry, config option, persistent schema change, or protocol-version bump was added. Real Gateway and browserThe built Gateway and its served Control UI ran against a fresh temporary home/state directory, separate ports, and two synthetic authenticated trusted-proxy profiles. All 53 live checks passed across 390 sessions; the live Gateway and temporary state were removed afterward. No operator Gateway, saved credentials, provider API, or model turn was used.
The served entry asset Verification
Commandspnpm build
node scripts/run-vitest.mjs run src/gateway/server-methods/sessions-read-cache.test.ts src/gateway/server-methods.control-plane-rate-limit.test.ts src/gateway/session-utils.perf.test.ts src/gateway/session-utils-owners.test.ts src/gateway/server-methods/sessions-viewers.test.ts src/gateway/test-helpers.server-env.test.ts src/gateway/server.chat.gateway-server-chat.test.ts ui/src/lib/sessions
node scripts/run-vitest.mjs run src/gateway/test-helpers.server-env.test.ts
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/session-owner-warm-refresh.e2e.test.ts ui/src/e2e/chat-retained-pane-hydration.e2e.test.ts
pnpm protocol-registry:check
pnpm protocol:gen
pnpm protocol:check:swift
pnpm protocol:gen:kotlin
node --import tsx scripts/check-protocol-since.mts
node .artifacts/pr-130294/live-roster.mjs --phase candidate-2The task-only live harness and generated media are not product files. The earlier rebase-only rank-up move is intentionally skipped: the branch is conflict-free, current-main owner paths were checked, and landing will require green CI on the final head. The new behavioral repairs warrant a fresh rating: @clawsweeper re-review. roster-live-8x.mp4 |
|
Codex review: needs maintainer review before merge. Reviewed August 26, 2026, 5:07 PM ET / 21:07 UTC. ClawSweeper reviewWhat this changesThe PR makes the Control UI obtain an authenticated owner-first session roster in the Merge readinessKeep open for normal maintainer landing review. The proposed Gateway-owned bootstrap and UI consumer form one coherent path with no concrete patch defect found, but the branch is behind main, required checks are still running, and this checkout could not hydrate the current-main/base objects for a final three-way comparison. Priority: P2 Review scores
Verification
Live VerificationCommand: Result: FAIL (failed) — step 1 Assertions:
How this fits togetherThe Control UI loads session navigation from the Gateway and refreshes it after session-change events. The Gateway owns authorization, pagination, and viewer-specific roster projection before the UI renders the resulting rows. flowchart LR
UI[Control UI connection] --> Subscribe[Session subscription request]
Subscribe --> Gateway[Gateway authorization and roster projection]
Gateway --> Snapshot[Bootstrap roster response]
Gateway --> Events[Session change events]
Snapshot --> Roster[UI session roster]
Events --> Refresh[One canonical refresh]
Refresh --> Roster
Before merge
Agent review detailsSecurityNone. PR surfaceSource +94, Tests +79, Docs +52, Other +4. Total +229 across 28 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the canonical Gateway projection and single-request UI bootstrap only after GitHub verifies the final merge result and required checks; preserve the documented empty-request acknowledgement behavior for existing clients. Do we have a high-confidence way to reproduce the issue? Not applicable as a defect report: this is a performance and protocol enhancement. The supplied PR comment includes an after-fix Gateway and browser exercise, while current-main pre-change execution could not be run from this partial clone. Is this the best way to solve the issue? Yes, based on the reviewed source: registering events before delegating to the existing authorized list projection keeps one canonical owner for visibility, paging, and viewer-specific rows rather than duplicating that logic in the UI. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 2df646128092. 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
History |
Scope cached projections to the authenticated viewer, apply startup admission consistently, and preserve the independent owner and shared preview budgets. Regenerate the Swift client and document the bootstrap and cursor contract. Publish Gateway test configuration atomically to remove the deferred-reader race. Co-authored-by: Amp <[email protected]>
|
Merged via squash.
|
* perf(ui): collapse session roster bootstrap RPCs Amp-Thread-ID: https://ampcode.com/threads/T-01a037b3-be95-76ea-8fb3-75979929acf1 * fix(gateway): isolate and bound session roster bootstrap Scope cached projections to the authenticated viewer, apply startup admission consistently, and preserve the independent owner and shared preview budgets. Regenerate the Swift client and document the bootstrap and cursor contract. Publish Gateway test configuration atomically to remove the deferred-reader race. Co-authored-by: Amp <[email protected]> * test(gateway): extract session roster cache fixtures --------- Co-authored-by: Amp <[email protected]>


What Problem This Solves
The Control UI previously waited on three Gateway requests to load its initial session roster: subscribe, list the signed-in owner's sessions, then list the shared page. Warm session-change refreshes required two lists. This PR reduces each flow to one request while preserving visibility, filters, pagination, and connection lifecycle.
Why This Change Was Made
sessions.subscribenow registers the observer before returning the canonical authorized list projection.ownerFirstuses the authenticated profile to prepend an independent window of at most 60 owned sessions, then deduplicates the normal shared page without advancing its cursor. The UI consumes that bootstrap and uses one canonical list for warm refreshes, removing the two-phase orchestration.Maintainer review repaired three connected defects: administrator cache keys now include the viewer identity, bootstrap shares the list's startup admission gate, and retained owner windows cannot consume the shared transcript-enrichment budget. The existing
involvingMecache path gets the same identity repair. Swift protocol models and client/protocol documentation were updated.The related CI fixture race was reproduced at both config writers. Both now use the existing atomic JSON writer so deferred session notifications cannot read a truncated config. Cache-test fixtures were extracted to keep the regression suite below its file-length limit, without suppressions or weakened coverage.
User Impact
Cold roster loading is one
sessions.subscribeand no separate list; a warm change is onesessions.list. Older owned sessions remain available alongside shared sessions, and paging retains the shared cursor and previously hydrated preview metadata. Observer errors remain visible and reconnects establish a fresh bootstrap.No new configuration or environment setting, storage schema change, or protocol-version bump. Empty-parameter subscriptions retain their acknowledgment-only response; subscription requests now receive the same retryable startup admission response as lists while the Gateway warms up. The optional
ownerFirstrequest parameter and non-empty subscribe snapshot response are the only protocol additions.Evidence
Inspected live video, before/after screenshots, commands, and results.
sincechecks, and core/UI/test typechecks passed.96e5796c7afcdaf4b0b2678a3f02ba6dd71d078a; requiredopenclaw/ci-gateis green.Production LOC: +154/-118 (net +36). This implements the combined bootstrap and bounded authenticated projection while removing duplicate client orchestration; the maintainer repairs reduce handwritten production code by seven lines relative to the incoming PR. Tests and support: +327/-190 before discounting the pure fixture move; generated Swift: +4; docs: +57/-5.
The latest ClawSweeper review found no actionable patch defect. Its rank-up request is satisfied: final-head CI is green, and GitHub merge ref
5c34be2844a001bce4da32d1a70d7e21b675d1b6was fetched and compared against the verified PR head on main26d3b08758fbb0fca0b474b8c4c533cf87ba89e7. All handwritten roster runtime/UI files are unchanged; current-main differences in touched files are unrelated generated approval/portal models and an independent mock-reset ordering change. The earlier rebase-only move remains intentionally skipped because the branch is conflict-free. The reviewer harness stopped after 30 seconds without a completed browser verdict; the completed three-test browser run, full hosted browser shards, and real Gateway/browser evidence above provide the actual results. No persistent-store schema changed.