Skip to content

test(responses): answer requests the code under test did not send with 404 in the Droid default fixtures - #8715

Merged
lidge-jun merged 1 commit into
devfrom
fix/dev-red8-droid-upstream-stray-requests
Nov 13, 2026
Merged

lidge-jun merged 1 commit into
devfrom
fix/dev-red8-droid-upstream-stray-requests

Conversation

@lidge-jun

@lidge-jun lidge-jun commented Nov 13, 2026 •

Copy link
Copy Markdown
Owner

Summary

test 5/5 of dev batch 43508374033 (self-hosted Linux, shard 5/5 batch 43/64: 778 pass / 1 fail / 1 error) failed tests/responses/droid-reasoning-defaults.test.ts "native Chat leaves explicit effort values and invalid defaults alone". The log shows the cause: a fixture upstream (Bun.serve({ port: 0 })) received a bodiless GET /healthz ("GET - /healthz failed"), its handler read every request as JSON and threw SyntaxError: Unexpected end of JSON input, and the case failed mid-run. The case kept sending after its teardown had already released the spend home and removed the temp home, and its last send got 429. That 429 is the batch's "Unhandled error between tests".

This is not a regression in the Droid reasoning default logic. The test file has not changed since de82861; nothing between the last green batches and this head touches reasoning or effort handling; and nothing in opencodex sends /healthz to a provider. The file passes alone on 28680d5c0 (28/28). The request came from another process that knew that loopback port. On a self-hosted host that runs several runners, an ephemeral port is reused across processes, and a lingering health probe for a former owner of the port can arrive.

Only a POST can be the request under test, so both fixture upstreams (upstream() and failingUpstream()) now answer anything else with 404, without reading or capturing it. The asserted request path and every other assertion are unchanged.

Verification

  • Reproduced the CI failure locally by sending a GET /healthz to each fixture upstream right after it starts: on the origin/dev version the targeted case fails with the same three symptoms (SyntaxError, "GET - /healthz failed", unhandled 429). With the probe at every upstream, the whole file fails (0 pass / 28 fail / 27 errors). With the fix and the same probes: 28 pass / 0 fail.
  • bun test tests/responses/droid-reasoning-defaults.test.ts: 28 pass / 0 fail. bun run typecheck: exit 0.
  • NOT RUN: the full suite locally. The rest of batch 43508374033 is still running.

Checklist

  • Scope stays focused and avoids unrelated cleanup.
  • Docs or release notes were updated when needed.
  • Security-sensitive changes were reviewed for secrets, auth, and unsafe defaults.

Summary by CodeRabbit

  • Tests
    • Updated request-handling test coverage to verify that non-POST requests receive a not-found response before their bodies are processed.
    • Added assertions covering request paths and a scenario involving temporary port collisions.

…h 404 in the Droid default fixtures

dev batch 43508374033, test 5/5 (self-hosted Linux): a fixture upstream of
droid-reasoning-defaults received a bodiless GET /healthz on its ephemeral
loopback port. Its handler read every request as JSON, threw, and failed
"native Chat leaves explicit effort values and invalid defaults alone"; the
case kept sending after its teardown had run and a later send got 429, which
was the batch's unhandled error. Nothing in opencodex probes a provider's
/healthz, so the request came from another process that knew the port.

Only a POST can be the request under test, so both fixture upstreams now
answer anything else with 404 without reading or capturing it. Injecting a
GET /healthz at every upstream fails all 28 cases before (with the same
SyntaxError, 429 and unhandled error) and passes all 28 after.
@lidge-jun
lidge-jun requested a review from Ingwannu as a code owner November 13, 2026 21:27
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-11-13T21:29:04.387416Z 5fcd570 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

Copy link
Copy Markdown
Contributor

✅ Deterministic PR hygiene checks passed.

@coderabbitai

coderabbitai Bot commented Nov 13, 2026 •

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

The Droid reasoning defaults test fixtures now return 404 for non-POST requests before parsing or capturing request bodies. A comment documents the ephemeral-port collision scenario and request-path assertions.

Changes: Fixture request filtering

Layer / File(s) Summary
Filter fixture requests
tests/responses/droid-reasoning-defaults.test.ts
A shared request filter and comment describe the fixture behavior. Both upstream fixtures return 404 for non-POST requests before parsing or capturing their bodies.

Estimated code review effort: 1 (Trivial) | ~5 minutes

Change: Other

Merge Risk: Minimal · up to 5fcd5

This change makes the Droid reasoning defaults test fixtures ignore stray non-POST requests, which removes a flaky failure. It does not touch production code, and no merge-blocking risk remains.

Pre-merge checks: Passed 4

Check name Status Explanation
Description Check Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check Passed The title names the test-fixture change: the Droid default fixtures answer requests the code under test did not send with 404. The raw summary and PR objectives confirm the fixtures now return 404 for…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Title check

Explanation

The title names the test-fixture change: the Droid default fixtures answer requests the code under test did not send with 404. The raw summary and PR objectives confirm the fixtures now return 404 for non-POST requests without reading or capturing their bodies, which addresses the stray GET /healthz reaching an ephemeral fixture port. The title is specific and matches the main change, though it is long at 104 characters and uses a dense scope and wording.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

Share

Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 28680d5 and 5fcd570.

Files selected for processing: 1

  • tests/responses/droid-reasoning-defaults.test.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review.

@github-actions github-actions Bot added the chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature). label Nov 13, 2026
@lidge-jun

Copy link
Copy Markdown
Owner Author

Maintainer judgment: integrating into dev under the MAINTAINERS.md maintainer-integration exception, without a second maintainer approval. This is maintainer integration, not a self-approval.

Exact head 5fcd570:

  • PR CI: every check on this head passed or was skipped by policy. The first gates attempt failed in an unrelated GUI test (gui/tests/codex-account-pool-target-switch.test.tsx "an old visit's read must not give back the new visit's in-flight count": expected 3 reads, got 2, a one-tick wait after a target switch); this PR touches no GUI file, the test passed 15/15 locally, and only the failed jobs were re-run. That GUI timing flake is a follow-up.
  • Fresh final review (gpt-6.1-terra, high) on this exact head: PASS, no blocking findings. No path in this fixture's handleChatCompletions flow probes a provider /healthz or sends a non-POST; no assertion weakened. The 429 explanation (the case continued after teardown released the spend owner) is plausible, not proven by the log alone.
  • Reproduced before the fix: a GET /healthz injected at each upstream fails the file 0/28 (27 errors) with the CI symptoms; 28/28 after.
  • NOT RUN: full suite locally.

Test-only change; no outstanding maintainer change requests and no security-boundary surface.

@lidge-jun
lidge-jun merged commit 905ab67 into dev Nov 13, 2026
51 of 53 checks passed
@lidge-jun
lidge-jun deleted the fix/dev-red8-droid-upstream-stray-requests branch November 13, 2026 21:46
lidge-jun added a commit that referenced this pull request Nov 13, 2026
)

gui/tests/codex-account-pool-target-switch.test.tsx "an old visit's read must
not give back the new visit's in-flight count" counted roster reads one
macrotask after a target switch rendered outside act. The new target's read
reaches fetch only after React commits and runs that effect, and on loaded CI
runners that took longer: PR gates on #8715 and #8716 saw 2 reads where 3 were
due. The case now waits (bounded, 2 s) for the third read before asserting the
exact count; every assertion is unchanged. Delaying the fixture's fetch by 5 ms
fails the old version the same way (expected 3, received 2) and passes this one.

Co-authored-by: lidge-jun <[email protected]>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore Maintenance, CI, tests, refactors, or build changes (not a user-facing bug or feature).

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant