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
41 changes: 29 additions & 12 deletions packages/junior/tests/integration/local-agent-runner.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1007,15 +1007,18 @@ describe("local agent runner", () => {
const eventId = "33333333333333333333333333333333";
const capture = vi.fn().mockReturnValue(eventId);

const generateReply = vi.fn<AgentRunner["run"]>(async (request) => {
const context = request;
await context.durability?.onSandboxRefChanged?.({
id: "sandbox-undelivered",
profileHash: "profile-undelivered",
});
await deliverAssistantText(request, "not delivered");
return completedAgentRun(successReply("not delivered"));
});
const realAgentRunner = createModelAgentRunnerForRun(() =>
createModelStream([{ type: "text", text: "not delivered" }]),
);
const agentRunner: AgentRunner = {
run: async (request) => {
await request.durability?.onSandboxRefChanged?.({
id: "sandbox-undelivered",
profileHash: "profile-undelivered",
});
return await realAgentRunner.run(request);
},
};

await expect(
runLocalAgentTurn(
Expand All @@ -1027,14 +1030,28 @@ describe("local agent runner", () => {
deliverReply: async () => {
throw new Error(rawDeliveryError);
},
agentRunner: { run: generateReply },
agentRunner,
logException: capture,
},
),
).rejects.toThrow(rawDeliveryError);

expect(await loadProjection({ conversationId: conversationId! })).toEqual(
[],
const projection = await loadProjection({
conversationId: conversationId!,
});
expect(projection).toEqual([
expect.objectContaining({
role: "user",
content: expect.arrayContaining([
expect.objectContaining({
type: "text",
text: expect.stringContaining("hello"),
}),
]),
}),
]);
expect(projection.some((message) => message.role === "assistant")).toBe(
false,
);
const state = await getPersistedThreadState(conversationId!);
expect(getPersistedSandboxState(state)).toBeUndefined();
Expand Down
2 changes: 1 addition & 1 deletion scripts/test-architecture-debt.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"manufactured-agent-outcome": {
"packages/junior/tests/integration/local-agent-runner.test.ts": 4,
"packages/junior/tests/integration/local-agent-runner.test.ts": 3,
"packages/junior/tests/integration/slack/assistant-thread-contract.test.ts": 2,
"packages/junior/tests/integration/slack/attachment-behavior.test.ts": 3,
"packages/junior/tests/integration/slack/attachment-media-behavior.test.ts": 4,
Expand Down
Loading