diff --git a/packages/agent-runtime/src/bridge-launch-process-key.test.ts b/packages/agent-runtime/src/bridge-launch-process-key.test.ts index 7234299334..93619e5040 100644 --- a/packages/agent-runtime/src/bridge-launch-process-key.test.ts +++ b/packages/agent-runtime/src/bridge-launch-process-key.test.ts @@ -37,4 +37,26 @@ describe("bridgeLaunchProcessKey", () => { }), ); }); + + it("changes with each capability declaration at the same artifact hash", () => { + const renamed: AgentRuntimeBridgeLaunch = { + ...base, + capabilities: { + ...base.capabilities, + supportsThreadRename: true, + }, + }; + const rewound: AgentRuntimeBridgeLaunch = { + ...renamed, + capabilities: { ...renamed.capabilities, fork: "tip" }, + }; + + expect( + new Set( + [base, renamed, rewound].map((launch) => + bridgeLaunchProcessKey(launch), + ), + ), + ).toHaveLength(3); + }); }); diff --git a/packages/agent-runtime/src/runtime.process-lifecycle.test.ts b/packages/agent-runtime/src/runtime.process-lifecycle.test.ts index 80a46a993f..d725db5d6b 100644 --- a/packages/agent-runtime/src/runtime.process-lifecycle.test.ts +++ b/packages/agent-runtime/src/runtime.process-lifecycle.test.ts @@ -914,6 +914,9 @@ describe("createAgentRuntime process lifecycle", () => { // runtime.recovery.test.ts. it("gives a changed declaration its own bridge process at the same artifact hash", async () => { + // bridge-launch-process-key.test.ts deterministically covers successive + // declaration changes. This lifecycle boundary starts the minimum two + // real processes needed to prove reuse and distinction end to end. const record = createScriptedEchoRequestRecord(); const bridgeLaunch: AgentRuntimeBridgeLaunch = createScriptedEchoLaunch({ pluginId: "provider-declared", @@ -964,20 +967,6 @@ describe("createAgentRuntime process lifecycle", () => { }); // A changed declaration at the same artifact hash is a new process. expect(initializeCount()).toBe(2); - - const rewound: AgentRuntimeBridgeLaunch = { - ...updatedDeclaration, - capabilities: { ...updatedDeclaration.capabilities, fork: "tip" }, - }; - await runtime.startThread({ - bridgeLaunch: rewound, - environmentId: "env-1", - threadId: "t4", - projectId: "p1", - providerId: "declared", - options: fullRuntimeOptions, - }); - expect(initializeCount()).toBe(3); } finally { await runtime.shutdown(); }