Repository navigation
fix(test): Gateway e2e connect times out before the Gateway's own handshake deadline on loaded runners - #169479
Conversation
|
🦞👀 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 changesThis PR defaults Gateway E2E client acquisition to the shared handshake deadline plus five seconds. Example: A Gateway completes hello after 12 seconds with the default 15-second handshake deadline.
Review scores
ProductKind: Test only · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this PR open: it fixes a fixture deadline mismatch still present on main, and no introduced defect was found. Priority: P2 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherGateway E2E fixtures turn connection options into an authenticated WebSocket client, retaining acquisition ownership until successful handoff or joined cleanup. flowchart LR
A[Gateway tests] --> B[E2E fixture]
C[Shared handshake deadline] --> B
B --> D[Client acquisition]
D --> E[Gateway handshake]
E --> F[Connected client or joined cleanup]
Technical reviewBest possible solution: Use the shared handshake deadline for the fixture budget while preserving explicit overrides and joined failure cleanup. Do we have a high-confidence way to reproduce the issue? Source establishes the 10-second fixture versus 15-second handshake mismatch, and the author reports a controlled 12-second before/after reproduction; no target code was run during this review. Is this the best way to solve the issue? The focused change reuses the authoritative resolver and fixes the fixture mismatch without changing production handshake policy. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 751fa4fe7652. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource +3. Total +3 across 1 file. Added test files: 0. 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 HistoryReview history (1 earlier review cycle)
Reviewed October 11, 2026, 9:19 PM ET / October 12, 2026, 01:19 UTC (Revision 2). |
…solation, and flake fixes from main (#172693) * fix(context-engine): stop re-logging terminal blocked turns on every run Backport of #167595 (be39fa3) to the 2026.9.33 outbox owner, which still lives in context-engine-turn-outbox.ts on this line. * test(agents): retire session MCP managers left by earlier test files (#172515) (cherry picked from commit d4be691) * test(ci): bound native declaration fixture libraries Use ES5 ambient libraries for the synthetic native preparation programs instead of loading the default ES2023/browser library graph on every preparation. Keep the ES2023 syntax target, real native compiler, seven plugin producers, six preparation calls, both compiler failure controls, all assertions, and every existing timeout unchanged. The oversized fixture configuration originated in b78612a. The original ten-file shard reproduces the 30-second repair-case timeout on two CPUs and two workers. With the fixture scoped to its required built-ins, the same shard passes twice: 163 passed, four platform skips, and repair case times of 23.292s and 23.555s (303.26s and 304.25s shard wall times). Focused remote proof: pnpm test test/scripts/prepare-extension-package-boundary-artifacts.native.test.ts --maxWorkers=1 passes 15 tests with three Windows skips in 77.39s wall time on two CPUs. No production code, assertion, retry, or deadline changes. Changed checks pass formatting, ratchets, and all four test-root type shards. The broader namespace-export scan flags the unchanged model-catalog.runtime barrel on the pinned base; upstream ece9d9c already removes that export. (cherry picked from commit 05179a7) * fix(test): prevent Wear reader leaks between test cases (#172075) * fix(test): prevent resource leaks and cold-build shutdown timeouts * fix(test): include the worker bootstrap in the PR wrapper inventory (cherry picked from commit 03b02ee) * test(gateway): wait past the server handshake deadline in Gateway e2e connects (#169479) (cherry picked from commit e482290) * fix(test): managed-process, Vitest shutdown, and worker-artifact tooling tests time out on loaded hosts while polling ready files (#162613) Test-tooling suites for the managed child-process runner, check-changed cancellation, Vitest fork/worker shutdown, worker artifacts, and run-vitest progress waited for fixture wrappers, workers, and descendants by polling ready files, PID files, and the process table against 1-15 s wall-clock deadlines, which a loaded host outlasts. Readiness now arrives on the owned channel each fixture already has: runManagedCommand's onReady stream and child events, stdout/IPC readiness written after the fact it announces (PID files are renamed into place first), relayed worker readiness for the Vitest fork/worker fixtures, and retained command outcomes that fail fast if the child settles first. Foreign-descendant extinction without an owner join keeps a deadline-free check bound to the test signal. check-changed-cancellation and run-vitest-progress drop out of the timeout-race baseline. The reverse-release wait in run-vitest-progress and the native Windows Job cases stay unchanged (follow-ups; the latter has no native CI execution). No product source, test timeout, product timeout, or assertion meaning changed. Part of the polling audit from #162274. Proof on Blacksmith Testbox: delayed-readiness fault probes fail the original bytes and pass these bytes; forced-abort probes reach cleanup; 20/20 standalone runs per file; 3/3 replays of all seven owning tooling shards on the rebased head; tsgo; Codex autoreview and ClawSweeper clean. (cherry picked from commit b9512e7) * test: stabilize release timing boundaries (#166218) (cherry picked from commit 69ccd1e) --------- Co-authored-by: Peter Steinberger <[email protected]>
What Problem This Solves
Fixes: Gateway e2e tests fail with
gateway connect timeoutwhen the connect handshake to a just-started test Gateway takes more than 10s on a loaded runner. Seen in release validation for 2026.10.5-beta.2 (test/plugins/codex-model-catalog.gateway.test.ts, job 114606058874, hosted ubuntu-24.04, 4 cores, workers=2).User Impact
No user-visible change; this is test-only. Gateway e2e fixtures stop failing on slow handshakes that the Gateway itself still accepts.
Why This Change Was Made
connectGatewayClient(used bystartGatewayWithClient) gave up after a fixed 10s. The Gateway's own preauth handshake deadline is 15s (DEFAULT_PREAUTH_HANDSHAKE_TIMEOUT_MS, overridable byOPENCLAW_HANDSHAKE_TIMEOUT_MS/OPENCLAW_TEST_HANDSHAKE_TIMEOUT_MS), and the client's challenge watchdog is aligned to that same deadline. So the fixture raced the product with a shorter timer and reported a handshake the Gateway would still complete as a failure. The fixture now defaults to the resolved server deadline plus 5s of grace. A real stall therefore surfaces as the Gateway's or client's own verdict (handshake close or challenge timeout, with phase and elapsed time), not the fixture's anonymous timer. ExplicittimeoutMscallers are unchanged.This is not a product bug. The failing test spent about 30s in
startGatewayServeron the hosted runner, then more than 10s in connect. Locally, phase probes put the full handshake at 250–350ms (warm, cold transform cache, and 4 concurrent copies), with at most 14ms of event-loop delay and no wait inprepareMembership. The CI stall is load on the hosted runner, not a handshake that never finishes. The "gateway token mismatch" line in the same job log comes fromgateway-cli-plugin-routing.test.ts's intentional wrong-token case and is unrelated.Evidence
main,pnpm test test/plugins/codex-model-catalog.gateway.test.ts --maxWorkers=1fails withError: gateway connect timeout. With this change, it passes. The delay injection was not committed.pnpm test test/plugins/codex-model-catalog.gateway.test.ts --maxWorkers=1passes (97s wall on a heavily loaded host; Vitest duration 42s). No new or changed test files.src/gateway/gateway-cli-plugin-routing.test.tsandsrc/gateway/server.shared-auth-rotation.test.tspass.oxlint,oxfmt --check, andgit diff --checkare clean.Inherited CI failures (run 38188111637)
openclaw/ci-gateis red only because 7checks-node-changed-*jobs failed. The change-based selector picked them because this file is imported by many gateway e2e suites. Every failing case also fails locally on the tested merge's first parent, main521393ecd7d(and on0387f4f96a2), without this change. The tested mergeadd092a0differs from that baseline only insrc/gateway/test-helpers.e2e.ts. None of the failures is a connect timeout. They are post-connect assertions or timeouts, and this change can only lengthen the connect budget:server.chat-recovered-output.test.ts(2),server.xai-fallback.test.ts(expected''to beThe answer is)server.chat.orphaned-recovery.test.ts(history length 3 vs 2)gateway.chat-redaction.test.ts(2, recorded model input)gateway-workshop-learning.e2e.test.ts,gateway.models-policy-reload.e2e.test.tsgateway-rpc-chat.e2e.test.ts(history length 2 vs 1)embedded-transcript-cursor.e2e.test.ts(generation_mismatch),gateway-completion-replay.e2e.test.tsgateway-session-end-shutdown.e2e.test.ts(120s timeout)security-fastand every other job passed.