fix: use target agent dir for compact command

This commit is contained in:
Tak Hoffman
2026-04-10 20:04:35 -05:00
parent aaec5c3283
commit 29018b4af5
2 changed files with 2 additions and 1 deletions

View File

@@ -226,5 +226,6 @@ describe("handleCompactCommand", () => {
agentDir: "/tmp/target-agent",
}),
);
expect(vi.mocked(resolveAgentDir)).toHaveBeenCalledWith(expect.any(Object), "target");
});
});

View File

@@ -97,7 +97,7 @@ export const handleCompactCommand: CommandHandler = async (params) => {
? resolveSessionAgentId({ sessionKey: params.sessionKey, config: params.cfg })
: params.agentId;
const sessionAgentDir =
params.agentDir ?? (sessionAgentId ? resolveAgentDir(params.cfg, sessionAgentId) : undefined);
(sessionAgentId ? resolveAgentDir(params.cfg, sessionAgentId) : undefined) ?? params.agentDir;
const customInstructions = extractCompactInstructions({
rawBody: params.ctx.CommandBody ?? params.ctx.RawBody ?? params.ctx.Body,
ctx: params.ctx,