Skip to content

feat(codex): CPR-style model_mappings for codex-auto-review (#526) - #598

Merged
dofastted merged 2 commits into
mainfrom
cursor/codex-auto-review-model-mappings-1ec5
Oct 19, 2026
Merged

dofastted merged 2 commits into
mainfrom
cursor/codex-auto-review-model-mappings-1ec5

Conversation

@dofastted

@dofastted dofastted commented Oct 19, 2026 •

Copy link
Copy Markdown
Owner

Summary

Implements REQ-0526 / #526: inbound exact model mapping before detectInboundPlatform, aligned with codex-proxy-rs modelMappings.

  • routing.codex.model_mappings: client model id → upstream GPT id; hot-reloads with other routing keys via normalizeCodexRouting.
  • Built-in defaults when unset/empty: codex-auto-review → gpt-6-luna; explicit empty target for that key → gpt-6.1-sol.
  • Rewrites body.model in handle-protocol before platform detect; literal detectInboundPlatform('codex-auto-review') unchanged (fail-close).
  • Invalid/disabled non-GPT targets → 400 (codex_model_mapping_invalid / model_disabled); no Anthropic hop.
  • Sets logBag.upstream_model on rewrite; requested_model stays the client value (billing uses upstream per existing log pipeline).

Tests

  • test/unit/codex-model-mapping.test.mjs: defaults, override, fallback, invalid/disabled targets, source-order check.

Docs

  • docs/PANEL_API.md ops note; CHANGELOG.md 未发布 entry.

Follow-up

  • Panel UI for editing codex.model_mappings (config-only for MVP).

Closes #526

Open in Web Open in Cursor 

Note

Medium Risk
Changes Codex inbound model resolution and platform detection order; misconfiguration could block or mis-route requests, but targets are validated against GPT policy before hop.

Reviewed by Cursor Bugbot for commit 847c2cb. Configure here.

@dofastted dofastted mentioned this pull request Oct 19, 2026
3 tasks done
Add CPR-style routing.codex.model_mappings applied before platform detect,
with product defaults codex-auto-review→gpt-6-luna and empty-target fallback
to gpt-6.1-sol. Validates GPT targets, preserves requested vs upstream logs,
docs and unit tests.

Co-authored-by: ted <kuhlmangarry24@gmail.com>
@cursor
cursor Bot force-pushed the cursor/codex-auto-review-model-mappings-1ec5 branch from 55afa54 to 8b40b4a Compare October 19, 2026 08:08
Co-authored-by: ted <kuhlmangarry24@gmail.com>
@dofastted
dofastted marked this pull request as ready for review October 19, 2026 08:12

@cursor cursor Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.

Reviewed by Cursor Bugbot for commit 847c2cb. Configure here.

}
merged[alias] = String(value).trim()
}
return merged

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Fallback mapping target not catalog-safe

Medium Severity

Clearing codex-auto-review is documented to fall back to gpt-6.1-sol, but that id is not in seedGptPolicy, patch validation skips empty values, and persist then stores the resolved fallback. After a Codex catalog sync, unseen GPT ids start disabled (or are unknown), so auto-review requests 400 with model_disabled, and a later PUT of the GET payload can fail even though the empty save succeeded.

Additional Locations (1)
Fix in Cursor Fix in Web

Reviewed by Cursor Bugbot for commit 847c2cb. Configure here.

@dofastted
dofastted merged commit e9b598e into main Oct 19, 2026
8 checks passed
@dofastted
dofastted deleted the cursor/codex-auto-review-model-mappings-1ec5 branch October 19, 2026 08:20
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.

[Bug] Codex无法自动审批

2 participants