diff --git a/package-lock.json b/package-lock.json index c5cfbef3..57895e4f 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@blockrun/clawrouter", - "version": "0.12.11", + "version": "0.12.23", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@blockrun/clawrouter", - "version": "0.12.11", + "version": "0.12.23", "license": "MIT", "dependencies": { "@scure/bip32": "^1.6.0", diff --git a/src/index.ts b/src/index.ts index 5ee4dbac..9141b42f 100644 --- a/src/index.ts +++ b/src/index.ts @@ -287,14 +287,8 @@ function injectModelsConfig(logger: { info: (msg: string) => void }): void { needsWrite = true; } const allowlist = defaults.models as Record; - // Clean out old blockrun entries that aren't in TOP_MODELS (from previous versions) - const topSet = new Set(TOP_MODELS.map((id) => `blockrun/${id}`)); - for (const key of Object.keys(allowlist)) { - if (key.startsWith("blockrun/") && !topSet.has(key)) { - delete allowlist[key]; - needsWrite = true; - } - } + // Additive-only: add TOP_MODELS entries if missing, never delete user-defined entries. + // Preserves any blockrun/* IDs the user has manually added outside this curated list. let addedCount = 0; for (const id of TOP_MODELS) { const key = `blockrun/${id}`; diff --git a/test/integration/setup.ts b/test/integration/setup.ts index 0a2d87fa..a9741c86 100644 --- a/test/integration/setup.ts +++ b/test/integration/setup.ts @@ -2,22 +2,31 @@ * Integration test setup — programmatically starts ClawRouter proxy. * * Shared across all integration test files via beforeAll/afterAll. - * Starts the proxy on port 8402, waits for /health to return 200, - * and caches the handle so multiple test files share one instance. + * Starts the proxy on a worker-scoped port, waits for /health to return 200, + * and caches the handle so test files in the same worker share one instance. */ import { startProxy } from "../../src/proxy.js"; import { resolveOrGenerateWalletKey } from "../../src/auth.js"; import type { ProxyHandle } from "../../src/proxy.js"; -const TEST_PORT = 8402; const HEALTH_POLL_INTERVAL_MS = 200; const HEALTH_TIMEOUT_MS = 5_000; let proxyHandle: ProxyHandle | undefined; +function getTestPort(): number { + // Keep worker 1 on the historical default (8402), then offset others. + const workerRaw = process.env.VITEST_POOL_ID ?? process.env.VITEST_WORKER_ID ?? "1"; + const workerId = Number.parseInt(workerRaw, 10); + if (Number.isInteger(workerId) && workerId >= 1) { + return 8401 + workerId; + } + return 8402; +} + /** - * Start the test proxy on port 8402. + * Start the test proxy on a worker-scoped port. * Polls /health until it returns 200 (up to 5s), then returns the handle. * Reuses an existing handle if already started. */ @@ -25,10 +34,11 @@ export async function startTestProxy(): Promise { if (proxyHandle) return proxyHandle; const wallet = await resolveOrGenerateWalletKey(); + const testPort = getTestPort(); proxyHandle = await startProxy({ wallet, - port: TEST_PORT, + port: testPort, skipBalanceCheck: true, });