[PR #2851] [CLOSED] fix(verify): route OpenAI model fixture requests by pathname #5437

Closed
opened 2026-10-31 01:06:37 +00:00 by bsakaguchi · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/morluto/rea/pull/2851
Author: @shubhamahuja9999
Created: 10/13/2026
Status: ❌ Closed

Base: main ← Head: fix/model-fixture-query-routes


📝 Commits (2)

  • 154e1c2 fix(verify): route OpenAI model fixture requests by pathname
  • 2be0921 fix(verify): type the OpenAI fixture's assistant message callback

📊 Changes

3 files changed (+100 additions, -2 deletions)

View changed files

➕ scripts/verify/clients/model-fixture.d.mts (+44 -0)
📝 scripts/verify/clients/model-fixture.mjs (+4 -2)
➕ tests/evaluation/model-evals/openAiModelFixture.test.ts (+52 -0)

📄 Description

Summary

Fixes #2588

The loopback OpenAI model fixture (scripts/verify/clients/model-fixture.mjs) used by the native client verification lanes compared the raw request target, query included. A chat-completion request such as POST /v1/chat/completions?api-version=1 was treated as an unsupported endpoint and returned 404 without reaching onRequest. GET /v1/models?limit=1 had the same problem.

Problem and expected behavior

Smallest trigger: POST {baseUrl}/chat/completions?stream=true returns 404, while the same body without the query returns 200.

Expected: the query component does not select an endpoint. Both chat-completion requests reach the callback and return 200, model listing ignores the query, and unrelated endpoints such as /v1/completions still return 404. This follows the format-aware boundary parsing rule in AGENTS.md and matches the sibling anthropic-model-fixture.mjs and gemini-model-fixture.mjs, which already route by new URL(request.url, "http://localhost").pathname.

Change and scope

  • Parse the pathname once per request and use it for both the /models and /v1/chat/completions routes.
  • Recorded requests[].path, probes[].path and the incoming-request files keep the original request target, query included, so captured client behavior is preserved.
  • Add the fixture's first regression test and a model-fixture.d.mts declaration so TypeScript tests can import it, following scripts/lib/*.d.mts. The declaration types the onRequest assistant message (role, content, optional tool_calls), so a callback returning nothing fails type checking (review follow-up).
  • Not included: streaming still follows the request body, and no other fixture behavior changes.

Placement note: no test covered these client fixtures before, so the test sits with the other model-evaluation tests in tests/evaluation/model-evals/. Happy to move it if you prefer another home.

Contribution scope: verification-fixture fix within existing boundaries; maintainer decision not applicable.

Contract and boundary impact

  • Semantic owner and earliest changed stage: request routing in the loopback OpenAI fixture.
  • Contribution scope fit and linked maintainer decision: not applicable.
  • CLI and MCP/tool-catalog contract: none.
  • Provider, bridge, target-format, or platform compatibility: none; affects only verification lanes that use this fixture.
  • Evidence, artifact, provenance, or reconstruction contract: none.
  • Target selection, authority, upstream behavior, and cleanup details: the fixture still binds 127.0.0.1 on an ephemeral port; the test closes it in finally and uses createTestTempDirectory.
  • Generated metadata, package, or installation impact: none.

Expected effects:

  • Read existing files or captured data.
  • Launch or attach to a process.
  • Inject instrumentation or run scripts/code.
  • Change process memory, registers, files, or configuration.
  • Contact network services.
  • Recover protected code or work around protections.
  • Documentation or usability only; no target interaction.
  • Not sure yet; investigation or maintainer guidance needed.

None of these apply: this is a test fixture behind loopback verification lanes.

Evidence and regression coverage

  • Test added: tests/evaluation/model-evals/openAiModelFixture.test.ts sends /chat/completions, /chat/completions?api-version=1, /completions and GET /models?limit=1 to the real fixture. It asserts statuses [200, 200, 404, 200], two callback invocations, the recorded original paths, one 404 probe for /v1/completions, and no fixture failure.
  • Base reproduction: without the fix the test fails with statuses [200, 404, 404, 404], which reproduces the issue and the same /models query case.
  • User-visible output: not applicable.
  • Remaining proof gaps: no native client lane (verify:*-client) was run; those need installed third-party clients.

Validation performed

Windows 11, Node.js 24.18.0, npm 11.16.0, on main at 6e25cc3c7:

  • npm run test:local -- tests/evaluation/model-evals/openAiModelFixture.test.ts: failed without the fix ([200, 404, 404, 404]); passes with it.
  • npm run test:focused -- tests/evaluation/model-evals/openAiModelFixture.test.ts tests/evaluation/model-evals/codexAgentEval.test.ts: 23/23 passed.
  • npm run test:local -- all 4 tests/evaluation/model-evals/*.test.ts: 71/71 passed.
  • npm run check:fast (typecheck and lint): passed.
  • npm run verify:test-discovery: "Discovered all 1089 test files exactly once."
  • oxfmt --check on changed files: passed.

Compatibility, safety, and release

  • Breaking changes or migration steps: none.
  • Real Hopper/Ghidra, browser, or OS coverage: not applicable.
  • Package or release metadata impact: none; scripts/verify/ is not shipped.
  • Security, privacy, process, or containment review: loopback-only fixture; recorded paths unchanged.

Before merge

  • This PR addresses a concrete problem or an agreed enhancement.
  • Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff.
  • The PR has one focused outcome and the title follows type(scope): outcome.
  • Related issue is linked, or the reason for not linking one is stated above.
  • Tests cover changed observable behavior and meaningful failure paths.
  • Owning docs, contracts, and generated metadata are updated where needed.
  • User-visible CLI/MCP changes include representative output.
  • I checked the final diff for secrets, unrelated cleanup, and unsupported claims.

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/morluto/rea/pull/2851 **Author:** [@shubhamahuja9999](https://github.com/shubhamahuja9999) **Created:** 10/13/2026 **Status:** ❌ Closed **Base:** `main` ← **Head:** `fix/model-fixture-query-routes` --- ### 📝 Commits (2) - [`154e1c2`](https://github.com/morluto/rea/commit/154e1c216634687565f7800e428c17c6582abfec) fix(verify): route OpenAI model fixture requests by pathname - [`2be0921`](https://github.com/morluto/rea/commit/2be0921a8de125eeb468b23f5d82723280a51c78) fix(verify): type the OpenAI fixture's assistant message callback ### 📊 Changes **3 files changed** (+100 additions, -2 deletions) <details> <summary>View changed files</summary> ➕ `scripts/verify/clients/model-fixture.d.mts` (+44 -0) 📝 `scripts/verify/clients/model-fixture.mjs` (+4 -2) ➕ `tests/evaluation/model-evals/openAiModelFixture.test.ts` (+52 -0) </details> ### 📄 Description ## Summary Fixes #2588 The loopback OpenAI model fixture (`scripts/verify/clients/model-fixture.mjs`) used by the native client verification lanes compared the raw request target, query included. A chat-completion request such as `POST /v1/chat/completions?api-version=1` was treated as an unsupported endpoint and returned 404 without reaching `onRequest`. `GET /v1/models?limit=1` had the same problem. ## Problem and expected behavior Smallest trigger: `POST {baseUrl}/chat/completions?stream=true` returns 404, while the same body without the query returns 200. Expected: the query component does not select an endpoint. Both chat-completion requests reach the callback and return 200, model listing ignores the query, and unrelated endpoints such as `/v1/completions` still return 404. This follows the format-aware boundary parsing rule in AGENTS.md and matches the sibling `anthropic-model-fixture.mjs` and `gemini-model-fixture.mjs`, which already route by `new URL(request.url, "http://localhost").pathname`. ## Change and scope - Parse the pathname once per request and use it for both the `/models` and `/v1/chat/completions` routes. - Recorded `requests[].path`, `probes[].path` and the incoming-request files keep the original request target, query included, so captured client behavior is preserved. - Add the fixture's first regression test and a `model-fixture.d.mts` declaration so TypeScript tests can import it, following `scripts/lib/*.d.mts`. The declaration types the `onRequest` assistant message (`role`, `content`, optional `tool_calls`), so a callback returning nothing fails type checking (review follow-up). - Not included: streaming still follows the request body, and no other fixture behavior changes. Placement note: no test covered these client fixtures before, so the test sits with the other model-evaluation tests in `tests/evaluation/model-evals/`. Happy to move it if you prefer another home. Contribution scope: verification-fixture fix within existing boundaries; maintainer decision not applicable. ## Contract and boundary impact - Semantic owner and earliest changed stage: request routing in the loopback OpenAI fixture. - Contribution scope fit and linked maintainer decision: not applicable. - CLI and MCP/tool-catalog contract: none. - Provider, bridge, target-format, or platform compatibility: none; affects only verification lanes that use this fixture. - Evidence, artifact, provenance, or reconstruction contract: none. - Target selection, authority, upstream behavior, and cleanup details: the fixture still binds `127.0.0.1` on an ephemeral port; the test closes it in `finally` and uses `createTestTempDirectory`. - Generated metadata, package, or installation impact: none. Expected effects: - [ ] Read existing files or captured data. - [ ] Launch or attach to a process. - [ ] Inject instrumentation or run scripts/code. - [ ] Change process memory, registers, files, or configuration. - [ ] Contact network services. - [ ] Recover protected code or work around protections. - [ ] Documentation or usability only; no target interaction. - [ ] Not sure yet; investigation or maintainer guidance needed. None of these apply: this is a test fixture behind loopback verification lanes. ## Evidence and regression coverage - Test added: `tests/evaluation/model-evals/openAiModelFixture.test.ts` sends `/chat/completions`, `/chat/completions?api-version=1`, `/completions` and `GET /models?limit=1` to the real fixture. It asserts statuses `[200, 200, 404, 200]`, two callback invocations, the recorded original paths, one 404 probe for `/v1/completions`, and no fixture failure. - Base reproduction: without the fix the test fails with statuses `[200, 404, 404, 404]`, which reproduces the issue and the same `/models` query case. - User-visible output: not applicable. - Remaining proof gaps: no native client lane (`verify:*-client`) was run; those need installed third-party clients. ## Validation performed Windows 11, Node.js 24.18.0, npm 11.16.0, on `main` at `6e25cc3c7`: - `npm run test:local -- tests/evaluation/model-evals/openAiModelFixture.test.ts`: failed without the fix (`[200, 404, 404, 404]`); passes with it. - `npm run test:focused -- tests/evaluation/model-evals/openAiModelFixture.test.ts tests/evaluation/model-evals/codexAgentEval.test.ts`: 23/23 passed. - `npm run test:local --` all 4 `tests/evaluation/model-evals/*.test.ts`: 71/71 passed. - `npm run check:fast` (typecheck and lint): passed. - `npm run verify:test-discovery`: "Discovered all 1089 test files exactly once." - `oxfmt --check` on changed files: passed. ## Compatibility, safety, and release - Breaking changes or migration steps: none. - Real Hopper/Ghidra, browser, or OS coverage: not applicable. - Package or release metadata impact: none; `scripts/verify/` is not shipped. - Security, privacy, process, or containment review: loopback-only fixture; recorded paths unchanged. ## Before merge - [x] This PR addresses a concrete problem or an agreed enhancement. - [x] Material scope and authority questions are resolved, and any required maintainer scope decision covers the final diff. - [x] The PR has one focused outcome and the title follows `type(scope): outcome`. - [x] Related issue is linked, or the reason for not linking one is stated above. - [x] Tests cover changed observable behavior and meaningful failure paths. - [x] Owning docs, contracts, and generated metadata are updated where needed. - [x] User-visible CLI/MCP changes include representative output. - [x] I checked the final diff for secrets, unrelated cleanup, and unsupported claims. 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
bsakaguchi 2026-10-31 01:06:37 +00:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
morluto/rea#5437
No description provided.