Repository navigation
Releases
Releases · raphvallee/opencode-openrouter-optimizer
v0.3.0
Feature release. Models served by a single provider now skip routing, and
routing-failure toasts also reach OpenCode Desktop windows, not only the TUI.
No breaking changes; the one behavior change is that a single-provider model's
request goes out unmodified.
Fixed
- A zero-survivors refresh no longer wipes the stored blacklist reasons and
debug rankings: the fallback that keeps the previous ranking re-saved it
without a metadata payload, and the UPSERT overwrotedetails_jsonand
blacklist_reasons_jsonwith NULL, so debug logging showed "unknown" for
every blocked provider after a restart. The save now preserves the stored
payload when a refresh carries none (COALESCEin the UPSERT).
Added
- A model served by exactly one provider bypasses the routing pipeline completely:
when OpenRouter lists only one provider, no endpoint test runs (context, completion
cap, uptime, status, pricing, tool support or the Tool Call Error Rate probe), no
blacklist and nosort: "price"is injected, and the request goes out completely
unmodified. The ranking is still recorded (modebypassed) so the pass-through
behaves the same after a restart, anddebugprints one line saying so. A provider
named inextraIgnoreis never bypassed: that option keeps its existing meaning and
the usual routing rules apply. debugBlacklistReasonsoutput is now a debugging tool, not just a reason
list: each blocked provider's causes carry the threshold they enforce
(uptime (min 90%)), the provider's own value that missed it
(u-one (40%)), and providers sharing a cause group are ordered
from the closest miss to the hardest failure. When every provider is
blacklisted and only thekeepAtLeastNfloor keeps a route open, the log
shows which of your filters is the strictest and by how much. Reasons are
persisted with every ranking (threshold, value, miss magnitude), so
enabling the debug option works on stored rankings without waiting for a
re-rank; theprobe-reasonsprobe prints the same format.- Routing-failure toasts are no longer TUI-only: a new
./gui-experimentalpart
(src/gui.tsx, built asdist/gui-experimental.cjswith the
@opencode/plugin/guivite preset) runs in every OpenCode Desktop window,
desktop app and web tabs alike, and raises the same error toast the TUI part
raises. The shared detection, sanitization and dedupe logic moved to
src/failure.tsso the two parts cannot drift. - A
noGUIoption (defaultfalse) turns the GUI part off, the waynoTUI
turns the TUI part off; an invalid value is rejected at startup by the server
part, which also validates unknown option keys.
v0.2.0
[0.2.0] - 2026-11-02
Security release. A full audit was run and its findings are fixed; see
VULNERABILITY-AUDIT.md for the audit and remediation status. There are no
breaking changes, but configuration is now stricter: anything invalid changes
nothing silently, it fails startup (or is ignored) loudly.
Security
- The npm publish workflow cannot be command-injected via its manual
tag
input anymore: the value travels inenv, is validated against
^[a-z0-9][a-z0-9._-]{0,127}$before publish, and the release tag must match
package.json. Actions are pinned to commit SHAs, the toolchain is pinned,
permissions: contents: readandpersist-credentials: falseare set, and
the release job runs in a protectedreleaseenvironment with provenance. - The spawned
opencode statsCLI no longer inherits your whole environment
(includingOPENROUTER_MANAGEMENT_KEYand cloud credentials); it gets an
allowlisted runtime environment. managementKeyEnvcannot point at well-known cloud secrets
(AWS_*,OPENAI_API_KEY,GITHUB_TOKEN, ...); the value is never echoed,
and overriding the default prints a warning naming the variable.dbPathis canonicalized, symlinks are refused, and a database file whose
fetches table does not look like ours is refused unmodified; a corrupt one
is quarantined to*.corrupt-<timestamp>and recreated. Foreign files are
never migrated or modified. The database is owner-only (0600/0700where
the platform supports it) and reads are capped at 5,000 rows.- Routing from a poisoned or empty refresh is never persisted over a healthy
snapshot; the previous ranking is kept until a good refresh lands.
Disk timestamps are clamped, slugs are validated and capped on write and on
read, and survivors are validated exactly like the blacklist. - A routing failure is never silent: without a session it is logged; with a
session it appears in the transcript and as a toast; the user's
extraIgnoreis now applied even when the filters leave zero survivors
(never withsort: "price"). - Upstream payloads are size-capped (5 MB) and shape-validated before use;
request bodies are streamed with a 25 MB ceiling; provider slugs are
validated (^[a-z0-9][a-z0-9._-]{0,63}$) everywhere they are built or read. - Untrusted strings reaching logs, the TUI or transcripts are stripped of
control characters (no ANSI/OSC injection) and length-capped. - Discounts of 100%+ are rejected as broken pricing; honored discounts are
capped at 50%; NaN cannot pass any filter; missing uptime is never read as a
perfect score, and invalid health data fails closed. - Authenticated requests to the Activity API use
redirect: "error". - The stats child is capped at 10 MB of stdout / 64 KB of stderr; bodies and
stats payloads over their caps are aborted, not buffered.
Added
SECURITY.md(reporting policy) and Dependabot for npm and GitHub Actions.- 14 security-invariant tests (
test/security.test.ts), covering routing
safety, persistence gating, database hardening and input validation.
Changed
- Configuration validation is stricter: control characters are rejected
anywhere in string options, values are truncation-capped (200 chars) and
redacted in errors for*key*/*token*/*secret*names,extraIgnore
entries are validated provider slugs,rankingWaitMsis capped at 30 s,
ttlHoursat 720,statsCacheMinutesat 1440 andstatsDaysat 365.