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

@@ -185,6 +185,20 @@ describe("runCronIsolatedAgentTurn", () => {
});
});
it("passes resolved agentDir to runEmbeddedPiAgent", async () => {
await withTempHome(async (home) => {
const { res } = await runCronTurn(home, {
jobPayload: DEFAULT_AGENT_TURN_PAYLOAD,
});
expect(res.status).toBe("ok");
const call = vi.mocked(runEmbeddedPiAgent).mock.calls.at(-1)?.[0] as {
agentDir?: string;
};
expect(call?.agentDir).toBe(path.join(home, ".openclaw", "agents", "main", "agent"));
});
});
it("appends current time after the cron header line", async () => {
await withTempHome(async (home) => {
await runCronTurn(home, {

View File

@@ -501,6 +501,7 @@ export async function runCronIsolatedAgentTurn(params: {
messageChannel,
agentAccountId: resolvedDelivery.accountId,
sessionFile,
agentDir,
workspaceDir,
config: cfgWithAgentDefaults,
skillsSnapshot,