Repository navigation
fix: keep updater CLI in sync - #211
Conversation
📝 WalkthroughWalkthroughThe update script now discovers the active ChangesClawRouter runtime update flow
Estimated code review effort: 4 (Complex) | ~45 minutes Sequence Diagram(s)sequenceDiagram
participant update.sh
participant npm_registry
participant ClawRouter
participant CLI_shim
participant viem_accounts
update.sh->>npm_registry: fetch latest ClawRouter version
update.sh->>ClawRouter: discover or install package
ClawRouter-->>update.sh: return active package directory
update.sh->>CLI_shim: synchronize clawrouter executable
update.sh->>viem_accounts: resolve wallet accounts from active package
viem_accounts-->>update.sh: derive wallet address
Possibly related PRs
Suggested reviewers: 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
Actionable comments posted: 3
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@scripts/update.sh`:
- Line 104: Update the generated CLI invocation sites in scripts/update.sh to
pass ACTIVE_PACKAGE_DIR as runtime data rather than interpolating it into
JavaScript source. Use an environment variable or process.argv with shell-safe
quoting for the Node commands and generated shim, preserving support for package
paths containing both single and double quotes.
- Around line 68-75: Update the candidate-selection logic around versionOrder so
location priority is ranked before package version, with version and mtime used
only when candidates share the same location priority; ensure the active
priority-0 OpenClaw extension is selected over unrelated npm/projects
installations. After force_install_from_npm, verify that INSTALLED_VER equals
LATEST_VER and enforce the requested version when it does not.
- Around line 22-25: Update the PATH setup in scripts/update.sh to prepend
"$NPM_PREFIX/bin" whenever NPM_PREFIX is set, without requiring the bin
directory to already exist. Keep exporting PATH so the directory created later
by sync_cli_shim is available to subsequent commands.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Path: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
Run ID: ad05d1de-d06a-4228-80c4-0b7007a63ef1
📒 Files selected for processing (1)
scripts/update.sh
| if [ -n "$NPM_PREFIX" ] && [ -d "$NPM_PREFIX/bin" ]; then | ||
| PATH="$NPM_PREFIX/bin:$PATH" | ||
| export PATH | ||
| fi |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Add npm’s bin directory to PATH even when it does not exist yet.
This guard skips the path entry, but sync_cli_shim later creates that directory. Consequently, the newly created clawrouter shim remains unavailable to subsequent commands in this process.
-if [ -n "$NPM_PREFIX" ] && [ -d "$NPM_PREFIX/bin" ]; then
+if [ -n "$NPM_PREFIX" ]; then📝 Committable suggestion
‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.
| if [ -n "$NPM_PREFIX" ] && [ -d "$NPM_PREFIX/bin" ]; then | |
| PATH="$NPM_PREFIX/bin:$PATH" | |
| export PATH | |
| fi | |
| if [ -n "$NPM_PREFIX" ]; then | |
| PATH="$NPM_PREFIX/bin:$PATH" | |
| export PATH | |
| fi |
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/update.sh` around lines 22 - 25, Update the PATH setup in
scripts/update.sh to prepend "$NPM_PREFIX/bin" whenever NPM_PREFIX is set,
without requiring the bin directory to already exist. Keep exporting PATH so the
directory created later by sync_cli_shim is available to subsequent commands.
| const versionOrder = best ? compareVersions(pkg.version, best.pkg.version) : 1; | ||
| if ( | ||
| !best || | ||
| versionOrder > 0 || | ||
| (versionOrder === 0 && | ||
| (candidate.priority < best.priority || | ||
| (candidate.priority === best.priority && stat.mtimeMs > best.mtimeMs))) | ||
| ) { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Select the active location before comparing versions, then enforce the requested version.
A newer package under npm/projects currently overrides the priority-0 OpenClaw extension. The updater can therefore skip updating the actual active package and point the CLI, wallet, and model assets at an unrelated installation.
Rank by location priority first, use version/mtime only within that location, and verify INSTALLED_VER = LATEST_VER after force_install_from_npm.
Also applies to: 663-681
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/update.sh` around lines 68 - 75, Update the candidate-selection logic
around versionOrder so location priority is ranked before package version, with
version and mtime used only when candidates share the same location priority;
ensure the active priority-0 OpenClaw extension is selected over unrelated
npm/projects installations. After force_install_from_npm, verify that
INSTALLED_VER equals LATEST_VER and enforce the requested version when it does
not.
| rm -f "$bin_dir/clawrouter" | ||
| cat >"$bin_dir/clawrouter" <<EOF | ||
| #!/bin/sh | ||
| exec node "$package_dir/dist/cli.js" "\$@" |
There was a problem hiding this comment.
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win
Pass ACTIVE_PACKAGE_DIR as data instead of embedding it into source code.
A valid package path containing ' breaks each JavaScript snippet, while " can break the generated CLI shim. Use an environment variable or process.argv for Node and shell-safe quoting when generating the shim.
Also applies to: 199-199, 666-666, 675-675, 831-831, 1132-1132
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@scripts/update.sh` at line 104, Update the generated CLI invocation sites in
scripts/update.sh to pass ACTIVE_PACKAGE_DIR as runtime data rather than
interpolating it into JavaScript source. Use an environment variable or
process.argv with shell-safe quoting for the Node commands and generated shim,
preserving support for package paths containing both single and double quotes.
…#1) * v0.12.221 — hotfix dead CLI in v0.12.220; add Claude Fable 5 + Grok 4.5 P0: v0.12.220 shipped to npm unusable. The tsup banner injected __cjs_createRequire, and a bundled dependency emits an import under the same name into the same ESM scope, so every entrypoint threw a load-time SyntaxError -- `clawrouter` would not start and the library would not import. Renamed the banner identifier to __blockrun_createRequire (spotted by @0xCheetah1 in #206). CI published it because the pipeline runs build && typecheck && test and none of those ever load dist/. Added scripts/smoke-dist.mjs as a postbuild step that imports dist/index.js and runs dist/cli.js --version; verified it exits 1 on the broken bundle and 0 on the fix, so this cannot reach npm again. Models, synced from blockrun (source of truth): - anthropic/claude-fable-5 relisted (Anthropic restored the offer 2026-07-06). fable aliases resolve to the real model again instead of opus-4.8, and it is restored as the premium COMPLEX primary -- reverting the forced 2026-06-13 downgrade. The auto profile is untouched. - xai/grok-4.5 added (upstream 2026-07-13). Explicit pins only; generic `grok` stays on 4.3 pending benchmarks, since 4.5 costs ~1.7x more and doubles the whole request above 200K prompt tokens. Verified end-to-end through the built proxy with real x402 payments on Base. /v1/models advertises 205 entries (was 201) with all 118 aliases intact. * v0.12.222 — fix the real cause: stop bundling a stale copy of ourselves v0.12.221 renamed the banner identifier, which un-bricked the CLI but treated the symptom. The actual defect survived: we were inlining an entire stale published ClawRouter into our own bundle. We and @blockrun/llm depend on each other, and noExternal: [/.*/] inlines it. v0.12.220's Polymarket port added src/polymarket/fund.ts -- our first-ever import of @blockrun/llm -- so its `import { route, ... } from "@blockrun/clawrouter"` resolved through node_modules to the LAST PUBLISHED build of this package, and esbuild inlined that whole stale bundle beside the one it was building. Two ClawRouters, different versions, separate module state. The old copy carried its own __cjs_createRequire, and esbuild cannot rename around a banner it never sees (banners are raw text injected after bundling) -- hence v0.12.220's collision. It also broke @blockrun/mcp, which reaches us transitively through @blockrun/llm. Aliasing the back-import to our own source dedupes it into the graph: dist/cli.js 10.2MB -> 7.6MB, one ClawRouter again. Left alone, every release would have inlined the previous one -- ~20MB next publish. scripts/smoke-dist.mjs now also asserts the stale copy is absent rather than merely harmless, since a loadable bundle hides it. Verified both directions: build exits 1 with the alias removed, 0 with it in place. * v0.12.223 — fix uninstallable plugin (P0); repair OpenClaw's third model plane P0, self-inflicted: v0.12.222 could not be installed as an OpenClaw plugin at all. `openclaw plugins install @blockrun/clawrouter` failed with "installation blocked: dangerous code patterns detected: Shell command execution detected (child_process) (scripts/smoke-dist.mjs:65)". The dist smoke check added in v0.12.221 is a build-time gate, but `scripts` is in package.json `files`, so it shipped -- and OpenClaw scans a plugin's loose script files and blocks the whole install over a child_process import. Excluded via "!scripts/smoke-dist.mjs". dist/ is exempt from that scan (the proxy legitimately spawns processes). The smoke check now asserts on the real `npm pack --dry-run --json` file list that no shipped scripts/*.mjs imports child_process. Verified it fails the build when the exclusion is removed. Picker staleness: OpenClaw keeps a THIRD model-list plane at ~/.openclaw/agents/<agent>/agent/models.json, separate from openclaw.json's picker and allowlist planes. Nothing synced it. Measured on a real machine, after setup had already repaired openclaw.json to 47, this cache still held 155 entries -- 127 retired (gpt-5.2, gpt-4.1, o1), duplicate free/kimi-k2.5 rows, and none of the current flagships. syncAgentModelCache() repairs it from setup and gateway start: only touches an existing blockrun provider, never creates one, preserves other providers and baseUrl/api/apiKey, compares order positionally, and is gated outside gateway mode like the config write. Also: setup's "~38 BlockRun models" hint was hardcoded and wrong since v0.12.184 -- now derived from the list. Known issue (OpenClaw-side, documented not worked around): `plugins install` ends in "Config write rejected (size-drop:76642->25200)" -- OpenClaw guards against large config shrinks and pruning 155 stale models to 47 is one, so it rolls the install back. `clawrouter setup` writes directly and is unaffected. E2E: packed, installed as a plugin (scanner clean, 26 tools + commands registered, extension 0.12.223), all three planes repaired to 47/0 stale/0 dupes, and fable-5 + grok-4.5 served live with 5 x402 payments settled on Base. * perf(build): stop publishing sourcemaps (50.0MB -> 16.6MB) (#208) dist/index.js.map and dist/cli.js.map were ~17MB each — 34MB of a 50MB install, 68% of the tarball — downloaded by everyone who runs npx @blockrun/clawrouter or installs anything depending on us. sourcemap: true stays in tsup.config.ts; maps are still generated for local debugging and CI, they just no longer ship. The bundles keep their sourceMappingURL comment; a missing map is silently ignored at runtime. Verified the packed tarball runs normally and under node --enable-source-maps. Found while auditing why @blockrun/mcp paid ~50MB (~15% of its install tree) for a router it never called. Co-authored-by: 1bcMax <viewitter@gmail.com> * fix: preserve OpenClaw plugin allowlist on update (#207) * fix: preserve OpenClaw plugin allowlist on update * fix: remove capitalized ClawRouter allow entry * v0.12.225 — kill the circular dep at its source; grok -> 4.5 We depended on @blockrun/llm ^2.11.0, which resolves to 2.13.0 -- and 2.13.0 lists @blockrun/clawrouter as a dependency. That back-dependency is the root of the entire v0.12.220 collapse: it is what let noExternal inline a stale published copy of ourselves, bloat dist to 10.2MB, and collide the tsup banner into a load-time SyntaxError that bricked the CLI. @blockrun/llm removed it in 3.x -- 3.6.1's dependencies are just bs58 and viem. We were pinned to the illness while the cure had already shipped. Bumped to ^3.6.1: `npm ls @blockrun/clawrouter` now reports (empty) and node_modules/@blockrun/ contains only llm. Verified BlockrunClient and createPaymentPayload -- our only imports, in src/polymarket/fund.ts -- are unchanged across the 2->3 major (typecheck clean, 674 tests pass). The tsup alias and the smoke check's stale-copy assertion stay: they are now belt-and-braces that re-arm automatically if anything reintroduces the cycle. grok -> xai/grok-4.5 (was 4.3). A deliberate cost increase: $2.50/$9.00 vs $1.50/$4.00, and 2x on the whole request above 200K prompt tokens. It buys a direct-xAI SKU -- 4.3 is OpenRouter-only and silently drops Live Search while still charging for it. Pin grok-4.3 to opt out. Now covered by a test so the tradeoff cannot be flipped silently. E2E: grok -> grok-4.5, grok-4.3 -> grok-4.3, fable -> claude-fable-5, auto routed, 4 x402 payments settled on Base. * docs(changelog): correct the v0.12.225 llm claim @blockrun/llm 3.x did not remove the @blockrun/clawrouter dependency -- it moved it to peerDependencies. `npm view <pkg> dependencies` only prints the dependencies field, which is what misled the original entry. The practical effect for our build is the same (npm will not install a package into itself, so no stale copy lands in our node_modules), but 'removed' was wrong and consumers of @blockrun/llm still resolve the peer. Also drop the implied install-size win: the tree is still ~247MB. llm's optionalDependencies (@solana/spl-token, @solana/web3.js, @anthropic-ai/sdk) are installed by default and spl-token's codecs rc chain pulls typescript. * v0.12.226 — salvage the two useful pieces of #206 (thanks @0xCheetah1) setup's OpenClaw detection was `command -v openclaw` and nothing else. npm runs lifecycle scripts with a stripped PATH, so a working global install is invisible there and setup exits telling the user to install what they already have. Verified: under `env -i PATH=/usr/bin:/bin`, `command -v openclaw` finds nothing while the binary is right there; the new fallback chain (npm_config_prefix, npm root -g, ~/.npm-global/bin, ~/.local/bin, /usr/local/bin) finds it. Added bare Gemini Pro shorthands: gemini-pro / gemini-3-pro / gemini-3.1-pro -> google/gemini-3.1-pro. `gemini-3-pro` was never a real id (the 3-series Pro shipped as -preview, then 3.1) but callers reach for it and got a 400. These are bare alias keys, so they advertise as their own /v1/models rows while the canonical google/gemini-3.1-pro catalog entry stays unshadowed -- a slash-prefixed key would have shadowed it and misadvertised the pricing. Pinned by a test. /v1/models 205 -> 208, no aliases lost. Both cherry-picked from #206, which is now closed: its cache-sync landed in v0.12.223, its allowlist fix as #207, its banner rename in v0.12.221, and its root cause was fixed properly in v0.12.225. * v0.12.227 — align picker + docs with the advertised catalog; fix dead image aliases - top-models.json 47 -> 44: drop 7 ids no longer advertised (grok-4-0709, grok-4-1-fast-reasoning, grok-3, free/gpt-oss-120b, free/gpt-oss-20b, free/qwen3.5-122b-a10b, free/llama-4-maverick); add the 4 new free models (mistral-nemotron, step-3.7-flash, nemotron-nano-9b-v2, nemotron-nano-12b-v2-vl). Router internals untouched — removed ids stay hidden-but-routable at the gateway. - Image aliases: dalle/dall-e-3 -> openai/gpt-image-2 (dall-e-3 delisted upstream 2026-05-25, gateway 400s it); flux removed (no gateway entry); new gpt-image-2 + seedream aliases; IMAGE_PRICING adds seedream-5-pro, drops the two dead entries; /cr-imagegen help + parity aliases updated. - README/skills: free tier now the live 8 NVIDIA models, default free model free/mistral-large-3-675b; grok-4.5 pricing row; kimi-k2.6 -> k2.7; 7-vs-8 free contradiction fixed; imagegen skill dalle/flux rows replaced. - Mirrors the hermes-plugin-clawrouter 0.3.10 alignment (2026-07-17 catalog). * v0.12.228 — follow blockrun's 07-17 free re-probe; mirror the $0.002/tx fee - free/deepseek-v4-flash recovered -> back in picker/eco chain/auto-pick/docs; free/qwen3-next-80b-a3b-instruct died -> off the picker, pins stay routable - FREE_MODELS cascade drops the three server-redirected dead models so /exclude can't be silently defeated - aliases re-aimed at blockrun's current redirect map (dead targets -> gpt-oss-120b, deepseek family -> v4-flash, mistral-small redirect removed after recovery) - estimateAmount mirrors the flat $0.002/tx settlement fee on paid requests; README pricing headline/note updated * style: prettier pass on README + skill docs (unblocks CI format check) * v0.12.229 — sync Kimi K3 (blockrun 07-17 flagship); generic kimi stays on K2.7 * fix: keep updater CLI in sync (#211) * v0.12.230 — fix #213: tool-aware recovery of Kimi K3 nameless tool-call blobs * feat(models): add Qwen3.7 Max * v0.12.231 — sync Qwen3.7 Max (blockrun 07-20); bare `qwen` stays unbound Rebases and completes #215 by @KillerQueen-Z. - qwen/qwen3.7-max registered: 1M ctx, 65K out, $1.475/$4.425 COGS, reasoning + agentic. Matches blockrun's entry field-for-field. - Picker/allowlist entry rebased onto current main — the PR branch forked at v0.12.216 and its top-models.json conflicted, where the obvious resolutions either resurrect four retired models (kimi-k2.7, grok-3, grok-4-0709, gpt-oss-120b) and duplicate four live ones, or silently drop the new model. - Dropped the bare `qwen` alias. Every other qwen* shorthand resolves to a FREE model, so binding the shortest name to the flagship would silently bill callers expecting the free tier. Same precedent as generic kimi (K2.7) and grok (4.3). Regression test pins it. - Added the qwen3-7-max dash form for convention parity with sonnet-4-6. - Test hardened: toEqual over toMatchObject (a subset match cannot fail on a stray deprecated/fallbackModel), plus TOP_MODELS + VISIBLE_OPENCLAW picker assertions the original lacked. - README mid-range row + SKILL.md catalog line + CHANGELOG. Routing tiers untouched — no benchmarks to justify promoting a $4.425/M-out model into the cheap coding fallbacks. * v0.12.232 — fix: max_completion_tokens was never read, letting requests walk through cost caps OpenAI deprecated `max_tokens` in favour of `max_completion_tokens`, but the string `max_completion_tokens` appeared nowhere in src/. Every request from a client on the modern field was sized at the 4096 default regardless of what it actually asked for. That number gates real money: routing, estimateAmount (balance pre-check), the strict-mode maxCostPerRun cap, chargedOutputTokens in logUsage, and pre-auth reuse. A request for 65536 output tokens was priced at 1/16th of its cost and passed a cap the user had set — src/proxy.max-tokens-cap.test.ts reproduces it (HTTP 200 before, 429 after). payment-preauth.ts had the same gap but sized such a request at 0, so a payment authorization cached for a tiny request could be reused to pay for a large one. Both now share resolveMaxTokens() in the new src/max-tokens.ts — separate module because proxy.ts already imports payment-preauth.ts and defining it in either would create a cycle. It reads either field, rejects values that cannot be a budget (NaN/Infinity/negative/non-numeric — each of which would have silently disabled the cap comparison), and takes the larger when a client sends both: over-estimating tightens the pre-check, under-estimating defeats it. Affects all 55+ models; exposure scaled with output price, so kimi-k3 ($15/M out) was the worst case. Verified: 696 unit tests, e2e 24 passed (mock + live gateway), resilience quick suite 5/5, dist smoke check. * v0.12.233 — sync Claude Opus 5; bare `opus` promoted (cost-neutral) Anthropic shipped Claude Opus 5 and blockrun added it on launch day (blockrun#283). ClawRouter had no entry for it at all. - Registry: anthropic/claude-opus-5 — $5/$25, 1M ctx, 128K out, reasoning/vision/agentic/tools. Verified against both source-of-truth planes (live gateway /v1/models + blockrun src/lib/models.ts). - Aliases: bare `opus`, `anthropic/opus`, `blockrun/opus` → opus-5, plus explicit pins opus-5 / opus-5.0 / opus-5-0. The generic-alias move is cost-neutral (identical $5/$25 and 1M/128K envelope as 4.8, so no per-call-cap wallet changes behavior) and matches blockrun repointing its `clawrouter-premium` redirect to opus-5. Every 4.x pin — including the generation-generic opus-4 — stays routable. - Router: inserted at the head of the in-family Opus fallback chain in premium COMPLEX/REASONING and agentic COMPLEX/REASONING. No primary moved; auto/eco/free untouched. selector.ts baseline unchanged (pricing-identical). - Picker: top-models.json rank 2. doctor opus now runs on Opus 5. - Docs: README pin example + premium pricing table, SKILL catalog line, reinstall.sh alias hint. Also corrected README and routing-profiles.md, which both still named claude-opus-4.8 as the premium COMPLEX primary — it has been claude-fable-5 since v0.12.221. toolCalling: true is live-verified — a gateway probe returned a structured tool_calls array (get_weather + valid JSON args, finish_reason "tool_calls"), no textual leak. Bare `opus` verified end-to-end serving anthropic/claude-opus-5. * docs/test: address Kimi K3 review of the Opus 5 sync Review-only follow-up to v0.12.233 — no runtime behavior change, so no version bump (CI will skip the npm publish). - models.test.ts: the alias loop missed the prefixed spellings. Now also covers anthropic/claude-opus-5.0, anthropic/claude-opus-5-0, blockrun/opus and openai/opus. - selector.ts: document why BASELINE_MODEL_ID stays on claude-opus-4.7. It is a price anchor, not "the current flagship" — 4.7/4.8/5 all bill $5/$25, so moving it changes no reported number while breaking comparability with historical journal entries. - models.ts: reword the bare-`opus` rationale, which parsed badly, and note the unit-price caveat — adaptive thinking can raise realized spend per call without changing the cap math. Two review findings were checked and rejected: - "opus-4.6 is a guaranteed-fail hop in all four fallback chains." It is not. A live gateway probe returned a normal completion served as claude-opus-4-6. `hidden: true` upstream means unlisted, not dead — blockrun's own comment is "still routable for clients pinned to 4.6". Keeping it in the chains is correct. - "'adaptive thinking' is an unverified claim for opus-5." It is accurate; thinking is on by default on Opus 5. * v0.12.234 — add GPT-5.5 Pro and ChatGPT Instant (chat-latest) Closes two catalog gaps found by diffing the live gateway against BLOCKRUN_MODELS during the Opus 5 sync. Both were already live upstream and billable but absent from the registry, so they carried no local pricing and never appeared in the picker. - openai/gpt-5.5-pro — $30/$180, 1.05M ctx, 128K out, reasoning+vision. Pin `gpt-5.5-pro`; added to the picker beside gpt-5.4-pro. Deliberately NOT flagged agentic (same as gpt-5.4-pro) — max-compute latency makes it a poor multi-step autonomous pick. Upstream's long-context tier (2x in / 1.5x out above 272K) is unmodelable here; as with grok that skews logUsage only, never the charge. - openai/chat-latest — $5/$30, 128K ctx, chat+vision. Pins `chat-latest` and `chatgpt`. The id is version-less on purpose: upstream exposes ChatGPT's default only as the rolling alias, so pinning it means "whatever the default is today", not a snapshot. Kept OUT of the picker (a rolling alias is pin-on-purpose, not a curated default — same treatment as sonnet-4.5 / opus-4.6), and registered with neither reasoning nor agentic: claiming reasoning would mis-route it into the REASONING tier and raise its per-model timeout 60s -> 180s. toolCalling: true live-verified on both — gateway probes returned structured tool_calls arrays (get_weather + valid JSON args, finish_reason "tool_calls"), no textual leak. `chatgpt` also verified end-to-end serving openai/chat-latest. Routing tiers untouched: neither is benchmarked, and a $30/$180 model does not belong in a chain reached by an automatic tier decision. * v0.12.235 — fix capability-flag drift vs blockrun's catalog Started as "add the missing vision flag on gpt-5.4-pro"; auditing all 88 shared entries against blockrun's categories turned up 16 mismatches. 9 corrected, 7 deliberate and now test-pinned. Fixed — vision missing on the max-compute Pro tiers: openai/gpt-5.2-pro, openai/gpt-5.4-pro. vision gates filterByVision(), so image requests were dropping both from the candidate pool for no reason. Fixed — reasoning missing on 7 thinking-capable models: gemini-3-flash-preview, nemotron-nano-9b-v2, nemotron-nano-12b-v2-vl, glm-5, glm-5.1, glm-5.2, glm-5-turbo. The flag enrolls the id in REASONING_MODEL_IDS, raising the per-model timeout 60s -> 180s; these models think before first token, so 60s was cutting them off on cold start. None is a tier primary, so the longer stall stays on fallback paths that only run after a primary already failed. Kept — vision on claude-haiku-4.5 and claude-sonnet-4.6: blockrun's catalog omits vision on both. That is an upstream data bug, not a ClawRouter over-claim — a live gateway probe sent an image to claude-haiku-4.5 and it read it correctly. Removing the flag to "match" the source of truth would break image routing to the premium REASONING primary and both agentic primaries. The source-of-truth rule covers pricing/ids/aliases; it is not a mandate to copy an upstream error into a working-feature regression. Left alone on purpose: gpt-5.3-codex, gemini-3.1-flash-lite and free/gpt-oss-120b are all tier primaries, so adding reasoning would triple the failover stall on default routing paths — a latency decision, not a data fix. xai/grok-4.20-* are hidden upstream. Also: the deployed /api/v1/models response lags blockrun's repo on categories — audit against the repo, not the live endpoint. * docs: bind the marketing numbers to the published artifact, fix four that were wrong (#220) The savings claim alone existed as three different numbers inside this repo — 92% in the README blurb, the same 92% derived from a hand-computed "$2.05/M blended average", and 85% in package.json — none of them reproducible, all against an unstated baseline. Model counts said 55+; the catalog serves 66. Numbers now regenerate from blockrun.ai/brand/numbers.json via markers: reduces AI API costs by up to <!-- br:savings.autoVsBaselinePct -->87<!-- ... -->% and the savings section states the method instead of an "up to": 87% on auto, 98% on eco, against pinning Claude Opus 5 for 100% of traffic, priced on the live catalog from a published workload mix. The dimension count was wrong in the other direction, and only writing the test found it. Every comment in the scorer says 14 — but rules.ts builds a 14-entry list and then pushes the agentic dimension, so 15 are actually scored. The README was right and the code comments were stale. Comments corrected; the artifact now publishes 15. src/router/brand-numbers.test.ts pins the four facts BlockRun publishes about this repo but cannot count from its own catalog. They are asserted over there, so without a test here a scorer change would quietly make 37 READMEs wrong. It also covers the two surfaces markers cannot reach: package.json's description, which npm renders and which is not markdown, and the hero badge, where the count lives inside an HTML attribute. Two CI gaps closed while wiring this up: - npm test was never run. The Build & Test job only ran the lifecycle integration test, so all 713 unit tests could fail without failing CI. - brand numbers are now checked offline against the committed snapshot. scripts/sync-brand-numbers.mjs is vendored byte-for-byte and added to .prettierignore — formatting it here would fork it from the source repo. Co-authored-by: 1bcMax <viewitter@gmail.com> * chore: resync sync-brand-numbers.mjs with the source copy (#222) The script is vendored byte-for-byte from BlockRunAI/blockrun:brand/, and this copy had fallen 24 lines behind it. Three fixes landed upstream after the initial distribution and never reached here: - skip nested repos. Walking into a submodule rewrites its markers from the WRONG repo's snapshot and reports drift that belongs to its CI. - do not follow symlinked directories. blockrun's docs/ -> awesome-blockrun/docs is the live case; a link pointing at an ancestor would also recurse forever. - scan .txt, for llms.txt — the file agents read to learn what BlockRun serves, which could not be bound at all before. None of this was detectable: nothing compared the copies. blockrun CI gains a job that does, in the same shape as its existing clawrouter-install-sync guard. Co-authored-by: 1bcMax <viewitter@gmail.com> * fix(readme): the tier table disagreed with the router it documents (#223) Three of twelve cells named a model the router does not route to: ECO SIMPLE said free/mistral-large-3-675b — config: free/gpt-oss-120b ECO REASONING said deepseek-reasoner — config: xai/grok-4-1-fast-reasoning AUTO REASONING same Nothing caught it because a README is prose to everything except a reader. src/router/brand-numbers.test.ts now reads the table and compares every cell to DEFAULT_ROUTING_CONFIG, so the doc fails the build rather than the reader. Separately, three places told users to pin `free/mistral-large-3-675b` as one of the eight free models. It is not one of the eight — it is hidden from /v1/models over NVIDIA's prompt-retention terms, so a reader following that instruction is pinning a model they cannot find in the catalog. Swapped for free/mistral-nemotron, which is genuinely in the published set, and dropped Mistral Large 3 from the "incl." list for the same reason. The corrected table now names two withheld primaries, so they carry a footnote saying so. That is the honest shape: the router does call them, and a reader should not go looking for them on the pricing page. It is also why the published savings figure is priced on visible models only. Co-authored-by: 1bcMax <viewitter@gmail.com> * fix: the skill shipped to agents was the stalest surface of all (#224) skills/clawrouter/SKILL.md is loaded into an agent's context to tell it what this router does. Nobody had swept it, and it showed: save 67% a sixth savings figure 55+ models twice — the catalog serves 66 a routing table describing a configuration that no longer exists That table quoted Gemini Flash, DeepSeek Chat, Claude Opus and o3 as the four tier primaries. config.ts routes to gemini-2.5-flash, kimi-k2.7, gemini-3.1-pro and grok-4-1-fast-reasoning. It also priced Opus at $75/M, which is wrong by any reading — Opus 5 is $5/$25. Rewritten from config.ts and the live catalog. The per-tier "% of traffic" and "% savings" numbers are dropped rather than restated: they were measured against a baseline nobody wrote down, and the published figure is blended across a stated workload mix. Removing an unverifiable claim beats replacing it with a different unverifiable claim. Frontmatter takes literals, not markers — it is a YAML string an agent reads, so a comment would be part of it. Asserted in brand-numbers.test.ts alongside package.json, which has the same constraint. README's ecosystem card said 50+ models; bound. Left alone: "LLM Router Benchmark: 46 Models" is the title of a benchmark that tested 46 models. Restating it would misrepresent what was run. Co-authored-by: 1bcMax <viewitter@gmail.com> * docs: correct the evergreen posts, date-stamp the ones that are measurements (#225) The docs/ directory is two different things and had been treated as one. Evergreen pages — comparisons, feature tables, the Anthropic cost posts — carry live claims that a reader takes as current. Those were stale: 55+ and 41+ models against a catalog of 66, and three savings figures (92%, 89%, a hand-computed "$2.05/M vs $25/M") that predate the published one. Bound to the artifact. Dated engineering posts are measurements. "We Benchmarked 39 AI Models" ran 39 models on March 16; rewriting that to 66 would misrepresent what was measured, not update it. Those keep their numbers and gain a note saying so, pointing at the current figures. 9-free-ai-models-zero-cost-blockrun.md is the awkward case: the count is in the title and the URL. The free tier is 8 now, not 9. Renaming breaks every existing link, so it takes the same note, which also explains WHY the number moved — models get withheld when a provider's terms change. Deliberately left: "up to 97%" is observation-compression ratio, not cost; "3 models per request" is the fallback attempt cap; "2 chains" is L1/L2; the 30% is Anthropic's own promo credit. Same words, different subjects. Co-authored-by: 1bcMax <viewitter@gmail.com> * fix(models): mark MiniMax M3 vision-capable (#226) The target metadata lists text, image, and video input for MiniMax M3, but the model was registered without the vision flag. ClawRouter's image_url detection and filterByVision path therefore excluded M3 from the candidate pool whenever a request carried an image_url content part. Add vision: true so image requests reach the model. M2.7 stays text-only and is left unchanged. Co-authored-by: octo-patch <266937838+octo-patch@users.noreply.github.com> * chore(release): v0.12.236 — MiniMax M3 vision flag (live-probed) The v0.12.235 capability audit missed M3 because blockrun's catalog under-claims it: no vision category upstream, but a 2026-08-02 live gateway probe confirmed M3 reads images. Test comment now cites the probe instead of vendor metadata, matching the haiku-4.5 precedent. * fix: cap balance preflight output estimate (#217) OpenClaw can send a model's huge default max_tokens (e.g. 128k on Opus-class models); the low-balance preflight treated that as guaranteed spend, so paid calls fell back to a free model even with $5+ in the wallet. Preflight now caps assumed output at 4096 tokens; estimateAmount() stays exact for strict cost caps and cached-balance accounting, and the free-fallback path clears the stale paid estimate so it is no longer deducted from the cached balance. * chore(release): v0.12.237 — balance preflight cap (#217, @0xCheetah1) * chore(release): v0.12.238 — stop bundling vulnerable axios 0.27.2 The Polymarket relayer client pins axios@^0.27.2 and tsup's noExternal bundles it into dist/, so every install shipped a 2022 axios with 20+ open advisories. Root override dedupes the tree to the 1.x line (the relayer's usage is 1.x-compatible). bigint-buffer stays: no patched release exists upstream. * chore(release): v0.12.239 — follow blockrun's 07-28 free re-probe; fee back to $0.001 - free/mistral-large-3-675b EOL at NVIDIA (HTTP 410, blockrun #309): off the FREE_MODELS cascade, picker and eco chain; pins stay routable (gateway redirects to gpt-oss-120b); mistral-free re-aimed at free/mistral-nemotron - deepseek-v4-flash kept: slow (~10 tok/s) but completing, only 1M-ctx free model - estimateAmount mirrors the $0.001/tx fee revert (blockrun #319, 2026-07-29) - brand numbers resynced: 65 chat-visible models, 7 free - deps: openclaw 2026.7.1 + security overrides (brace-expansion, fast-uri, tar, hono, jayson>uuid), lockfile regenerated * docs: reshoot the banner without the stale savings number The banner PNG advertised "Save 78% on LLM costs" long after the published figure moved to 87%. scripts/sync-brand-numbers.mjs cannot reach a PNG, so any number baked into the artwork drifts silently — the new tagline carries none. Same layout and wordmark; assets/banner.html ships as the source with the regeneration command in its header comment. * chore(release): v0.12.240 — drop openclaw's shrinkwrap so overrides actually apply openclaw <=2026.7.1 publishes with hasShrinkwrap:true. A shipped npm-shrinkwrap.json pins that package's whole subtree ahead of the root project's `overrides`, silently and misleadingly: `npm ls` prints "fast-uri@3.1.2 overridden" next to a version the override forbids. Every override v0.12.239 added was therefore dead on arrival, and regenerating package-lock.json from scratch did not help. Bump the openclaw dev dependency to ^2026.7.2-beta.7, the first release without the shrinkwrap. With it gone the overrides land and the openclaw subtree audits clean: undici 8.5.0 -> 8.10.0 fast-uri 3.1.2 -> 3.1.5 hono 4.12.25 -> 4.13.0 @hono/node-server 1.19.14 -> 2.1.0 ip-address 10.2.0 -> 10.4.0 brace-expansion 5.0.7 -> 5.0.9 Clears 13 of 15 open Dependabot alerts, 3 of the 4 highs. New overrides for @hono/node-server and ip-address; floors raised on ws, postcss, tar, brace-expansion, fast-uri. All in the single existing overrides key. Side effects: - Contributor Node floor is now 22.22.3 (openclaw's preinstall gate). CI's node-version "22" already resolves above it; published users are unaffected since openclaw is dev-only and never bundled. - Bundled undici floor raised to ^8.10.0 (8.9.0 was already past the advisory range, so this is a patch-line bump, not a fix). dist/ carries the upstream TLS servername and idle-socket timeout changes. - assets/banner.html reformatted; it had been failing `prettier --check` on main since the previous commit, reddening CI. Left open, no upstream patch exists: - bigint-buffer (high). 1.1.5 is the last publish (2019) and @trufflesuite/bigint-buffer@1.1.10's src/bigint-buffer.c is byte-identical, so the fork is not a fix. Reaches the lockfile as an optional dep of @blockrun/llm via createSolanaPaymentPayload, which ClawRouter never imports; dist/ has zero references to spl-token, buffer-layout-utils, or toBigIntLE. - elliptic (low). 6.6.1 is latest and still in range; arrives via ethers v5 under @polymarket/*. * chore(brand): refresh the snapshot — the markers were rendering a stale catalog (#232) * chore(brand): refresh the snapshot — the markers were rendering a stale catalog brand-numbers.json here was a catalog generation behind, so every br: marker in this repo rendered a number that has not been true for some time. The markers did their job — they rendered the input they were given. Nothing refreshes that input: sync-brand-numbers.mjs reads the local snapshot and only re-fetches under --refresh, and --check is offline on purpose so PR CI stays deterministic. Its header defers freshness to a fan-out job that was never built, so every consumer validated markers against its own stale copy and reported green. Produced by --refresh, not by hand. * chore(brand): fix the counts markers cannot reach, and drop the dead free model The snapshot refresh moved brand-numbers.json to 71/92/6, and this repo's own brand-numbers.test.ts immediately failed — correctly. Four of the numbers it guards live in surfaces a br: marker cannot reach: a package.json description, a shields badge URL and its alt text, and a skill's YAML frontmatter, where a marker is not inert because it becomes part of the string. Those hold literals and are asserted by test instead, which is exactly what caught this. They were two generations stale, not one — 65 models and 7 free, against a real 71 and 6. The free count moved 7 -> 6 because nvidia/seed-oss-36b 410'd upstream on 2026-08-03. Changing the digit alone would have left the model named in four places as something a caller can still use, so it is removed from the SKILL.md enumeration, the README model table, the pricing prose, and the /model suggestion line. Verified against the live catalog: six free models, and seed-oss is not among them. src/router/brand-numbers.test.ts: 22 passed. --------- Co-authored-by: 1bcMax <viewitter@gmail.com> * chore(release): v0.12.241 — drop free/seed-oss-36b, dead upstream since 08-03 #232 refreshed the brand markers to blockrun's live catalog (71 chat-visible / 6 free) but touched no code, so the router kept routing to a model that has been EOL upstream for four days. blockrun's probe got HTTP 410 Gone from NVIDIA on both passes on 2026-08-03 and the production health gate fired [ALERT][free-model-dead] kind=gone the same day. Upstream hid the model and re-pointed its own dependents — qwen3-coder-480b and devstral-2-123b, both of which used seed-oss as their fallback — at gpt-oss-120b. ClawRouter was still carrying it in three request-time paths: FREE_MODELS auto-pick cascade (proxy.ts) 9 -> 8 picker (src/top-models.json) 7 -> 6, now exactly blockrun's visible free set router fallback chains (router/config.ts) 3 sites Not cosmetic. A dead model the gateway server-redirects silently defeats /exclude: the caller excludes it, the router hands the request to it anyway, and the gateway answers from the redirect target. Same failure mode as mistral-large-3-675b in v0.12.239, same fix. The free profile's SIMPLE chain drops the rung outright — gpt-oss-120b/20b already head it. The premium and agentic "NVIDIA free ultimate backstop" rungs are retargeted to free/gpt-oss-120b rather than dropped, since nothing else free sat below them. Six generic coding shorthands promised "a live free coder" and pointed at a dead one; they now follow blockrun's own retarget to free/gpt-oss-120b: qwen-coder, qwen-coder-free, coder-free, glm-free, devstral, devstral-2. Left routable because they name the model itself rather than a capability: seed-oss, seed-oss-36b, nvidia/seed-oss-36b, and the catalog entry. The gateway redirects them, as it does the other retired free ids. Verified: picker set now equals blockrun's authoritative free-visible list exactly (6), brand-numbers guard clean, 731 tests pass, typecheck/lint/prettier clean, and the built dist/ cascade confirmed free of the dead id. * feat(router): make portfolio routing the Auto default (#238) * feat(router): make portfolio routing the Auto default * style(router): apply repository formatting * chore(release): bump ClawRouter to 0.12.241 * fix(router): harden Auto routing boundaries * fix(router): fail closed on telemetry and capacity edges * test(router): assert shadow callback execution * refactor(router): depend on product-neutral core * build: refresh router core artifacts * style: format router integration import * fix(router): rebuild dist off the fixed pin, unship the URL dep, guard liveness Review follow-up on #238. Three blocking items, all mechanical; the router extraction and the portfolio policy are unchanged. 1. Committed dist/ was stale relative to the pinned router-core. dist/router/index.js carried "free/seed-oss-36b" in three fallback chains (lines 3013/3131/3221) with the pre-fix comments intact. That model went HTTP 410 EOL at NVIDIA on 2026-08-03 and v0.12.241 removed it. The pin itself was already correct: router-core 6a790eb ("fix: retire unavailable seed fallback") fixes all three sites in config.ts, and its own dist is clean. Only ClawRouter's committed artifact was built against an older snapshot. Rebuilt; the chains are now clean. This mattered because BlockRun server-redirects retired free ids, so routing to one SILENTLY DEFEATS /exclude: the caller excludes a model, the router hands it the request anyway, and the gateway answers from the redirect target. 2. @blockrun/router-core moved to devDependencies. tsup's noExternal inlines it (dist/router/index.js line 3 is "// node_modules/@blockrun/router-core/dist/index.js"), so nothing imports it at runtime. In dependencies it made every `npm install @blockrun/clawrouter` fetch a codeload.github.com tarball at install time for code already in the bundle. The integrity hash protects `npm ci` here, but the published package does not ship our lockfile: consumers resolve the bare URL from package.json with no verification. It also made installs fail whenever GitHub is unreachable or the org is renamed, which has happened before. The published tarball now declares zero non-registry dependencies again. 3. Version 0.12.241 -> 0.12.242. 0.12.241 is already on npm. publish.yml guards on `pkg != npm`, so merging at 0.12.241 would land on main and silently never publish. Also adds src/router/free-model-liveness.test.ts. Router selection coverage left this repo with the code (713 tests here vs 731 on main, selector.test.ts and strategy.test.ts deleted, none added), and item 1 is what walked through the gap. The guard walks every tier container's primary and fallback entries and asserts each free/* id is live in src/top-models.json, plus the two deliberate gpt-oss defaults. The allowed set is derived from the picker, not hard-coded, so a future free-tier resync updates it automatically. Verified to FAIL against the regression: re-injecting seed-oss into one chain produces "tiers.SIMPLE.fallback[3] -> free/seed-oss-36b" and fails two of the three assertions. A third assertion fails loudly if the config shape changes and the walk stops finding tiers, so it cannot pass vacuously. Verified: typecheck, lint, prettier, build + dist smoke all clean. 716 tests pass (713 + 3 new). Packed artifact confirmed to declare no URL dependency, and dist/ confirmed free of seed-oss routing entries; the four remaining mentions in dist/index.js are the deliberate pins and catalog entry that v0.12.241 kept routable. * docs(changelog): v0.12.242 — portfolio Auto default, router-core extraction, stale-build fix --------- Co-authored-by: 1bcMax <viewitter@gmail.com> * chore(release): v0.12.243 — bigint-buffer out of the tree, 0 high alerts left npm audit on this repo goes 4 high / 17 low -> 0 high / 17 low. bigint-buffer's native toBigIntLE() carries an unpatched buffer overflow (GHSA-3gc7-fjrx-p6mg) with no fixed release anywhere: 1.1.5 is the last publish, from 2019, and @trufflesuite/bigint-buffer@1.1.10 ships a byte-identical src/bigint-buffer.c — a prebuild fork, not a security fork. Overriding onto it would have laundered the advisory without fixing anything, which is why that was never done here. It reached us four levels down: @blockrun/llm -> @solana/spl-token -> @solana/buffer-layout-utils -> bigint-buffer ClawRouter never executes that path. We import the EVM createPaymentPayload, not createSolanaPaymentPayload, and Solana payments go through @x402/svm. It landed in every consumer's lockfile anyway because @solana/spl-token was an OPTIONAL DEPENDENCY of @blockrun/llm, and npm installs those automatically. Fixed upstream in @blockrun/llm@3.10.0 (published today): the Solana packages became optional PEER dependencies, which npm does not auto-install. Consumers who make Solana payments through that SDK install them explicitly and get an error naming the install command if they forget. Here: floor moves to ^3.10.0 and the lockfile is regenerated. Trap worth recording: bumping the dependency alone did NOT drop it. `npm install @blockrun/llm@^3.10.0` updated the SDK but kept the stale transitive entry — the optional-dep-to-optional-peer change only takes effect after a full `rm -rf node_modules package-lock.json` regeneration. Same class as the override staleness in v0.12.240. Verified: `npm ls bigint-buffer` empty, dist/ still has zero references to spl-token / buffer-layout-utils / toBigIntLE, @solana/kit re-confirmed at 5.5.1 after the regen (the v5-vs-v6 split is what broke Solana signing in March), 716 tests pass, typecheck/lint/prettier/build+smoke clean. Remaining 17 low are the elliptic chain under @polymarket/* (ethers v5). 6.6.1 is latest and still in range, so there is nothing to move to. * chore(brand): refresh the snapshot — the markers were rendering a stale catalog (#239) Opened by brand/fanout-brand-numbers.mjs. brand-numbers.json here was behind the published artifact, so every br: marker in this repo rendered a number that is no longer true. The markers did their job — they rendered the input they were given. --check is offline on purpose so PR CI stays deterministic, which means it validates against this repo's own snapshot, and only --refresh updates that snapshot. This job is what runs it. Produced by --refresh, not by hand. Co-authored-by: blockrun-brand-bot <hello@blockrun.ai> * docs(readme): move the dimension count out of the code fence so it stays synced README's architecture diagram claimed the scorer weighs 14 dimensions. It weighs 15, and the three other br:clawrouter.dimensions markers in the same file all said 15. The marker was inside a ``` fence, and sync-brand-numbers.mjs deliberately skips fenced blocks so it never rewrites code samples. That is a reasonable rule, but it made this occurrence invisible to BOTH halves of the tool: --check reported "up to date" and --refresh reported "already up to date" while the rendered number was wrong. A stale marker that no guard can see is worse than no marker, because it looks maintained. Moved the count into the prose line above the diagram, where the script manages it, and left the diagram generic. Verified by tampering: setting the value to 99 now makes --check fail with the diff and the fix command, and --refresh corrects it back to 15. Before this change, both passed silently. Not fixing the script itself: scripts/sync-brand-numbers.mjs is a copy distributed from blockrun, which has CI guarding that the copies match, so editing this one would create exactly the drift that guard exists to catch. If fenced markers should be supported, that belongs upstream. No version bump — README-only, same as the other recent docs commits. * fix(brand): carry the 87% -> 88% savings update into the two plain-text surfaces The brand fan-out PR (#239) updated every br:-marked occurrence of savings.autoVsBaselinePct but left package.json's "description" and skills/clawrouter/SKILL.md's frontmatter on 87%, because neither is marker-wrapped. src/router/brand-numbers.test.ts pins exactly those two, so main went red the moment that PR merged. Same shape as the seed-oss regression in v0.12.241: the fan-out maintains markers, and anything quoting a brand number OUTSIDE a marker is invisible to it. The guard test is what catches the gap — it did its job here. Both surfaces now read 88%. 716 tests pass, brand-numbers --check clean, prettier clean. No version bump: package.json's description ships in the npm metadata, but 0.12.243 is already published and this is a marketing string, not behaviour. It rides along with the next release. * chore(release): v0.12.244 — Seedance 2.5, and three stale rates in the family blockrun added a fourth Seedance and repriced the other three (#351/#354). ClawRouter knew about three, at pre-reprice rates. Added bytedance/seedance-2.5: 720p with synced audio, long-form (up to 30s against the 12-15s ceiling on the rest), multilingual, image-to-video. Not a replacement for 2.0 Pro — that is still the 1080p/4K one. Pinned as `seedance-2.5` / `seedance-2-5`, added to the /videogen provider list and its help text. Bare `seedance` deliberately stays on 1.5-pro. It is the cheapest of the family ($0.070/s vs 2.5's $0.315/s) and /videogen documents it as "default — cheapest"; repointing the short name at the newest tier would 4.5x the quote for everyone who typed it expecting the default. Same rule that keeps `kimi` on K2.7 and left bare `qwen` unbound. Fixed the three stale rates: seedance-1.5-pro 0.0875 -> 0.070 seedance-2.0-fast 0.22687 -> 0.165 seedance-2.0 0.28358 -> 0.227 These are base rates; estimateVideoCost applies the 5% margin at use. It is telemetry ONLY — the charge comes from the x402 payment header and this is the fallback for when paymentStore is empty. So the blast radius was a skewed usage log, never a wrong bill. Verified the call site before touching the numbers rather than assuming the separation still held. Also worth recording: 2.5 has no OpenRouter failover upstream, so a token360 outage surfaces as an error instead of quietly rendering on another model. Published alias count 202 -> 204. That number is hand-maintained in blockrun's src/lib/brand-numbers.ts, because the alias table lives here and cannot be counted from there; src/router/brand-numbers.test.ts pins the two together and is what failed when I added the pins. Updated on both sides — blockrun first, since it is the source of truth (7868a88). Verified: 716 tests, typecheck, lint, prettier, build + dist smoke all clean. * chore(release): v0.12.245 — blockrun catch-up sync: deepseek-v4-flash EOL, 10 missing models, 6 stale prices deepseek-v4-flash hit NVIDIA's published EOL this morning (410 on both of blockrun's probe passes, prod gate fired kind=gone twice — blockrun #367). Dropped from the picker (6 -> 5 free, exactly blockrun's visible set), the FREE_MODELS cascade (8 -> 7), and router-core's eco SIMPLE chain (pin bumped to 18bf4ab). Pins naming the model stay routable via the gateway redirect; generic shorthands follow blockrun's retarget to gpt-oss-120b. Same /exclude-defeating failure mode as seed-oss-36b in v0.12.241, same fix. Also mirrors everything blockrun shipped that ClawRouter never synced: - 10 models: GPT-5.6 Sol/Terra/Luna Pro, Gemini 3.6 Flash, Gemini 3.5 Flash Lite, Qwen3.7 Plus/Flash (#329); Tencent Hy3 + Xiaomi MiMo-V2.5 Pro (07-25); Nano Banana 2 (image); Seedance 2.0 Mini (video, signs the 3dp-floored $0.079/s). toolCalling LIVE-VERIFIED on all seven flagged chat models via the ~$0.003 gateway probe. - 6 stale prices: gpt-5.6-terra/luna (07-30 OpenAI cut, #326), deepseek-chat/reasoner 0.14/0.28 (#354), glm-5 1.00/3.20 (#354), gemini-3.5-flash 1.50/9.00 (#304 — was under-logging by 3x and letting maxCostPerRun-capped wallets underestimate). - Brand numbers 71 -> 70 chat / 6 -> 5 free, markers + the two plain-text surfaces; aliases 204 -> 229 (blockrun #371 carries the upstream half). 716 tests pass, typecheck/lint/prettier clean, dist smoke check green, built cascade confirmed free of the dead id. * fix(image): stop advertising dall-e-3 and flux in the OpenClaw picker The image UI sends the picked id from provider.models straight to /v1/images/generations, which forwards the body verbatim with no alias resolution. Two ids there have been dead since v0.12.227: - openai/dall-e-3 — gateway 400s (delisted upstream 2026-05-25) - black-forest/flux-1.1-pro — no gateway entry at all Both were dropped from IMAGE_PRICING and MODEL_ALIASES in that release, but buildImageGenerationProvider was missed, so picking either one is a guaranteed upstream failure. The three live models added since (gpt-image-2, nano-banana-2, seedream-5-pro) were never advertised. Same drift class the blockrun_image_generation tool description carried, which pointed agents at the same two dead ids. - picker list resynced to IMAGE_PRICING's 9 gateway-served ids - IMAGE_MODEL_IDS exported from proxy.ts as the pinning source of truth - partner tool description and model-param example refreshed - stale --model dall-e-3 hints in user-facing copy updated src/index.image-provider.test.ts pins the picker against IMAGE_PRICING so the two cannot drift apart again; it fails on the pre-fix list. * chore(deps): pin router-core at 9386c53 — eco SIMPLE no longer opens on a dead model At 18bf4ab the eco SIMPLE chain led with free/gpt-oss-120b and free/gpt-oss-20b, and the gateway now answers 400 Unknown model for both (probed 2026-08-21). 9386c53 retargets the free rungs to the current NVIDIA free tier (step-3.7-flash primary, nemotron-nano-9b-v2 fast rung), verified live by direct calls, and brings the decision-snapshot suite that pins all 88 corpus decisions upstream. Three surfaces here encoded the old chain and are updated with the pin: - free-model-liveness now judges liveness by BASENAME across the free/ and nvidia/ prefixes, because the picker and the new chains name the same models in different namespaces. The gpt-oss allowlist is gone — those ids were "hidden but served" until they weren't, and an allowlist of dead ids would wave through the exact regression this suite exists to catch. - exclude-models e2e excludes nvidia/step-3.7-flash instead of the dead id (the fixture needs a model that is actually in the eco SIMPLE chain). - The README tier table's ECO SIMPLE row names step-3.7-flash, without the withheld dagger — it is in the public catalog. Known, deliberately out of scope: the free-tier product surfaces are stale independently of this pin — src/top-models.json lists free/* ids that all 400 now, and the alias table redirects the live nvidia/* ids INTO that dead namespace. That predates this bump and needs its own catch-up-sync release. * style: prettier pass on the reworked liveness suite CI's format check caught what the local loop skipped — the liveness test was edited by script and never ran through prettier. * test: keep free/gpt-oss-120b in the exclusion fixture — it guards the FREE_MODEL append path The pin bump removed it as an eco-chain member, but the second assertion in this suite is about a different surface: the proxy's product-side payment-failure append still targets free/gpt-oss-120b, and excluding it is what proves the append respects /exclude. Ran in CI only (skipped locally), which is why the bump commit went out green here and red there. All three filter paths now each have their own exclusion: the eco-chain member, a mid-chain paid model, and the append target. * fix(image): add nano-banana-2 alias and pin the catalogs both ways Review feedback on #254. - IMAGE_MODEL_ALIASES gained banana-2 / nano-banana-2; the shorthand was otherwise passed through raw and 400'd, while the full id worked. Also listed in the /cr-imagegen help block. - The picker test now asserts set equality against IMAGE_MODEL_IDS rather than one-way inclusion, so a model added to the pricing table but not advertised fails too. The reviewer's suggestion to build the picker list from IMAGE_MODEL_IDS is left out: importing it into index.ts breaks index.lifecycle.test.ts, which fully mocks ./proxy.js. * fix(image): list grok-imagine-pro in the /cr-imagegen help block Review feedback on #254. The help block listed 8 of the 9 models the picker advertises; xai/grok-imagine-image-pro was missing even though IMAGE_MODEL_ALIASES has mapped grok-imagine-pro to it all along, so the model was reachable but undiscoverable. Price matches IMAGE_PRICING. * chore(deps): repin router-core at d7bc10c; correct the append-path claim d7bc10c adds RouterOptions.unavailableModels — the host-side kill-switch for a chain rung observed dead at the gateway, so the next free-tier retirement is an option the proxy can flip instead of a three-repo repin chain. Not wired into the proxy yet; this makes it available. Also corrects a wrong claim written into the exclude-models fixture two commits ago: it asserted the proxy's FREE_MODEL append target was dead at the gateway. The literal free/* id does 400, but the proxy maps free/* to nvidia/* upstream and nvidia/gpt-oss-120b answers 200 (hidden from the catalog, probed 2026-08-21) — the append path was healthy the whole time, and the pin-bump commit's claim that the free-tier product surfaces were stale was wrong for the same reason: every ClawRouter free surface calls through the mapper. The stale-surface problem is real only for consumers that send free/* ids literally, which ClawRouter never does. * chore: brand-sync workflow + refresh brand numbers The vendored sync script's --check is offline by design, so nothing ever re-fetched the canonical artifact — numbers rotted behind green CI. This adds the freshness half: a weekly workflow running --refresh (direct push, PR fallback on protected branches), and lands today's refresh: brand-numbers: updated 7 file(s) * fix: package.json + SKILL frontmatter say 71 models — the two surfaces markers cannot reach The snapshot refresh (previous commit) moved brand-numbers.json to the current published counts and this repo's own guard did exactly its job: package.json's description and the SKILL.md frontmatter carry plain literals (markers cannot live there) and were still quoting 70. Guarded surfaces, guarded correctly — this is the follow-through. * feat: new installs default to the Solana payment chain (v0.12.246) Brand-new wallets persist payment-chain=solana at generation, gated on successful Solana derivation (@solana/kit present). Existing installs, env-var restores, and wallet-recover flows are untouched — absent config still resolves to base, where pre-existing funds live. Also removes the /chain command from docs (never registered; use /wallet solana|base) and documents the new default. * fix(image): follow-ups to #254 — 202 polling on the chat path, live-verified size lists, drift-proofing Live-probed the gateway (2026-08-23) to verify #254's premise and found more: - /cr-imagegen chat path now polls 202 + poll_url jobs (mirrors the /v1/images/generations handler, with client-abort guard). Previously a slow model (gpt-image-2 beyond the 30s inline window) surfaced as 'Image generation returned no results' — Response.ok is true for 202. The upload-failure hint no longer recommends a specific model. - geometry.sizes resynced to the live-probed union: dropped 1216x832 / 1792x1024 / 1024x1792 (accepted by NO model — the gateway validates size per model pre-payment and 400s them), added the six missing seedream sizes (1280x720, 2048x1024, 2304x1728, 1728x2304, 2848x1600, 1600x2848). Seedream IMAGE_PRICING sizes filled in from 402 quotes. - IMAGE_MODEL_ALIASES hoisted to module scope + exported, with a hasOwnProperty guard (a prototype key like 'constructor' no longer resolves to a function that JSON.stringify drops). - New pinning tests: every alias target ∈ IMAGE_MODEL_IDS, picker sizes == IMAGE_MODEL_SIZES union, partner registry description enumerates exactly the servable ids with the right count. - Doc surfaces synced: skills/clawrouter/SKILL.md (8→9 image models), skills/imagegen/SKILL.md (banana-2 row; removed sizes that 400), README banana-2 row, docs/image-generation.md full refresh (dall-e-3/ flux rows and alias table were still live), reinstall.sh example. - IMAGE_MODEL_IDS JSDoc: it is IMAGE_PRICING declaration order, not picker order. * chore: release v0.12.247 — image picker resync (#254) + /cr-imagegen 202 polling; rebuild dist * fix(proxy): stop deleting assistant prose on tool-calling turns (v0.12.248) Any assistant turn carrying tool_calls had its content blanked to "" before reaching the client, on both the streaming and non-streaming paths. The turn kept its tool call and lost its voice: operators watching a long-running agent saw an unbroken run of bare [Called function "exec" ...] lines, and a plain question typed into the chat came back as another bare tool call with the answer deleted en route. Three sites blanked it: the SSE synthesizer (which then skipped emitting the content chunk entirely), the non-streaming native-tool_calls branch, and the non-streaming branch that synthesizes tool calls out of text. The third is the sharpest: extractTextualToolCalls already computes cleanedContent -- the prose with the raw <tool_call> markup stripped -- and is unit-tested to preserve it, but proxy.ts never read it. All three now forward the prose through stripThinkingTokens, so tagged chain-of-thought is still stripped and raw tool-call syntax still never leaks. This matches what OpenAI-compatible clients expect: content and tool_calls on the same message. CLAWROUTER_TOOL_CALL_PROSE=off restores the old suppression. The four tests asserting the blanking now assert delivery; src/proxy.tool-call-prose.test.ts covers the native, textual, streaming, thinking-token, and opt-out paths. * style: format docs/image-generation.md + clawrouter SKILL.md The prettier --check step in CI has been red since v0.12.247 (#254), which landed both files with unaligned markdown tables. Formatting only -- no content change, so the npm publish workflow does not retrigger. * fix(proxy): time-bound the balance RPC in /health?full=true (v0.12.249) The full health check awaited balanceMonitor.checkBalance() with no time bound. The surrounding catch covers a rejection but never a hang, so an unresponsive RPC held the response open indefinitely -- on the one endpoint monitoring hits and the one that must always answer. Now bounded by the same BALANCE_CHECK_TIMEOUT_MS (2.5s) as the pre-request path, degrading to the balanceError the response shape already carried. This is also why CI's lifecycle integration test had been failing: GitHub runners are slow enough to reach the RPC that the endpoint blew past the test's 5s limit. Covered by src/proxy.health-balance-timeout.test.ts. * test: keep live-gateway integration suites out of the default run There was no vitest.config.ts, so `npm test` fell back to vitest's default glob and swept in test/integration/** -- seven suites that stand up a proxy and send real requests to the live BlockRun gateway. On a GitHub runner those hang past even their own declared 30s timeouts, so the publish workflow (which gates on `npm test`) could be blocked by runner networking rather than by anything wrong with the code. v0.12.249 was blocked twice this way. vitest.integration.config.ts already existed with the right 30s/15s timeouts and was wired to nothing. Now `npm test` is hermetic (716 tests) and `npm run test:integration` runs the gateway-dependent suites (26) on demand. Same 742 total. * fix(free): retarget the free default off dead gpt-oss-120b; realign routing docs to router-core V3.4 (v0.12.250) - `free` alias, FREE_MODEL and the FREE_MODELS cascade head now agree on free/step-3.7-flash (router-core's ecoTiers.SIMPLE primary, live 200). gpt-oss-120b has hung upstream since 2026-08-16 and the gateway 400s the free/ id; gpt-oss-120b/20b dropped from the cascade, generic shorthands follow the free default, explicit gpt-oss pins stay routable. - README / docs/routing-profiles.md / docs/configuration.md / docs/architecture.md / SKILL.md rewritten against router-core V3.4: constraint-first stages, full AUTO/ECO/PREMIUM/AGENTIC chains, ranking weights, strategy/shadow levers, corrected scorer weights, repaired profiles table, kimi-k3 out of the Budget table. - Rebuilt dist. * chore(router): repin to router-core V3.5 — chains name only catalog-listed models (v0.12.251) @blockrun/router-core d7bc10c → 5d91187. No ClawRouter code changed; the routing decision did: every hidden id (kimi-k2.7, the grok-4-fast pairs, grok-4-0709, opus-4.6, free/*) leaves every chain, the GPT-5.6 / Gemini 3.6 / GLM-5.3 / Grok 4.3 / Kimi K3 / Qwen 3.7 / MiniMax M3 generation enters as fallback rungs, and the capability + performance priors are regenerated from the public catalog and a 2026-08-29 gateway probe. Primaries that moved are tabulated in CHANGELOG.md. README tier table, docs/routing-profiles.md, docs/configuration.md and docs/architecture.md now describe the V3.5 chains (brand-numbers.test.ts pins the README table to the pinned config). dist/ rebuilt with the new engine inlined. * docs: BRCC links pointed at blockrun.ai/brcc.md, which 404s — use the repo (#272) Both README mentions (and any docs copies) linked https://blockrun.ai/brcc.md; that path has never resolved (404 today). The repo link redirects to the current home of BRCC. Co-authored-by: 1bcMax <viewitter@gmail.com> * fix(proxy): keep tool-call pairs intact on truncation; abort img2img upstream on client disconnect (v0.12.252) - truncateMessages() walked a raw slice(-N) over the conversation, which could open the kept window on an orphaned role:tool result → provider 400s (Anthropic tool_use/tool_result mismatch, OpenAI missing tool response). The boundary now walks forward past leading tool results (OpenAI role:tool and Anthropic tool_result content blocks) so a straddled exchange is dropped whole and the result stays under MAX_MESSAGES. Closes #252. - /v1/images/image2image had no clientAbort controller, unlike /v1/images/generations: a client that disconnected mid-request left the upstream call running and the x402 payment settling for nothing. Wired the same controller through the source-image download and the paid call. Closes #251. Thanks to @Sertug17 for both reports. * fix(proxy): abort paid upstream on client disconnect for audio + chat-path img2img (v0.12.253) Same bug class as #251: /v1/audio/generations and the chat-side /img2img command had no clientAbort controller, so a client that disconnected mid-request still had the x402 payment settle. Both now mirror the generations/image2image wiring (controller on res close, signal on payFetch and the track download, abort swallowed in the outer catch). Every paid handler in the proxy now carries this. * fix(proxy): abort paid upstream on client disconnect for chat path (v0.12.254) The media handlers all abort their upstream on client disconnect (#251, v0.12.252-253), but the main /v1/chat/completions path never did. proxyRequest wired its abort to req.on("close"), and on Node (verified on v24.15.0) an IncomingMessage emits "close" when the request-body readable finishes, not when the client hangs up. The body is fully drained near the top of proxyRequest, so that event had already passed by the time the listener was attached far below -- onClientClose never ran and a caller that hung up mid-request left the paid x402 upstream running to completion for a response nobody would receive. Move the abort to res.on("close") (guarded by !res.writableEnded), mirroring every media handler, and migrate the four removeListener cleanup sites to match. Covered by src/proxy.chat-abort.test.ts (upstream socket observes the abort after the client destroys its request). * fix(proxy): close the pre-attach disconnect window + stop reporting client cancels as 300s timeouts (v0.12.254) Follow-ups on #279 (@erhnysr), landed in the same release: - proxyRequest now checks res.destroyed right after attaching the res "close" listener. Context compression and the balance check run between draining the body and the attach; a client that hung up in that window had already emitted "close", so the listener alone never fired and the paid upstream still ran. - A client cancel used to reach the shared abort exits and surface as "Request timed out after 300000ms" -> onError + balance cache invalidation. Introduce ClientDisconnectedError, return quietly from the catch, keep the cache. Regression test…
Summary
Fixes the ClawRouter updater so
curl -fsSL https://blockrun.ai/ClawRouter-update | bashupdates the user-facingclawrouterCLI to the same package OpenClaw installed.What changed
~/.openclaw/npm/projects/*/node_modules/@blockrun/clawrouter~/.openclaw/extensions/clawrouter~/.openclaw/npm/node_modules/@blockrun/clawrouterclawrouterCLI shim to execute the active OpenClaw-installed package.~/.openclaw/extensions/clawrouter.curl | bashpath handling by readingsrc/top-models.jsonfrom the active package instead of$SCRIPT_DIR.PATHsoopenclawis found in non-login shell updater runs.Why
The updater could report success while
clawrouter --versionstayed on an older global npm install. On testbed, OpenClaw installed0.12.229, but the CLI still resolved to global0.12.220.Verification
bash -n scripts/update.shnpm run format:checknpm run typechecknpm run lintclawrouter --versionreturns0.12.229127.0.0.1:8402top-models.jsonmigration no longer fails withENOENTSummary by CodeRabbit