fix(cron): pass agentDir into embedded follow-up runs

Co-authored-by: seilk <88271769+seilk@users.noreply.github.com>
This commit is contained in:
Peter Steinberger
2026-02-22 21:34:08 +01:00
parent 34fef3ae60
commit 3820ad77ba
5 changed files with 48 additions and 0 deletions

View File

@@ -279,3 +279,34 @@ describe("createFollowupRunner messaging tool dedupe", () => {
expect(store[sessionKey]?.outputTokens).toBe(50);
});
});
describe("createFollowupRunner agentDir forwarding", () => {
it("passes queued run agentDir to runEmbeddedPiAgent", async () => {
runEmbeddedPiAgentMock.mockClear();
const onBlockReply = vi.fn(async () => {});
runEmbeddedPiAgentMock.mockResolvedValueOnce({
payloads: [{ text: "hello world!" }],
messagingToolSentTexts: ["different message"],
meta: {},
});
const runner = createFollowupRunner({
opts: { onBlockReply },
typing: createMockTypingController(),
typingMode: "instant",
defaultModel: "anthropic/claude-opus-4-5",
});
const agentDir = path.join("/tmp", "agent-dir");
const queued = baseQueuedRun();
await runner({
...queued,
run: {
...queued.run,
agentDir,
},
});
expect(runEmbeddedPiAgentMock).toHaveBeenCalledTimes(1);
const call = runEmbeddedPiAgentMock.mock.calls.at(-1)?.[0] as { agentDir?: string };
expect(call?.agentDir).toBe(agentDir);
});
});

View File

@@ -154,6 +154,7 @@ export function createFollowupRunner(params: {
senderE164: queued.run.senderE164,
senderIsOwner: queued.run.senderIsOwner,
sessionFile: queued.run.sessionFile,
agentDir: queued.run.agentDir,
workspaceDir: queued.run.workspaceDir,
config: queued.run.config,
skillsSnapshot: queued.run.skillsSnapshot,