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.
* feat(ci): omni-queue owner voice and signed merge commits, both off
Owner voice (config `voice`, default "app"): with "owner", the queue's
comments and label removals on pull requests, the dashboard issue and its
comments, base-red comments and the tree-divergence issue go out with
OMNI_QUEUE_LAND_TOKEN (scripts/merge-queue/voice.mjs). Reads, commit
statuses, refs, the state branch and re-runs stay the App's. A missing
token or a 401/403 retries the same write with the App's token and records
one error event per tick. commentOnce trusts markers by the App or by the
owner's login read from the token itself (GET /user).
Signed merge commits (config landing.signing, default "none"): with "ssh"
and landing.actor "owner", composeCandidate signs every merge commit with
the key the tick job writes from the OMNI_QUEUE_SIGNING_KEY secret to a
0600 file under RUNNER_TEMP (removed by an always() step). git gets the
path as per-command configuration through the environment. A missing key
or a failed signature composes unsigned and records one error event per
batch.
The shipped config keeps both off and mode shadow.
* docs(changelog): add the fragment for the omni-queue owner voice and signed merges (#20792)
* test(ci): compare the signed commit's committer by prefix, not a built regex (#20792)
The retired-asset audit in provider-assets-generic-fallback.test.mjs walked the
working tree at module load and read every text file whole. In the omni-queue
base check, "Fast Quality Gates" builds config/quality/test-impact-map.json
(gitignored, ~556 MB on release/v3.8.55) before running the whole unit suite,
and readFile(path, "utf8") on it threw "RangeError: Invalid string length"
(run 44795004759).
The audit now lists files with git ls-files (same scope rules; the old walk
stays as the fallback for a tree without git metadata), reads each file with a
64 MiB bound, and reports oversized or unreadable files by name instead of
aborting. A regression test builds a temporary git repository with an
untracked 600 MB sparse file in a walked directory.
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.
CodeQL flags js/resource-exhaustion when a timer delay comes from
configuration without a visible upper bound at the call. The value was
already clamped to 100-5000 ms by the schema and clampDecisionTimeout,
but through a helper the analysis does not follow. Compare against
MAX_DECISION_TIMEOUT_MS where the timer is set (and where the transport
receives its timeout), so the bound is explicit. Behavior is unchanged.
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`).
* fix(gamification): commit one XP award as a single transaction
An authenticated request ran six autocommit statements per award: addXp inserted
xp_audit_log and upserted xp_action_counts and user_levels, then
updateRewardScores upserted leaderboard for global, weekly and monthly. Each took
the writer lock and its own commit, and a failure between them left XP without a
score or the reverse.
awardXp wraps addXp and the leaderboard upserts in one db.transaction.
emitGamificationEvent and the bonus-XP path (streak_bonus, badge_unlock) use it,
and the leaderboard credit now follows the award directly. Anti-cheat still runs
before any write; the lifetime action counter, one-time badge and streak-bonus
guards, tokens_shared scope and score values are unchanged. No setting or
delayed batch is added, so no award can be lost on shutdown.
Finding: ordata-48.
(cherry picked from commit a6517e5416cfbbb8e692767e68b0548dce931369)
* perf(db): compute the migration 044 key backfill once per connection
The old statement ran two correlated GROUP BY / ORDER BY subqueries for every
usage_history row that missed api_key_name, so the cost was the missing rows
times the history of their connection. The most used name and id of each
connection now go into two temp tables once, and the update joins them. The
values filled are the same: the most used non-empty value wins, a count tie
goes to the greater value, name and id are picked independently, a row with no
connection is not touched, and an unknown connection stays empty. Only installs
that have not run 044 yet see the change.
Finding: ordata-92.
(cherry picked from commit cb61850859b9e571c6cfbc6471349bdbb0048f54)
* fix(usage): retry a locked usage write on a backoff before dropping the row
A usage row that met a locked database was retried once after 1 s, then
dropped with one console.error. The 2 s busy timeout is not waited on the
first attempt, so a second writer process (CLI, desktop host) that holds the
lock for a few seconds lost the billing row.
The usage writer now retries on a 1, 2, 4, 8, 16 s backoff (about 31 s in
all), off the request path as before. Non-lock errors are still logged at
once and never retried. The generic one-retry scheduler used by call logs
and proxy logs is unchanged.
Finding: sub2api-86
(cherry picked from commit 93dd20bdd69b5cc23d836575c93c03172edca1f8)
* fix(quota): a stale exhausted sample with no reset no longer pauses an account
An exhausted quota window that carries no future reset time and was last seen
more than 2 hours ago now reads as unknown, not as reached. A paused account
receives no fresh quota headers, so one old sample kept it paused forever.
A window with a future reset still pauses until that reset, and a window seen
within 2 hours still pauses.
Finding: sub2api-43.
(cherry picked from commit e0b51b8052e42e475e8554d904b3f96223f181a1)
* fix(usage): add a late row to a purged day's rollup instead of replacing it
The retention job rolls usage_history up into daily_usage_summary, then deletes
whole days. The next rollup replaced a day's summary with the raw rows it still
found, so one row that arrived late for a purged day erased that day's earlier
totals (3 requests became 1 in the probe).
The purge now records the day it reached and the highest row id at that time in
one key_value row (no migration). A row below that day with a higher id is late:
the rollup adds it to the day's summary and moves the recorded id forward in the
same transaction. A second rollup that read the same rows finds the mark changed,
rolls back, and reports an error, so the caller keeps its raw rows. Days that are
not purged yet are still recomputed from their raw rows.
Finding: sub2api-82.
(cherry picked from commit 449f4f3b10f117e2e25716abd302ee0641949968)
* chore(changelog): name the new fragments 0000-<slug> for the publisher
* refactor(db): move the usage purge day recording into two helpers
The late-row member adds a branch and a transaction to deleteWholeDaysBefore.
That raises its cognitive complexity from 0 to 1 over the base. Two small helpers
keep the function at its old complexity. No behaviour change.
* docs(changelog): number the fragment (#20226)
* chore: drop derived values the release refresh now owns
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.
* test(usage): stop waiting for a MockTimers warning newer Node versions never emit
The retry test waited at the top level for the experimental-feature
warning that the first mock.timers.enable() prints, so a later test that
counts console.error lines would not see it. Node 24 (the CI runtime) no
longer emits that warning, so the wait never settled and the runner
failed the whole file with 'unsettled top-level await'. Wait one
macrotask instead: on versions that still warn, the warning (queued on
process.nextTick) has passed by then; on versions that do not, the wait
ends at once.
* revert(quota): drop the stale-sample no-pause fix from this bundle
Reverts 9a2da1815d (fix(quota): a stale exhausted sample with no reset no
longer pauses an account), with its changelog fragment and test.
Replaced by a separate PR with a per-session/opt-in design (see the PR list); dropped here so the two do not conflict.
* fix(usage): bound late rows to the read max id and check the purge mark on every rollup write
- The late-row branch of the rollup SELECT is bounded by the MAX(id) it read,
so a row another process commits between the two reads waits for the next
run instead of being counted now and again after the mark moves to maxId.
- A rollup transaction that only replaces summaries now checks the purge mark
it classified the days with and rolls back when a purge or a late-row add
moved it, so a stale read cannot overwrite a day that gained late rows.
* revert(db): drop the migration 044 backfill rewrite from this PR
044 is a merged migration: databases that already recorded it never run the new SQL, and a merged migration keeps its content. Removes the SQL change, its changelog fragment and its test, as the maintainer asked. The other changes in this PR are unchanged.
---------
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
check:complexity-ratchets (new-code mode) flagged five new violations:
selectAsync, the combo-model decider, resolveDecisionApiKey (cyclomatic
17 > 15) and DecisionModelSection (289 lines, complexity 16). The
pre-decider checks and the answer checks of the strategy, the
preconditions and in-scope dispatch of the combo-model decider, and the
referenced-connection branch of the credential resolver move into
helpers; the builder section is split into settings, descriptions, test
and preview-hook pieces. Behavior is unchanged: the decision unit tests
and the builder UI tests pass as before.
Co-authored-by: Marcel Rösler <3178520+BelphegorPrime@users.noreply.github.com>
Co-authored-by: Alvin T. Veroy <551419+alvinveroy@users.noreply.github.com>
Co-authored-by: Rafa Martins <146174365+rafacpti23@users.noreply.github.com>
Co-authored-by: Miguel Enes <1568086+miguelenes@users.noreply.github.com>
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.
Step 12 and integration: AUTO-COMBO.md gains the `decision` strategy
section (deciders, fields, flag, what leaves the box, failure reasons),
ENVIRONMENT.md and .env.example list OMNIROUTE_DECISION_API_KEY and the
COMBO_DECISION_ROUTER_ENABLED flag, openapi.yaml documents
POST /api/combos/decision-preview, and a changelog fragment is added.
Code: an upstream-reported model name only reaches the log when it looks
like a model id (no spaces, at most 100 characters); the failure branches
of the decision results name their variant explicitly, because
`strict: false` does not narrow the `ok` union (check:open-sse-typecheck
flagged them).
Co-authored-by: Marcel Rösler <3178520+BelphegorPrime@users.noreply.github.com>
Co-authored-by: Alvin T. Veroy <551419+alvinveroy@users.noreply.github.com>
Co-authored-by: Rafa Martins <146174365+rafacpti23@users.noreply.github.com>
Co-authored-by: Miguel Enes <1568086+miguelenes@users.noreply.github.com>
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.
Caller-supplied poll_interval_ms, timeout_ms and poll_timeout_ms on the
NanoBanana, Magnific, Black Forest Labs and RenderHour image handlers are
clamped (30 s interval, 10 min window) by a shared helper that never
shortens a default. The RenderHour poller passes the request abort signal
to sleep(). applySyntxProviderRules only runs own entries of the rules
table.
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".
isInternalAdmissionBypass() accepted the bypass header together with a
bearer equal to resolveSelfLoopBearer(), which is the deployment env key
when one is configured. That key is an ordinary API key clients hold, so
it proved nothing about where a request came from.
Apply the rule from #19292: only the per-process self-hop token (held in
memory on globalThis, compared in constant time) grants the bypass and
the internal upstream-start cap. The vision bridge describe call, the
only caller that sends the bypass header, now also sends the token; it
only does so for this process's own listener.
Engine: google. Sources: docs/architecture/QUALITY_GATES.md, docs/ops/BRANCHING_MODEL.md, docs/ops/MERGE_TRAIN.md, docs/ops/RELEASE_CHECKLIST.md, docs/ops/RUNNER_BOX.md. 299 mirror file(s). 31 unit(s) failed and were left as they were.
Run: https://github.com/cheaper-inference/OmniRoute/actions/runs/44793361106
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.
Step 10: picking the `decision` router strategy shows a section that
writes `config.decision`: decider (TypeSafe System One, own decision URL,
one of the combo's models), base URL and wire for http, model,
connection ID, timeout (100-5000 ms), minimum confidence, per-model
descriptions with the generated cost-rank text as placeholder, and a
one-off Test decision through POST /api/combos/decision-preview. There is
no API-key field. English strings only in en.json. Adapted from the
#18555 DecisionModelSection and draft helpers.
Co-authored-by: Marcel Rösler <3178520+BelphegorPrime@users.noreply.github.com>
Step 9: POST /api/combos/decision-preview (management auth) builds the
decision menu and the generated cost-rank descriptions for an unsaved
combo. With a prompt it runs one decision with the unsaved settings,
behind the same COMBO_DECISION_ROUTER_ENABLED flag (off = skipped,
nothing fetched); combo-model decisions only exist inside a live request
and are skipped. The body is validated with a strict schema (no apiKey),
failures are log-safe reasons, and errors go through sanitizeErrorMessage.
Adapted from the #18555 preview route.
Co-authored-by: Marcel Rösler <3178520+BelphegorPrime@users.noreply.github.com>
Step 8: comboRuntimeConfigSchema now validates `config.decision` and the
decision block under `config.auto` with the strict decision schema: the
decider and wire are closed enums, baseUrl is http(s) up to 500
characters without credentials, query or fragment, model up to 200,
timeoutMs an integer from 100 to 5000, minConfidence from 0 to 1, and at
most 50 descriptions (key up to 300, value up to 1000). There is no apiKey
field: `.strict()` rejects it, so no secret can be stored in a combo.
The rest of `config.auto` stays free-form as before.
Co-authored-by: Marcel Rösler <3178520+BelphegorPrime@users.noreply.github.com>
Co-authored-by: Rafa Martins <146174365+rafacpti23@users.noreply.github.com>
Step 7: a new `decision` strategy in the Auto router registry, next to
nadir. The combo's decision block (config.auto.decision, or
config.decision for top-level router knobs) names the decider:
systemone, http or combo-model. The answer narrows the pool to the chosen
model and rules picks the connection; every failure falls back to rules
with `decision(<kind>): fallback (<reason>)` in the log line, never a URL,
key, prompt or upstream body.
COMBO_DECISION_ROUTER_ENABLED (default false, warning level caution) gates
every decider: while it is off no decider is built, so no credential is
read and nothing is fetched. The jev strategy and its flag are untouched.
resolveAutoStrategy only forwards the parsed block plus the request seams
(signal, handleSingleModel, combos, allowlist) into the routing context.
New tests pin that combos without a decision block keep exactly today's
order and context with the flag on, and that a decision combo with the
flag off routes like the rules fallback with zero fetch. The flag count
tests and the FEATURE_FLAGS.md catalog move from 126 to 127; the strategy
list test gains `decision`.
Co-authored-by: Marcel Rösler <3178520+BelphegorPrime@users.noreply.github.com>
Step 6: one of the operator's own provider models answers the routing
question through the combo's handleSingleModel, the way the fusion judge
runs. Combo references (auto, auto/*, configured combo names, ids without
a provider prefix) are refused; the call is non-streaming, tool-free,
temperature 0 with a 256-token budget and carries none of the client's
system prompt, tools or history; an AsyncLocalStorage depth guard refuses
a decision started inside a decision call; the timeout aborts the target.
Prompt and parser are the OpenAI-chat decision wire from #15641.
Co-authored-by: Alvin T. Veroy <551419+alvinveroy@users.noreply.github.com>
Step 5: an operator classifier at its own URL, on the System One wire
(#18555) or the OpenAI chat-completions wire (#15641: strict JSON system
prompt, extractJsonObject, confidence defaults to 0). The base URL must be
http(s) without credentials, query or hash; a URL pointing at this gateway
is refused (recursion); a failure cools the endpoint down for 30 s; a
choice outside the menu or a refusal is a failure, never a route.
Co-authored-by: Marcel Rösler <3178520+BelphegorPrime@users.noreply.github.com>
Co-authored-by: Alvin T. Veroy <551419+alvinveroy@users.noreply.github.com>
Step 4: the systemone decider asks TypeSafe through the base client
(#15278). Its key comes only from a stored connection by reference
(connectionId, inside the API key allowlist, the jevAsk pattern) or from
OMNIROUTE_DECISION_API_KEY; a referenced connection outside the allowlist
yields no key and never falls back to the environment. The credential
inventory gains the new call site (class B, like jevAsk).
Co-authored-by: Miguel Enes <1568086+miguelenes@users.noreply.github.com>
Step 3: the TypeSafe System One client used a bare fetch, read the body
with an unbounded response.json() and followed redirects. It now posts
through the decision transport: safeOutboundFetch with the provider
outbound guard, no retries, redirects refused, a 64 KB body cap and the
same status-only failures. Timeouts, results and the jev callers are
unchanged.
Co-authored-by: Miguel Enes <1568086+miguelenes@users.noreply.github.com>
Co-authored-by: Rafa Martins <146174365+rafacpti23@users.noreply.github.com>
Step 2: every network decider leaves through one path. safeOutboundFetch
with the provider outbound guard, no retries, redirects refused
(redirect "error" on the seam, allowRedirect false on the fetch), a body
read capped at 64 KB, one timeout over the whole round trip, caller abort,
and status-only failures so an upstream body never reaches a log.
Co-authored-by: Rafa Martins <146174365+rafacpti23@users.noreply.github.com>
Co-authored-by: Marcel Rösler <3178520+BelphegorPrime@users.noreply.github.com>
Step 1 of the unified decision routing: the shared types every decider
returns (never throws, log-safe failure reasons), the menu of unique pool
models with operator or cost-rank descriptions, the bounded extractor of
the last user message (chat/Claude messages and Responses input; never the
system prompt, tools or instructions), and the anti-recursion header.
Co-authored-by: Marcel Rösler <3178520+BelphegorPrime@users.noreply.github.com>
Co-authored-by: Alvin T. Veroy <551419+alvinveroy@users.noreply.github.com>
On the Firecrawl cloud endpoint, a wait_for_selector that is a plain
non-negative integer is now sent as the v2 waitFor delay in milliseconds,
capped at the v2 limit of 60000. Any other value still goes through the
wait action as a CSS selector. Self-hosted base URLs keep the v1 body.
The mapping moves into applyWaitForSelector() so firecrawlFetch does not
grow. Adds the changelog fragment for the v2 scrape migration (#19636).
Grafted from #19799 (numeric waitFor handling and changelog entry), with
the integer-only rule and the 60000 ms clamp from the review.
Co-authored-by: Rafa Martins <rafacpti23@users.noreply.github.com>
New feature flag PLUGIN_PERMISSION_MODEL_ENABLED (security, default off).
When it is on, pluginManager.activate() asks loadPlugin() to start the plugin
host with the Node.js permission model, built from the manifest by
buildPermissionModelArgs() (src/lib/plugins/permissionModel.ts):
- --permission (accepted by Node 22.22+, 24 and 26);
- --allow-fs-read for the generated host script and the plugin directory,
plus the plugin data directory (plugin-data/<name> next to the plugin root)
when file-read or file-write is declared;
- --allow-fs-write for the data directory only when file-write is declared;
- --allow-child-process only when exec is declared.
Workers, addons and WASI stay denied. network stays declarative because the
Node.js permission model does not gate outbound network access. With the flag
off the host argv and env are exactly as before.
PLUGIN_SDK.md gets a flag-off / flag-on permission table, PLUGIN_MARKETPLACE.md
and FEATURE_FLAGS.md document the flag, and the flag-count tests move to 127.
Apply the #20567 status contract to the subscription/plan quota text
signals ("usage limit reached", "plan limit", weekly/session usage
limits). On a 400 such a phrase now counts only with a structured
credit/quota code or for the message-only allow-listed providers
(command-code, bai, openai-compatible-*), so a phrase repeated from the
request no longer classifies as QUOTA_EXHAUSTED or puts a shared LLM or
search connection on hold. 429, 403 and every other status are
unchanged.
The status rule is extracted from isCreditsExhaustedForStatus into
quotaTextSignalCountsForStatus and reused by the classifier, the
fallback engine and the search cooldown.
POST /api/plugins/marketplace/install downloads plugin code and may activate it,
so it now requires the management credential in every auth mode
(alwaysRequireAuth), like POST /api/plugins.
PUT /api/plugins/[name]/config now validates the body with
validatePluginConfig(): only keys declared in the plugin's configSchema are
stored, with type, range and enum checks. A plugin without a configSchema has
no configurable keys, so the write is refused with a fixed 400 and nothing is
stored.
Exclusion is decided before the account-cooldown check, so an account that
the fallback loop just excluded could turn its short model lockout into the
reported model cooldown even while the account itself was cooling down for
much longer, and the caller would retry too early. Count an excluded account
only when it is not in an account cooldown, with the regression test from
#20249.
Co-authored-by: Rafa Martins <rafacpti23@users.noreply.github.com>
The text form of the usage command (@@om-usage and the plain
/api/usage/om-usage) now applies the same account rule as the JSON form:
a key without self:account-quota or a management scope sees only its
personal quota, and the shared provider accounts are not read for it.
Keys with self:account-quota, management keys and the environment key
keep the provider quota.
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.
Additive merge of cheaper-inference/OmniRoute release/v3.8.55; retain upstream's equivalent VS Code Terra effort recognition and keep provider catalog changes focused. Upstream's existing translated-doc whitespace is outside the PR delta.
The fragment was keyed by the issue number (20250-auggie-cli-quiet-flag.md);
changelog.d fragments are keyed by the PR number, so it becomes
20272-auggie-cli-quiet-flag.md with its content unchanged.
Co-authored-by: Rafa Martins <rafacpti23@users.noreply.github.com>
The node tests in this PR exercise the request-body builder, the schema and
the validator directly; on the current base they pass because the fix (#19384)
is already merged. This jsdom test renders AddApiKeyModal for cloudflare-ai,
types an API key and an Account ID, clicks "Check" and asserts the request to
/api/providers/validate carries the trimmed accountId. It fails with the
#19384 change reverted (the body has no accountId) and passes with it.
The changelog fragment is renamed to the <PR>-<slug> convention and moved to
maintenance: the fix itself already has its entry under #19384, so this PR
only adds regression tests.
Co-authored-by: Rafa Martins <rafacpti23@users.noreply.github.com>
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.
Add the resolveModelDisplayName cases from #20114: an explicit name such as
"Custom Label" wins over a dated snapshot id, and the id passed as its own
name is still derived to "GPT-5". Also cover the namespaced
cmc/openai/gpt-4.1-2025-04-14 id.
Co-authored-by: Rafa Martins <rafacpti23@users.noreply.github.com>
The existing #20449 case passes on the base too: the entry-relative worker is
found before any module-relative candidate, so the guard is never exercised.
This case leaves only a cwd-relative TypeScript worker, so the base (which
ignores moduleUrl and keeps using the real module directory) returns the
source tree's worker, while the fix skips every module-relative candidate and
probes only the cwd layout.
Co-authored-by: Rafa Martins <rafacpti23@users.noreply.github.com>
The fragment was named api-key-usage-limits-long-context-20153.md;
changelog.d fragments are keyed by the PR number first, so it becomes
20255-api-key-usage-limits-long-context.md with its content unchanged.
Co-authored-by: Rafa Martins <rafacpti23@users.noreply.github.com>
The five wall-clock assertions used a 250 ms budget, which a loaded CI runner
can exceed even with the linear fix. The pre-fix regexes take tens of seconds
on the same inputs, so a shared 2 s budget still fails on the old code and
passes on the fix. Also names the changelog fragment after PR #19916, as
changelog.d/README.md asks.
Guards the opt-in contract of targetModels/excludedModels: with both lists unset
or empty, every model is still routed by task type and counted in the stats,
and a persisted config written before #20294 (no scoping keys) hydrates without
adding a scope.
Co-authored-by: Rafa Martins <rafacpti23@users.noreply.github.com>
The fragment was named cursor-grok-47-standard-speed-20077.md; changelog.d
fragments are keyed by the PR number first, so it becomes
20248-cursor-grok-47-standard-speed.md with its content unchanged.
Co-authored-by: Rafa Martins <rafacpti23@users.noreply.github.com>
The fallback loop can also pass the account that just failed through the
excludeConnectionIds array option, not only the positional argument. Add a
test for that entry point (adapted from #20249, which used the option name
excludedConnectionIds that getProviderCredentials does not read), and add the
changelog fragment for #20083 based on the wording from #20249.
Co-authored-by: Rafa Martins <rafacpti23@users.noreply.github.com>
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 fragment was named dashboard-fmt-compact-boundary-20068.md; changelog.d
fragments are keyed by the PR number first, so it becomes
20113-dashboard-fmt-compact-boundary.md with its content unchanged.
Co-authored-by: Rafa Martins <rafacpti23@users.noreply.github.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>
Exclusion is decided before any quota check, so an excluded account whose
quota for the model is exhausted could still turn its short lockout into the
reported model cooldown, and the caller would retry too early. Count an
excluded account only when its quota still allows the model, with a
regression test where both accounts are exhausted.
check:test-tla-order rejected the top-level await placed between test() calls:
under --test-force-exit the later tests can silently never run (#18045). Move
the combos.ts import up with the other top-level imports.
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.
Keeps resolveCallLogArtifactWorker under the cyclomatic complexity cap
(15) flagged by the complexity-ratchets new-code gate; lookup order and
fallbacks are unchanged.
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.
update() awaited findById() between reading the row and running the
UPDATE, so two overlapping updates of the same rule could both read the
same base row and the second write dropped the first caller's fields.
Read the row synchronously so the read, merge, reference check and write
cannot interleave.
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.
A count of 64 candidates let short decoy hex runs placed first use up the
budget, so a base64-encoded instruction after them was never decoded.
Budget decoded bytes instead, sized above what the 16 KB scan text can
produce over both layers, so no candidate is skipped. Covered by a
failing-then-passing decoy test plus a cost test for a text packed with
readable encoded runs.
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.
targetModels/excludedModels now cover the exact id plus its ":" variants
and "/" children, so scoping openai/gpt-4o no longer captures
openai/gpt-4o-mini (#20294).
The bounded `.{0,N}?` repeats still backtracked when a long whitespace run
followed SELECT, import or if (SELECT plus 140k spaces took ~2 s; if plus
140k spaces did not finish), and they stopped scoring valid spans longer
than the cap.
Count the import/SELECT/${} indicators with a linear scan that keeps the
old greedy one-per-line semantics, and make the if ... then condition start
at a non-space so no two whitespace quantifiers overlap. Each span indicator
is now asserted on its own, including spans past the old caps.
- Reject `compaction_trigger` on Chat Completions targets again: Codex remote
compaction v2 needs exactly one `compaction` output item, which a Chat upstream
cannot return, so skipping the marker answered with an unusable normal turn
(and a trigger-only input produced `messages: []`).
- Restore readable compaction items with role-aware text parts (`output_text`
for assistant), so the Codex normalizer no longer forwards assistant history
as `input_text`.
- Accept only non-blank string content or a non-empty part array, falling back
to `text`; other shapes are no longer forwarded as Chat content.
- Split restoreReadableCompactionItem into helpers (complexity ratchet).
Refs #19730
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 new vertex default rows copied Pro rates onto gemini-3-flash-preview
($2/$12 instead of $0.50/$3), used a flat $2/$12 for gemini-2.5-pro
(Google bills $1.25/$10 up to 200K prompt tokens and $2.50/$15 above),
and set the 2.5 Flash Lite cached-input rate to $0.025 instead of $0.01.
Add the long_context tier for 2.5 Pro and a test that pins the rows.
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.
Conflict in src/sse/services/auth.ts (imports only): keep isExpiryFirstDeadlineOrder
from this branch and isWorkspacePolicyBudget429 from #19314.
expiry-first-combo-ordering case 8 (#17829) pinned the old reading of a lapsed
reset as maximally urgent. With this PR a lapsed weekly reset counts as a refilled
window rolled forward one period, so the expected score is 1/167 instead of 3.2.
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.
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 multi-key and solitary-thought branches pushed consumePlanningLeak
over the cognitive-complexity limit (complexity-ratchets new-code 0 -> 1).
Extract classifyUnclosedObject, isSolitaryThought and
classifySolitaryThought; behavior is unchanged (the repeated top-level
comma check in the unclosed branch was already covered by the early
return).
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
#19384 already landed the same accountId forwarding in the validate
request body, the Zod schema and the route. Merging the base made both
copies coexist (duplicate accountId keys in an object literal and in the
schema), so drop this branch's duplicates and keep the base code; the
regression tests pass against it unchanged.
Co-authored-by: diegosouzapw <8016841+diegosouzapw@users.noreply.github.com>
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.
During fallback, the account that just failed is excluded from the retry and
tagged "excluded", so the #18664 branch (which only checked "modelLocked")
skipped its short retryable lockout. When every other account was
quota-exhausted, the request was reported as "All <provider> accounts have
exhausted their quota" with a reset minutes or days away, and clients backed
off for that long although the healthy account recovered within seconds.
Also consider "excluded" connections in that branch. Excluded connections
without an active retryable lockout are still ignored.
Fixes#20083
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.
v2 scrape reads waitFor as a millisecond delay, so the selector string cannot
go there. The v2 actions list has a wait step that blocks until a CSS selector
is visible, which is what the field meant. A self-hosted base URL still speaks
v1 and keeps the selector in waitFor.
Signed-off-by: Minxi Hou <houminxi@gmail.com>
Firecrawl shuts its v1 API down on 2026-12-10 and answers it with HTTP 410
after that. Search, map and credit usage already call v2. The page fetch and
the dashboard key probe were the two calls still posting to /v1/scrape.
The cloud host now posts to /v2/scrape. v2 scrape rejects maxDepth outright and
treats waitFor as a millisecond delay, so the depth and CSS selector fields
stay on our own request but are no longer forwarded to the cloud. A
self-hosted base URL still speaks v1, so it keeps /v1/scrape and both fields.
Fixes#19636
Signed-off-by: Minxi Hou <houminxi@gmail.com>
Tavily added max_age_hours in October 2026 so a search can cap how old the
cached copy of each result is: 1 to 720 hours, 0 to always fetch live, -1 to
never fetch live. The provider_options bag drops any key that is not on the
allow-list, so callers had no way to send it.
The field now passes through with that exact value set, and anything outside
it (721, a fraction, a string) is dropped instead of forwarded.
Signed-off-by: Minxi Hou <houminxi@gmail.com>
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.
The follow-up leg of a non-streaming server-owned tool loop re-translates the next
source body without antigravitySessionKey, so it fell back to the account-wide
sessionId and could evict a parallel conversation's cache. chatCore now resolves
the key once at function scope and passes it to runNonStreamingResponse, whose
follow-up translation forwards it. Adds docstrings for the session helpers.
Review: CodeRabbit on #19876.
knip flags ReasoningEffortMode, ReasoningRuleScope and ReasoningTargetKind as
new dead exports in the touched facade. No importer uses them through
src/lib/db/reasoningRoutingRules; they remain exported from the domain
repository contract.
The OpenAI->Antigravity envelope derived request.sessionId from the account
email alone (#13305), so every conversation running in parallel on one
account shared a single Cloud Code session. Parallel coding-agent tasks then
evicted each other's prompt cache: on a live 8-task opencode run against
gemini-4-carbon-medium, tokens_cache_read collapsed from ~280k to 10,443/None
and 250k-380k uncached prefills took 250-589s (two 600s pre-header 504s),
while the same conversation alone on an account finished 255k-271k cached
turns in 11-14s.
chatCore now passes the resolved conversationId (falling back to the
session-affinity key) into translateRequest as antigravitySessionKey, and the
envelope hashes account + conversation. One conversation keeps one stable
session across turns (cache reuse is preserved), parallel conversations get
distinct sessions, and requests with no conversation key keep the old
account-derived id.
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.
An OpenAI-format tool loop sent to Claude ends with the results of the last
assistant turn's tool calls. They sit after that turn's cache breakpoint, so
they are billed as fresh input, and the next call sends them again.
prepareClaudeRequest rebuilds every message marker, so the policy must live
there. Add markFinalToolResults: when the final user turn holds a tool_result
and fewer than 4 markers exist, mark its last block with the tail marker (same
5m class as the other tail markers). The next call then reads those tokens
from cache at 0.1x. A request with no follow-up pays a one-time 0.25x write
premium on those tokens. Client-managed (passthrough) markers are not changed,
and the 4-marker limit still holds: enforceCacheControlBlockLimit and the new
helper share one marker walk.
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)
resolveProviderId calls getProviderByAlias, which looped over every
provider section and compared alias and id on each entry. A miss, for
example an openai-compatible-* id, scanned the whole catalog of about
380 providers and then returned the input. Circuit-breaker names,
target gates, quota lookups and failure records call it on every
routing step.
Build one Map from alias and id to provider on first use. A key is
claimed by the first provider in section order whose alias or id
equals it, the same rule as the old scan, so an alias that equals
another provider's id (poe) keeps resolving as before. Only the
internal lookup changes: ALIAS_TO_ID and getProviderById are untouched.
(cherry picked from commit a95c42fda203fabf12cf226431340d1c2c6f57f1)
The custom PII pattern gate relied on safe-regex alone. safe-regex is a
static star-height check and accepts overlapping alternations such as
(a|aa)+$, which take exponential time on a run of one character. Such a
pattern passed save, preview and runtime compile, then froze the event
loop on the first matching text.
After the static check, run the pattern on seven 64-character runs
(letter, non-ASCII letter, digit, space, dash, underscore, dot) under a
100 ms vm deadline. A pattern that is cut off is refused as unsafe.
The same gate covers save, preview and the runtime skip of stored rows.
(cherry picked from commit e45b0378848f3428ce7d9ae62b63641cc4e50370)
A HALF_OPEN circuit breaker closed on the first probe success, whatever
`halfOpenRequests` was. One lucky probe could restore a flapping
provider, and the setting had no effect above 1.
The breaker now counts probe successes in the HALF_OPEN episode and
closes when `halfOpenRequests` of them have passed. A probe failure
still reopens the breaker. The count resets on every state change and
when a stale probe lease is renewed. The default (1) behaves as before.
(cherry picked from commit f2d231c43c41ed330d733231fe4ffb812d16d91d)
detectInjection matched the surface text only. "Ignore all previous
instructions" wrapped in base64, hex or percent-encoding passed the guard
with no detection, even in block mode. The only rule that mentioned encoding
(encoding_evasion) needs the words "base64 decode" next to "instruction".
detectInjection now also decodes encoded runs in the scanned text, to two
layers, and runs the injection patterns on what they decode to. A hit keeps
the rule's severity and is reported as "decoded:<rule>", so the block
threshold, logging and the guard treat it like the plain form.
Bounds: the input is still the 16 KB scan window. A run needs 24 base64
characters or 12 hex bytes, at most 64 decode attempts run per request, and
a run that decodes to binary (a hash, a token, random data) is dropped. The
run patterns are single character classes, so they are linear. Worst case on
a 16 KB window is about 0.6 ms in the benchmark, and no benign sample (hashes,
random base64, kebab-case paths, form data) produced a hit.
(cherry picked from commit 838f618f8ba16be77af64147a1128eb9075f51fd)
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)
- list expiry-first-deadline-order and -session-spreading tests in
stryker tap.testFiles (they cover quotaScoring.ts and sse/services/auth.ts)
- extract windowUsableCap() from resolveUsableAndReset so the lapsed-window
cap stays under the cognitive-complexity limit (same behaviour)
- move pickExpiryFirstConnection's JSDoc back above its function
A combo edit routed to Leonardo uploaded only the first reference and dropped
the rest, while the single-model route answers 400. The combo branch now
returns the same 400, so the combo moves on to its next provider.
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.
After a strategy picks an account, getProviderCredentials moves the request to
a peer OAuth account with fewer foreign sessions in flight. Under
`expiryFirstOrder: "deadline"` that undid the decision: on a two-account
Claude pool every parallel Claude Code conversation after the first was moved
to the account whose week resets two days later, so it kept being spent.
Deadline order now keeps its pick; the default rate order still spreads.
A session whose reset already passed was only skipped when a longer window
existed. For a session-only account the past reset stayed negative and its
stale fraction still capped `usable`, so deadline order ranked it as already
expiring. A lapsed session is now refilled with its next reset one 5h period
later, like weekly and monthly windows. Adds two regression tests.
A longer quota window whose reset already passed comes from a stale quota
read. expiry-first scored it as "expires now" (deadline floored to
minHours), so a stale account looked like the most urgent one and took the
traffic: on 2026-11-06/07 a Claude Team account whose last read still carried
the previous Friday's weekly reset drained ahead of a Max account resetting two
days later. A lapsed weekly/monthly window is now treated as refilled, with its
next reset one nominal period later; a lapsed window of unknown length keeps no
deadline.
Adds `expiryFirstOrder: "deadline"` (provider override or global): accounts
that still hold quota are spent strictly by the nearest deadline, a spent 5h
session or exhausted window is skipped until it refills, and deadlines within
`expiryFirstDeadlineTieMinutes` (default 60) rotate least-recently-used. The
default stays the per-hour rate. Provider strategy overrides now reach the
expiry-first config, and the settings schema accepts both keys per provider.
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.
/v1/images/edits passed only the prompt to the Leonardo handler, so every
edit came back 1024x1024 whatever size the client asked for, while
/v1/images/generations already maps size to width/height. Pass size on the
single-model and combo edit paths; the route test now asserts 576x1024.
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)
The release now downloads Leonardo results through the guarded media fetch
(DNS resolve + pinned agent), so the edit tests stub the lookup and the pinned
fetch the same way the other Leonardo tests do, and wait for call-log saves
before closing the DB.
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
/v1/images/edits rejected every Leonardo model, although Leonardo does
image-to-image on its generations call. Upload the edit reference through
Leonardo's init-image flow (presigned S3 form post, no Leonardo token sent
to S3) and generate with init_image_id and init_strength 0.3, on both the
single-model and the combo edit paths. Edits are call-logged under
/v1/images/edits.
The video handler posted an image-generation body (modelId "phoenix",
num_frames) to /generations, which Leonardo rejects with 400 "Unexpected
variable num_frames", so leonardo video never worked. Submit to
/generations-text-to-video with a model enum and resolution, read
motionVideoGenerationJob, poll the generations status URL, and download
motionMP4URL (url is a jpg thumbnail). The catalog lists Motion 2.0 and
Motion 2.0 Fast; the old phoenix id maps to Motion 2.0.
Leonardo's v1 generations API takes a platform-model UUID as modelId. The
handler sent the catalog id (phoenix, sdxl), which Leonardo answers with
HTTP 500 "internal error", so every leonardo/* image request failed.
Map phoenix and sdxl to the Phoenix 1.0 and SDXL 1.0 UUIDs; a raw UUID
passes through so any Leonardo model can be used.
| `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 |
- **feat(images):** `/v1/images/edits` supports Leonardo: the reference image is uploaded through Leonardo's init-image flow and the generation is guided by it (`init_image_id`, `init_strength` 0.3), instead of the edit being rejected as unsupported. Leonardo takes one reference image; more than one returns 400, and a combo moves on to its next provider rather than editing with the first image only ([#18674](https://github.com/cheaper-inference/OmniRoute/pull/18674), closes [#18671](https://github.com/cheaper-inference/OmniRoute/issues/18671))
- **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(providers):** `expiry-first` treats a lapsed weekly/monthly reset (stale quota read) as refilled instead of "expires now", and gains an opt-in `expiryFirstOrder: "deadline"` (per provider) that spends the account whose quota is lost first while it has quota ([#19583](https://github.com/diegosouzapw/OmniRoute/pull/19583)) — thanks @feci
- **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
- feat(routing): allow scoping task-aware routing to specific target or excluded models/combos via `targetModels` and `excludedModels` in TaskRoutingConfig (#20294)
- 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))
- **feat(plugins):** Opt-in `PLUGIN_PERMISSION_MODEL_ENABLED` feature flag (off by default) runs each plugin process under the Node.js permission model built from its manifest: reads confined to the plugin directory, writes only to its data directory with `file-write`, child processes only with `exec`; `network` stays declarative
- **feat(ci):** omni-queue can speak as the owner and sign its merge commits, both off by default. With `voice: "owner"` in `config/merge-queue/config.json`, the queue's comments and label removals on pull requests, the dashboard issue and its comments, base-red comments and the tree-divergence issue go out with `OMNI_QUEUE_LAND_TOKEN`; statuses, refs, the state branch, re-runs and reads stay the App's, and a missing or refused token falls back to the App with one `error` event. With `landing.signing: "ssh"` (owner actor only), every merge commit the queue composes is signed with the owner's key from the `OMNI_QUEUE_SIGNING_KEY` environment secret, and a missing key composes unsigned with one `error` event per batch ([#20792](https://github.com/cheaper-inference/OmniRoute/pull/20792))
- **feat(combo):** new `decision` router strategy for Auto combos: a decider picks the model for each request and `rules` picks the account. The decider can be TypeSafe System One, your own decision URL (System One or OpenAI chat format), or one of the combo's own models called in process. Only the last user message (up to 8000 characters) and the model menu are sent; the key comes from a stored connection inside the API key's allowed connections or from `OMNIROUTE_DECISION_API_KEY`, never from the combo. Calls go through the outbound guard with no redirects, a 64 KB answer cap and a 2 s default timeout (5 s max), and any failure routes with `rules`. Off by default behind `COMBO_DECISION_ROUTER_ENABLED`; combos without a decision block do not change. The combo builder gets the settings and a Test decision button, and the TypeSafe client now uses the same guarded transport — thanks @BelphegorPrime, @alvinveroy, @rafacpti23 and @miguelenes
- Add an opt-in `X-OmniRoute-Selected-Connection-Plan` response header for Codex account-routing troubleshooting (`OMNIROUTE_CODEX_PLAN_RESPONSE_HEADER=1`), off by default with an explicit plan allowlist.
- **feat(models):** add GPT-6.1 Terra to OpenAI API and Codex model catalogs, including Responses-only tool routing, supported reasoning tiers, verified token pricing, long-context rates, and Codex aliases.
- **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))
- **fix(translator):** parallel tool calls from OpenAI-compatible providers that omit the tool-call index no longer merge into one call with empty arguments on Gemini-format and Antigravity streams. ([#19403](https://github.com/cheaper-inference/OmniRoute/pull/19403))
- **fix(mcp):** one skill with a duplicate MCP tool name no longer stops the later skills from getting tools. The duplicate is skipped and logged. ([#19542](https://github.com/cheaper-inference/OmniRoute/pull/19542))
- **fix(sse):** A field that a provider rejected with a 400 stays removed when the same URL is re-run after a 429, also for Claude-compatible relays with active thinking. The Claude step re-added `context_management` after the learned strip, so the relay rejected the same field again and the client got the 400. The learned strip now runs once more after that step. Follow-up to [#19033](https://github.com/cheaper-inference/OmniRoute/pull/19033). ([#19628](https://github.com/cheaper-inference/OmniRoute/pull/19628))
- **perf(sse):** large chat requests to plain (non-fingerprinted, unsigned) providers no longer re-parse the outbound body after serialization, which saves a body-sized copy and about 2.5 ms of blocking time per attempt on a 3 MB agent body ([#19628](https://github.com/cheaper-inference/OmniRoute/pull/19628))
- **perf(db):** chat requests no longer re-run the compression-combo table bootstrap and default seed on every call, so a request no longer stalls for up to 2 s with "database is locked" while another process holds the SQLite write lock ([#19630](https://github.com/cheaper-inference/OmniRoute/pull/19630))
- **fix(db):** Deleting a compatible provider node now also deletes its custom model list, so no orphaned model rows are left behind. ([#19630](https://github.com/cheaper-inference/OmniRoute/pull/19630))
- **fix(skills):** the server tool replay table no longer grows without limit; rows older than 30 days and rows beyond the newest 10,000 (never the last day, never a live claim) are removed. ([#19630](https://github.com/cheaper-inference/OmniRoute/pull/19630))
- **fix(cli):** an XDG or %APPDATA% install keeps using its own database when an empty `~/.omniroute` folder appears, instead of silently switching to a new empty database on the next start. ([#19634](https://github.com/cheaper-inference/OmniRoute/pull/19634))
- Move the Firecrawl cloud scrape call and the dashboard key probe from `/v1/scrape` to `/v2/scrape` before the 2026-12-10 v1 shutdown (#19636): a CSS `wait_for_selector` becomes a v2 `wait` action, a plain integer becomes the `waitFor` delay in milliseconds (capped at 60000), and `maxDepth` is no longer sent to the cloud endpoint. Self-hosted base URLs stay on `/v1/scrape` with the previous body.
- **fix(admission):** with per-tenant virtual lanes on, a freed slot now rotates across tenants instead of always serving the first lane, and a newer request no longer jumps an older request queued in its own lane. ([#19684](https://github.com/cheaper-inference/OmniRoute/pull/19684))
- **fix(resilience):** a DashScope key with no balance (400 `Arrearage`) or without the model service (403 `AccessDenied.Unpurchased`) now parks as credits exhausted instead of being retried every few seconds; a ban phrase quoted inside a 408, 429 or 5xx body no longer gives the account a one-year permanent cooldown ([#19684](https://github.com/cheaper-inference/OmniRoute/pull/19684))
- **fix(db):** automatic and manual backup pruning now skips a migration restore point that a running upgrade still holds, once the upgrade takes its lease; a lease left by a dead process is ignored. ([#19690](https://github.com/cheaper-inference/OmniRoute/pull/19690))
- **fix(db):** a migration that was left out of the ledger now repairs every missing column and index it adds, no longer adds cache tokens to usage history a second time, and no longer gets recorded as applied when a column it adds is still missing. ([#19690](https://github.com/cheaper-inference/OmniRoute/pull/19690))
- **fix(db):** restoring a database backup made under a different `STORAGE_ENCRYPTION_KEY` is refused with a message that names both key fingerprints, instead of loading credentials that cannot be read. Pass `allowKeyMismatch` for a key rotation. ([#19690](https://github.com/cheaper-inference/OmniRoute/pull/19690))
- **fix(db):** Retention cleanup no longer deletes spend that an active daily, weekly or monthly API-key budget window still counts, so a 31-day month cannot reopen its used allowance. ([#19701](https://github.com/cheaper-inference/OmniRoute/pull/19701))
- **fix(db):** Scheduled cleanup now prunes ended exclusive-connection lease rows and past provider quota-reset events, so these two history tables stop growing forever. ([#19701](https://github.com/cheaper-inference/OmniRoute/pull/19701))
- **fix(db):** the scheduled call-log retention pass now also deletes the request/response body files of the rows it removes, so an idle gateway no longer keeps expired bodies on disk. ([#19701](https://github.com/cheaper-inference/OmniRoute/pull/19701))
- **fix(security):** the prompt-injection guard now decodes base64, hex and percent-encoded text in a request and scans the result, so an instruction hidden in an encoded string is scored like the same instruction in plain text. ([#19724](https://github.com/cheaper-inference/OmniRoute/pull/19724))
- **fix(resilience):** a circuit breaker with `halfOpenRequests` above 1 now needs that many probe successes in a row before it closes, so one lucky probe no longer restores a flapping provider. ([#19724](https://github.com/cheaper-inference/OmniRoute/pull/19724))
- **fix(pii):** a custom PII regex that backtracks for exponential time on a long run of one character, such as an overlapping alternation, is now refused when you save or test it, instead of freezing the gateway. ([#19724](https://github.com/cheaper-inference/OmniRoute/pull/19724))
- **fix(a2a):** cancelling an A2A task now aborts the task's signal and a task that finishes after a cancel is refused with a clear "cancelled" error, instead of failing with "Invalid transition: cancelled → completed". ([#19727](https://github.com/cheaper-inference/OmniRoute/pull/19727))
- **fix(cli-tools):** the CLI tools overview no longer shows Claude, Droid, OpenClaw, Cline and Kilo as configured when their config only mentions OmniRoute in unrelated text, or points at another host or port. The badge now follows the same fields the tool's own settings page reads. ([#19727](https://github.com/cheaper-inference/OmniRoute/pull/19727))
- **fix(guardrails):** opt-in credential redaction no longer rewrites signed thinking blocks, encrypted reasoning or long base64 blobs because random bytes look like a short-prefix key, so replayed signatures stay valid. Full-format keys inside them are still redacted. ([#19727](https://github.com/cheaper-inference/OmniRoute/pull/19727))
- **fix(quota):** the Redis quota store now charges a usage counter and sets its expiry in one atomic call, so a crash between the two steps can no longer leave a counter that never expires. ([#19727](https://github.com/cheaper-inference/OmniRoute/pull/19727))
- **fix(codex):** The Codex ChatGPT Web and app-server adapters now cap the buffered event backlog by retained text size and merge adjacent small text deltas, so a fast producer behind a slow client can no longer grow memory without bound. ([#19733](https://github.com/cheaper-inference/OmniRoute/pull/19733))
- **fix(gemini):** a non-streaming Gemini or Antigravity reply whose `[Tool call: ...]` text arrives in several stream parts now returns one tool call, and a tool-only stream cut before its finish reason is now marked as cut so a combo can try the next target. ([#19733](https://github.com/cheaper-inference/OmniRoute/pull/19733))
- **fix(translator):** Gemini requests now map content roles `function` and `tool` to user messages, and infer a missing role from the parts, so single-turn Gemini requests without a role no longer reach the upstream as assistant messages. ([#19733](https://github.com/cheaper-inference/OmniRoute/pull/19733))
- **fix(usage):** A non-streaming reply with no usage object now writes its estimated token counts to usage history and the call log, as a stream already does, so per-key USD limits count that spend. ([#19745](https://github.com/cheaper-inference/OmniRoute/pull/19745))
- **fix(cache):** The semantic cache no longer stores a reply that ended in a content filter block (`content_filter`, or Claude `refusal`), so a false-positive block can clear on retry instead of being served from cache for the whole TTL. ([#19749](https://github.com/cheaper-inference/OmniRoute/pull/19749))
- **fix(usage):** rerank spend now counts toward a key's daily, weekly and 5-hour USD limits. Speech and transcription already count through their usage history rows and are counted once. ([#19754](https://github.com/cheaper-inference/OmniRoute/pull/19754))
- **fix(cache):** Claude Code requests to OpenRouter `anthropic/*` models keep their prompt-cache breakpoints (4 at most), so those turns write and read the prompt cache instead of paying full input price. Other OpenRouter families are unchanged. ([#19755](https://github.com/cheaper-inference/OmniRoute/pull/19755))
- **fix(sse):** Claude Code CCH signing now uses the seed and the body view of the real client (verified on Claude Code 2.1.252 and 2.1.322), so the `cch=` token in the billing header equals the token the real client sends for the same body. ([#19761](https://github.com/cheaper-inference/OmniRoute/pull/19761))
- **fix(providers):** Gemini 4 Carbon is registered like Argon — `gemini-4-carbon-{low,medium,high}` on Antigravity/AGY and `gemini-4-carbon` on the Gemini API key are priced at the published $2/$10 introductory rate, the bare id aliases to `-medium`, and the tiers get the declared 65535 output cap instead of the 16384 fallback ([#19797](https://github.com/cheaper-inference/OmniRoute/pull/19797), closes [#19796](https://github.com/cheaper-inference/OmniRoute/issues/19796)) — thanks @xiaoyaner0201
- **fix(translator):** translate Responses `compaction` input items carrying readable content or text into standard Chat messages (assistant summaries keep `output_text` parts) instead of rejecting them. Previously, compaction items without `ocx1:` bridge encryption were rejected with `400 unsupported_feature`, causing combo fallbacks to fail for Responses-native clients. Remote compaction (`compaction_trigger`) still fails explicitly on Chat Completions targets, since they cannot return the required `compaction` output item ([#19730](https://github.com/cheaper-inference/OmniRoute/issues/19730)).
- **fix(db-backups):** a chunked import upload is refused at the configured size while it streams, instead of being buffered in full and rejected afterwards ([#19831](https://github.com/cheaper-inference/OmniRoute/pull/19831)) — thanks @AndreAlmeidaDC
- **fix(security):** strip `'unsafe-eval'` from the Content-Security-Policy `script-src` directive in production builds while retaining it strictly in development mode for React Fast Refresh and HMR ([#19836](https://github.com/cheaper-inference/OmniRoute/issues/19836)).
- **fix(antigravity):** parallel conversations on one account no longer share a single Cloud Code session and evict each other's prompt cache — the upstream `sessionId` is now derived from account + conversation ([#19876](https://github.com/cheaper-inference/OmniRoute/pull/19876)) — thanks @adevwithpurpose
- **auto-combo**: Count the `import … from`, `SELECT … FROM` and `${…}` code indicators in `detectCodeComplexity` with a linear scan, and stop the `if … then` pattern in `detectReasoningDepth` from backtracking across long whitespace runs, eliminating quadratic backtracking on long lines without dropping long valid spans (#19881)
- **fix(dashboard):** move the custom banned-keyword editor back to the Resilience settings tab (next to Auto Disable) instead of Security, and harden its save/load path: keywords appear only after the server accepts the PATCH, a failed settings load surfaces an error instead of a misleading empty list, the 200-character limit is enforced in the UI, and removals match by keyword value rather than index. The editor now also stays available when `/api/resilience` fails to load ([#20078](https://github.com/cheaper-inference/OmniRoute/pull/20078)) — thanks @sdfsdfw2
- **fix(sse):** Consider fallback-excluded accounts with short retryable model lockouts when checking remaining accounts for quota exhaustion, returning the short lockout cooldown instead of a multi-hour quota reset; an excluded account that is in an account cooldown or whose own quota for the model is exhausted is still ignored ([#20084](https://github.com/cheaper-inference/OmniRoute/pull/20084), [#20083](https://github.com/cheaper-inference/OmniRoute/issues/20083)) — thanks @bojackduy and @rafacpti23
- **fix(sse):** the usage guard computes the request body size and the input-token estimate once per request instead of on every streamed chunk that carries usage, so an upstream that repeats `usage` (for example with 0 input tokens) on each chunk no longer re-serializes and re-tokenizes a large request per chunk and starves the event loop, and a Responses passthrough stream no longer rebuilds the accounting receipt for every delta ([#20086](https://github.com/cheaper-inference/OmniRoute/issues/20086), [#20480](https://github.com/cheaper-inference/OmniRoute/issues/20480)) — thanks @mmatus3 and @javargasm
- Roll over compact count formatting (`fmtCompact`) to `M` and `B` at rounding boundaries (e.g. 999,950 to `1.0M` and 999,999,999 to `1.0B`) to prevent displaying `1000.0K` or `1000.0M` in analytics and dashboard counts (#20068).
- **fix(translator):** streamed chat completions from Claude models now return `"{}"` as the arguments of a tool call that takes no parameters, matching the non-streamed response. Before, the arguments were an empty string, which is not valid JSON. ([#20152](https://github.com/cheaper-inference/OmniRoute/issues/20152))
- **fix(codex):** Keep subscription tier badges and paid-model routing eligibility in sync with the latest successful Codex usage response, including upgrades from Free to Plus and subsequent downgrades ([#20178](https://github.com/cheaper-inference/OmniRoute/pull/20178)) — thanks @Bl0ck154
- Guard `POST /api/providers/[id]/sync-models` with `requireManagementAuth()` when not called with an internal model-sync token so validated management subjects (local CLI token, scoped `oma_` access tokens, manage-scoped API keys, internal service token) are accepted consistently and inference-only keys get 403 ([#20187](https://github.com/cheaper-inference/OmniRoute/issues/20187)) — thanks @wsk0715
- **fix(sse):** in a combo, the Codex effort-suffix guard no longer removes the client's `output_config.effort` from the request body that the next combo target reads. ([#20194](https://github.com/cheaper-inference/OmniRoute/pull/20194))
- **fix(sse):** let a deduplicated request run its own upstream call when the first caller disconnects. ([#20194](https://github.com/cheaper-inference/OmniRoute/pull/20194))
- **fix(sse):** requests to DeepSeek models (`deepseek-*`, on any provider) keep only the first definition of a repeated tool name, because DeepSeek answers a repeated name with HTTP 400 "Tool names must be unique". Other models are not changed. ([#20194](https://github.com/cheaper-inference/OmniRoute/pull/20194))
- **fix(sse):** a failed memory-settings read is logged at debug level; the request still runs with memory off, as before, but the cause is now visible. ([#20194](https://github.com/cheaper-inference/OmniRoute/pull/20194))
- **fix(memory):** memory injection no longer puts the per-query memory text at the head of an OpenAI, Codex or Azure prompt (it broke automatic prefix caching on every turn), and one corrupt skill row no longer makes every non-streaming request of an API key fail. ([#20194](https://github.com/cheaper-inference/OmniRoute/pull/20194))
- **fix(sse):** stop probe key-health writes on non-streaming calls and cap ModelScope retry waits. ([#20194](https://github.com/cheaper-inference/OmniRoute/pull/20194))
- **fix(skills):** registering the same skill again (same API key, name and version) now updates the existing row and keeps its id and run history, instead of adding a duplicate. A migration removes old duplicates once (keeps the newest) and adds a unique index. ([#20194](https://github.com/cheaper-inference/OmniRoute/pull/20194))
- **fix(sse):** A Claude passthrough request whose tool is named with a leading `proxy_` (for example `proxy_search`) gets the same tool name back in the reply; the executor strips that prefix upstream and the reply used to show the stripped name. ([#20199](https://github.com/cheaper-inference/OmniRoute/pull/20199))
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.