fix(gateway): clear fallback context on close

Fixes gateway fallback request context cleanup on close/startup failure and shards the full gateway Vitest lane to avoid the observed memory hang.\n\nValidation:\n- Testbox: OPENCLAW_TESTBOX=1 pnpm check:changed\n- Testbox: env OPENCLAW_VITEST_MAX_WORKERS=1 /usr/bin/time -v pnpm test:gateway (254 files, 2950 tests, max RSS 4144692 KB)
This commit is contained in:
Vincent Koc
2026-04-27 21:19:21 -07:00
committed by GitHub
parent 738f5f7508
commit e8b4e39a97
8 changed files with 151 additions and 17 deletions

View File

@@ -1,5 +1,13 @@
import { createProjectShardVitestConfig } from "./vitest.project-shard-config.ts";
import { createScopedVitestConfig } from "./vitest.scoped-config.ts";
const gatewayProjectConfigs = [
"test/vitest/vitest.gateway-core.config.ts",
"test/vitest/vitest.gateway-client.config.ts",
"test/vitest/vitest.gateway-methods.config.ts",
"test/vitest/vitest.gateway-server.config.ts",
] as const;
export function createGatewayVitestConfig(env?: Record<string, string | undefined>) {
return createScopedVitestConfig(["src/gateway/**/*.test.ts"], {
dir: "src/gateway",
@@ -13,4 +21,10 @@ export function createGatewayVitestConfig(env?: Record<string, string | undefine
});
}
export default createGatewayVitestConfig();
export function createGatewayProjectShardVitestConfig() {
return createProjectShardVitestConfig(gatewayProjectConfigs);
}
export default process.env.OPENCLAW_GATEWAY_PROJECT_SHARDS === "1"
? createGatewayProjectShardVitestConfig()
: createGatewayVitestConfig();