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

@@ -147,13 +147,17 @@ export function NodeDetailModal({
setIsPulling(true);
try {
await onPullSettings(node.id);
if (!isMountedRef.current) return;
addToast("Settings pulled successfully", "success");
} catch (error) {
if (!isMountedRef.current) return;
const message = error instanceof Error ? error.message : "Pull settings failed";
setSyncError(message);
addToast(message, "error");
} finally {
setIsPulling(false);
if (isMountedRef.current) {
setIsPulling(false);
}
}
}, [addToast, node, onPullSettings]);
@@ -163,13 +167,17 @@ export function NodeDetailModal({
setIsSyncingAuth(true);
try {
await onSyncAuth(node.id);
if (!isMountedRef.current) return;
addToast("Auth credentials synced successfully", "success");
} catch (error) {
if (!isMountedRef.current) return;
const message = error instanceof Error ? error.message : "Auth sync failed";
setSyncError(message);
addToast(message, "error");
} finally {
setIsSyncingAuth(false);
if (isMountedRef.current) {
setIsSyncingAuth(false);
}
}
}, [addToast, node, onSyncAuth]);

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) {