mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 11:51:37 +00:00
fix(cron): pass agentDir into embedded follow-up runs
Co-authored-by: seilk <88271769+seilk@users.noreply.github.com>
This commit is contained in:
@@ -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);
|
||||
});
|
||||
});
|
||||
|
||||
@@ -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,
|
||||
|
||||
Reference in New Issue
Block a user