mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-16 20:22:21 +03:00
fix(executors): strip client context_management on 400 (port from 9router#1468)
Claude Code always sends a top-level `context_management` field. Strict anthropic-compatible gateways reject it with 400 "context_management: Extra inputs are not permitted". The dedicated context-editing 400-fallback in base.ts only fires when OmniRoute's own `contextEditing` feature is enabled (default off), so a client-sent field passed through untouched and 400'd with no recovery. Add `context_management` to KNOWN_OFFENDING_FIELDS so the generic reactive 400 field-downgrade strips-and-retries it once, independent of the feature flag (the generic path already re-signs for claude-compatible relays). Regression guard: tests/unit/provider-field-strips.test.ts. Reported-by: ohahe52-dot (https://github.com/decolua/9router/issues/1468)
This commit is contained in:
@@ -9,6 +9,12 @@ test("findOffendingField matches known field names in a 400 body", () => {
|
||||
assert.equal(findOffendingField("Invalid argument: reasoning_budget not supported"), "reasoning_budget");
|
||||
assert.equal(findOffendingField("unexpected field chat_template"), "chat_template");
|
||||
assert.equal(findOffendingField("reasoning_content is not allowed"), "reasoning_content");
|
||||
// #1468: Claude Code's top-level context_management field rejected by strict
|
||||
// anthropic-compatible gateways → strip + retry regardless of the contextEditing flag.
|
||||
assert.equal(
|
||||
findOffendingField("context_management: Extra inputs are not permitted"),
|
||||
"context_management"
|
||||
);
|
||||
assert.equal(findOffendingField("all good"), null);
|
||||
assert.equal(findOffendingField(""), null);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user