feat(FN-2081): merge fusion/fn-2081

This commit is contained in:
gsxdsm
2026-04-18 21:52:21 -07:00
parent 76d318ca5e
commit 94bbca31da
2 changed files with 26 additions and 8 deletions

View File

@@ -1376,8 +1376,9 @@ describe("HeartbeatMonitor", () => {
expect(systemPrompt).not.toContain("task_log");
expect(systemPrompt).not.toContain("task_document_write");
expect(systemPrompt).not.toContain("task_document_read");
expect(systemPrompt).not.toContain("Task Documents:");
expect(systemPrompt).toContain("task_create");
expect(systemPrompt).toContain("heartbeat_done");
expect(systemPrompt).toContain("memory_append");
// The execution prompt is passed to session.prompt by promptWithFallback mock
const promptCalls = mockSession.prompt.mock.calls;
@@ -1396,6 +1397,24 @@ describe("HeartbeatMonitor", () => {
expect(executionPrompt).not.toContain("Task description:");
});
it("task-scoped heartbeat run receives full system prompt with task_log and task Documents", async () => {
const store = createStoreWithAgentForExec({ taskId: "FN-001" });
const mockSession = createMockAgentSession();
mockedCreateKbAgent.mockResolvedValue({ session: mockSession as any });
const monitor = new HeartbeatMonitor({ store, taskStore: mockTaskStore, rootDir: "/tmp" });
await monitor.executeHeartbeat({ agentId: "agent-001", source: "timer" });
expect(mockedCreateKbAgent).toHaveBeenCalledOnce();
const callArgs = mockedCreateKbAgent.mock.calls[0]![0]!;
const systemPrompt = callArgs.systemPrompt;
expect(systemPrompt).toContain("task_log");
expect(systemPrompt).toContain("task_document_write");
expect(systemPrompt).toContain("Task Documents:");
});
it("identity agent without task gets soul in system prompt", async () => {
const store = createStoreWithAgentForExec({ taskId: undefined, soul: "I am a CEO who prioritizes high-impact work" });
const mockSession = createMockAgentSession();