Skip to content

fix(sse): route AgentRouter GPT models through Responses - #18560

Merged
diegosouzapw merged 7 commits into
cheaper-inference:release/v3.8.53from
trespassmk:fix/17997-agentrouter-responses
Nov 4, 2026
Merged

diegosouzapw merged 7 commits into
cheaper-inference:release/v3.8.53from
trespassmk:fix/17997-agentrouter-responses

Conversation

@trespassmk

Copy link
Copy Markdown
Contributor

Summary

  • Route the confirmed AgentRouter Responses-only models gpt-6-astra, gpt-6.1-sol, and gpt-5.6-sol through /v1/responses when a connection has no explicit protocol selection.
  • Preserve explicit Chat, Claude, Responses, custom-model, registry, and passthrough precedence.
  • Translate Responses output back to valid buffered and streaming Chat Completions output for Chat clients and dashboard probes.

Related Issues

⚠️ base-red inherited: #17219

Target Branch

  • Base is the active release/v3.8.53 branch, not main.
  • This is a bug fix, not a new feature.
  • Reconciled with release/v3.8.53 tip 689b1eb573e21ea1bac4467c2ccfd9b8aaa7c518.
  • No release freeze was active at reconciliation time.

Validation

  • Change type: provider / routing
  • Focused tests and category gates from the golden path
  • npm run lint
  • Reconciled with the current active release base; focused checks rerun afterward
  • Production-code changes include updated automated tests

Commands run after reconciliation:

node --import tsx/esm --test tests/unit/chatcore-target-format.test.ts tests/unit/agentrouter-chatcore-protocols.test.ts tests/unit/agentrouter-executor-protocols.test.ts tests/unit/agentrouter-live-catalog.test.ts tests/unit/agentrouter-model-test-responses-17997.test.ts
# 36 passed, 0 failed

npm run lint
# passed

npm run typecheck:core
# passed

npm run check:open-sse-typecheck
# passed, 0 errors

npm run check:changelog-integrity
# passed

git diff upstream/release/v3.8.53..HEAD --check
# passed

npm run check:test-tla-order currently fails on the unchanged upstream file tests/unit/perplexity-research-tool.test.ts (test line 56, top-level await line 198, later test line 230). Running the same gate logic against base tip 689b1eb573 reproduces the failure and confirms the file is not allowlisted. This PR does not modify that file.

TDD evidence:

  • New resolver/handler regressions failed before the production fix because requests selected Chat and reproduced AgentRouter's endpoint HTTP 400.
  • Reverting only the production routing hunk made the real dashboard-runner regression fail against /v1/chat/completions; restoring it passed.
  • Independent SSE error, response.failed, and completed-empty fixtures reject false-positive health results.

Live acceptance used an isolated local OmniRoute data directory with the credential supplied only through the environment. Buffered Chat, streaming Chat, native Responses, and dashboard model tests completed for all three affected IDs. Diagnostics selected openai-responses; one Astra dashboard timeout and one empty gpt-5.6-sol response were treated as failures and passed one bounded retry.

Tests Added Or Updated

  • tests/unit/chatcore-target-format.test.ts
  • tests/unit/agentrouter-chatcore-protocols.test.ts
  • tests/unit/agentrouter-model-test-responses-17997.test.ts

Existing focused guards also run:

  • tests/unit/agentrouter-executor-protocols.test.ts
  • tests/unit/agentrouter-live-catalog.test.ts

Coverage Notes

  • Resolver tests cover exact-ID defaults, empty/absent connection settings, explicit protocol precedence, custom-model precedence, and unrelated models/providers.
  • Handler tests cover URL, Bearer/Codex headers, request translation, buffered Chat output, streaming Chat chunks, terminal semantics, and credential immutability.
  • The dashboard integration test exercises the real database, connection selection, route, handler, resolver, execution credentials, and stream reader while mocking only external AgentRouter HTTP.
  • Full unit/Vitest, coverage ratchet, and production build remain CI checks per the contribution guide.

Reviewer Notes

  • Automatic routing is intentionally an exact-ID set; no GPT-family or suffix matching was added.
  • No catalog targetFormat was added because it would override explicit connection choices.
  • No credentials or environment files are included in the diff.
  • Fresh-context review found one failure-fixture isolation gap; it was fixed by splitting SSE error, response.failed, and empty-output cases.

@trespassmk
trespassmk marked this pull request as ready for review October 29, 2026 16:51
@coderabbitai

coderabbitai Bot commented Nov 3, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Summary

Summary by CodeRabbit

  • New Features
    • AgentRouter now uses the OpenAI Responses format by default for gpt-6-astra, gpt-6.1-sol, and gpt-5.6-sol.
    • Chat requests to these models continue to return Chat-compatible responses, including streaming responses.
    • Explicit connection format settings are preserved, and other models retain their existing format behavior.

AgentRouter now defaults three named models to the Responses endpoint when no explicit target format is set. The changes add tests for target-format selection, Chat-shaped output, and dashboard probe results.

Changes: AgentRouter Responses routing

Layer / File(s) Summary
Model-specific target-format resolution
open-sse/handlers/chatCore/targetFormat.ts, tests/unit/chatcore-target-format.test.ts, changelog.d/fixes/18560-agentrouter-responses.md
The resolver defaults gpt-6-astra, gpt-6.1-sol, and gpt-5.6-sol to OpenAI Responses when no explicit target format is set. Tests cover explicit overrides and other models and providers. The changelog records the default and preservation of explicit settings.
Chat requests and Responses conversion
tests/unit/agentrouter-chatcore-protocols.test.ts
Existing Chat cases now set OpenAI Chat explicitly. New streaming and non-streaming cases verify Responses endpoint requests and Chat-shaped output.
Dashboard model probe validation
tests/unit/agentrouter-model-test-responses-17997.test.ts
Tests cover successful Responses output, SSE errors, failed streams, and completed streams with empty output.

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix · Severity of issue fixed: Medium

Possibly related PRs

Merge Risk: Minimal · up to fda59

The three models retain the intended default routing, and no actionable issue remains before normal merge checks.

Security architecture risk: Low · up to fda59

The change is narrowly scoped and preserves explicit settings and existing credentials. Ordinary translated requests disable remote response storage. Retention and recovery behavior remain unverified when storage is explicitly enabled.

Retained concerns
No architecture-level concerns identified.

Security review details

Security Blast Radius

  • inferred — The routing delta affects requests resolving to the three exact AgentRouter model identifiers without a higher-priority format selection. It changes which existing provider endpoint receives those requests, but does not supply another account key or establish additional tenant, infrastructure, or service authority.

Trust Boundaries and Controls

  • observed — Protocol metadata is copied into execution credentials for the current request rather than persisted to the connection. The added Chat regressions assert use of the supplied bearer key, absence of Claude-specific authentication headers, and unchanged original credentials.

Resilience and Maintainability Implications

  • inferred — Default stateless translation limits the remote-state transition introduced by automatic routing. When connection storage is enabled, however, store is omitted and continuation identifiers may survive. Repository evidence does not establish the external service's resulting retention, ownership, idempotency, or recovery guarantees; no remote-state creation or cleanup failure is verified.
Pre-merge checks: Passed 5 · Failed 1 · Inconclusive 1

Failed Failed checks: 1 warning · 1 inconclusive

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentat… Write docstrings for the functions missing them to satisfy the coverage threshold.
No Ai Attribution Inconclusive All seven reviewed commit messages have no Co-Authored-By trailers or Generated with footer. The supplied PR body is explicitly truncated, so the complete body cannot be checked for the prohibited att… Provide the complete PR body, or confirm that it contains neither an AI/bot Co-Authored-By trailer nor a Generated with footer.
Passed Passed checks: 5 passed
Check name Status Explanation
Title check Passed The title "fix(sse): route AgentRouter GPT models through Responses" follows the Conventional Commits format with a valid type (fix) and scope (sse). It describes the main change: the three AgentRoute…
Description check Passed The description follows the repository template in part. It has a Summary, Related Issues (Closes #17997, Related to #17219), a Target Branch checklist, and a Validation section that lists the command…
Linked Issues check Passed The PR satisfies the coding requirements in #17997. resolveChatCoreTargetFormat selects OPENAI_RESPONSES for the exact models gpt-6-astra, gpt-6.1-sol, and gpt-5.6-sol when no explicit conne…
Out of Scope Changes check Passed The changed resolver, ChatCore protocol tests, dashboard probe test, and changelog entry directly support #17997. The changes preserve existing protocol precedence and test the required regression beh…
Tests For Production Code Passed The PR changes production code in open-sse/handlers/chatCore/targetFormat.ts. It also adds or updates three relevant unit-test files: tests/unit/chatcore-target-format.test.ts, `tests/unit/agentro…
Full details: Title check

Explanation

The title "fix(sse): route AgentRouter GPT models through Responses" follows the Conventional Commits format with a valid type (fix) and scope (sse). It describes the main change: the three AgentRouter GPT model IDs now route through the Responses endpoint. The diff touches the chat core target-format resolver (open-sse/handlers/chatCore/targetFormat.ts), so the scope 'sse' is a loose fit, but the title is still related to the main change.

Full details: Description check

Explanation

The description follows the repository template in part. It has a Summary, Related Issues (Closes #17997, Related to #17219), a Target Branch checklist, and a Validation section that lists the commands run and the test files changed. It lacks a Coverage Notes section that explains coverage for the touched src/ and open-sse/ code, though the Reviewer Notes section and the 'Coverage Notes' bullets in the description partly cover this. The Tests Added Or Updated section lists the changed test files, and the description states that focused test runs passed (36 passed). Required content is mostly complete, so the check passes.

Full details: Linked Issues check

Explanation

The PR satisfies the coding requirements in #17997. resolveChatCoreTargetFormat selects OPENAI_RESPONSES for the exact models gpt-6-astra, gpt-6.1-sol, and gpt-5.6-sol when no explicit connection format exists. Explicit connection and custom-model formats retain precedence. The resolver and ChatCore tests cover all three model IDs. The dashboard probe test verifies a Responses request and Chat-shaped probe success, with failure cases for SSE errors, failed Responses, and empty output.

Full details: Out of Scope Changes check

Explanation

The changed resolver, ChatCore protocol tests, dashboard probe test, and changelog entry directly support #17997. The changes preserve existing protocol precedence and test the required regression behavior. No unrelated change is demonstrated. The related reference to #17219 does not add a separate active coding target.

Full details: Tests For Production Code

Explanation

The PR changes production code in open-sse/handlers/chatCore/targetFormat.ts. It also adds or updates three relevant unit-test files: tests/unit/chatcore-target-format.test.ts, tests/unit/agentrouter-chatcore-protocols.test.ts, and tests/unit/agentrouter-model-test-responses-17997.test.ts. The tests cover the changed AgentRouter model routing and /v1/responses behavior.

Full details: Docstring Coverage

Explanation

Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff with cyclomatic complexity of at least 2. Documentation-only edits and deletions within surviving functions are included; unchanged diff context and fully deleted functions are excluded. Analyzed 1 functions across 4 files. (1 skipped: 1 unsupported.)

Resolution

Write docstrings for the functions missing them to satisfy the coverage threshold.

Full details: No Ai Attribution

Explanation

All seven reviewed commit messages have no Co-Authored-By trailers or Generated with footer. The supplied PR body is explicitly truncated, so the complete body cannot be checked for the prohibited attribution. No full PR description is available in the checkout refs.

Resolution

Provide the complete PR body, or confirm that it contains neither an AI/bot Co-Authored-By trailer nor a Generated with <AI tool> footer.

Finishing Touches
Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Usage-based review receipt

  • Mode: Continue automatically
  • Reviewed files: 5
  • Waived: $1.25 (charged $0.00)
  • View usage details

Note

This review exceeded your plan’s limits and used usage-based reviews—free during trial, billed after paid activation unless disabled. Manage usage-based reviews.

Recent review info
Run configuration
Commits

Reviewing files that changed from the base of the PR and between f000c11 and fda59ad.

Files selected for processing: 5
  • changelog.d/fixes/18560-agentrouter-responses.md
  • open-sse/handlers/chatCore/targetFormat.ts
  • tests/unit/agentrouter-chatcore-protocols.test.ts
  • tests/unit/agentrouter-model-test-responses-17997.test.ts
  • tests/unit/chatcore-target-format.test.ts

Limit details: You’ve used all 10 included reviews currently available.

@diegosouzapw
diegosouzapw merged commit 3255552 into cheaper-inference:release/v3.8.53 Nov 4, 2026
37 of 39 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix(providers): AgentRouter model tests return unsupported-endpoint 400 after upgrading

2 participants