Fix LiveRunWidget activeRun merge bug and add idle_warning clear test

- Fix: activeRun merge in LiveRunWidget was dropping errorCode and
  lastOutputAt, preventing idle badge and last-output display from
  rendering for active runs
- Add test: verify reportRunActivity clears idle_warning error code
  and updates lastOutputAt

Co-Authored-By: Paperclip <noreply@paperclip.ing>
This commit is contained in:
Devin Foley 2026-03-27 00:02:57 -07:00
parent d747d847e4
commit b3bccf3648
2 changed files with 20 additions and 0 deletions

View file

@ -332,4 +332,22 @@ describeEmbeddedPostgres("heartbeat orphaned process recovery", () => {
expect(run?.errorCode).toBeNull();
expect(run?.error).toBeNull();
});
it("clears the idle warning when the run reports activity again", async () => {
const { runId } = await seedRunFixture({
includeIssue: false,
runErrorCode: "idle_warning",
runError: "Idle warning: no output for 10 minutes",
});
const heartbeat = heartbeatService(db);
const updated = await heartbeat.reportRunActivity(runId);
expect(updated?.errorCode).toBeNull();
expect(updated?.error).toBeNull();
expect(updated?.lastOutputAt).toBeTruthy();
const run = await heartbeat.getRun(runId);
expect(run?.errorCode).toBeNull();
expect(run?.error).toBeNull();
});
});

View file

@ -68,6 +68,8 @@ export function LiveRunWidget({ issueId, companyId }: LiveRunWidgetProps) {
agentId: activeRun.agentId,
agentName: activeRun.agentName,
adapterType: activeRun.adapterType,
errorCode: activeRun.errorCode,
lastOutputAt: toIsoString(activeRun.lastOutputAt),
issueId,
});
}