Skip to content

🤖 fix: route mux gateway models in backend#2025

Merged
ibetitsmike merged 7 commits intomainfrom
mike/backend-gateway-routing
Feb 4, 2026
Merged

🤖 fix: route mux gateway models in backend#2025
ibetitsmike merged 7 commits intomainfrom
mike/backend-gateway-routing

Conversation

@ibetitsmike
Copy link
Contributor

Summary

  • Move mux-gateway routing decisions into the backend so the first message in new workspaces routes correctly.
  • Ensure persisted model IDs stay canonical while the backend applies gateway routing as needed.
  • Clean up gateway provider parsing and edit-message handling for stricter typing.

Background

Implementation

  • Added backend-side gateway resolution in AIService and normalized model IDs before persistence in AgentSession.
  • Removed frontend send-path rewrites so clients always send canonical model IDs.
  • Centralized gateway-supported providers and tightened provider parsing/type guards.

Validation

  • make static-check

Risks

  • Low: gateway routing behavior now depends entirely on backend config (global toggle + allowlist + coupon), but falls back to canonical providers if unavailable.

Generated with mux • Model: openai:gpt-5.2-codex • Thinking: xhigh • Cost: $6.60

@github-actions github-actions bot added the bug label Jan 29, 2026
Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 71c79a8440

ℹ️ 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".

@ibetitsmike
Copy link
Contributor Author

@codex review

Addressed the legacy mux-gateway routing note by honoring explicit mux-gateway prefixes (with comments) while still respecting backend config + global toggle.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 51c28cc9f7

ℹ️ 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".

@ibetitsmike
Copy link
Contributor Author

@codex review

Preserved explicit mux-gateway prefixes for legacy clients in send/resume before routing, while still normalizing persisted model IDs.

Copy link

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 52565615d8

ℹ️ 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".

@ibetitsmike ibetitsmike force-pushed the mike/backend-gateway-routing branch from 5256561 to d3f6f04 Compare January 29, 2026 18:34
Propagate routedThroughGateway metadata through stream events and message
hydration so the UI can render the Mux Gateway indicator even when models
remain canonical.

---

_Generated with `mux` • Model: `openai:gpt-5.2-codex` • Thinking: `xhigh` • Cost: `$17.62`_

<!-- mux-attribution: model=openai:gpt-5.2-codex thinking=xhigh costs=17.62 -->
Codex noted that compaction metadata may contain an empty model string.
Trim and fall back to workspace defaults to avoid backend validation errors.

---

_Generated with `mux` • Model: `openai:gpt-5.2` • Thinking: `xhigh` • Cost: `$17.93`_

<!-- mux-attribution: model=openai:gpt-5.2 thinking=xhigh costs=17.93 -->
@ibetitsmike ibetitsmike force-pushed the mike/backend-gateway-routing branch from d3f6f04 to 07c935c Compare February 4, 2026 14:40
@ibetitsmike
Copy link
Contributor Author

@codex review

Fixed empty/whitespace compaction model overrides by trimming and falling back to the workspace model; added tests to cover both cases.

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. More of your lovely PRs please.

ℹ️ 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".

Add unit tests for AIService.resolveGatewayModelString to lock in routing
behavior across enabled/disabled/configured cases, supported providers,
variant allowlisting via modelKey, and explicit legacy opt-in.

---

_Generated with `mux` • Model: `openai:gpt-5.2` • Thinking: `xhigh` • Cost: `$17.93`_

<!-- mux-attribution: model=openai:gpt-5.2 thinking=xhigh costs=17.93 -->
@ibetitsmike
Copy link
Contributor Author

@codex review

Follow-up: added unit tests for AIService.resolveGatewayModelString to cover the backend routing cases (enabled/disabled/configured, supported providers, modelKey variants, explicit legacy opt-in).

@chatgpt-codex-connector
Copy link

Codex Review: Didn't find any major issues. Chef's kiss.

ℹ️ 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".

@ibetitsmike ibetitsmike merged commit aea79af into main Feb 4, 2026
22 of 23 checks passed
@ibetitsmike ibetitsmike deleted the mike/backend-gateway-routing branch February 4, 2026 15:44
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.

1 participant

Comments