Stabilize parallel provider status tests - #1443
Conversation
Parallel pre-push runs exposed two nondeterministic checks: tool-input status heartbeats could beat an already-ready stream part, and the route matcher asserted wall-clock timing under shared CI load. The stream helper now prefers a resolved stream part before emitting a pending heartbeat, and the route matcher test checks the cache contract directly. Constraint: Tests run concurrently in the pre-push hook and CI. Rejected: Raising the route-matching timing threshold | keeps the same host-load flake with a larger number. Confidence: high Scope-risk: narrow Tested: VF_DISABLE_LRU_INTERVAL=1 SSR_TRANSFORM_PER_PROJECT_LIMIT=0 REVALIDATION_PER_PROJECT_LIMIT=0 NODE_ENV=production LOG_FORMAT=text deno test --no-check --allow-all --parallel --unstable-worker-options --unstable-net src/provider/runtime-loader.test.ts src/routing/api/api-route-matcher.test.ts Tested: deno fmt --check src/provider/runtime-loader/tool-input-status.ts src/routing/api/api-route-matcher.test.ts Tested: DENO_NO_PACKAGE_JSON=1 deno lint src/provider/runtime-loader/tool-input-status.ts src/routing/api/api-route-matcher.test.ts
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 099535fe4b
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| const ready = await Promise.race([ | ||
| nextPartPromise.then((result) => ({ kind: "part" as const, result })), | ||
| Promise.resolve({ kind: "pending" as const }), | ||
| ]); |
There was a problem hiding this comment.
Do not let the sentinel win over settled stream parts
When the timeout branch runs after iterator.next() has already settled, this helper still returns null: nextPartPromise.then(...) creates a new pending promise, while Promise.resolve({ kind: "pending" }) is already fulfilled, so the sentinel can win the Promise.race even for a ready part. In that timing window the code still emits a pending_input heartbeat before processing the already-ready tool-input-delta or tool-call, which is the stale status this change is trying to avoid.
Useful? React with 👍 / 👎.
Summary
Follow-up after #1430 to keep the parallel pre-push/CI suite deterministic.
pending_inputheartbeat.Verification
Targeted:
deno fmt --check src/agent/detached-run-tracker.test.ts src/security/utils/constant-time.test.ts src/provider/runtime-loader/tool-input-status.ts src/routing/api/api-route-matcher.test.ts DENO_NO_PACKAGE_JSON=1 deno lint src/agent/detached-run-tracker.test.ts src/security/utils/constant-time.test.ts src/provider/runtime-loader/tool-input-status.ts src/routing/api/api-route-matcher.test.ts VF_DISABLE_LRU_INTERVAL=1 SSR_TRANSFORM_PER_PROJECT_LIMIT=0 REVALIDATION_PER_PROJECT_LIMIT=0 NODE_ENV=production LOG_FORMAT=text deno test --no-check --allow-all --parallel --unstable-worker-options --unstable-net src/agent/detached-run-tracker.test.ts src/security/utils/constant-time.test.ts src/provider/runtime-loader.test.ts src/routing/api/api-route-matcher.test.tsTargeted result:
4 passed (55 steps) | 0 failed.Full pre-push hook:
Checked 3305 files)Checked 3274 files)1663 passed (17210 steps) | 0 failed | 0 ignored (2 steps), 7m27s)