Repository navigation
perf(ui): stop idle identity reads and restart probes - #167968
Conversation
Retain agent identity until connection, config, or agent invalidation. Hold announced bootstrap drains until readiness or reconnect, while keeping one slow recovery probe for unannounced restart refusals. Pause sidebar and Automations refreshes and preserve restart evidence while the draining socket stays connected. Direct workspace identity/avatar edits are picked up on reload or reconnect. Synthetic browser proof reduces identity calls from 11 to 1 per tab over ten idle minutes and announced-drain rejects from 99 to zero. Testbox owner and sibling tests, full changed checks, and independent review pass.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. What this changesThe Control UI reuses agent names and avatars until invalidated and pauses background reads during announced Gateway restarts. Example: A user leaves a Control UI chat open through ten idle minutes with presence updates.
Review scores
ProductKind: Performance · Worth it: Yes Merge readiness✅ Ready for maintainer review This PR remains useful and distinct from the earlier performance fixes. No actionable patch defect was found, and the reported CI failure matches an earlier main failure rather than this diff. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherThe Control UI reads agent identity and automation information from the Gateway over its shared client. Connection and availability owners control when those reads run and when cached results become obsolete. flowchart TD
A[Control UI views] --> B[Shared identity cache]
C[Configuration and agent changes] --> B
B --> D[Gateway request owner]
E[Restart and suspension announcements] --> F[Connection availability]
F --> D
F --> G[Sidebar and Automations reads]
D --> H[Gateway responses]
H --> A
Technical reviewBest possible solution: Keep the existing cache and request owners with event-driven refreshes and the documented direct-file reload tradeoff. Do we have a high-confidence way to reproduce the issue? Yes: current-main source retains the one-minute identity expiry and announced-pause probes, and the supplied before/after browser observations exercise those paths. No target code was executed during this read-only review. Is this the best way to solve the issue? Yes: the patch changes the existing cache, request, and availability owners and preserves explicit invalidation, cancellation, deadlines, and unannounced-refusal recovery. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1d09a03dc9cd. Provenance checked
TestingProof path: shipped entry point. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +18, Tests +206, Docs +2. Total +226 across 12 files. Added test files: 0. View PR surface stats
Review metrics
LabelsLabel changes: No label changes. Label justifications:
Rating scale6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior. WorkflowClawSweeper edits this one comment on every review. Comment HistoryReviewed October 9, 2026, 6:14 PM ET / 22:14 UTC (Revision 3). |
|
The remaining CI red is inherited. I verified the captured CI merge ( Landing exact head |
Retain agent identity until connection, config, or agent invalidation. Hold announced bootstrap drains until readiness or reconnect, while keeping one slow recovery probe for unannounced restart refusals. Pause sidebar and Automations refreshes and preserve restart evidence while the draining socket stays connected. Direct workspace identity/avatar edits are picked up on reload or reconnect. Synthetic browser proof reduces identity calls from 11 to 1 per tab over ten idle minutes and announced-drain rejects from 99 to zero. Testbox owner and sibling tests, full changed checks, and independent review pass.
What Problem This Solves
Control UI tabs repeatedly read agent identity while the Gateway drains for restart. Ordinary presence updates also refetch unchanged identity after its one-minute cache expiry.
User Impact
Identity refreshes on connection, configuration changes, and agent invalidation. Announced drains pause bootstrap reads and sidebar/Automations refreshes until readiness or reconnect. Direct edits to workspace
IDENTITY.mdor avatar image files require a tab reload/reconnect because those files do not publish a Gateway identity event.Why This Change Was Made
The five-to-six-second restart cadence comes from the shared Gateway client's replay probe. Its existing request owner now distinguishes an announced drain from an unannounced refusal. Unannounced restart refusals retain one probe after at least a minute because canceling a restart fence may not publish readiness.
The UI deletes successful-identity expiry and retains its connection/config/agent invalidations. Cron and model catalogs already use events; their remaining automatic refresh paths now honor availability. The availability owner keeps restart evidence while the socket remains connected and retains normal offline expiry after it closes.
Production delta: +18 lines, excluding tests/docs. Expiration machinery and redundant dispatch guards are removed. Growth is needed to distinguish announcement from refusal and preserve recovery at the existing request, availability, and cron/sidebar owners.
Evidence
Headless Chromium, synthetic Gateway data, and virtual time:
The final browser proof also confirms zero calls for all four methods during the announced drain, followed by identity recovery on reconnect. Config-change refresh and interrupted identity-edit recovery pass.
Provider:
blacksmith-testbox, profileopenclaw-check.tbx_01m4h53tqvw1h9ssprwst2mzh6(run): 53 transport tests and 141 UI owner/sibling tests pass. Seven transport and twelve UI regression cases fail unchanged baseline production. Fullnode scripts/check-changed.mjs --stagedpasses, including core/UI types, all 27 selected test-type graphs, lint, unused exports, and repository guards. The combined baseline/browser/cron/gate command took 30m19.1s.tbx_01m4h6cce4n056wzjb79s9mvvy(run): 80 Gateway-store sibling tests pass (6.09s command wall), as do four browser cases (26.38s). The connected-drain regression fails against the original availability helper.node scripts/check-changed.mjs --staged --timed -- ui/src/app/gateway-store.availability.ts ui/src/app/gateway-store.observers.test.ts ui/src/e2e/agent-identity-reconnect.e2e.test.tspasses with the exact twelve-file candidate staged remotely (257.42s).The browser proof measures RPC counts using virtual time, not production throughput. The new browser case takes about 3.6s and exercises boot, rendering, shared caches, and transport replay together.
Single-worker test costs (
pnpm test <file> --maxWorkers=1, all pass):packages/gateway-client/src/protocol-client.request.test.tsui/src/lib/agents/identity.test.tsui/src/components/sidebar-attention-store.test.tsui/src/pages/cron/cron-page.lifecycle.test.tsui/src/app/gateway-store.observers.test.tsAll twelve changed-file hashes match the tested candidate after rebasing onto current main (
ea6022cae60c); the branch contains only this change. Both remote leases are stopped. CI attempt 1 (run 37992454305) has one inherited root failure:build-artifactsfailspnpm plugins:assets:checkbecauseextensions/workboard/openclaw.plugin.jsonis stale. The identical error appears in earlier main run 37987811729, job 114014378480, before this PR. The Workboard browser tree, SDK runtime, build owner, manifest and dependency inputs are unchanged by this diff. Fail-fast canceled 24 jobs; their step metadata contains no separate failures. Security, performance, i18n, docs, boundary guards and two E2E shards passed. The completed E2E shards took 185s and 196s; canceled UI jobs provide no complete per-file CI timing. Remote single-file timings above remain the cost evidence. Landing uses the maintainer-authorized inherited-failure exception; no CI was rerun.