fix(FN-2116): restore agent run logs

This commit is contained in:
Fusion
2026-04-18 17:59:42 -07:00
committed by gsxdsm
parent 93b97cd786
commit 6d82880da5
5 changed files with 106 additions and 59 deletions

View File

@@ -36,6 +36,7 @@ vi.mock("@fusion/core", async () => {
return {
...actual,
isGhAuthenticated: vi.fn(),
isQmdAvailable: vi.fn().mockResolvedValue(false),
CentralCore: vi.fn().mockImplementation(() => ({
init: mockCentralInit,
close: mockCentralClose,

View File

@@ -12941,6 +12941,11 @@ export function createApiRoutes(store: TaskStore, options?: ServerOptions): Rout
const agentStore = new AgentStoreClass({ rootDir: scopedStore.getFusionDir() });
await agentStore.init();
const agent = await agentStore.getAgent(req.params.id);
if (!agent) {
throw notFound(`Agent ${req.params.id} not found`);
}
const activeRun = await agentStore.getActiveHeartbeatRun(req.params.id);
if (activeRun) {
throw new ApiError(409, "Agent already has an active run", { runId: activeRun.id });
@@ -12965,6 +12970,11 @@ export function createApiRoutes(store: TaskStore, options?: ServerOptions): Rout
const agentStore = new AgentStore({ rootDir: scopedStore.getFusionDir() });
await agentStore.init();
const agent = await agentStore.getAgent(req.params.id);
if (!agent) {
throw notFound(`Agent ${req.params.id} not found`);
}
// Check for existing active run
const activeRun = await agentStore.getActiveHeartbeatRun(req.params.id);
if (activeRun) {