Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions packages/agent-runtime/src/bridge-launch-process-key.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
});
});
17 changes: 3 additions & 14 deletions packages/agent-runtime/src/runtime.process-lifecycle.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down Expand Up @@ -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();
}
Expand Down
Loading