@@ -7,12 +7,12 @@ import { afterEach, describe, expect, it, vi } from "vitest";
77import { createBundleMcpJsonSchemaValidator } from "./agent-bundle-mcp-runtime.js" ;
88import { cleanupBundleMcpHarness } from "./agent-bundle-mcp-test-harness.js" ;
99import {
10- testing ,
1110 createSessionMcpRuntime ,
1211 getOrCreateSessionMcpRuntime ,
1312 materializeBundleMcpToolsForRun ,
1413 retireSessionMcpRuntime ,
1514 retireSessionMcpRuntimeForSessionKey ,
15+ testing ,
1616} from "./agent-bundle-mcp-tools.js" ;
1717import type { SessionMcpRuntime } from "./agent-bundle-mcp-types.js" ;
1818import { writeExecutable } from "./bundle-mcp-shared.test-harness.js" ;
@@ -1672,12 +1672,12 @@ process.on("SIGINT", shutdown);`,
16721672 } ) ;
16731673 const releaseLease = runtime . acquireLease ?.( ) ;
16741674
1675- // TTL elapses while the lease is still held — sweep skips active runtimes
1675+ // TTL elapses while the lease is still held, so sweep skips active runtimes.
16761676 now += 60 ;
16771677 await expect ( manager . sweepIdleRuntimes ( ) ) . resolves . toBe ( 0 ) ;
16781678
1679- // Release the lease — must not reset lastUsedAt, so the runtime is
1680- // evictable on the very next sweep without waiting another full TTL
1679+ // Release must not reset lastUsedAt; the runtime is evictable on the very
1680+ // next sweep without waiting another full TTL.
16811681 releaseLease ?.( ) ;
16821682 await expect ( manager . sweepIdleRuntimes ( ) ) . resolves . toBe ( 1 ) ;
16831683
@@ -1722,6 +1722,9 @@ process.on("SIGINT", shutdown);`,
17221722 cfg : { mcp : { servers : { } } } ,
17231723 } ) ;
17241724 const lastUsedBefore = runtime . lastUsedAt ;
1725+ if ( ! runtime . acquireLease ) {
1726+ throw new Error ( "Expected production session MCP runtime to expose acquireLease" ) ;
1727+ }
17251728 const release = runtime . acquireLease ( ) ;
17261729 release ( ) ;
17271730 expect ( runtime . lastUsedAt ) . toBe ( lastUsedBefore ) ;
0 commit comments