Repository navigation
Conversation
Replace fixed startup-refusal retries in the shared pending-request owner with bounded exponential waits while honoring server hints. Preserve request deadlines, cancellation, and correlated non-delivery proof. All four chat data owners recover automatically with substantially less startup pressure.
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
Advance fake clocks through the eight-second startup backoff before checking delivery. Keep the existing deadlines, cancellation, original request identity, and single-delivery assertions; no test timeout is increased.
|
Codex review: needs changes before merge. What this changesThis PR adds bounded exponential backoff to requests refused while the Gateway starts. Example: A models.list request receives repeated startup refusals with retryAfterMs: 500.
Review scores
ProductKind: Performance · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep open: the shared-owner fix is useful, but its longer retry interval breaks seven existing startup tests and the required UI checks. Priority: P2 Before merge
Findings
Tests
Agent review detailsHow this fits togetherBrowser and Node adapters send requests through GatewayPendingRequests, which owns correlation, deadlines, cancellation, startup retries, and final settlement. flowchart LR
A[Control UI data owners] --> B[Gateway protocol client]
B --> C[Pending request owner]
C --> D[WebSocket transport]
D --> E[Gateway admission]
E --> F[Method handler]
E -->|Startup refusal| C
Technical reviewBest possible solution: Keep backoff in the existing request owner and update the four affected consumer suites to advance through the supported retry window while preserving their delivery and cancellation assertions. Do we have a high-confidence way to reproduce the issue? Current-main source retries every matching startup refusal at the unchanged server hint; the supplied base/head regressions exercise that path, and GitHub annotations independently confirm the affected consumer-test failures. Is this the best way to solve the issue? The production change is the smallest complete fix: retain one delay per pending request in the existing owner, reuse its timer, and preserve correlation, settlement, cancellation, and deadlines. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 1e293027afc0. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource +3, Tests +173, Docs +7, Other +117. Total +300 across 6 files. Added test files: 1. View PR surface stats
LabelsLabel 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 Reviewed November 1, 2026, 3:01 AM ET / 08:01 UTC. |
|
Merged via squash.
|
## What Problem This Solves Fixes two jobs in [run 41288828221](https://github.com/openclaw/openclaw/actions/runs/41288828221): - [checks-node-compact-large-14](https://github.com/openclaw/openclaw/actions/runs/41288828221/job/124795798742): `gateway-chat.startup.test.ts:246`, both “send waits through startup and writes once” and “new waits through startup and writes once” time out at 120000ms. - [checks-node-compact-large-19](https://github.com/openclaw/openclaw/actions/runs/41288828221/job/124795798949): `server-methods.startup-deadline.test.ts:195`, `startup agent: ready` and `startup sessions.create: ready` time out at 120000ms. ## User Impact Test-only CI repair; production startup backoff remains unchanged. ## Why This Change Was Made Introduced by ebc9d7e (#190159): repeated startup refusals back off to eight seconds. Advancing only one second after readiness leaves the awaited retry frozen. Advance to the already scheduled next timer in both fixtures. Existing deadline, cancellation, serialized-request-byte, and exactly-one-write assertions remain unchanged. Production delta 0; tests +2/-2, with no new machinery. ## Evidence - Ownership rechecked against fresh main and recent/targeted open PR file inventories; no competing fix found. - Lane l201 reproduced all four ready-case failures through the Gateway/TUI boundaries. Complete Gateway startup, TUI startup, and pending-request/backoff owner suites passed 33/33 on pinned Bun and 33/33 on Node. Scoped typecheck, type-aware lint, format, and whitespace passed. - Independent Codex autoreview with both complete fixtures and the request/backoff owner on base `42d5039f0aa8`: P0–P2 scoped-clean, no findings. The rebased patch is identical; affected fixtures and backoff owner are unchanged on main. - After rebasing onto `2423623c3461610130360fa978cd364653fee1b2`, reran both complete touched test files through `OPENCLAW_VITEST_RUNTIME=bun node scripts/run-vitest.mjs ... --maxWorkers=1`: 22/22 passed (10 Gateway and 12 TUI cases, no skipped cases). - No retries, skipped tests, timeout increases, weakened assertions, baseline growth, or workflow reruns. Co-authored-by: steipete <[email protected]>
* fix(ui): back off requests while the Gateway starts Replace fixed startup-refusal retries in the shared pending-request owner with bounded exponential waits while honoring server hints. Preserve request deadlines, cancellation, and correlated non-delivery proof. All four chat data owners recover automatically with substantially less startup pressure. * test(ui): allow the bounded startup retry window Advance fake clocks through the eight-second startup backoff before checking delivery. Keep the existing deadlines, cancellation, original request identity, and single-delivery assertions; no test timeout is increased.
) ## What Problem This Solves Fixes two jobs in [run 41288828221](https://github.com/openclaw/openclaw/actions/runs/41288828221): - [checks-node-compact-large-14](https://github.com/openclaw/openclaw/actions/runs/41288828221/job/124795798742): `gateway-chat.startup.test.ts:246`, both “send waits through startup and writes once” and “new waits through startup and writes once” time out at 120000ms. - [checks-node-compact-large-19](https://github.com/openclaw/openclaw/actions/runs/41288828221/job/124795798949): `server-methods.startup-deadline.test.ts:195`, `startup agent: ready` and `startup sessions.create: ready` time out at 120000ms. ## User Impact Test-only CI repair; production startup backoff remains unchanged. ## Why This Change Was Made Introduced by fbb3769 (openclaw#190159): repeated startup refusals back off to eight seconds. Advancing only one second after readiness leaves the awaited retry frozen. Advance to the already scheduled next timer in both fixtures. Existing deadline, cancellation, serialized-request-byte, and exactly-one-write assertions remain unchanged. Production delta 0; tests +2/-2, with no new machinery. ## Evidence - Ownership rechecked against fresh main and recent/targeted open PR file inventories; no competing fix found. - Lane l201 reproduced all four ready-case failures through the Gateway/TUI boundaries. Complete Gateway startup, TUI startup, and pending-request/backoff owner suites passed 33/33 on pinned Bun and 33/33 on Node. Scoped typecheck, type-aware lint, format, and whitespace passed. - Independent Codex autoreview with both complete fixtures and the request/backoff owner on base `0082e6368c96`: P0–P2 scoped-clean, no findings. The rebased patch is identical; affected fixtures and backoff owner are unchanged on main. - After rebasing onto `1f4d22031c73bcd1c42b48d5c84c9a9192b37099`, reran both complete touched test files through `OPENCLAW_VITEST_RUNTIME=bun node scripts/run-vitest.mjs ... --maxWorkers=1`: 22/22 passed (10 Gateway and 12 TUI cases, no skipped cases). - No retries, skipped tests, timeout increases, weakened assertions, baseline growth, or workflow reruns. Co-authored-by: steipete <[email protected]>
What Problem This Solves
Fixes repeated Control UI requests overwhelming a Gateway while it is still starting. Four outstanding chat reads could each retry every 500 ms for the entire startup window.
User Impact
Chat metadata loads automatically once its request is admitted, with substantially fewer startup failures. Repeated startup refusals now back off up to eight seconds; recovery can consequently take up to eight seconds after admission opens. Longer server retry hints remain authoritative. Original request deadlines and cancellation still apply.
Why This Change Was Made
The four UI owners already share pending loads. The shared Gateway client's pending-request owner retained startup refusals but retried every time at the unchanged server hint. It now doubles that request's wait, retaining the existing timer, correlation, settlement, and connection lifecycle. A slow agent does not hold unrelated requests. The server already provides
retryable,retryAfterMs, and a correlated startup reason; it does not publish a method/agent startup-ready WebSocket signal, so no protocol extension is needed.Runtime production delta: +3 lines for one delay value and its update; no new cache, configuration, schema, or per-store retry path. The fixed-delay path is replaced. Documentation describes the latency tradeoff. The committed measurement script is proof tooling, separate from production LOC.
Evidence
Acceptance rule recorded before measurement: 30 synthetic connections × four outstanding startup reads, 13 seconds of correlated
UNAVAILABLEwith a 500 ms server hint; at most five attempts per pending read before readiness, then all reads recover. Five interleaved A/A/B triplets, 100 waves/sample; separate untraced timing and sampled-allocation passes.Baseline A/A medians: elapsed 758.831 / 749.280 ms; CPU 830.681 / 813.855 ms; allocation 667,612,440 / 667,084,144 B. Startup refusal count falls 81.5%. Recovery in this fixture is at 13.5 seconds before versus 15.5 seconds after. Allocation sampling uses a 4 KiB interval and includes collected objects. Separate CPU profiling identifies send/encoding/timer work as the hot path.
Run
node --import ./scripts/tsx.mjs scripts/perf/control-ui-startup-retry-measure.mts [owner-module]against separately bundled owner modules from each revision (same esbuild options: bundle, Node platform, ESM). This isolates retry-owner work and wire serialization; it does not benchmark database/handler work, filesystem size, btrfs, or whole-Gateway latency. Startup refusals precede those handlers. No production data or runtime was used.mentions.listmakes 26 additional retries in 13 seconds, above the budget of five. Candidate passes for all four request families and displays recovered mentions, model, effective tool, and GitHub account options; successful reads stop retrying. Test execution 2.772 seconds, wrapper 13.82 seconds.Independent Codex autoreview through P2: scoped-clean, no actionable findings. Simplification pass retained the existing owner and timer rather than adding a scheduler or store-specific policy.
pnpm check:changedpassed all selected checks except dead exports. The exact main parent4475bed8cf500c9be80257b2f142c1136bd9dfbd, checked in an isolated worktree withnode --import ./scripts/tsx.mjs scripts/check-deadcode-exports.mts, reproduces the identical findings:collectModelAllowlistWildcardOffersexported without an external production caller887cf720aab8, #190031allowProviderModelsexported without an external production caller8f606d9ec191, #190019materializeSessionRepositoryWorkspaceOnGatewayleft exported after its external caller migratedaf7cee293365, #189350Production scan flags all three; full-tree scan flags the first. These are separate main regressions, left for their owners; this PR changes none of their files or the scan configuration. No failure was suppressed or reclassified as passing.
The first CI run (
41286025904) exposed seven PR-caused test timeouts in four long-startup delivery fixtures: they advanced fake time only 500–1,000 ms after readiness before awaiting a retry. Updated those four advances to the documented eight-second backoff bound. No test timeout or delivery/cancellation/identity/deadline assertion was relaxed. All seven failures reproduced locally; 80/80 tests across the affected files now pass (3.67 s). Follow-up Codex review is scoped-clean.pnpm check:changed --base HEADfor this test-only correction passed every selected check except the same independently reproduced main dead exports above. The production implementation and before/after measurements are unchanged.