Repository navigation
fix: keep Gateway and Control UI responsive during concurrent session updates - #133061
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. |
|
Codex review: needs maintainer review before merge. Reviewed August 30, 2026, 1:02 PM ET / 17:02 UTC. ClawSweeper reviewWhat this changesThe PR reduces SQLite session-update reads and Control UI redraw work during concurrent session mutations, while revalidating label collisions at commit time. Regression provenancePossible regression — probable (reproduction; reviewed change). No predecessor PR is attributed. Merge readinessNo concrete introduced correctness defect was found, but this maintainer-authored, protected PR remains open for the landing decision and exact-head completion checks. Priority: P1 Review scores
Verification
How this fits togetherGateway session mutations update per-agent SQLite session metadata and emit change events. The Control UI reconciles those events into the sidebar and chat pane, so excess database hydration or rendering can delay interactive session actions. flowchart LR
A[Session update requests] --> B[Gateway mutation planner]
B --> C[SQLite session metadata]
C --> D[Session change events]
D --> E[Control UI reconciliation]
E --> F[Sidebar and chat pane]
Decision needed
Why: The source review found no discrete patch defect, but the remaining browser-performance caveat is a maintainer risk-acceptance decision for a protected maintainer PR. Before merge
Agent review detailsSecurityNone. PR surfaceSource +63, Tests +296, Other -1. Total +358 across 27 files. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Land the owner-boundary repair only after current-head Gateway/native checks and a final current-main reconciliation confirm that the disclosed browser limitation is a tracked follow-up rather than a regression in this change. Do we have a high-confidence way to reproduce the issue? Yes, source and supplied issue context define a bounded concurrent-renames workload and focused owner tests, but this read-only review did not execute it on current main. Is this the best way to solve the issue? Yes for the identified owner boundaries: scoped label-owner reads with transaction-time validation and frame-coalesced UI publication avoid the broad hydration and redraw work without adding a configuration or schema surface. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 86b6ec0afa2c. 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
HistoryReview history (6 earlier review cycles)
|
|
Live interaction proof for A locally retained recording shows a rename and chat send during that load. Rename RPC completed in 52 ms; chat.send was acknowledged in 1,270 ms. The assistant reply was visible 1.966 seconds before the background workload finished. RPC readback verified the same session ID, renamed label and persisted assistant response. All fixture processes and the isolated browser were then closed. The locally retained stills show the same candidate immediately before and after this workload. Media upload was refused by the active Octopool outbound safety policy; that restriction was not bypassed. This is isolated Chromium evidence, not a claim that earlier real-profile Chrome attempts passed. Those failures remain recorded. An initial recording attempt failed only because its reply selector matched both the visible paragraph and the accessibility announcement; the corrected visible-paragraph selector passes the unchanged workload. The separate Linux latency benchmark also passes its unchanged gates (61.25 to 14.80 seconds for 32 turns), but all 18 heavy-load CPU-pressure samples remain degraded. Exact-head hosted CI is still running. |
|
Refreshed browser proof after integrating current main: UI commit 7b0fb42, built by the canonical UI workflow. This uses a real disposable Gateway and isolated Chromium with a synthetic streaming provider. The unchanged workload retained 502 sessions, ran 32 concurrent turns and completed 1,000 renames through eight writers in 14.532 seconds. The interactive rename RPC completed in 132 ms; chat.send was acknowledged in 1,250 ms. The assistant reply became visible 2.426 seconds before the background load finished. Actual Gateway readback confirmed the same session ID, the new label and persisted reply. All fixture processes and the isolated browser were closed afterward. The UI is freshly built from the current PR head. The backend reuses the earlier 7ca3e14 build containing the unchanged relevant repair files; this recording is not a claim of a complete current-head backend rebuild. Separate Linux before/after measurements and their CPU-pressure caveat remain in the PR body. The prior original Chrome profile lag is also still unresolved; it is not counted as a passing run. The attached stills show before and after the workload on the same candidate, not before and after the code change. The complete recording and captures were inspected and contain only synthetic fixture content. The fresh UI build passed all 794 asset sidecar checks and the unchanged startup budget (346,153 bytes gzip, limit 346,761). attachment-2037700744.webm |
|
@clawsweeper re-review The final integration at 3285517 removes an obsolete route override now superseded by main's canonical conversation identity. Keeping agent-specific route keys restores separate retained-pane ownership; the original outbox, quota and agent-persistence fixtures now pass unchanged (7 E2E tests, plus 99 route/identity tests). Two proven clock-dependent workshop assertions were corrected without product changes; 83 owner tests pass. Production delta is reduced from +74 to +63. The scoped projection and transaction-time validation remain necessary; no cache, timeout, schema or configuration surface was added. The original signed-in Chrome load limitation and sustained CPU-pressure measurements remain explicit follow-ups. Current-head CI and native gates will be completed before merge, as requested by the previous rank-up move. A fresh recording from the committed UI is being finalized. |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Final committed-UI proof at 3285517: canonical build passed (startup 346,137 bytes gzip, unchanged limit 346,761), and the unchanged 502-session, 32-turn, 1,000-rename workload completed in 12.125 seconds. Interactive rename RPC completed in 41 ms, chat.send was acknowledged in 1,074 ms, and the assistant reply appeared 1.945 seconds before background load ended. Gateway readback verified the same session ID, updated label and persisted reply. The fixture used a real disposable Gateway, synthetic streaming provider and isolated Chromium. Backend reuse from the earlier 7ca3e14 build is explicitly disclosed; this is final UI integration proof, not a complete current-head backend rebuild. The original signed-in Chrome limitation and Linux CPU-pressure diagnostics remain in the PR body. The inspected captures contain only synthetic content. Stills show before and after the workload on the same candidate; the video is 14.92 seconds. All fixture processes, browser and temporary dependency links were cleaned up. These final artifacts supersede the earlier 7b0fb42 recording. attachment-4047642519.webm |
|
Merged via squash.
|
… updates (openclaw#133061) * fix: keep gateway responsive during concurrent session renames * refactor: let the session writer deduplicate patch keys * fix: reduce Control UI session event processing work * fix: coalesce chat session and swarm redraws * fix: reduce session rendering work and publish connector loading state * test: expect canonical global key when reopening selected agent * fix: retain per-agent chat routes after identity consolidation




Closes #133053
What problem this solves
Renaming sessions while agent turns ran could stall the Control UI and session list. The original 500-session, 1,000-rename, 32-turn reproduction took 61.25 seconds, with session-list responses reaching 5.68 seconds. The repair removes repeated whole-store hydration, unrelated plugin activation, duplicate event publication and unnecessary browser redraws at their owning boundaries.
What changes
Session mutation planning loads only target keys and the owners of requested labels. Label owners are read-only inputs; their key set and rows are revalidated in the existing synchronous write transaction after asynchronous planning. This preserves authorization, queued alias checks, ordered label collisions and atomicity, including concurrent label claims and release/reclaim races. No schema, index, persistence format or writer queue changes.
CLI backend lookup selects manifest owners before evaluating activation. The shared activation owner skips channel discovery when no channel configuration exists. No metadata cache is added. The benchmark respects the configured absolute deadline instead of imposing hidden 60/65-second caps; the workload's 120-second deadline and two-second latency bounds remain unchanged.
The UI resolves identity through current main's canonical conversation owner, preparing snapshot facts once per roster projection and looking up each row's generation owner once. Ordinary keys avoid structural parsing needed only by opaque channel IDs. Duplicate timestamped events preserve result identity. Sidebar retention is bounded to the requested page plus one prior page while preserving active/pinned rows. Chat and Swarm publications use the existing frame scheduler; disabled Swarm and unchanged events avoid redundant work. Connector loading begins before menu props projection. Current main owns canonical conversation identity. The earlier route override is removed: retaining each agent's route key preserves separate pane ownership while main resolves shared global history and the newer quota-provider filter.
Validation
Same-workload isolated Linux comparison, four CPUs and six GiB memory, a mock streaming provider, 32 turns, 500 sessions, 1,000 renames, eight mutation clients, four history readers and eight subscribers:
The benchmark exits 0; all turns, renames and probes succeed within the unchanged gates. All 18 CPU-pressure samples still report degraded load, with maximum event-loop p99 of 1,287 ms. The additional zero-warning wrapper remains false. This demonstrates a latency improvement, not elimination of CPU saturation or reduced memory use.
That backend comparison uses base 634c773 plus the five backend production changes from 90da404. Those files were identical between the comparison base and branch base 7ca3e14. It uses the supported sourcePerformance build and unchanged UI assets from the same base; a separate complete branch build passed. It is not an exact-latest-main release benchmark.
Final browser video and before/after-workload stills exercise clean UI 3285517 against a real disposable Gateway in isolated Chromium: 502 retained sessions, 32 turns and 1,000 renames through eight writers, completing in 12.125 seconds. Interactive rename RPC: 41 ms. Chat acknowledgement: 1,074 ms. The reply appeared 1.945 seconds before load finished. Gateway readback confirms the same session ID, renamed label and persisted reply. This recording reuses the earlier 7ca3e14 backend build containing the unchanged relevant repair files; it is UI integration proof, not a complete current-head backend rebuild. All fixture processes were closed.
The refreshed UI build passes 794 sidecar checks and the unchanged startup-size budget: 346,137 bytes gzip, limit 346,761. Current-main integration passed 437 identity/deletion/outbox/history/route/render-lifecycle tests and 63 plugin activation/policy/registry tests. Earlier owner coverage passed 143 Gateway tests, 126 broad SQLite accessor/lifecycle tests plus the corrected ABA case, 12 benchmark tests, 29 event-reconciliation tests, 115 sidebar tests and 184 chat/Swarm lifecycle tests. The final persistence/quota/capability browser rerun passed 16/16, exit 0 without the earlier teardown warning. Full build, UI typecheck and independent scoped Codex review passed.
Regression tests fail on the unfixed paths for whole-store hydration, unrelated activation, absent-channel discovery, the internal deadline cap, label claim/ABA races, duplicate events, sidebar overflow and plain global routes. Real capability replay improved from 6.163 to 1.400 seconds; real ChatPane replay improved from 2.623 to 1.254 seconds. Database-handle coverage proves commit-time validation uses the reopened handle.
CI on 7b0fb42 exposed two integration failures and an unrelated clock-dependent test. The prior route override collapsed distinct agents into one retained global pane after main gained canonical conversation identity. Removing it restores each agent's pane ownership. The original outbox, quota and persistence fixtures remain unchanged and pass all seven tests. An additional 95 route/key/navigation tests and four identity tests pass; scoped lint and formatting pass. Two workshop assertions now compare exact membership independently of millisecond timestamp order; deterministic before/after reproductions and 83 owner tests pass. The earlier Octopool native-workflow and attachment blocker is resolved; current-head CI and native prepare/merge completed successfully. Landed as fbe4b1bb8bf2.
Limits and follow-ups
The original signed-in Chrome profile still exceeded its 30-second controller deadline in the last attempted run, with rename persistence after load and no chat sent. Its idle control works; the cause is unresolved. The isolated Chromium workload passes, but no universal browser-performance claim is made. The first isolated recording failed a selector matching both visible text and an accessibility announcement; the corrected visible-paragraph selector passed the unchanged workload.
Protected provider-auth metadata still evaluates activation before manifest ownership and needs secops involvement for optimization. CPU-pressure diagnostics remain a separate follow-up. The previously noted cross-agent roster concern now uses main's newer canonical scope guard; this PR preserves that ownership and its focused tests.
Best-fix judgment: remove work at the projection, activation and publication owners. A broad activation cache risks stale policy, while higher timeouts or a smaller workload mask the failure. Relative to integrated main, runtime +141/-78 (net +63), benchmark tooling +4/-5 (net -1), tests +407/-111 (net +296), across 27 files. Runtime growth implements scoped label-owner authority, transaction-time uniqueness checks, bounded retention and explicit lifecycle ownership. Obsolete alias policy, duplicate generation lookup and render-time loading callback are removed. No public configuration option, protocol or SQLite schema/index is added.
ClawSweeper follow-through: the latest review has no concrete code findings. Its rank-up move is completion of current-head Gateway/native checks, which was satisfied before the native merge. The disclosed original-profile lag is retained as a bounded follow-up, not claimed solved by the isolated proof. Removing the obsolete route override cuts the production delta from +74 to +63; the remaining growth owns scoped label authority and lifecycle validation, rather than a new cache or timeout. Explicit maintainer landing was requested.
Final integration commit: 3285517. Full-PR Codex review is scoped-clean at P0 (0.97). All 106 focused UI tests and 83 workshop tests pass. The final committed-UI recording passes; Current-head CI33323384430 completed successfully.
The linked stills are before and after the same synthetic workload on the final candidate, not a code-version comparison. All captures were inspected; no real-user content or credentials appear. Video duration is 14.92 seconds. The older7b recording remains available in the earlier proof comment; the final linked evidence supersedes it.