Skip to content

Commit 00cc1f1

Browse files
committed
fix: stop hijacking user model selection
Remove runtime config override (lines 666-676) that was setting model.primary to blockrun/auto on every plugin load, even when user had selected a different model. The persistent config (injectModelsConfig) already handles defaults correctly. Runtime override was redundant and broke model selection. Fixes #14 - users can now select models from other providers without ClawRouter hijacking their selection. Tested: - Fresh install: defaults to blockrun/auto ✓ - User selects anthropic/sonnet: persists correctly ✓ - Gateway restart: preserves user selection ✓
1 parent d146776 commit 00cc1f1

7 files changed

Lines changed: 58 additions & 25 deletions

File tree

package-lock.json

Lines changed: 46 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@blockrun/clawrouter",
3-
"version": "0.9.36",
3+
"version": "0.9.37",
44
"description": "Smart LLM router — save 78% on inference costs. 30+ models, one wallet, x402 micropayments.",
55
"type": "module",
66
"main": "dist/index.js",
@@ -33,13 +33,13 @@
3333
"lint": "eslint src/",
3434
"format": "prettier --write .",
3535
"format:check": "prettier --check .",
36-
"test:resilience:errors": "npx tsx test/resilience-errors.ts",
37-
"test:resilience:stability": "DURATION_MINUTES=5 npx tsx test/resilience-stability.ts",
38-
"test:resilience:stability:full": "DURATION_MINUTES=240 npx tsx test/resilience-stability.ts",
39-
"test:resilience:lifecycle": "npx tsx test/resilience-lifecycle.ts",
36+
"test:resilience:errors": "tsx test/resilience-errors.ts",
37+
"test:resilience:stability": "DURATION_MINUTES=5 tsx test/resilience-stability.ts",
38+
"test:resilience:stability:full": "DURATION_MINUTES=240 tsx test/resilience-stability.ts",
39+
"test:resilience:lifecycle": "tsx test/resilience-lifecycle.ts",
4040
"test:resilience:quick": "npm run test:resilience:errors && npm run test:resilience:lifecycle",
4141
"test:resilience:full": "npm run test:resilience:errors && npm run test:resilience:lifecycle && npm run test:resilience:stability:full",
42-
"test:e2e:tool-ids": "npx tsx test/e2e-tool-id-sanitization.ts",
42+
"test:e2e:tool-ids": "tsx test/e2e-tool-id-sanitization.ts",
4343
"test:docker:install": "bash test/run-docker-test.sh",
4444
"test:docker:edge-cases": "bash test/docker/run-edge-cases.sh"
4545
},
@@ -83,6 +83,7 @@
8383
"openclaw": "latest",
8484
"prettier": "^3.8.1",
8585
"tsup": "^8.0.0",
86+
"tsx": "^4.21.0",
8687
"typescript": "^5.7.0",
8788
"typescript-eslint": "^8.54.0",
8889
"vitest": "^4.0.18"

src/index.ts

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -663,18 +663,6 @@ const plugin: OpenClawPluginDefinition = {
663663
models: OPENCLAW_MODELS,
664664
};
665665

666-
// Set blockrun/auto as default ONLY if no model is set (first install)
667-
// Do NOT override user's model selection on subsequent loads
668-
if (!api.config.agents) api.config.agents = {};
669-
const agents = api.config.agents as Record<string, unknown>;
670-
if (!agents.defaults) agents.defaults = {};
671-
const defaults = agents.defaults as Record<string, unknown>;
672-
if (!defaults.model) defaults.model = {};
673-
const model = defaults.model as Record<string, unknown>;
674-
if (!model.primary) {
675-
model.primary = "blockrun/auto";
676-
}
677-
678666
api.logger.info("BlockRun provider registered (30+ models via x402)");
679667

680668
// Register /wallet command for wallet management

test/e2e-tool-id-sanitization.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
* before being forwarded to upstream APIs (especially Anthropic which
66
* requires pattern ^[a-zA-Z0-9_-]+$).
77
*
8-
* Run: npx tsx test/e2e-tool-id-sanitization.ts
8+
* Run: tsx test/e2e-tool-id-sanitization.ts
99
*/
1010

1111
import { startProxy } from "../dist/index.js";

test/resilience-errors.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
* - Memory pressure (concurrent large requests)
1010
*
1111
* Usage:
12-
* BLOCKRUN_WALLET_KEY=0x... npx tsx test/resilience-errors.ts
12+
* BLOCKRUN_WALLET_KEY=0x... tsx test/resilience-errors.ts
1313
*/
1414

1515
import { createServer, type IncomingMessage, type ServerResponse } from "node:http";

test/resilience-lifecycle.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* - Repeated restart cycles
88
*
99
* Usage:
10-
* BLOCKRUN_WALLET_KEY=0x... npx tsx test/resilience-lifecycle.ts
10+
* BLOCKRUN_WALLET_KEY=0x... tsx test/resilience-lifecycle.ts
1111
*/
1212

1313
import { createServer, type IncomingMessage, type ServerResponse } from "node:http";

test/resilience-stability.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,10 @@
77
*
88
* Usage:
99
* # Quick 5-minute test
10-
* BLOCKRUN_WALLET_KEY=0x... DURATION_MINUTES=5 npx tsx test/resilience-stability.ts
10+
* BLOCKRUN_WALLET_KEY=0x... DURATION_MINUTES=5 tsx test/resilience-stability.ts
1111
*
1212
* # Full 4-hour production test
13-
* BLOCKRUN_WALLET_KEY=0x... DURATION_MINUTES=240 npx tsx test/resilience-stability.ts
13+
* BLOCKRUN_WALLET_KEY=0x... DURATION_MINUTES=240 tsx test/resilience-stability.ts
1414
*
1515
* # Memory leak test with GC
1616
* BLOCKRUN_WALLET_KEY=0x... node --expose-gc -r tsx/cjs test/resilience-stability.ts

0 commit comments

Comments
 (0)