The preferred-account response-start failover from #19259 stopped working
in the v3.8.55 cycle. The contributor-train merge 60383f4fa5 ("Merge #19592
(head fc4b408e) into contributor train e1b") applied #19592 from a stale
branch whose diff deleted the wiring in src/sse/handlers/chat.ts. The
helper (src/sse/services/preferredConnectionFailover.ts), the Resilience
settings and the dashboard card stayed in place, so the toggle still showed
but no chat request ever used it. The existing tests only cover the helper,
so nothing failed.
Restore the wiring exactly as it was before the train (a78e2a87): resolve
preferredAccountFailover from the cached runtime settings, compute the
preferred deadline before dispatch (still disabled for pinned connections,
managed leases, Muse callers, combos and after the one hop), pass it as
requestUpstreamStartTimeoutMs, make one sibling hop on
REQUEST_SCOPED_UPSTREAM_TIMEOUT, and surface the original timeout when no
sibling is left. The #19592 additions (selectedConnectionPlan,
getCodexPlanType) stay.
Add tests/unit/chat-preferred-account-failover-wiring.test.ts, which drives
handleChat(): with the setting on, a slow preferred account hops once to the
sibling without cooling either account; with it off, the preferred account
serves the request. The enabled case fails on the current base and passes
with this change.
CodeQL flagged four new high-severity alerts on this train:
- js/polynomial-redos in refreshCopilotToken (#20763): baseUrl is now
trimmed with stripTrailingSlashes() from utils/urlSanitize.ts, the
linear helper the repo already uses for this, instead of /\/+$/.
- js/incomplete-url-substring-sanitization x3 in the #20606 test: the fetch
stubs matched "chatgpt.com" and "registry.npmjs.org" as substrings of the
URL; they now compare the parsed hostname exactly.
No behavior change: the copilot and codex discovery tests that import these
files pass (416/416 node, 1/1 vitest).
The Antigravity envelope builder grew to 81 counted lines once #20204 added
the model-turn-first case to the #9030 client-system relocation, one over the
max-lines-per-function cap of 80, and the complexity ratchet flagged it on
this train (4 -> 5 violations in the file). Move the relocation into
prependClientSystemParts(); the three cases (first turn is user, first turn
is model, empty history) are unchanged.
The reported-paths test pinned /api/resilience/connections and /api/skills/executions as
always blocked for a remote session. Whether they are is the route guard's decision (a GET
exemption or the manage-scope bypass list), and resolveDashboardLocalAccess already asks the
guard. The test now names only paths no configuration opens, and a new case sets the bypass
list both ways and checks the path is reported only while the list leaves it out.
check-pr-test-policy (from #20677) rejects any new test file outside tests/.
The @omniroute/* workspace packages run their own suites from
<package>/tests/ (52 files in opencode-plugin-v2, 29 in opencode-plugin,
1 in opencode-provider), so a new test there, such as the one in #18804,
was reported as misplaced. Accept @omniroute/<package>/tests/ as well;
any other location, including elsewhere inside a package, is still
rejected.
Brings over the parts of #20225 that do not change any default:
- call logs: skip the "mark missing" UPDATE after a successful detail publish
- providers: read the CodeBuddy CN retry-at phrase (请于 <time> 后重试) as China Standard Time
- db settings: read the database size from page_size/page_count instead of per-table scans
- provider stats: filter wire observations on the row instead of a primary-key self-lookup
- usage: requests-by-provider-date sums archived total_requests and floors raw history at
retention.usageHistory, like the main analytics route
- db: drop the two plain copies of the summary tables' provider/model/date index at boot,
keeping the UNIQUE index the rollup upsert needs
Left out: the quota snapshot sweep reading retention.quotaSnapshots, because that setting's
built-in default is 7 days and the sweep's current default is 90; the owner kept 90.
The db-provider-stats planner assertion now accepts any timestamp index: the predicate reads
request_type, which the covering index does not hold.
Co-authored-by: serenity <295272363+serenity-X@users.noreply.github.com>
Salvaged from #20231 by @serenity-X, without the two members the
maintainer declined (standalone launcher reading the default data-dir
.env, and Claude re-auth with a different accountUUID creating a new
connection).
- fix(models): image rows in GET /v1/models no longer inherit chat
capabilities and token limits from the chat sibling whose id they
start with.
- fix(guardrails): the opt-in credential masker also masks a value
behind a label (DB_PASSWORD=..., client_secret: ..., ?api_key=...);
error sanitization skips the new pattern, so default error bodies
are unchanged.
- fix(network): the direct egress dispatcher picks the least loaded
one-connection agent for the requested origin; equal loads rotate.
- fix(usage): Cline free-bucket models get all-zero price rows, so a
USD-limited API key no longer fails closed after one request.
- perf(usage): the input-token plausibility check skips serializing
the body when the reported count is within the fixed allowance.
Co-authored-by: serenity <295272363+serenity-X@users.noreply.github.com>
`omniroute resilience config set` had no flag for the p2c latency weight,
so the only way to set it was a hand-written PATCH /api/resilience call.
The flag validates 0..20 client side (the same bounds as
p2cLatencySettingsSchema) and sends { p2cLatency: { weight } }.
Salvaged from #20604 without its PATCH /api/settings 400 change, which
stays as it is today. Refs #20445.
check:file-size froze open-sse/utils/stream.ts at 3992 lines and this
branch had grown it to 3998. Move the request usage basis and the
passthrough usage sanitizer (with its message_delta receipt guard) into
open-sse/utils/streamUsageGuard.ts; stream.ts keeps one constructor
call and reads usageGuard.basis / usageGuard.sanitizePassthrough at the
existing call sites. Behavior is unchanged: the basis is still built
once per stream and the receipt is still rebuilt only for
message_delta. stream.ts is now 3986 lines, below the base.
Add tests/unit/stream-usage-guard.test.ts for the extracted module.
Graft the API-key case from #20302: a manage-scoped key passes
requireManagementAuth() and reaches the connection lookup (404), while
an inference-only key is rejected with 403 "lacks 'manage' scope". On
the base route the old isAuthenticated() guard answers the
inference-only key with 401 instead of the scope error, so the test
fails there.
Co-authored-by: Rafa Martins <rafacpti23@users.noreply.github.com>
Graft the mixed-tool stream case from #20251: a tool_use with no
parameters closes with "{}" while the next tool_use keeps its streamed
arguments untouched, and message_delta still maps stop_reason tool_use to
finish_reason tool_calls (#20152).
Co-authored-by: Rafa Martins <rafacpti23@users.noreply.github.com>
The dashboard layout decides which local-only features to replace with a
notice from the pipeline's peer-locality stamp on the page request. Nothing
tested that the stamp reaches a page: without it the session is "undecided"
and every local-only surface sends one request that can only be rejected.
Drives the real pipeline for dashboard page requests (remote, loopback,
private network), rebuilds the request headers a server component sees from
Next's override encoding, and checks resolveDashboardLocalAccess() on them.
The KEA-9390 change pushed two functions of MediaPageClient.tsx over the
complexity limit (the /api/providers handler 16 and switchTab 18, limit 15),
which the complexity ratchet counts in new-code mode (5 -> 7 violations in the
file).
Move the added logic into three module-level helpers of the same file:
listedProviders() (the providers a tab shows), preferredProvider() (the
connected-first choice) and providerToOpenOn() (what the connection list
changes once it loads). switchTab resolves the provider id once instead of
three times. LOCAL_PROVIDERS moves to module scope so the helpers can read it;
the exhaustive-deps directive it needed is gone with it.
No behaviour change. The file is back to its 5 pre-existing violations.
Graft the isGeminiThinkingLevelModel assertion from #19809 so the bare,
Antigravity tier and vertex-prefixed Carbon ids stay on the thinkingLevel
path. Only the test is taken; the unverified vertex catalog row and CI
input-modality row from #19809 are intentionally left out.
Co-authored-by: Rafa Martins <rafacpti23@users.noreply.github.com>
Follow-up to the local-only notices, for two new-code gates:
- OmniSkillsPageClient gained five branches for the executions local-only
state. They move to a small helper (executionStat) and a child component
(ExecutionsPanel), so the page function is back to its previous cyclomatic
complexity. No behaviour change.
- LocalOnlyNotice exported the component twice; every caller uses the named
export, so the unused default export is removed.
Graft the per-body WeakMap memo from #20116. The stream path already
reuses one RequestUsageBasis per stream; the callers outside it (cursor
executor, finalizeStreamingUsage, estimateUsage) still serialized and
regex-split the whole body on every call. The estimate is now cached
on the body object, and the entry is released with the body.
The test is adapted from the getter-count test in #20116: repeated
calls on one body read its messages only once.
Co-authored-by: Rafa Martins <rafacpti23@users.noreply.github.com>
Graft the regression test from #20430: a Responses passthrough stream
with 200 deltas and no usage must serialize the request body a small,
constant number of times. On the base it is serialized once per delta
(sanitizePassthroughUsage rebuilt the accounting receipt for every
event); the message_delta guard in this branch keeps it constant.
Closes#20480
Co-authored-by: bufftop25 <147844179+bufftop25@users.noreply.github.com>
The inline validation added to the Custom, Slack and Discord forms pushed
their components over the complexity ratchet (new-code mode): function
length, cyclomatic and cognitive complexity.
No behaviour change. The debounced server check the three forms each
carried a copy of becomes the `useWebhookUrlCheck` hook, and what a field
shows under itself is derived by pure helpers in webhookFieldValidation.ts
(`webhookUrlFieldFeedback`, `webhookSecretFieldError`).
The access-token, webhook and eval-suite forms read their inline messages
from the new formValidation namespace, but the per-section namespace map was
not regenerated, so the dashboard would not have sent those messages to the
client. Regenerated with `npm run gen:i18n-routes`; the drift test
tests/unit/i18n-route-namespaces.test.ts fails without it.
resolveDashboardLocalAccess() read the page request through
getRequestPeerLocality(), which fails closed to "remote" when no trusted
signal is present. If the pipeline's locality stamp ever fails to reach the
dashboard layout, that default would hide every local-only feature from a
local operator.
Only an explicit stamp on the page request now decides "local" or "remote";
without it the session is "unknown", so pages ask once and the response
decides, as they already do behind a trusted private proxy.
The Media page knew nothing about connections: every tab opened on the
alphabetically first provider (Adobe Firefly on Image) and "Generate" was
enabled whether or not anything could run it, so the request was sent only to
come back as "No credentials for image provider: adobe-firefly".
- mediaProviderConnection.ts: pure rule that reads the connection list the
page already loads and says whether a provider is connected, needs no
connection (local / keyless), is not connected, or cannot be decided. It is
one-sided on purpose: "not connected" only when the server would certainly
refuse (ids, aliases and connection-sharing ids are honoured; anything
undecidable stays usable).
- MediaPageClient: open each tab on a connected provider when there is one,
mark unconnected providers in the list, disable Generate for them and show
why with a "Connect this provider" link; when nothing is connected the hint
says so up front. Tabs no longer open on a hidden local provider.
- Copy: the credentials banner link no longer names a section ("Configure API
keys in Providers" -> "Open provider connections").
No server change: the missing-credentials check already answers in
milliseconds without any upstream call.
Resilience > Connections and Skills > Executions could never load on a
dashboard reached remotely (managed instance, tunnel, reverse proxy): both
JSON reads sat behind the loopback-only tier although neither spawns anything.
- /api/resilience/connections stays LOCAL_ONLY and joins the default
manage-scope bypass list next to /api/mcp/. A remote caller needs an
authenticated dashboard session or a manage-scope key; an anonymous remote
caller still gets 403 LOCAL_ONLY, also with requireLogin=false. An install
that stored its own bypass list keeps it.
- GET /api/skills/executions is exempted by exact path and safe method, the
shape /api/mcp/audit already uses (#13941). POST, which runs a skill and
reaches the sandbox spawn, stays loopback-only (GHSA-jx89-f37j-pq89).
The default list lives in three places (route guard constant, runtime
snapshot default, settings default); a test now asserts they agree.
/api/plugins and /api/services/<name>/status (all but the read-only
CLIProxyAPI status) are local-only routes.
- Plugins: a remote session saw the "no plugins" empty state and a scan
button that could only fail. It now gets the shared notice and no request.
- Services: each service tab polled its status every 5 s from several
components and the card read "HTTP 403". useServiceStatus no longer fetches
or polls a status the session cannot reach, the status card shows the
notice, and the Services page replaces a local-only service tab with the
notice so its lifecycle and log panels do not poll either. The CLIProxyAPI
tab is unchanged.
Quality > New suite refused to save a case whose "Model (optional)" was
empty, and reported every problem only as a toast ("This case has
validation errors") with nothing highlighted.
- The model is optional, as labelled: the save schema already takes a
case without one and the runner resolves it (the run's model or combo
target, else the case's model, else the default). The dialog no longer
requires it and omits `model` from the request when empty, since the
schema refuses an empty string. A hint under the field says what an
empty model runs on; the default is now one constant shared by the
runner and the hint.
- A refused save flags each missing field inline (suite name, case name,
prompt, expected value), marks the required ones, and moves focus -
and the dialog's scroll position - to the first of them. The messages
clear as the fields are filled.
Every Traffic Inspector API (capture modes, sessions, the live socket, the
TPROXY status) is a local-only route. A remote session got an inspector that
looked ready but stayed empty, with silent 403s and a socket that kept
reconnecting.
The page now mounts the inspector workspace only when the session can reach
those routes; otherwise it keeps the header and shows the shared notice, with
no request and no socket. A local-only rejection of the capture-modes read
makes the same switch for sessions the server could not classify up front.
On the configure step, Next was silently disabled while the destination
was empty; plain text such as "not-a-url" was reported 600 ms later as
"a blocked private address"; a URL or secret over the route's limits was
sent and the refusal reached the banner as "[object Object]".
- Next stays enabled: a refused click flags the fields inline and focuses
the first one (all four integration kinds).
- A value that is not an http(s) URL, or is over the limit, is said at
once next to the field, without a round trip. The limits (URL 2000,
secret 500) are the ones the routes' Zod schemas already enforced, now
shared through src/shared/constants/formLimits.ts. Nothing is cut: the
secret field has no maxLength, and a 400-character key reaches the API
whole.
- POST /api/webhooks/validate-url answers `invalid_url` for text that is
not a URL instead of `blocked_private`.
- A validation refusal from the API is shown by its message.
Follow-up to the Providers first-paint fix. The page is frozen at 1985
lines (tests/unit/deprecated-provider-banner-13067.test.ts) and the
separate loader call grew it by three.
loadProviderPageData now starts the stats request with the essential
ones and returns it un-awaited as `openRouterProviderStats` (a promise
that never rejects), so the page keeps its size: one line swaps the
setter for `.then(setter)`. The first paint still never waits for it,
and the request starts in parallel again instead of after the paint.
/api/skills/executions is a local-only route. The Skills page parsed the
guard's 403 body as a result, so a remote session saw "No executions found",
0 executions and a 0% success rate.
The Executions tab and the skill inspector's Executions panel now show the
shared notice when the session cannot reach the route, the two execution
stats show a dash, and no executions request is sent once that is known.
A 200 still renders the list, so the page keeps working wherever the server
serves the read.
Create was silently disabled while Name was empty, and a name over the
route's 100-character limit was sent and came back as a generic
"Invalid request".
Create now stays enabled: a refused click flags Name inline (required,
or over the limit with the current count) and focuses it; an over-long
name is flagged as it is typed and is never cut or sent. The limit lives
in src/shared/constants/formLimits.ts and is the one the route's Zod
schema enforces. Validation messages come from a new shared
`formValidation` namespace (en.json only).
/api/db/health is a local-only route, so on a remote dashboard the check
answers 403. The card read "no report" as unhealthy: "Attention needed" with
0 issues and 0 repairs, and "Run Auto-Repair" could only answer "HTTP 403".
- A session that cannot reach the route gets the shared local-only notice in
the card, no auto-repair button, and no request (the 15 s poll skips it).
- With no report yet the status reads "Checking…"; when the check fails for
another reason it reads "Check failed". Issues and repairs show a dash
until a report exists. Only a real report can say "Attention needed".
Local-only API routes (the route guard's LOCAL_ONLY tier) answer 403 to any
remote dashboard by design. Resilience > Connections showed a loading state
and then "This page is only accessible from localhost or LAN (LOCAL_ONLY).".
One source of truth for every such surface:
- the dashboard layout reads the authz pipeline's trusted peer-locality stamp
and asks the route guard which registered dashboard paths a non-local
session cannot reach (resolveDashboardLocalAccess), so a remote page knows
before its first request;
- detectLocalOnlyRejection() recognises the guard's 403 body and remembers it
for the session, for the cases the server cannot decide up front;
- useLocalOnlyBlocked(path) + <LocalOnlyNotice /> give pages one check and
one plain-language message with no raw code and no retry.
Resilience > Connections now renders the notice on the first paint and sends
no request when the session is remote; a 403 that is not the local-only
rejection keeps the retryable error.
The route guard and every server-side tier are unchanged.
The combo detail page listed the stored settings under their config keys
("explorationRate", "routerStrategy", "candidatePool"), most visibly on
the built-in automatic routes.
Each row now shows a readable label: the English name from
comboControl.runtimeConfigLabel.<key> for every key the config schema
accepts, and the key spelled out in words for anything else (the schema
is passthrough, so a stored key can be one no message knows about).
The Providers page kept its skeleton until five requests settled, one of
them /api/providers/openrouter-stats. That route answers from a 24h disk
cache, but with a cold, expired or unwritable cache it calls three
openrouter.ai endpoints (15s timeout each) before responding, and the
data only feeds the usage-rank chip on each card.
The stats now load beside the first paint (loadOpenRouterProviderStats)
instead of inside its gate; the cards gain the chip when it resolves.
The first block on Usage > Analytics showed Accounts, Providers, API Keys and
Models under the heading "Infrastructure". The four figures are distinct
entities that handled at least one request in the selected period and key
filter (summary.unique* and byProvider of /api/usage/analytics), so a workspace
with connections and keys but no traffic in the period read
"Infrastructure: 0 / 0 / 0 / 0".
The figures are unchanged; the heading now says what they count and a sentence
under it says that connections and keys without traffic are not included.
CompactStatGrid sections take an optional description and test id.
A chat turn that fails after /v1/chat/completions has committed to
200 text/event-stream (the handler outlived the early-keepalive threshold:
1 s, or 15 s for keyless providers) can only report the failure in-band, as a
`data: {"error":{...}}` frame. The Playground's Chat and Compare readers only
looked at `choices[0].delta.content`, so that frame was dropped: "Generating…"
ended with neither a reply nor an error, and the network panel showed no
4xx/5xx.
- chatTabEndpointRequest: add readStreamError() for the in-band failure shapes
the engine emits (chat `error`, Responses `error` / `response.failed`).
- ChatTab: surface the in-band error, report a stream that closes without any
content, drop the empty assistant bubble, and buffer lines across network
chunks so a split error frame is still parsed.
- CompareTab: an in-band error fails the column instead of finishing it empty.
The server side is unchanged: tests pin that withEarlyStreamKeepalive already
delivers the error in-band on the slow path.
Translate the copilot system prompt, help response, knowledge examples, and create-combo guidance from Spanish to English. Keep the multilingual input-matching regexes so Spanish-speaking users are still classified correctly. Add a unit test that pins English output and the preserved matchers.
Incorporate official release/v3.8.55 through bd9b1324ab, including the upstream call-log teardown fix for the previously failing TIA test. Source-only additive merge, no feature-code rewrite or force push.
Restructure the keychain-only exclusion so the copilot-m365-web branch stays
the first, unconditional operand (copilot-m365-web is never keychain-only).
Same behaviour; keeps the m365-native-catalog-auth source contract.
A catalog write can land while the lookup awaits, and a concurrent lookup can
then move the cache to the new version before this one stores its result.
Store the providers only when the model-catalog version is still the one
captured before the query, so a pre-write answer is never kept under the
post-write version.
A provider whose catalog is authoritative only advertises the models its
account returned on the last sync. A connection added through OAuth therefore
stayed active with an empty catalog until the six-hour scheduler reached it, and
every request for a model only that account has failed with "not available in
the active live catalog" until someone pressed sync by hand.
Both create paths now hand the connection to one shared trigger. Eligibility is
the scheduler's own predicate, so antigravity and agy connections qualify on
their default autoSync while API-key providers keep their explicit
autoFetchModels opt-in. The sync goes through the same loopback helper as the
scheduler, keeps the import semantics the API-key path had, and runs at most
once per connection per five minutes so a single sign-in cannot fire one sync
per path it touches.
Signed-off-by: Minxi Hou <houminxi@gmail.com>
The header is read from clientRawRequest.headers in chatCore, which every route built on handleChat reaches: Chat Completions, Responses, Messages, Completions and the Gemini-compatible path. The previous wording limited it to chat and Responses.
Co-authored-by: Cursor <cursoragent@cursor.com>
Resolve the effective no-log decision before agent-context extraction and pass it to resolveUsageAgentContext. A normal key sending x-omniroute-no-log: true now drops prompt-derived projectPath, gitBranch and path-derived projectName from usage attribution while keeping explicit header identifiers.
Co-authored-by: Cursor <cursoragent@cursor.com>
Add x-omniroute-no-log as a per-request opt-out of call-log payload persistence. The header is ORed with the API key's no_log flag; the call log row keeps timestamp, model, status, duration and token counts, while request/response bodies, summaries and pipeline artifacts are omitted.
The header is stripped from executor client headers so it never reaches an upstream provider. Memory extraction and the semantic cache remain separate opt-outs (x-omniroute-no-memory / x-omniroute-no-cache).
Co-authored-by: Cursor <cursoragent@cursor.com>
auto/<family> pools bypass the no-auth allowlist and rely on the readiness
gate alone (#18417). /v1/models already hides auggie and zcode when their
binary cannot be resolved on the host (#18753), but the pools never got
the same verdict, so family pools kept routing to a CLI that cannot start.
registerNoAuthAutoRoutingReadiness() now registers a readiness probe for
every provider localCliAvailability can check (exposed through
getBinaryGatedLocalCliProviderIds(), today auggie and zcode). The probe
reads the module's cached verdict, the same one the catalog uses. No
second availability module: devin-cli-agentic keeps its login probe and
codex-app-server stays fail-open, as #18753 decided.
Salvaged from #19995.
Co-authored-by: Nick Krzemienski <krzemienski@gmail.com>
setup-claude wrote the category's effortLevel (xhigh/high/low) into every
profile even when the catalog row lists the model's effort tiers and the
level is not one of them. The level is now kept within
capabilities.effort_tiers: a level the model does not offer is lowered to
the highest listed level below it (never to minimal, which is not a Claude
Code level), and omitted when no level fits. Without catalog tiers the
category level passes through unchanged.
buildProfileSettings keeps its (modelId, baseUrl, cfg, contextWindow)
contract and takes the tiers as an optional fifth argument;
syncClaudeProfilesFromModels reads them from each catalog row, so the
dashboard auto-sync (claudeProfileAutoSync) gets the same behavior. The
compact-window logic (claudeWindowEnv, #19465) is unchanged.
Salvaged from #19973.
Co-authored-by: Nick Krzemienski <krzemienski@gmail.com>
Address review of the empty-stream hold-back:
- mark the client terminal seen only when it reaches the client, so a client
that leaves while it is withheld is recorded as a disconnect, not a completion
- skip the hold for a permitted empty turn so it is not delayed by the grace
- stop judging the upstream end after the client has left
- cover reasoning-only length, content_filter, empty-argument tool calls,
Claude tool_use without input deltas and Responses function calls
An upstream stream that ends with no content was detected (#8649) only once
the reader reported done, so the translated terminal (data: [DONE],
message_stop, response.completed) had already reached the client and the
error frame landed behind it. The openai SDK stops at [DONE], so Pi recorded
an empty but successful finish_reason: stop and never retried.
Withhold a self-contained terminal while the stream still looks empty and
release or drop it once the stream is judged. A keep-alive upstream that
stays open after its terminal gets it released after a 1 s grace, exactly
as before.
v1 filled a missing gateway max_output_tokens with limit.output 0; v2 now
leaves limit.output out. The v1-vs-v2 mapper parity check asserts both
sides of that divergence explicitly and compares the rest of the payload.
preflightQuota grew past the 80-line function cap once the expired-window
skip landed, which tripped the new-code complexity ratchet. The per-window
warning loop now lives in warnApproachingWindowCutoffs; behavior is unchanged.
Anthropic Web periodically introduces new telemetry or metadata SSE events.
Previously, unexpected event types triggered an immediate fatal protocol
error in dispatchProtocolEvent, aborting the active text stream.
This changes unhandled events to fail open by returning null, allowing
the text stream to continue uninterrupted.
A combo replays the caller's request body on its next target, and
buildClaudePassthroughBody only shallow-copies it. Hoisting a marked
system/developer message moves its cache_control onto the preceding block
in place (#9436), so that block stays marked in the shared body. On the
next target the hoisted marker can't move again and is kept, and the
request carries 5 cache_control blocks, which Anthropic rejects: "A maximum
of 4 blocks with cache_control may be provided. Found 5."
Copy the blocks once, before any rewrite, instead of only before the
marker-less breakpoint injection.
Each unit's reason was sanitized on its own and then the joined message was
sanitized again as a whole. The sanitizer redacts a credential label fail-closed,
so the second pass matched an already-redacted "Password: [REDACTED]" and cut
that unit's status and every later unit from the terminal message.
Sanitize the unit label on its own as well and stop re-sanitizing the joined
message: every upstream-derived part is already sanitized and the rest is fixed
text. Adds a RED->GREEN test.
The inner payload of a billing block can carry `isQueued`, whose name
matches the broad "queued" busy heuristic, so the envelope unwrapper and
the CLI failure parser returned 503 upstream_busy instead of 429
qoder_billing_block. The exact billing codes are now checked first.
A hook that replaces a top-level body property in place and returns the same
object was remembered as a pass-through, so a failover attempt that got its
own top-level copy of the body skipped the hook and lost the rewrite. The gate
now compares the body's top-level property references before and after the
hook and only remembers an unchanged body. The changelog fragment states the
cases that still call the hook again.
prepareClaudeRequest sanitized tool_use / tool_result ids in place, so a
Claude-format caller block (shared with later combo targets) lost its
original id. The rewritten block is now a copy. The id assertion of the
normalized-values test no longer accepts a missing id coerced to a string.
With a known plan cap, used was cap minus ALL remaining credits, so purchased or
free credits hid an exhausted monthly allowance (used=0, 100% left). Used now
follows the monthly pool only; the extra credits still extend the total so the
account stays spendable for quota preflight.
COMMAND_CODE_VERSION is a supported override read at module load, so a developer
environment that sets it made the default-version assertions fail. Clear it before
the per-process import.
An input of only a blank-id custom_tool_call and its blank-id output now drops
both, which left messages:[] and an upstream 400. Apply the empty-input
placeholder after conversion too, when no message survived.
An input of only a replayed image_generation_call is skipped item by item,
which left messages:[] and an upstream 400. Apply the empty-input placeholder
after conversion too, when no message survived.
- withChatAdmission passed CHAT_ADMISSION_QUEUE_MAX_MS to admitChatStructure
even when the route set queueMs, so queueMs 0 could still wait and admit a
busy request. The structure stage now gets the same wait as the byte stage
(regression test: a lease freed during the wait is not taken).
- The structure test drains the call-log writes and resets the DB handle.
hasQoderImageParts only read top-level content parts, so a Claude request whose
only image sat inside a tool_result (and that declared no tools) did not require
the HTTP transport, and selection could pick a PAT connection.
A data URL that could not be decoded or an upload that was rejected was silently dropped and generation continued without the reference; both now return an explicit 400 or 502 and the new cases fail without the change.
A failed loadFromDatabase leaves the previous load's entries in the registry,
and the request then advertised them through injectSkillsWithMetadata, so a
removed or changed skill could still reach the model. The request now skips
custom-skill injection after a failed load; client and memory tools stay as
they were.
- claude-to-gemini: an enabled numeric budget_tokens keeps its priority over
output_config.effort "none", and Gemini 2.5 Pro (which cannot switch
thinking off and answers 400 to a zero budget) keeps its upstream default.
The existing gemini-2.5-pro effort=none test goes back to its base form.
- openai-to-kiro: a failed tool result whose tool call is missing from the
history keeps the [tool_error: true] line when the builder turns it into
text, since the status field is dropped with toolResults.
cleanupExpired marked an expired task failed and dropped its controller
without aborting it, so a running smart-routing fetch kept going until its
own timeout. Covered by a failing-then-passing fake-timer test.
Also clear OMNIROUTE_PORT (and restore the port env afterwards) in the
exact config-status test, which expects the default port.
Name the two hashView() patterns in order and note that the model
pattern stops at the first quote, so an escaped quote in a model value
is emptied only up to it, as the captured client does.
The stream restorer matches tool names case-insensitively, so a search alias
for a declared proxy_search renamed an upstream SEARCH (a declared tool) to
proxy_search. Add the alias only when no declared name equals the stripped
name ignoring case.
An OpenAI-format client can mark a part of a role:"tool" message. The
marker moves off the part (Anthropic rejects cache_control inside
tool_result.content) and the OpenAI echo-field pass drops it from the
message, so OpenRouter anthropic/* requests still carry 4 serialized
breakpoints at most.
The store guard test fed content_filter straight into the assembled body.
Push a passthrough content_filter stream and a translated Claude refusal
through the real stream assemblers and check the assembled body keeps the
reason and the streaming store refuses it.
A push that overflows the AsyncEventQueue backlog throws from the socket
notification and tool-call callbacks, outside run()'s catch. The error
escaped as an uncaught exception and the consumer waited for a terminal
event that never came. Route those pushes through a guard that pushes a
terminal error, closes the queue and settles the turn.
The joined-text retry cleared all accumulated text once it found a
[Tool call: ...] marker, so a reply such as "Let me check.\n[Tool call: x]
Arguments: {...}" kept the call but lost its preface. Return the text
before the marker from tryParseTextualToolCall and keep it as content.
requestFollowsToolCalls() searched the whole history, so a tool exchange
that the assistant had already answered armed the buffered empty-turn
retry on every later follow-up and cost those turns incremental
streaming. Walk back from the newest entry and stop at the latest
assistant turn (assistant message, Responses function_call, Gemini model
turn): only tool results after it make the request a post-tool
continuation. A user or system note appended after the tool results
still counts. Covers all four client formats with negative and positive
cases (#20092).
Drives the real POST /v1/messages route against a fake Anthropic upstream and
checks the gateway contract from code.claude.com/docs/en/auto-mode-classifier-billing
in both directions, streamed and non-streamed, for the native claude provider and
anthropic-compatible nodes:
- the dangerous-tool-use-2026-09-03 / afk-mode-2026-01-31 betas and the
safeguards body field reach the upstream together, byte-equal
- tool_use / tool_result ids in history are not rewritten on the way up
- message_delta.delta.safeguard_results (stream) and top-level
safeguard_results (JSON) plus the new tool_use id reach the client unchanged
- without the paired beta, safeguards is dropped instead of sent unpaired
Characterizes the anthropic-compatible-cc relay bridge, which rebuilds the
body without safeguards (client classifier fallback). Adds a troubleshooting
entry for the "this session isn't eligible" notice to the Claude Code guide.
Refs #17899
The base's passthrough usage repair built the stream accounting receipt on every
chunk, and the receipt re-estimates input from the request body, so per-chunk
usage serialized the whole body again (the #20086 test saw 45 serializations for
40 chunks vs 6 for one). Only a Claude message_delta consumes that receipt, so
other chunks now skip it. The shared basis is renamed usageBasis so the
passthrough call fits one line and stream.ts stays inside its frozen size.
The release base now disambiguates equal display names in the published
catalog with a route suffix, so two models enriched with the same name no
longer tie on name when published. Assert the published pair in its
disambiguated name order and check the default chain's recency-descending
tie break directly on the comparator.
The per-unit 300-char cap ran before connection-id redaction, so a UUID or
long hex id cut in half at the cap no longer matched and leaked most of its
characters. Redact first, then cap. The opencode free-tier label is now
decided on the full reason, so a signal past the cap keeps its label, and
the cap no longer leaves half of a surrogate pair.
Each unit's reason is now collapsed to one line, sanitized on its own and capped
at 300 characters before the reasons are joined. The joined message is still
sanitized as a whole, but that pass keeps only the first line, caps at 4096
characters and treats a path span as running to the end, so a raw HTML 502 page,
a multi-line upstream error or an oversized body in an early unit used to hide
every later unit's reason.
Also split the terminal-body guards out of withRuntimeUnitOutcomes to keep it
under the complexity ratchet, and use neutral model names in the tests.
Both batch STT adapters fail on every real request:
- Gladia's /v2/upload reads the file from the "audio" multipart field.
The adapter used the helper's default "file" field, so Gladia answered
400 "Invalid parameter(s)" with validation_errors ["Missing audio file"]
before any job was submitted.
- Speechmatics rejects a job config without transcription_config.language
("Job config JSON is invalid ... missing property 'language'"). The
adapter sent only operating_point. It now passes the request's
`language` field and falls back to "auto" (language identification).
The Gladia test mock now rejects uploads without the "audio" field, as the
live API does, and new Speechmatics tests check the submitted job config.
Both fixed request shapes were checked against the live APIs.
executeRuntimeUnitCombo returned only the last unit's response when every
unit failed. An earlier unit's real reason (an empty reply rejected by
quality validation, an HTTP 500) was dropped, so a last unit that was only
skipped before dispatch ("Model X is unavailable") became the only error
the client saw.
Record a {model, status, error, kind} entry per failed unit, mark the
loop's own pre-dispatch skips as kind "skipped", and when two or more
units failed rewrite the terminal error.message with formatComboOutcomes,
the same helper the flat attempt loop uses (#10314). Status, headers,
quota classification, diagnostics and the early-return paths (safety
stop, local pressure, client abort, protected priority target) are
unchanged; single-unit failures keep their exact message.
The tip already writes a usage_history row for every speech and transcription call
(recordMediaRequest), and the per-key USD limits count that row. Tagging those calls with
the modal ledger tier as well would count each call twice. Only rerank, which writes no
usage_history row, keeps the modal tier. The tests now check the speech ledger row keeps
its own tier and that a transcription with no reported duration adds no spend.
The merge of the active release base was pushed, but the upstream PR head remained pinned to its preceding revision while the remote fork ref had moved. Re-signal the branch head without changing production files or quality baselines.
Models without max_output_tokens published a zero output limit, zero token budgets were labelled as quotas and free markers stacked in picker names; publish only known limits, use one leading marker and warn when freeSignals is set without freeOnly.
chat.ts calls handleChatCore again for each account-fallback attempt, and the
plugin onRequest gate ran inside handleChatCore, so a request that failed over
to a second account ran every onRequest plugin twice. A plugin that counts
requests (the rate limiter example in the plugin guide) counted a failover
twice and halved its real threshold; the shared 100 calls per second plugin
budget was spent twice too.
Remember a plain pass-through per client request (the headers snapshot that
chat.ts builds once) and per provider and model. A block or a body rewrite is
never remembered, so the next attempt still gets the plugin's answer, and a
caller without a headers snapshot is never remembered.
Finding: F-C3-33.
The live /models catalog serves Sonus and Cantus under the opaque ids smodel and cmodel. The static registry listed neither, so those ids stopped resolving whenever the live catalog was unavailable. Add both rows (vision, reasoning, 180k max input); the live catalog still wins when it is reachable. They get no FREE_MODEL_BUDGETS twin: free-budget rows need audited evidence, so the free-catalog parity check now excludes the two static-only rows. Comparison-gap finding e0056.
The /alpha/billing endpoints can report short plan ids (go, go-v1, goat, pro, pro-v1, provider, max, ultra, teams-pro) and every known plan has a fixed monthly credit cap. The usage fetcher knew only the long individual- ids and derived the credits total from period spend, so a short id showed a raw name and a capped plan showed a nonsense total whenever the usage summary lagged the credit pools. Map the aliases to their canonical ids and, when a plan cap is known, report total=cap and used=max(0, cap-remaining). Unknown plans keep the spend-derived total. Comparison-gap finding e0053.
The /alpha/generate fallback and the API-key probe are the only paths that send CLI-mimic headers, and they still announced version 1.15.1 with x-cli-environment: external and no x-cli-surface, matching a CLI profile the upstream retired long ago. Align them with the current CLI 1.88.0 wire format (x-cli-environment: production, x-cli-surface: cli) through one shared buildCommandCodeCliHeaders helper used by both call sites; the chat path is unchanged. The COMMAND_CODE_VERSION override still wins. Comparison-gap finding e0003.
Qoder reports an account that spent its daily credit allowance with nested envelope codes 110 and 112, in the same triple-nested shape as the 10605 queue throttle. The executor mapped them to the outer 403 authentication_error or a generic provider error, parking a healthy PAT on a failure cooldown. Classify them as a 429 qoder_billing_block so routing fails over to another account. Comparison-gap finding e0190.
The first head of #20331 regressed the pre-existing legacy Gemini
passthrough contract. Validate normalized explicit values only for
models implementing native thinking levels; retain verbatim values for
legacy models. Add regression to the focused test file.
Normalize allowed explicit values and ignore unknown override strings so
Gemini receives a supported thinkingLevel or the model-native fallback.
Add three focused translator regressions for casing and invalid values.
Adds eight cases for the GitHub Copilot rotating item_id fix (#19218, #19575),
each asserting the concatenated delta.content equals the answer exactly once:
stable ids, a message at output_index 1 behind a reasoning item, two messages
with stable and with rotating ids, a lost final delta recovered once, a
completed-only snapshot, and two guards that a new message reusing an
output_index after its own output_item.added stays separate. Cases 2, 4, 5
and 8 fail on the code before #19575; all pass on release/v3.8.54.
The "already-compliant strict-provider request is a no-op" test compared
translateRequest's output with the caller's own `messages` array. That held
only because translateRequest edited the caller's message objects in place:
the xiaomi-mimo reasoning placeholder (9router#1321) was added to the output
and to the caller's assistant message alike, so the two sides could never
differ. Once translateRequest copies the messages and leaves the caller's
alone, the output carries the placeholder and the caller's array does not, and
the comparison failed.
Take a structuredClone of the messages before the call and compare against
that. The hoist still has to leave the system and user turns and the order
untouched. The one expected difference is the placeholder on the plain
assistant turn, which xiaomi-mimo requires on a reasoning-cache miss and which
translator-xiaomi-mimo-reasoning-replay-1321 already pins. The assertion count
is unchanged.
mergeAbortSignals now returns AbortSignal.any so a merge that never aborts leaves no
listener on a long-lived combo or client signal. The two stream deadline paths
(createStreamDeadlineSignal and withDeadlineSignal) depended on the old plain-controller
merge: Node pins an AbortSignal.any composite in a module-level set while it carries an
abort listener, and those paths hand the merged signal to listeners that close over the
request. A request that completed without aborting then stayed reachable with its whole
wire body, and the stream-deadline-signal "does not pin a completed request" test failed
(0 of 50 requests collected).
Add mergeAbortSignalsUnpinned, the plain-controller merge with the same abort-reason
contract, and use it in those two request-scoped deadline paths. Executor merges keep
AbortSignal.any. Cover the new function in merge-abort-signals-no-abort-leak.
responses-additional-tools.test.ts pinned the old behaviour that the
previous commit on this branch changes on purpose. In "Responses -> Chat
gives top-level tools precedence over namespaced members" and "Responses ->
Chat enforces explicit precedence within additional_tools" a flat `exec`
and a custom `exec` inside the `commands` namespace were expected to
produce only `["exec"]`. That held only because the filter compared the
member's bare leaf with the flat names. The Chat conversion qualifies the
member as `commands__exec`, so it is a different tool and must reach Chat.
Both tests keep their intent (an explicit tool wins on a real collision)
and now assert it on a real collision: a flat `commands__run` removes the
member `commands.run`, which has the same Chat wire name. They also assert
that `commands__exec` is kept next to the flat `exec`, and that it is
listed as a custom tool name. No assertion is removed.
#20169 froze the 001-241 series and 240 now belongs to
240_provider_node_custom_json_config.sql on release/v3.8.54, so the
numbering gate rejected this PR's 240_skills_unique_owner_name_version.sql
as a duplicate. Rename it with npm run db:new-migration (same description,
same SQL; the header no longer states a number) and add a
RENAMED_MIGRATION_COMPATIBILITY entry, so a database that ran a build of
this PR moves its 240 row to the new stamp instead of skipping
provider_node_custom_json_config. The entry sits after the first entry, so
the positional spot-checks of the constants test stay put; the count goes
from 107 to 108. The migration test reads the new file name and drops the
number from its file and test names, and the changelog fragment no longer
names a migration number.
#20169 froze the 001-241 series and 238 now belongs to
238_codex_connection_fences.sql on release/v3.8.54. Rename this PR's
migration with npm run db:new-migration (same description, same SQL),
and add a RENAMED_MIGRATION_COMPATIBILITY entry so a database that ran a
build of this PR moves its 238 row to the new stamp instead of skipping
codex_connection_fences. The entry sits after the first entry, so the
positional spot-checks of the constants test stay put; the count goes
from 107 to 108.
Plan 2026-11-13 (derived numbers resolved only at release): feature PRs no longer write values
that depend on the state of the base. This commit restores the lines this PR changed only to
update such values (counts in docs, the llm.txt mirrors, the Stryker test list, the package
description, counts in agent-instruction files) to the text of the PR's merge base, so merging
the current base brings the values `npm run release:refresh-derived` maintains. Every other
change of the PR is untouched.
Plan 2026-11-13 (derived numbers resolved only at release): feature PRs no longer write values
that depend on the state of the base. This commit restores the lines this PR changed only to
update such values (counts in docs, the llm.txt mirrors, the Stryker test list, the package
description, counts in agent-instruction files) to the text of the PR's merge base, so merging
the current base brings the values `npm run release:refresh-derived` maintains. Every other
change of the PR is untouched.
Plan 2026-11-13 (derived numbers resolved only at release): feature PRs no longer write values
that depend on the state of the base. This commit restores the lines this PR changed only to
update such values (counts in docs, the llm.txt mirrors, the Stryker test list, the package
description, counts in agent-instruction files) to the text of the PR's merge base, so merging
the current base brings the values `npm run release:refresh-derived` maintains. Every other
change of the PR is untouched.
Plan 2026-11-13 (derived numbers resolved only at release): feature PRs no longer write values
that depend on the state of the base. This commit restores the lines this PR changed only to
update such values (counts in docs, the llm.txt mirrors, the Stryker test list, the package
description, counts in agent-instruction files) to the text of the PR's merge base, so merging
the current base brings the values `npm run release:refresh-derived` maintains. Every other
change of the PR is untouched.
Plan 2026-11-13 (derived numbers resolved only at release): feature PRs no longer write values
that depend on the state of the base. This commit restores the lines this PR changed only to
update such values (counts in docs, the llm.txt mirrors, the Stryker test list, the package
description, counts in agent-instruction files) to the text of the PR's merge base, so merging
the current base brings the values `npm run release:refresh-derived` maintains. Every other
change of the PR is untouched.
Plan 2026-11-13 (derived numbers resolved only at release): feature PRs no longer write values
that depend on the state of the base. This commit restores the lines this PR changed only to
update such values (counts in docs, the llm.txt mirrors, the Stryker test list, the package
description, counts in agent-instruction files) to the text of the PR's merge base, so merging
the current base brings the values `npm run release:refresh-derived` maintains. Every other
change of the PR is untouched.
Plan 2026-11-13 (derived numbers resolved only at release): feature PRs no longer write values
that depend on the state of the base. This commit restores the lines this PR changed only to
update such values (counts in docs, the llm.txt mirrors, the Stryker test list, the package
description, counts in agent-instruction files) to the text of the PR's merge base, so merging
the current base brings the values `npm run release:refresh-derived` maintains. Every other
change of the PR is untouched.
The previous maintainer commit put the derived counts in the translated
README mirrors back to the merge-base values, but wrote them as ASCII
numbers where the mirror uses native digits (for example Persian). The
lines still differed from the base and kept conflicting. This commit
writes the merge-base text back exactly. No other change.
Plan 2026-11-13 (derived numbers resolved only at release): feature PRs no longer write values
that depend on the state of the base. This commit restores the lines this PR changed only to
update such values (counts in docs, the llm.txt mirrors, the Stryker test list, the package
description, counts in agent-instruction files) to the text of the PR's merge base, so merging
the current base brings the values `npm run release:refresh-derived` maintains. Every other
change of the PR is untouched.
The previous maintainer commit put derived files back to the merge-base
version but read them through a trimming helper, so each restored file
lost its last newline and still differed from the base. This commit
makes those files byte-identical to the merge base again (or, for
line-level restores, puts the final newline back). No other change.
The previous maintainer commit put derived files back to the merge-base
version but read them through a trimming helper, so each restored file
lost its last newline and still differed from the base. This commit
makes those files byte-identical to the merge base again (or, for
line-level restores, puts the final newline back). No other change.
The previous maintainer commit put derived files back to the merge-base
version but read them through a trimming helper, so each restored file
lost its last newline and still differed from the base. This commit
makes those files byte-identical to the merge base again (or, for
line-level restores, puts the final newline back). No other change.
The previous maintainer commit put derived files back to the merge-base
version but read them through a trimming helper, so each restored file
lost its last newline and still differed from the base. This commit
makes those files byte-identical to the merge base again (or, for
line-level restores, puts the final newline back). No other change.
The previous maintainer commit put derived files back to the merge-base
version but read them through a trimming helper, so each restored file
lost its last newline and still differed from the base. This commit
makes those files byte-identical to the merge base again (or, for
line-level restores, puts the final newline back). No other change.
The previous maintainer commit put derived files back to the merge-base
version but read them through a trimming helper, so each restored file
lost its last newline and still differed from the base. This commit
makes those files byte-identical to the merge base again (or, for
line-level restores, puts the final newline back). No other change.
Plan 2026-11-13 (derived numbers resolved only at release): feature PRs no longer write values
that depend on the state of the base. This commit restores the lines this PR changed only to
update such values (counts in docs, the llm.txt mirrors, the Stryker test list, the package
description, counts in agent-instruction files) to the text of the PR's merge base, so merging
the current base brings the values `npm run release:refresh-derived` maintains. Every other
change of the PR is untouched.
Plan 2026-11-13 (derived numbers resolved only at release): feature PRs no longer write values
that depend on the state of the base. This commit restores the lines this PR changed only to
update such values (counts in docs, the llm.txt mirrors, the Stryker test list, the package
description, counts in agent-instruction files) to the text of the PR's merge base, so merging
the current base brings the values `npm run release:refresh-derived` maintains. Every other
change of the PR is untouched.
Plan 2026-11-13 (derived numbers resolved only at release): feature PRs no longer write values
that depend on the state of the base. This commit restores the lines this PR changed only to
update such values (counts in docs, the llm.txt mirrors, the Stryker test list, the package
description, counts in agent-instruction files) to the text of the PR's merge base, so merging
the current base brings the values `npm run release:refresh-derived` maintains. Every other
change of the PR is untouched.
Plan 2026-11-13 (derived numbers resolved only at release): feature PRs no longer write values
that depend on the state of the base. This commit restores the lines this PR changed only to
update such values (counts in docs, the llm.txt mirrors, the Stryker test list, the package
description, counts in agent-instruction files) to the text of the PR's merge base, so merging
the current base brings the values `npm run release:refresh-derived` maintains. Every other
change of the PR is untouched.
Plan 2026-11-13 (derived numbers resolved only at release): feature PRs no longer write values
that depend on the state of the base. This commit restores the lines this PR changed only to
update such values (counts in docs, the llm.txt mirrors, the Stryker test list, the package
description, counts in agent-instruction files) to the text of the PR's merge base, so merging
the current base brings the values `npm run release:refresh-derived` maintains. Every other
change of the PR is untouched.
Plan 2026-11-13 (derived numbers resolved only at release): feature PRs no longer write values
that depend on the state of the base. This commit restores the lines this PR changed only to
update such values (counts in docs, the llm.txt mirrors, the Stryker test list, the package
description, counts in agent-instruction files) to the text of the PR's merge base, so merging
the current base brings the values `npm run release:refresh-derived` maintains. Every other
change of the PR is untouched.
translateRequest edits the message objects it is given: it strips echo fields
(reasoning_content, reasoning, refusal, annotations, cache_control) for an
OpenAI-format non-reasoner target, fills tool call ids and arguments
(ensureToolCallIds), sets tool_call_id on the matching tool message, and moves a
displaced tool result inside the messages array. A combo copies the body per
target with a shallow copy (#7847), so the message objects are shared. After
target 1 (a non-reasoner) stripped reasoning_content in place, a later reasoning
target that needs the client reasoning_content no longer received it.
Copy the messages, and each message's tool_calls and function object, once at
the entry of translateRequest (callerMessages.ts, 0.4 ms for a 12 MiB body).
The copy is one level deep. content is shared because the translator never
writes into it. Only the sites proven to mutate (probe with frozen bodies) are
covered; no deep clone.
Finding: F-C5-64.
A Chat tool message with no tool_call_id was sent to a Responses target as a
function_call_output with call_id "". The repair step kept any output whose
call_id was blank, because the old filter only checked outputs that had an id.
A blank id matches no call, so it is an orphan like any other unmatched id.
Drop it in the repairing (default) mode. Strict tool-history mode is unchanged
and still refuses a blank id.
In the other direction a custom_tool_call with a blank call_id got a made-up
id and an empty result, so the output text was lost. Skip such a call, as a
function_call with a blank call_id is skipped (#2893); its output is then
dropped as an orphan.
Malformed input only. What to do with the unpaired text is a maintainer choice;
this keeps the smallest change (drop, do not demote to a user message).
Finding: F-C5-86.
A follow-up Responses request that replays an image_generation_call item (the
image the model made on an earlier turn) failed with a 400 on a Chat
Completions target: "input item type 'image_generation_call' cannot be
represented in Chat Completions".
Skip that one type, as tool_search_call, tool_search_result and web_search_call
are skipped. The narrow slice is deliberate: item_reference, mcp_call and
computer_call_output still throw, because dropping them loses input
(item_reference cannot be resolved; mcp_call carries output). The existing test
that pins the 400 for those three is unchanged.
Finding: F-C5-69.
collectResponsesTools dropped a namespace member whenever any flat tool or
additional_tools entry had the same bare leaf name. The Chat conversion
qualifies a member as <namespace>__<leaf>, so a flat "search" and
"mcp__github.search" are two different Chat tools, and the member was lost
for no reason. The opposite case also failed: a flat tool already named
"mcp__github__search" did not drop the member that flattens to the same name,
so two Chat tools with one name reached a strict upstream.
Compare the member's flattened wire name (flattenNamespaceToolName, the same
function the conversion uses) with the explicit names. The default "functions"
namespace keeps bare leaf names (#17890), so a flat "exec" still wins over
functions.exec, as the existing tests require.
Intended precedence is unchanged: explicit top-level declarations still win
on a real name collision.
Finding: F-C5-62.
A tool result without a thought signature is replayed to Gemini as text inside a
<previous_tool_result_context> block. The content was escaped for &, < and >.
< and > are the tag breakout guard: they stop a result from closing or
reopening the block. & cannot open or close a tag, so escaping it only changed
what the model reads: "a && b" was sent as "a && b", and shell, code and
URL results were harder to read.
Drop only the & escape from the content. The < and > escapes stay, so the
breakout guard is unchanged. The attribute escape (source="...") is untouched.
The existing assertion in openai-to-gemini-helpers-split.test.ts that pinned
the & escape for content is changed to match; the breakout tests in
translator-openai-to-gemini.test.ts pass unchanged.
Finding: F-C5-41.
withChatAdmission wraps /v1/messages, /v1/completions, /v1/api/chat,
/v1/providers/{provider}/chat/completions, /v1/relay/chat/completions,
/v1/antigravity and /v1/responses/{path}. It runs the byte admission
(admitChatRequest) only. A request that is small in bytes but heavy in
structure (200 or more messages, or 64 or more tools) took no heavyweight lease
there, while /v1/chat/completions and /v1/responses call admitChatStructure for
it (#9654). The byte budget bounds the body, not the concurrency of heavy
requests.
After admitChatRequest, read a small body once on a clone and pass it to
admitChatStructure with the lease the request already holds. It takes a lease
only for a structurally heavy body and keeps an existing one, so a body that
reached the large-body size is decided by the byte lease alone. A body that is
not JSON goes to the handler. The same controller and lease type are used, so
this is not a second admission path. A rejection is logged like the byte
rejection.
Changes default behaviour on these routes: a structurally heavy small request is
now shed with the retryable 503 while heavyweight capacity is busy and the heap
is under pressure (with a healthy heap it is admitted through the bounded
headroom budget). It costs one extra parse of a body under the large-body size.
Finding: F-C1-20.
Claude to Gemini wrote is_error into functionResponse.response.error for a
signed history (#19405), but a Claude history carries no Gemini signatures, so
the common path turns the tool result into context text. That text dropped the
flag: a failed call read like a success. claude-to-openai already keeps such a
failure visible with a `[tool_error: true]` marker; add the same marker to the
historical tool-result context.
Finding: F-C5-75 (the signed path was fixed in #19405).
(cherry picked from commit 1da069f2b5c0971fe30ee2baaf2df69d267bf1f8)
claude-to-gemini sent no thinkingConfig for thinking:{type:"disabled"} or
output_config.effort:"none". Gemini 2.5 then thinks dynamically and can spend the whole
maxOutputTokens on hidden thoughts, while the OpenAI path already sends an explicit
thinkingBudget 0 for reasoning_effort "none". Send the same off switch here through
buildGeminiThinkingConfig (it drops the zero budget for Flash-Lite, which answers 400).
Models with a thinking-level knob or a zero budget cap keep the upstream default.
One existing test pinned the old "skip" behaviour for effort "none"; it now pins the
explicit off switch.
Finding: F-C5-28
(cherry picked from commit 85d74dc563c62dd711dbea312884ca165b000b2d)
The Gemini to OpenAI translator holds text that ends in "<", "<t", "<th" ... in case it
opens a <think> tag. At finish nothing emitted the held text, so a stream that ended inside
code such as "Array<" lost its last 1 to 6 characters. Emit the held prefix as content at
finish.
Re-check id: F-C5-51.
(cherry picked from commit 9cf398c989089061bdf4781ff2343399a4916bda)
A signed image part no longer takes the standalone-signature skip, so the image reaches OpenAI clients. Finding F-C5-23.
(cherry picked from commit e40f9c9dd7948e30c519a168d873555d70a04e8a)
A Claude request pivots through OpenAI before it reaches Kiro. The OpenAI
tool role has no error flag, so claude-to-openai writes a "[tool_error: true]"
line at the start of the tool text. The Kiro builder hardcoded
status "success" for the tool role, so a failed tool run reached Kiro as a
success with a marker in the text. A direct Claude tool_result block already
mapped is_error to "error".
The Kiro builder now reads the marker at the start of a tool message, sends
status "error" and the original text without the marker. A marker in the
middle of the text is left alone.
Finding: 9rself-36 (the small fix, not new direct translators)
(cherry picked from commit c8e46b5134204de647ff8f5a57674403a9ca2c54)
buildKiroPayload prepends `[Context: Current time is <ISO>]` to the final
content. With no pre-compression body and an empty history (turn 1) the
conversationId seed fell back to that content, so turn 1 got a fresh random id
on every call and a different one from turn 2 (which seeds from history[0]).
Keep the content before the clock line for the seed.
Finding: F-C5-80.
(cherry picked from commit abfc2cea324d86606e4433b62983f4b930774c34)
Kiro accepts only inline image bytes, and only for Claude models. A remote image URL, or any
image for a non-Claude model, was dropped with nothing left in the text, so the model answered
as if no image was sent. Count the image blocks that were not attached and add one line to
the message text. The prettier pre-commit hook also reformatted three lines that were already
off in this file.
Re-check id: F-C5-42. A 400 instead of a note is a product choice; the note keeps today's
requests working.
(cherry picked from commit a107f54a33a98a105668cf717a28a574f9f9057f)
A tool result array that holds an image now sends the image as its own part and the text
as the function result (gemini-sampling-tools). The old test expected the array unchanged.
What: openaiToGeminiBase now removes a leading "x-anthropic-billing-header:" line
from each system message before it becomes a systemInstruction part. The Antigravity
envelope builds on the same base, so both targets are covered.
Why: the Claude-to-OpenAI translator already strips this line. An OpenAI-format
client that forwards it (Claude Code behind an OpenAI-shape proxy) reached Gemini
and Antigravity with the line intact. It changes every turn, so it breaks the
prompt prefix cache. A system message that is only the line now leaves no empty
part.
Finding: e0204 (comparison re-check). The Hermes identity rewrite named in that
row has no source we can check, so it is not built.
(cherry picked from commit 90320ad461e165c5b86708bb68e0cc71069dca3f)
The #9030 relocation prepended the client system parts to contents[0] without
checking its role. When the history opens with an assistant turn (for example
system, assistant, user, or a truncated history), the system text became a
model utterance. Prepend into contents[0] only when it is a user turn,
otherwise insert a leading user turn.
Finding: F-C5-79.
(cherry picked from commit 16f665d8eedf86857feb79f193ceb764350d66b4)
Keep image bytes out of function-response JSON and retain them as native media. Omit sampling fields removed by Gemini 4 while preserving older models. F-C5-16 and F-C5-21.
(cherry picked from commit 1aaf64c4e95e4191fdcab8c69f1b9cb655471f2c)
What: the OpenAI to Claude translator now wraps a message `content` that is one
bare block object into a one-item array, for system turns (normalizeContentToString)
and user turns (getContentBlocksFromMessage).
Why: a system turn with a bare text block was read as "" and sent as an empty
system block. A user turn with a bare text block was dropped, and the request went
out with "." as its text. Array and string content are unchanged.
Finding: e0217 (comparison re-check). The 4-marker cache cap half of that row is
already on the tip.
(cherry picked from commit 36cb4e8ad29612e2ba8012ebe31c193f97eb2ebd)
The data URL regex ended in `(.+)$`, and `.` does not match a newline. A
MIME-wrapped base64 image became `{type:"url", url:"data:..."}`, which
Anthropic rejects, and the same regex for file parts dropped the attachment.
Match any character and strip white space from the payload.
Finding: F-C5-77.
(cherry picked from commit 5cea7bfcbdc77720a04517af5084f4598048d312)
- thinking {type:"enabled"} without budget_tokens (the DeepSeek/GLM/Kimi shape) was sent
as is; Anthropic answers 400 "budget_tokens: Field required". A missing or zero budget
now gets the model's default budget (1024 minimum), then fitThinkingToMaxTokens fits it.
- An empty system or developer message produced system:[{type:"text",text:""}], which
Anthropic rejects. Empty system parts are now dropped.
- temperature was dropped for every claude-(opus|sonnet)-4* model for every provider, and
also when thinking was disabled. The name-based drop is for Claude OAuth, whose beta
header forces thinking, so it now applies to that provider only, and the final guard
skips thinking.type "disabled".
Findings: F-C5-25, F-C5-31, F-C5-30
(cherry picked from commit a3e0f3aa07f6ac67db1ad3a61c7dfdf68f9f0964)
Anthropic rejects extended thinking with a forced tool choice. Reconcile the two fields in the shared OpenAI to Claude translator. F-C5-20.
(cherry picked from commit 56a8eaf7e97f697437c936b4a8c716a867e917f8)
rotation-success-bookkeeping reads the credentials of the account that served the request
(`served`) in onRequestSuccess. Two source-text tests pinned the old variable name.
Accept both names; the asserted calls are unchanged.
executeWithSessionPool reported a cooldown for any throw, including the caller's
AbortError, so a user who cancelled a request penalised a healthy session
(consecutiveFails and the back-off grow). Skip the cooldown for a local stream
lifecycle error (the same classifier the circuit breaker uses) and still release
the session.
Finding: F-C4-15.
(cherry picked from commit 3753fb6dd60a322f89a68571b8bb31311dec90ba)
stripClaudeSystemPrefixBlocks removed a whole system block when its text
started with the Claude Code sentinel. A client that sent the sentinel and its
own instructions in one block lost the instructions. Remove only the sentinel
prefix and drop the block when nothing else is left; the billing header block
is still removed whole.
Finding: F-C4-12.
(cherry picked from commit 9a653fa6c5003126d3fd68b1a116400f5a1ac5d3)
The first send goes through applyFingerprint, which builds an ordered body. The
live transformedBody keeps the client order, and serializeRetryBody used a
plain JSON.stringify, so every recovery retry (field downgrade, clamp) went out
in the client order although the code comment calls the order a fingerprint.
Serialize through applyFingerprint when the first send did.
Finding: F-C4-13.
(cherry picked from commit 593ddad140303b4a045eea29c60dca8ce72c1d35)
The manual merge removed its two abort listeners only after an abort. A merge that never
aborted (one per fetch attempt or retry) left both listeners on the long-lived combo or client
signal. AbortSignal.any (Node 22 and later, the engines range) holds no listener on its inputs
and keeps the abort reason.
Re-check id: F-C1-24.
(cherry picked from commit 10b2067e5a3316e733ebc2499113f13a7b0deab8)
A Qoder PAT connection runs the local qodercli binary and sends it text only.
The prompt builder replaced every image part with the text "[Image omitted]",
while the registry still declares supportsVision, so image requests were routed
to a PAT connection and the model answered without the picture.
Image requests now use the same rule as caller tools: credential selection skips
PAT connections (a combo goes on to its next target), and the executor answers
400 image_input_unsupported before it starts the CLI. HTTP connections still
forward images. The registry flag stays true because the HTTP transport serves
images; no image forwarding is added to the CLI path.
Finding: e0212.
(cherry picked from commit ef7e47491f45ec886540558eb7eeb4953a89308a)
When a Codex request got a 429, the provider pipeline moved it to a sibling
account B. The pipeline rewrites the refreshed copy of the credentials, but
chat.ts and the onRequestSuccess hook kept reading the original object that
still named the failed account A. On success the handler then:
- set the selected-connection header to A,
- marked A quota-healthy for 30 minutes (A had just answered
usage_limit_reached), and cleared its error state,
- left B's own error state in place.
Read the connection id from the refreshed credentials, which follow the
rotation, in the success path of chat.ts and in onRequestSuccess.
Finding: F-C3-26.
(cherry picked from commit 8d7c7880fd2dbcdefeef6e0c499d368fa281367a)
Forward the redirected target pin and allow-list, and release the OAuth session slot before rethrowing a connection reasoning rule error, as the sibling stages do. Findings F-C1-17, F-C1-18.
(cherry picked from commit e0407e7ab2b0da9222e80164ccfdfe42e334af5a)
The native Claude executor strips a leading "proxy_" from every tool name
before dispatch. The passthrough name ledger assumed the opposite: it mapped
"proxy_" + name back to name. A client tool literally named "proxy_search"
went upstream as "search", and the reply reached the client as "search".
Build the ledger from the executor's real behaviour as well: for a declared
tool whose name starts with "proxy_", map the stripped name back to the
declared name, unless the client also declared the stripped name itself.
The old prefixed entries stay, so a prefixed echo still restores.
Finding: F-C3-21.
(cherry picked from commit 04bf04a083dfa21d36e6c66508fafe27ecebff85)
isTokenExpiringSoon passed the value to `new Date(...)`. An epoch in seconds
became a date in 1970 (a valid token looked expired). A numeric string
became an invalid date (an expired token looked valid). The shared
parseTokenExpiryMs already reads both forms and is used by
BaseExecutor.needsRefresh; use it here.
Finding: F-C3-40.
(cherry picked from commit 91567f50b3272d995e15445a6739e0c3b06b56e2)
excludeConnectionForCooldown ended its cooldown write in an empty catch, and
markCodexScopeRateLimited used `.catch(() => null)`. When the write failed the
connection was selected again with no trace of why. Keep the fallback behaviour
and warn with the sanitized message (Hard Rule 12: never the raw err.message).
Finding: F-C2-41 (two of the five sites; the executeProviderRequest and
chatStreamController catches are left).
(cherry picked from commit 0fa0b83d81320b38fba90b3a1716d27f3c9a85fb)
In `fallback` mode the wrapper returned only the proxy leg's result when the
native answer had a retryable status, and never cancelled the native body, which
held its socket until GC. Cancel it before the proxy call.
Finding: F-C2-40 (the body-cancel half only; recording the native 429 cooldown
needs a design decision and is left).
(cherry picked from commit 58bc8bca8591e50a5ad05479a7627710c351e679)
The retry did Object.assign(deps.credentials, nextCreds). Keys that the next
connection's object does not define stayed from the first one: routing, an
exclusive lease, and the account-bound copilotSessionToken. Replace the keys
with the same helper that already restores the snapshot when the retry is
rejected.
Finding: F-C2-39.
(cherry picked from commit f94d8bfaff553297165fe35fa3a7dfb3af2a0985)
The Droid CLI check was `userAgent.includes("droid")`, which also matches
"Android". A Dalvik or mobile browser client was treated as the Droid CLI, so
a Responses-shaped body on a non-/responses endpoint kept the Responses
response format instead of collapsing to Chat Completions. Match the whole
word `droid`.
Finding: F-C3-22.
(cherry picked from commit 47946f644e202aa1fc5c947eec4f178f0cb1e6ad)
The tip took 239 (call_logs_pending_detail_index). Move the skills migration and its test to 240
and bump the migration count in the docs from 236 to 237 (count tokens only).
DeepSeek answers a request with a repeated tool name with HTTP 400
"Tool names must be unique", on its own API and on every gateway that
serves a deepseek-* model. OmniRoute only de-duplicated names for Gemini,
so a client that sends the same tool twice (two MCP servers, a merged
tool list) got the 400.
finalizeTranslatedRequest now keeps the first definition of each name
when the upstream model id is deepseek-*, for both the Chat and the
flat Responses tool shape. Tools without a name and other models are
not changed. tool_choice and history refer to tools by name, so they
stay valid.
Finding 9rself-27.
(cherry picked from commit b788d06923dd28ca85c954c2f03eeeb7bde42bb7)
A combo gives each target a shallow copy of the client body, so output_config is shared.
The Codex guard that drops output_config.effort when the model name already encodes
effort used `delete oc.effort` on that shared object, so a later target of the combo lost
the client's effort. The earlier fix for the same kind of leak covered the format strip
and the output_format write; this was the one site left. Copy before editing.
Finding: F-C3-20 (remaining part)
(cherry picked from commit 28f8adff362253f6213705ad62bb73f9eac7d58a)
The test slept 50 ms twice to let the shared call start and the joiner attach.
Under parallel CI load that raced and failed about 1 run in 5. Resolve a promise
when the shared call starts, and yield twice with setImmediate for the joiner.
(cherry picked from commit 2b0dc240af0b99018e634c4863aa8be39761e76b)
When the shared call rejects with a client-lifecycle error and this caller is still connected, run one own call. Finding F-C2-25.
(cherry picked from commit bad435263c939a5a2f470a2ee3f80bf65420850f)
Apply the stream-path probe guard to non-streaming key health, cap Retry-After at 10 s, and end the retry sleep on client abort. The zero-remaining retry rule stays as is: an upstream test pins it as a temporary throttle. Findings F-C2-20, F-C2-26.
(cherry picked from commit 0721d42d6985d4ae70a6bfc28a741141c7f19795)
skillRegistry.register() inserted a new row on every call and the skills
table had no unique key, so installing the same skill twice left
duplicate rows. unregister() deleted only the row it found in its cache,
so the other copies stayed.
Migration 239 removes old duplicates once (keeps the newest row per
api_key_id, name, version, and moves the run history of removed rows to
the kept row, because skill_executions.skill_id cascades on delete) and
adds a unique index. register() is now an upsert on that key: it updates
the row, keeps its id and created_at, and returns the same skill id.
The migration count in README, AGENTS.md, llm.txt and the translated
README and llm.txt files goes from 235 to 236 (count tokens only).
tests/unit/db-backups-skills-3500.test.ts used one fixed skill name for
all seeded rows; it now uses the row id, so the rows stay distinct.
Finding orsurf-06.
(cherry picked from commit 7e16b8ae162cb379ffb68d7da5e93a532d7b4efe)
`getMemorySettings().catch(() => DEFAULT_MEMORY_SETTINGS)` turned a read error
into "memory disabled" for that request with no log line. Keep the fallback and
log the cause at debug.
Finding: F-C2-45 (settings-read half).
(cherry picked from commit 5741f108a4aaa6168d7cd278cb840161b01a37d1)
- cacheSafe came from hasCacheControl only. OpenAI, Codex and Azure cache an identical
prefix from token 0 without any marker, so the per-query memory text was prepended at
messages[0] and missed the cache on every turn. usesAutomaticPrefixCaching now also
selects the cache-safe placement (just before the last user turn).
- skillRegistry.loadFromDatabase ran outside any try/catch, and JSON.parse(row.schema)
threw on one bad row (a global skillsmp/skillssh row loads for every key), so every
non-stream request of the key rejected. The registry now skips a corrupt row with a
warning, and the caller treats a failed load as "no skills" like the memory block above it.
Not changed: for Claude with cache_control the memory text still lands in system[0]
(F-C2-28), and auto-mode skill selection per turn (F-C2-33). Both need a design decision.
Findings: F-C2-29, F-C2-30
(cherry picked from commit 2386a17176821102c0549a24166f85515c7ee926)
Retain the active Codex inventory guard while incorporating the released scanner and provider follow-up repairs. The merged candidate passes all 20 Codex inventory tests, 16 stale-kit scanner tests, core typecheck and changed-file lint.
Anthropic sends no input_json_delta for a tool_use block whose tool takes
no input, so the Claude to OpenAI stream translator left the tool call's
arguments as "" (not valid JSON). On content_block_stop, emit "{}" for a
tool_use block that received no argument fragments, matching the
non-streaming path.
Fixes#20152
The migration-count bump in this PR also changed one digit of the ETH
donation address (...102337a84 -> ...102347a84) in 66 README files.
Put the original address back; the address now matches the base branch.
sanitizeUsagePayloadForRequest runs on every parsed SSE event. When the
event's usage reports 0 input tokens it serialized the whole request body
to get its size and then serialized and tokenized it again for the
estimate; a positive count still serialized it once. Nothing was kept
between chunks, so an upstream that attaches usage to every chunk paid
for the full body on each one.
Add createRequestUsageBasis(body), which computes the body size and the
input estimate lazily and keeps them. createSSEStream builds one per
stream and passes it to every sanitize call (including the translate
flush tail). Callers that pass no basis get a fresh one, so their
behaviour is unchanged.
Closes#20086
A mute upstream turn on a post-tool continuation silently breaks agentic
loops (#13600). FLUSH_EMPTY_RETRY_ENABLED already covers every path but
is opt-in, so the default behavior still forwards the empty turn.
Detect submitted tool results in the client request body (OpenAI
role tool/function, Claude tool_result, Responses function_call_output,
Gemini functionResponse) and arm the existing bounded retry for those
turns only; all other streams keep the flag-off path untouched.
The limit test only called readUpload, a module-private helper, so nothing tied the streaming bound to the route a client actually reaches. This one posts through POST with an operator credential and a request whose body has no content-length, and asserts the 413 arrives before the stream is drained: on the base the handler answers 400 only after buffering all 64 MB.
check:provider-asset-provenance fails on every branch, base included, with 'auditedCommit object does not exist: 959ff4dd'. The release branch was force-pushed and dropped that commit, so the gate can no longer resolve its snapshot.
895c0f357 is the commit that produced the current public/providers tree (no later commit touches those paths); every blob id under public/providers is identical between it and HEAD, so the audit claim still holds. auditedAt is unchanged.
Same two-file change as #19965 (fast-xml-parser override to ^5.12.0, mongoose chain to its patched lines). audit --audit-level=critical exits 0. Identical bytes, so merging any of these first makes the others' copy a no-op.
The pipeline's body-size guard only reads Content-Length, so an upload sent chunked (no such header) skipped it and the raw branch buffered whatever arrived before the size was checked at all.
Count the bytes as they arrive and answer 413 as soon as the configured ceiling is crossed. The multipart branch keeps formData(), which needs the parsed parts; the raw branch is the one Bug #770 exists for and the one that can be bounded.
Upstream #15201 fixed the same lost-update race in providers.ts, so this PR
no longer changes that file. Keep the concurrent-fields test as a regression
guard; drop the changelog line that claimed the fix.
The CCH hash-view change in this bundle and #19761 fix the same signer.
#19761 is the complete version: its view also covers model and max_tokens
keys nested in tool schemas, proven against 46 captured requests from
Claude Code 2.1.322 (this version fails 1 of them). Drop the change here
so the two PRs do not conflict; the other five fixes in this bundle stay.
The snapshot-lease guard added one branch to pruneBackupDirectory and pushed
it over the cyclomatic and cognitive limits of the new-code complexity
ratchet. Move the per-family unlink loop into deleteFamilyFiles. Behaviour
is unchanged: the same files go, and an emptied portable directory is still
removed only when at least one file was deleted.
normalizeCchInput was one 117-line function, and the object parser inside it
reached cognitive complexity 17. Both broke the new-code complexity ratchet.
Move the scanner into a small class with one method per JSON construct, and
split the member parse out of parseObject. The hash view is unchanged: the
golden vectors still pass.
Gemini 4 Carbon (2026-11-10) is advertised by the live Antigravity catalog for
Ultra plans at gemini-4-carbon-{low,medium,high} and to paid Gemini API keys as
gemini-4-carbon. With no registry entries the tiers routed but were recorded as
unpriced, the bare id was rejected by the live-catalog check, and the output cap
fell back to the conservative default.
Adds GEMINI_4_CARBON_PROMO_PRICING ($2/$10 introductory, same as Argon, kept as
its own constant), the Antigravity shared-model tiers, a bare -> medium alias,
a modelSpecs entry, and the gemini API-key catalog row.
Signed-off-by: 小妍儿 ✨ <258399167+xiaoyaner0201@users.noreply.github.com>
OpenRouter documents Anthropic-style cache_control breakpoints on content
parts and tools of its OpenAI-style chat endpoint, with 4 explicit
breakpoints at most. OpenRouter was in neither the caching provider set nor
the OpenAI-format cache_control set, so every Claude Code request to an
anthropic/* model through OpenRouter lost all its breakpoints. The turns
wrote no cache and paid full input price.
Gate by model family on the openrouter provider: only a model id with the
anthropic/ prefix counts as a caching provider and keeps cache_control. Every
other OpenRouter family stays stripped. The per-connection override still
wins over the gate.
Three translator gaps showed up once the markers were allowed through, all
limited to OpenRouter:
- a user turn that is one marked text block collapsed to a plain string and
lost its marker; it keeps its block array now.
- the tool object dropped cache_control; OpenRouter types it there.
- the OpenAI-format path had no 4 breakpoint cap; the shared Anthropic cap
now runs there too.
Turning caching on for anthropic/* also switches on the cache-aware
compression guard and prompt_cache_key for those models. Both are pinned by
tests. No live OpenRouter call was made.
The daily, weekly and 5 hour USD limits of an API key read usage_history and
the search tier of the cost ledger. The speech, transcription and rerank
routes write no usage_history row. Speech and rerank only called
recordModalCallCost, which feeds the budget and the ledger under a normal
tier. Transcription did not price the call at all. So a key with a weekly
limit never saw this spend.
Add a "modal" ledger tier next to the "search" tier. The speech route (direct
and combo), the rerank route and the transcription route tag their ledger
row with it. The limit readers sum both tiers and take the oldest row of
both for the 5 hour reset. Transcription now prices the call per second from
the duration the upstream reports, and charges 0 when it reports none.
Image calls are not tagged: the ones that report usage already write a
usage_history row, and a second ledger row would count them twice. Chat rows
keep their real tier and are never summed by the new reader.
The cache already refuses a truncated reply (finish_reason length), because a
temperature 0 entry pinned for the TTL is served to every identical request
and no retry can clear it. A moderation block has the same trap: upstream
re-asks it and a false-positive block can clear, but a cached one cannot.
Treat content_filter, and its Claude spelling refusal, like length in the
shared isTruncatedCompletion set. The non-streaming and the streaming store
both use it, so both are covered.
When a provider returns a 2xx JSON body with no usage object, the client body
gets an estimate (applyClientUsageBuffer) and the cost ledger bills it, but
the non-streaming path read the empty provider usage for the usage_history
row and the call log. The row was never written, so per-key USD limits, which
read only usage_history, never counted that spend, and the call log showed
zero tokens.
Use the estimated client usage when the provider usage is empty. The existing
estimated marker flows to the call log as it does for streams. Provider
reported usage and the stream path are unchanged.
OmniRoute hashed the raw body with seed 0x6e52736ac806831e. A loopback
capture of the real client does not match that: 9 of 9 bodies from Claude
Code 2.1.322 (1.9 KB to 74 KB) and 3 of 3 from 2.1.252 carry a token that
equals xxHash64 with seed 0x4d659218e32a3268, masked to 20 bits, over the
body with cch=00000, every model string value emptied and every numeric
max_tokens member removed. The OmniRoute token differed in every case.
Use that seed and that view. The view uses plain text matching, as the
client does: the captures with model and max_tokens keys inside a tool
schema only match when the view reaches nested keys too.
The golden test uses two bodies captured from 2.1.322 with a synthetic
device id. It puts the placeholder back, signs, and expects the captured
token.
Built on the head of #19021, which changes the same file.
selectOverflowArtifactPaths lists artifact rows by timestamp DESC, id DESC
and skips the newest maxEntries. The only artifact index is ordered by
path. Without planner stats SQLite scans idx_cl_timestamp and sorts ties
in a temporary B-tree. After ANALYZE it picks the path index and sorts
every artifact row. Each rotation pass pays this again.
Add idx_cl_artifact_overflow_order on (timestamp DESC, id DESC), limited to
rows with an artifact path. The query plan becomes one index scan with no
sort, with and without stats. The index holds only artifact rows, so
writes to the other rows are not affected. Additive only: the query and
its callers are unchanged.
getProviderModel falls back to getGlobalModel for every model that is not
listed under its own provider: custom, passthrough and OpenAI-compatible
models. That fallback walked the whole provider registry up to three
times per call (exact id, vendor-prefix base name, startsWith scan), and
the first two phases also built and sorted a candidate list. The calls
run per request and per combo target. The exact-id and scoresAs lookups
already had a memo cleared on registry change. getGlobalModel had none.
Add a memo for getGlobalModel in the same place. The registry Proxy
already clears the lookup memos on every set and delete, so the new memo
is dropped on the same events. Misses are stored too, because custom
models always miss. The memo is capped, since the key is a client model
id.
(cherry picked from commit 5b328823af143b6dc55d7e72f016a3090ad4d1bb)
The buffered Gemini/Antigravity SSE parser tried the `[Tool call: name]`
text convention on each stream part alone. That marker is usually split
over several parts, so a split call stayed plain text and the client got
no tool call. Now the parser also tries the joined text once the stream is
read, and turns a match into one tool call.
A native functionCall part did not count as content. A stream that held
only tool calls and ended without a finishReason or [DONE] was not seen as
cut, so it carried no truncation tag and a combo could not fail over. A
native call now counts as content. The cut tag is set and the complete
calls are kept.
(cherry picked from commit e27dfcd33c1f88144febf39b232f36adf7534db6)
The Gemini to OpenAI request translator mapped only role "user" to a user
message. Every other value became an assistant message, including an omitted
role (the role field is optional in single-turn requests) and the roles
"function" and "tool" that some clients use for tool results. A request
without a role therefore reached the upstream as an assistant turn.
Map "user", "function" and "tool" to user. When the role is omitted, infer
it from the parts: a functionCall or a thought part means assistant,
anything else means user. Infer the role before thought parts are split
out, so visible text next to a thought stays assistant. Other roles stay
assistant. Tool-call id pairing is unchanged.
(cherry picked from commit 7148ca7f575adca57251810ba5bd819adc645636)
AsyncEventQueue capped the backlog at 10000 events and ignored event size.
A fast producer behind a slow client could hold 10000 large text deltas, or
10000 tiny ones, without a byte limit.
Count the retained string length of each buffered event and reject a push
that would pass 32 Mi UTF-16 code units. Merge an adjacent text or thinking
delta of the same type and phase into the last buffered event, up to 64 Ki
code units, so many tiny deltas stop using one slot each. Tool, phase and
error events never merge. A terminal error event is always accepted so an
overflow still reaches the consumer. Consuming an event returns its share
of the budget.
(cherry picked from commit 35dbd95f19a648e45df54c6ea89b5f6658720c7f)
The earlier commit in this bundle made the task manager abort a per-task
signal on cancel (getTaskSignal). No handler read that signal, so the
upstream /v1/chat/completions call kept running until the 30 s timeout.
executeSmartRouting now passes getTaskManager().getTaskSignal(task.id) to
routeFetch. routeFetch combines it with the 30 s timeout through
AbortSignal.any, so the call ends on whichever comes first. A task with no
live signal behaves as before. Smart routing is the only A2A skill that
calls routeFetch; the other skills make no upstream fetch.
Tests: new a2a-smart-routing-cancel-signal test. Before this change the
fetch signal was not aborted when the task was cancelled.
With models.dev sync off (the default) the all-row capability cache is
never primed, so every getSyncedCapability call prepared a SELECT and ran
the CREATE TABLE IF NOT EXISTS guard again, for hits and misses alike. One
chat request makes about nine such calls.
Remember each (provider, model) result, misses included, in a bounded map.
The map is dropped when the model catalog cache version moves (every
capability write already calls invalidateDbCache for model-capabilities) or
when the database instance changes. The map is cleared whole at 4096
entries, because model names come from request bodies. The table guard
runs once per database instance.
(cherry picked from commit 7a3f07c1b57bf9bcbdaa3e98d96c12e5c071b153)
RedisQuotaStore.consume sent INCRBYFLOAT, EXPIRE, EXPIRE and MGET as four
round trips. A crash or disconnect after INCRBYFLOAT left a counter with no
expiry, so the usage window never reset for that key.
Run the charge, both TTL refreshes and the previous-bucket read in one Lua
EVAL. The sliding-window result is unchanged.
(cherry picked from commit 6e193197ce9e3173dab1ceb0f6ff438075da59ed)
The opt-in credential masker ran every catalog pattern over every
string. Short-prefix patterns (hf_, r8_, sk-, gh*_, npm_, AIza) match
random base64url often enough to rewrite a signed thinking block or an
encrypted reasoning blob. A rewritten signature fails provider
verification when the client replays the turn.
Inside signature, thoughtSignature, thought_signature, encrypted_content
and similar fields, and inside any string that is one long base64 run
(256 chars or more), apply only the long-prefix patterns (PEM key, JWT,
AWS, Anthropic, sk-proj, Stripe, SendGrid, Slack, connection string).
Normal text still gets the full catalog.
(cherry picked from commit 34951c47e88f9308a78bce0ce09dff3fc5e93e81)
The batch status (used by the CLI tools overview) searched a tool's config for
marker text. For Claude any ANTHROPIC_BASE_URL counted, so a stale localhost
port, a foreign HTTPS host and the direct Anthropic URL all showed as
configured. For Droid, OpenClaw, Cline and Kilo, any file that contained
"omniroute", "sk_omniroute" or "localhost:<port>" anywhere showed as
configured, even in a note or an unrelated provider. The expanded card of each
tool reads specific fields, so the two views disagreed.
The batch check now reads the same field each tool's settings route reads
(Claude env.ANTHROPIC_BASE_URL, Droid customModels "custom:OmniRoute-N",
OpenClaw models.providers.omniroute, Cline openai provider + openAiBaseUrl,
Kilo router entry in auth.json) and requires a loopback host on this API port.
An OmniRoute entry that points elsewhere is reported as "other" for Claude,
Droid and OpenClaw, which the card already shows. Codex, Hermes, omp, Pi,
WhyCodes, Qwen and Grok Build keep their existing checks.
(cherry picked from commit ecba932321d14e7558b3c9d0da88007af9959a96)
cancelTask only set state=cancelled. The handler kept running and, when it
finished, updateTask threw "Invalid transition: cancelled -> completed". A
handler that failed after the cancel threw "cancelled -> failed" the same way,
which turned a client cancel into a 500 on message/send.
Give every live task an AbortController, abort it when the task becomes
cancelled, and expose its signal through getTaskSignal. After a cancel, a late
"failed" is ignored and a late "completed" is refused with a "cancelled" error
that carries no artifacts. Other invalid transitions still throw as before.
Handlers must read getTaskSignal to stop their own work; the skill wiring is a
separate change.
(cherry picked from commit f3abb2ea54cc93f36b18114a59b712edd6d94388)
cleanupCallLogs removed expired call_logs rows with a bare batched DELETE.
The body file each row points at (artifact_relpath) stayed on disk. Only the
request-driven orphan scanner removes such files, and it checks a few
entries per rotation and runs only when new call logs arrive. On an idle
gateway the expired bodies stayed.
For call_logs, each batch now picks its rows first, deletes exactly those
rowids, and then removes their files. A failed delete leaves the file of a
row that still exists. Other tables keep the old single statement.
(cherry picked from commit aef70539cc90467cfc720f3a32a245ec0bc82df0)
updateProviderConnection read the row, awaited the management-password
guard, then merged the old snapshot into a full-row UPDATE. Two updates
to different fields that overlapped on that await both merged against the
same old row, and the second write restored the first field to its old
value.
Move the SELECT after the await. From the read to the write there is no
await left, so the merge always starts from the newest row.
(cherry picked from commit e1f7c379657f0cae813ece1ad5c38a374537e907)
The retention rollup reads every token-shape group before its cutoff with one
all() call, prices each group in one Promise.all, and only then reduces the
groups to daily rows. After a long backlog, such as a retention cut or a
stopped scheduler, one pass held every group of every expired day in memory.
cleanupUsageHistory now runs the rollup and the delete for one UTC day at a
time, oldest first. A pass holds one day of groups. The rollup still runs
before the delete of the same day boundary, and a failed rollup still stops
the delete. The daily totals are the same as before.
Pricing inside one day is still unbounded. That needs a change in
aggregateHistory.ts, which another change set already edits.
(cherry picked from commit 581da00fe608facde621eac989f10daa167860ce)
exclusive_connection_leases gets one row per exclusive lease. Expire, release
and invalidate only change its state. provider_quota_reset_events gets one row
per observed quota reset. Neither table had a DELETE path, so both grew without
limit.
Scheduled cleanup now deletes lease rows whose ended_at is older than the
call-log retention window, and reset events whose window reset time is older
than that window. A live lease has no ended_at, so it is never deleted. The
current quota window and the last window stay, because the window start
lookup reads them.
(cherry picked from commit 47fc76062f1ecf1378c43cba3e59573e0386d111)
Dollar budgets add up domain_cost_history rows from the start of the current
daily, weekly or monthly window. Scheduled cleanup deleted rows older than
retention.domainCostHistory (30 days by default) without looking at that window.
On the last day of a 31-day month, the first-day spend was older than the cutoff.
Cleanup deleted it and the key got that allowance back. A shorter retention
setting did the same to weekly and daily windows.
Lower the cutoff to the earliest active budget window start. Rows outside every
window still follow the retention setting.
(cherry picked from commit 8c9f07f06cb080266b304756d5a8cb5b24298d62)
The earlier commit in this bundle added acquireSnapshotLease and made
pruneBackupDirectory skip a leased snapshot. Nothing took a lease, so the
change had no effect.
runMigrations now takes a lease on the restore point after each
createPreMigrationBackup and releases it in a finally block. A backup prune
from any call site or process keeps the snapshot until the upgrade ends,
whether it succeeds or throws. The run is split into runMigrations (lease
owner) and runMigrationsLeased (the existing body); the body is unchanged.
The portable snapshot durability test treated every renameSync as the
snapshot publication. The lease file is also written by rename, so the test
now ignores lease files.
Tests: new db-migration-runner-snapshot-lease test. A prune during the
upgrade deleted the restore point before this change. The lease is gone
after a successful run and after a failed run.
validateApiKey cached only valid keys. A client that kept sending a key with
no row paid one SQLite lookup per request, and each miss also re-ran the
legacy secret backfill scan.
Keep a separate hash -> time map for keys with no row. It has a 30 second
TTL and its own size cap, so a flood of bad keys cannot evict valid entries.
createApiKey drops the entry for the new key; every other write path
(import, regenerate, revoke, delete, restore) already calls
clearApiKeyCaches, which now clears this map too. bypassCache neither reads
nor writes it.
(cherry picked from commit 733221f645806bef716c22596be96831918e5bde)
A restore under a different STORAGE_ENCRYPTION_KEY loads every row,
but each stored credential is encrypted under the old key and cannot
be read. The operator sees a successful restore and then dead accounts.
Write a key fingerprint (sha256: plus the first 16 hex of the key's
SHA-256) into the database just before each manual, automatic and
pre-restore copy. On restore, read it from the backup and refuse,
before any live file is touched, when it differs from the running
key. The message names both fingerprints and never the key. A backup
with no fingerprint (older, or made with encryption off) restores as
before. restoreDbBackup takes { allowKeyMismatch: true } for a key
rotation. A failed fingerprint write only logs a warning; the backup
is still taken.
(cherry picked from commit 3fd751a499513009b0bc21cefe1dc58a8e3830ca)
The runner treats a migration as already applied when one sentinel schema object
exists, and the duplicate-column recovery writes the ledger row even when the
replay left columns missing. Three effects followed from a ledger gap:
- 005 and 027 were skipped when only one of their columns existed, so the other
columns and indexes were never created.
- 012 added the cache tokens to usage_history.tokens_input a second time, which
inflates the stored billing history.
- A recovery that failed for another reason after a duplicate column was
recorded as applied with columns still missing.
Check every column and index that 005 and 027 add. Skip 012 once any later
migration is in the ledger, because later rows already store the total. After
duplicate-column recovery, roll back the ledger row and fail the migration when
a column the file adds is still missing. The leftovers test now builds a schema
that has the column, as the case it describes.
(cherry picked from commit 74492d37e3b9676145cade5ddd1aaf094644225d)
Count and age pruning treat a pre-migration snapshot like any other
backup family. The migration runner avoids pruning itself, but
backupDbFile, createManagedDbBackup and the scheduled cleanup prune
the same directory from other call sites and other processes. The
only protection was a temp-directory marker that disappears when the
snapshot is published, which is before the migrations finish. A
restore point in use could be deleted mid-upgrade.
Add acquireSnapshotLease(backupDir, snapshotPath). It writes a small
lease file (pid and snapshot name) next to the snapshot and returns a
release function. pruneBackupDirectory skips every family named by a
lease whose process is alive and whose file is under a day old, and
removes leases of dead processes. Without a lease nothing changes.
The migration runner has to take and release the lease. That change
is in a separate file and is not part of this commit.
(cherry picked from commit f094abe1958b52136a09cf0ee84db0017bb43e6f)
checkFallbackError no longer gives a permanent verdict to a banned-signal
body on HTTP 408, 429 or 5xx, because a transient status that only quotes a
ban phrase is not a ban. BAN_DETECTION.md still said the permanent
terminalization fires at any HTTP status. The line now names the three
excluded statuses.
Checks: check-docs-sync, check-docs-frontmatter, check-fabricated-docs,
check-docs-symbols and prettier pass.
expandPromptCacheAffinityTargetsFromConnections looked up the authType of
every scoped account with a linear find over the same provider list. For
one unpinned target that is O(accounts^2); for T targets it is
O(T x accounts^2). Auto combos run this expansion on every request.
Build one id -> connection index per provider on first use and read
authType from it. The first entry wins for a duplicate id, as the find
did. Output order, connection ids and execution keys are unchanged.
(cherry picked from commit 1762b693cc16c34ad066f328a224b0d79b16bb57)
The Gemini RPM and TPM trackers pruned expired entries with
Array.slice(i), which copies the whole remaining window on every
request. Cost per request grew with the number of requests in the last
60 seconds, and the published limits reach 16000 RPM. The map keys also
stayed after traffic stopped.
Each window now keeps a head index. Expiring an entry moves the index.
The array is compacted only when the dead prefix is at least half of it.
A window with no live entries is deleted from its map. The 60 second
cutoff is unchanged.
(cherry picked from commit a73eabdf2f6b6c9866f00985ac52ffb525557881)
Bare-model resolution asked the database which active providers carry the
model, with two json_each scans over every connection's synced and custom
model catalog, on every request. The work grew with catalog size, not with
the size of the lookup.
Keep the answer per model id and drop it when the model catalog cache
version moves. Every connection write (create, update, delete) and every
synced or custom model write already bumps that version, and the write
paths that skip it only touch cooldown, error and token fields. The map is
capped at 1000 ids because ids come from clients.
(cherry picked from commit db48f5fba5537b2c9d723a31692bc55583e023b1)
A DashScope key with no balance answers 400 Arrearage, and a key without the
model service answers 403 AccessDenied.Unpurchased. Both stay true until the
owner pays. The first got no cooldown (shouldFallback false) and the second a
3 s auth cooldown, so the dead key was hit again and again. Both now return
credits_exhausted with a 1 h cooldown, matched on the vendor code or its exact
sentence and only on 400 and 403.
isAccountDeactivated is a substring match with no status check. A 408, 429 or
5xx body that only quotes a ban phrase (a relay echoing an old error, a
throttle message) gave the account a one-year permanent cooldown. The permanent
verdict now needs a status other than 408, 429 and 5xx. 401 and 403 keep it.
(cherry picked from commit 846e42ae792fafc6cdafc385dffe3fdaeacd4516)
The CCH token was xxHash64 of the raw request body with seed
0x6e52736ac806831e. The native Claude Code client hashes a different
view of the body and uses a different seed, so the token never matched
what a real client sends.
Seed: the Claude Code binary stores the four xxHash64 initial-state
words for seed 0x4d659218e32a3268 next to its "cch=00000" routine. The
seed 0x6e52736ac806831e is not in the binary, neither as a seed nor as
state words.
View: the native client drops "max_tokens", "fallbacks" and
"fallback_credit_token" members at every depth and empties "model"
string values. It keeps the comma before a trailing run of two or more
dropped members. The bytes of the sent body do not change except for the
five digits.
The new test pins 24 vectors from Claude Code 2.1.220 (published in the
CLIProxyAPI signer tests) and the view rules. The vectors reproduce
only with the new seed and the new view.
(cherry picked from commit be5c1f05f4476cb97a2524c106b84671e034858f)
With per-tenant virtual lanes on, dispatchLanes rebuilt the lane list in
Map order on every release. One release frees one slot, so the first lane
took it and the loop returned before any later tenant was looked at. A
lone tenant waited behind the whole backlog of the tenant ahead of it.
A lane that is served now moves to the end of the Map, which makes the Map
order the round-robin cursor. Dispatch also repeats rounds while capacity
remains and a lane was served, so spare capacity is not left idle.
The direct-admission fast path checked only the shared queue. With lanes
on, older work waits in its lane while the shared queue is empty, so a
newer request from the same tenant was admitted ahead of it. The fast
path now also requires that the tenant's own lane is empty. Other
tenants still bypass a lane head that does not fit, so the bounded bypass
stays and no head-of-line block spans tenants.
(cherry picked from commit 143b576c215d356dc9e44c85b8137d344f1813e9)
With DATA_DIR unset, every default-data-dir resolver returned any existing
~/.omniroute first. Other code creates ~/.omniroute/<sub> directly, so an
XDG (or %APPDATA%) install with its database in the platform dir moved to a
new empty database on the next start.
The legacy dir now wins unless the platform dir holds storage.sqlite and the
legacy dir does not. Fresh installs, legacy installs and installs where both
dirs hold a database keep the old choice. The rule is applied the same way in
the six resolver copies, so the CLI and the server pick the same database.
Every server-owned tool call inserted a row into server_tool_executions and
finalized it. Nothing deleted a row, so the table grew with tool traffic.
On claim, at most once per 5 minutes per database handle, delete rows older
than 30 days (the replay horizon) and rows beyond the newest 10,000 that are
older than one day. A running claim with a live lease and the last day of
rows are never deleted, so a client retry still replays instead of running a
tool twice. A failed sweep is logged and does not fail the claim.
(cherry picked from commit 75a124806cac37606adea371848901a239150eb8)
chatCore calls listCompressionCombos() on every request, and each call ran
the full bootstrap: two CREATE TABLE IF NOT EXISTS, three CREATE INDEX IF
NOT EXISTS, an INSERT OR IGNORE seed and the legacy-seed upgrade check. The
INSERT OR IGNORE takes the SQLite write lock even when the seed row exists.
While another process (CLI, backup, second instance) held the write lock,
each request blocked the event loop for the full busy_timeout and then
failed the lookup with "database is locked".
Latch the bootstrap per DB instance in a WeakSet. The latch is set only
after the bootstrap succeeds, so a failed bootstrap retries on the next
call, and a restore or reset (a new instance) bootstraps again.
(cherry picked from commit bf57d38ab82cca51d2538381d17fa945150c543d)
(cherry picked from commit 70ce760302fe028fec6f5762df20828903f659d9)
A compatible node's custom models are stored in key_value under the
'customModels' namespace keyed by the node id. deleteProviderNode
removed only the provider_nodes row, so the node's model list outlived
the node. deleteProviderConnectionsByProvider already purges the synced
models and discovery state of a deleted provider, but not this row, so
the management listings (GET /api/provider-models, /api/pricing/models)
kept returning it. Delete the customModels row inside the node delete.
Canonical providers are unaffected: their rows are keyed by provider
name, never by a node id.
Port of 9router a8f63f4d.
(cherry picked from commit 93a805880008de0eaec44af5715f40648e55cf2b)
(cherry picked from commit c40729cda0a93eedbc1706a76fc5ce8a80d747e4)
BaseExecutor serialized the body for the wire and then JSON.parse'd that
string back to build result.transformedBody. Without a CLI fingerprint and
without CCH signing, the wire string is exactly JSON.stringify of the live
transformedBody, so the parse produced a copy of an object we already had.
On a 3 MB agent body that copy costs a body-sized allocation and a blocking
parse per attempt (execute() median of 3 runs: 8.8 ms before, 6.3 ms after).
The fingerprint and Claude paths keep the parse-back: there the wire has a
different key order and a signed cch token, and the logged/returned body
must show that post-fingerprint shape. The live object already carries
_toolNameMap, so the response-side un-cloak keeps working.
(cherry picked from commit 9ec6371ff44ac2571d2ba85b0605505d4b6b8d6c)
(cherry picked from commit 576f502abc0370a22a311ac0f824c36b74d7c3cd)
A 400 field-downgrade removes the rejected field and records it, so a later
re-run of the same URL (for example after a 429) keeps it removed. The strip
ran right after the body was built, before the Claude step. For a Claude
compatible relay with active thinking, that step re-adds context_management.
The re-run sent the rejected field again, the relay answered 400 again, and the
recorded strip blocked a second downgrade, so the client got the 400.
reapplyStrippedFields now runs a second time after the Claude step. The loop
moved into a helper next to the other 400 recovery code.
(cherry picked from commit c4701d4c772145e67c9faa42a63fccc5a779291b)
The inline tail copy raised the cognitive complexity of openai-responses.ts
from 4 to 5 violations. A small helper restores the base count. Behaviour is
the same: a tail shorter than the fragment is copied, a full fragment is
emitted as is.
createMcpServer registers one skill_<name> tool per enabled skill inside a
single try/catch. registerTool throws on a duplicate tool name, and two
skills whose names differ only in characters that the tool-name sanitizer
replaces (for example "a.b" and "a/b") map to the same name. The throw left
the loop, an empty catch hid it, and every later skill got no MCP tool.
Wrap each registration in its own try/catch. A failed skill is skipped and
logged to stderr with a sanitized message. Later skills still register.
The Claude thinking block from the Responses translator now carries an
empty signature string on purpose, because strict clients need the key.
The test asserted only that the signature is falsy, so a change that
dropped the key still passed. Assert the empty string itself.
When an upstream re-sends the whole argument string on every chunk,
the Chat-to-Responses translator took the new tail as a slice of that
snapshot. The short slice keeps the whole snapshot alive for as long as
the emitted event lives. A stream of 1500 snapshots (48 B growth each)
kept about 54 MB through its emitted deltas.
Copy the tail when it is shorter than the incoming fragment. A fragment
that is new in full is still emitted as is. A new test feeds growing
snapshots and checks both the emitted bytes and the retained heap.
The OpenAI-to-Gemini SSE and OpenAI-to-Antigravity stream translators
keyed streamed tool calls by tc.index ?? 0. Some OpenAI-compatible
endpoints send no index, so every parallel call landed in slot 0. The
arguments of two calls joined into one string that did not parse, and the
call went out with empty args.
A shared resolveToolCallIndex now picks the slot. A numeric index is used
as sent. Without one, a fragment that brings a new id, different from the
latest call's id, starts the next call. Any other fragment continues the
latest call. Streams that send an index are unchanged.
(cherry picked from commit feb9b0344e0a4e8b148a3055987ff93fd829616a)
The mid-stream heartbeat is an OpenAI chunk with `choices: []` and no
usage. The OpenAI-to-Gemini SSE translator dropped every chunk without
a choice, so a Gemini-native client with an idle-read timeout saw a
silent socket while the upstream was quiet.
The translator now turns that heartbeat into `data: {"candidates":[]}`.
Probed against @google/genai 1.0.0, 1.22.0, 1.35.0 and 2.0.0 on a
loopback server: this frame parses in all four. A colon comment breaks
versions before 1.35 and a lone newline breaks versions before 1.22.
A frame with an empty text part would be stored by chat sessions as an
empty model turn on every heartbeat; a frame with no candidates is not.
A usage-only chunk is still the usage chunk, and a chunk with no
`choices` array is still dropped.
(cherry picked from commit 7acbe9de0e3188cc42b8a0e7e5ed2da351634d08)
Strict Claude clients deserialize the signature key on every thinking
block and fail when it is missing. The OpenAI-to-Claude and
Gemini-to-Claude stream translators opened a thinking block with only
type and thinking, and the non-stream OpenAI-to-Claude translator did the
same. A translated block has no real signature, so each now carries an
empty string.
The empty value is not replayed as a signature. The request side drops
any thinking block with an empty signature, and a test now pins both
guards. One older test asserted that the key is absent; it now asserts
that no signature value exists.
(cherry picked from commit 8a507daba50e54ef9f76d73468747250fc5c7dd9)
The Chat-to-Claude and Chat-to-Responses translators appended each tool
argument fragment to a buffer, then emitted buffer.slice(oldLength). V8
flattens the cons-string buffer for every slice, and the small slice keeps
a reference to the whole old prefix. A live stream with 94 KiB of
arguments retained about 94 MiB of heap through its emitted deltas.
The new bytes are always the tail of the incoming fragment: appendToolCallArgumentDelta
returns the old buffer, the new snapshot, or old + fragment. Take that
tail from the fragment itself. Repeat dedup, snapshot growth, repeated
incremental characters and object fragments keep the same emitted bytes.
The Responses transformer had the same slice and gets the same change.
(cherry picked from commit 48dbff217292c12fa4d63ca22c7f7884889b192b)
catalog published in raw API arrival order; modelOrder sorts it by an ordered { key, direction } list over provider, name, recency, free, price, context, defaulting to provider then name then newest release date then id; an unknown key or direction fails the load naming the value and the supported set
2026-11-03 12:23:34 +01:00
860 changed files with 36390 additions and 2223 deletions
| `apiKey` | connected credential, then `OMNIROUTE_API_KEY` | Chat key for `/v1/*` — see [Credentials](#credentials) |
| `managementReadToken` | option, then `OMNIROUTE_MANAGEMENT_API_KEY`, then `apiKey` | Management key for `/api/*` (combos, providers, enrichment) — usually **not** the same key |
| `displayName` | `"OmniRoute"` | Provider display name |
| `modelCacheTtlMs` | `300000` | Catalog cache TTL and background refresh period (minimum 60000 ms): the served catalog follows the gateway within this window, with no service restart; disk snapshot warms cold starts |
| `timeouts` | per-endpoint override | `{ models, combos, enrichment }` in ms; falls back to `timeoutMs` (`autoCombos` still parses but is ignored — the virtual-entries route is no longer requested) |
| `providerTag` | `true` | Toggle the trailing editor parenthesis: `Provider - Model (Editor)`. The provider (the route that serves the model: Openrouter, Opencode-go, Nvidia for `nvidia/...` ids) is always shown; the editor (who made the model: MoonshotAI, Meta, DeepSeek) appears only in the parenthesis. Example: `Openrouter - MoonshotAI: Kimi K 3.1 Pro` -> `Openrouter - Kimi K 3.1 Pro (MoonshotAI)`. The parenthesis is omitted when the editor shares the provider's name. Set `false` to drop it. |
| `geminiSanitization` | `true` | Strip `$schema`/`additionalProperties` from tool schemas sent to Gemini models (`$ref` tools are forwarded untouched) |
| `combosSource` | `"api"` | Combo source. `"api"` reads `/api/combos` and publishes a combo only when every member passes the filters; `"models"` skips that request and publishes the combo rows `/v1/models` serves. Any preset, `usableOnly`, `providersAllow` or visible/hidden list keeps `"api"` |
| `freeOnly` / `toolsOnly` / `visionOnly` | `false` / `false` / `false` | Filter to free-tier / tool-calling / image-input models; combos with a filtered member are dropped, never partial. Presets filter the pool before the default view ranks it, and a combo publishes only when every resolved member passes (dropped when a member fails or none resolves) |
| `freeSignals` | `["declared"]` | Extra signals that admit a model under `freeOnly`: `priced`, `named`, `provider-named` (see below) |
| `freeProviders` | none | Provider prefixes counted as free by `provider-named` |
| `freshWindowDays` | `90` | Freshness window in days for the fresh branch |
| `usageMemory` | `true` | Restore statically dropped entries named by 30-day usage analytics (needs a management token; inert without one) |
| `visibleModels` / `hiddenModels` | `[]` | Exact (`cc/keep-me`), suffix (`keep-me`), or branch (`prefix/*`) entries ; deny wins ; `"*"` publishes the full catalog and skips narrowing |
| `providersAllow` | `[]` | Provider allowlist by flat name, or branch claim (`prefix/*`) for exhaustive mode ; a branch claim names a branch, a flat entry names a provider prefix |
| `combos` | `true` | Set to `false` to hide every combo (no `/api/combos` request, no combo rows from `/v1/models`) ; models are unchanged |
| `apiFormat.allowAnthropic` | `false` | Route allowlisted ids to the Anthropic API block |
| `apiFormat.anthropicModels` | `[]` | Full model ids routed to Anthropic |
| `apiKey` | connected credential, then `OMNIROUTE_API_KEY` | Chat key for `/v1/*` — see [Credentials](#credentials) |
| `managementReadToken` | option, then `OMNIROUTE_MANAGEMENT_API_KEY`, then `apiKey` | Management key for `/api/*` (combos, providers, enrichment) — usually **not** the same key |
| `displayName` | `"OmniRoute"` | Provider display name |
| `modelCacheTtlMs` | `300000` | Catalog cache TTL and background refresh period (minimum 60000 ms): the served catalog follows the gateway within this window, with no service restart; disk snapshot warms cold starts |
| `timeouts` | per-endpoint override | `{ models, combos, enrichment }` in ms; falls back to `timeoutMs` (`autoCombos` still parses but is ignored — the virtual-entries route is no longer requested) |
| `providerTag` | `true` | Toggle the trailing editor parenthesis: `Provider - Model (Editor)`. The provider (the route that serves the model: Openrouter, Opencode-go, Nvidia for `nvidia/...` ids) is always shown; the editor (who made the model: MoonshotAI, Meta, DeepSeek) appears only in the parenthesis. Example: `Openrouter - MoonshotAI: Kimi K 3.1 Pro` -> `Openrouter - Kimi K 3.1 Pro (MoonshotAI)`. The parenthesis is omitted when the editor shares the provider's name. Set `false` to drop it. |
| `geminiSanitization` | `true` | Strip `$schema`/`additionalProperties` from tool schemas sent to Gemini models (`$ref` tools are forwarded untouched) |
| `combosSource` | `"api"` | Combo source. `"api"` reads `/api/combos` and publishes a combo only when every member passes the filters; `"models"` skips that request and publishes the combo rows `/v1/models` serves. Any preset, `usableOnly`, `providersAllow` or visible/hidden list keeps `"api"` |
| `freeOnly` / `toolsOnly` / `visionOnly` | `false` / `false` / `false` | Filter to free-tier / tool-calling / image-input models; combos with a filtered member are dropped, never partial. Presets filter the pool before the default view ranks it, and a combo publishes only when every resolved member passes (dropped when a member fails or none resolves) |
| `freeSignals` | `["declared"]` | Extra signals that admit a model under `freeOnly`: `priced`, `named`, `provider-named` (see below) |
| `freeProviders` | none | Provider prefixes counted as free by `provider-named`|
| `freshWindowDays` | `90` | Freshness window in days for the fresh branch |
| `usageMemory` | `true` | Restore statically dropped entries named by 30-day usage analytics (needs a management token; inert without one) |
| `visibleModels` / `hiddenModels` | `[]` | Exact (`cc/keep-me`), suffix (`keep-me`), or branch (`prefix/*`) entries ; deny wins ; `"*"` publishes the full catalog and skips narrowing |
| `providersAllow` | `[]` | Provider allowlist by flat name, or branch claim (`prefix/*`) for exhaustive mode ; a branch claim names a branch, a flat entry names a provider prefix |
| `combos` | `true` | Set to `false` to hide every combo (no `/api/combos` request, no combo rows from `/v1/models`) ; models are unchanged |
| `apiFormat.allowAnthropic` | `false` | Route allowlisted ids to the Anthropic API block |
| `apiFormat.anthropicModels` | `[]` | Full model ids routed to Anthropic |
| `modelOrder` | `provider → name → recency → id` | Ordered list of `{ key, direction }` pairs that sorts the published catalog; each entry is `{ key, direction?: "asc" \| "desc" }`. Keys: `provider` (upstream owner), `name` (display name), `recency` (release date), `free` (zero-cost first), `price` (input, then output cost), `context` (window size). Omitted `direction` uses the key's default — `asc` for `provider`, `name`, `free`, `price`; `desc` for `recency`, `context`. A missing release date or context window sorts last in either direction; an entry whose cost is all zero counts as free; `id` always breaks the final tie. Unknown key or direction fails the plugin load, naming the value and the supported set. **Default changed:** without this option the catalog used to publish in raw API arrival order and now publishes as `provider → name → recency → id`. An explicit `[]` equals the default. |
| `telemetry` | `false` | Opt-in; marks inference requests through the host SDK hook when enabled |
<tr><td nowrap><b>Language</b></td><td>TypeScript 6.0 — <b>100% TypeScript</b> across <code>src/</code> and <code>open-sse/</code> (zero <code>any</code> in core since v2.0)</td></tr>
- **feat(opencode-plugin-v2):** make the published catalog order configurable through `modelOrder` — an ordered list of `{ key, direction }` pairs over `provider`, `name`, `recency`, `free`, `price` and `context`, each with its direction — so the OpenCode plugin publishes models deterministically by default (`provider → name → recency → id`, replacing raw API arrival order) and the operator can reorder the picker ([#18804](https://github.com/cheaper-inference/OmniRoute/pull/18804)) — thanks @maxmad64bis
- **feat(api):** add the per-request `x-omniroute-no-log` header to omit request/response payloads from call logs while keeping timestamp, model, status, duration and token counts ([#20096](https://github.com/cheaper-inference/OmniRoute/pull/20096))
- **feat(sse):** Mistral now counts as an automatic-prefix-caching provider (cache-aware compression guard, cache stats) and gets a stable `prompt_cache_key` on both Chat Completions and Responses bodies ([#20111](https://github.com/cheaper-inference/OmniRoute/pull/20111)) — thanks @RayJW
- Command Code short plan ids (go, goat, pro, ultra, teams-pro) now resolve to their plan names, and known plans show their fixed credit cap as the quota total. ([#20347](https://github.com/cheaper-inference/OmniRoute/pull/20347))
- Qoder's Sonus (smodel) and Cantus (cmodel) are now in the static model fallback, so the ids stay routable when the live catalog is unavailable. ([#20351](https://github.com/cheaper-inference/OmniRoute/pull/20351))
- **fix(translator):** thinking blocks that OmniRoute translates for Claude clients now carry an empty `signature` field, so strict Claude clients no longer fail to parse reasoning from OpenAI-shaped and Gemini providers. ([#19403](https://github.com/cheaper-inference/OmniRoute/pull/19403))
- **fix(translator):** Gemini-native streams (`/v1beta/models/*:streamGenerateContent`) now forward the mid-stream keepalive as an empty `data:` frame, so a client idle-read timer resets while the upstream is quiet. Before, the keepalive was dropped and the socket stayed silent. ([#19403](https://github.com/cheaper-inference/OmniRoute/pull/19403))
Some files were not shown because too many files have changed in this diff
Show More
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.