mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-07-26 09:52:11 +03:00
fix(codex): translate messages to input for Cursor 5.5 compact endpoint passthrough (#1832)
This commit is contained in:
@@ -15,6 +15,8 @@
|
||||
|
||||
### 🐛 Bug Fixes
|
||||
|
||||
- **Combo Routing:** Fixed an issue where Gemini `-preview` models were incorrectly normalized to their canonical names, causing 404 errors during combo routing (#1834)
|
||||
- **Codex Native Passthrough:** Added support for Cursor 5.5 sending `messages` arrays to the `responses/compact` endpoint, preventing upstream rejections with empty requests (#1832)
|
||||
- **Rate-limit Watchdog:** Implemented a new rate-limit watchdog with environment override capabilities and Stage Tracing to prevent and diagnose silent wedges (#1828)
|
||||
- **Encryption Resiliency:** Prevent sending encrypted tokens to providers by returning null on decryption failure (#763d353)
|
||||
- **i18n & Locales:** Fixed OpenCode baseUrl locale placeholders and added compression keys across 32 languages
|
||||
|
||||
@@ -1251,6 +1251,23 @@ export class CodexExecutor extends BaseExecutor {
|
||||
// so any references to previous response items would cause 404 errors.
|
||||
stripStoredItemReferences(body);
|
||||
|
||||
// Issue #1832: Map messages to input for clients like Cursor 5.5 that use responses/compact but send messages instead of input
|
||||
if (!body.input && Array.isArray(body.messages)) {
|
||||
body.input = body.messages.map((msg: any) => ({
|
||||
type: "message",
|
||||
role: typeof msg.role === "string" ? msg.role : "user",
|
||||
content:
|
||||
typeof msg.content === "string"
|
||||
? [{ type: "input_text", text: msg.content }]
|
||||
: Array.isArray(msg.content)
|
||||
? msg.content.map((c: any) => {
|
||||
if (c && c.type === "text") return { type: "input_text", text: c.text };
|
||||
return c;
|
||||
})
|
||||
: [],
|
||||
}));
|
||||
}
|
||||
|
||||
// Issue #806: Even for native passthrough, some clients (purist completions) might indiscriminately inject
|
||||
// a `messages` or `prompt` array which the strict Codex Responses schema rejects.
|
||||
delete body.messages;
|
||||
|
||||
Reference in New Issue
Block a user