Skip to content

The open-source app everyone uses to manage agents at work

Fix issue active-run fallback to match issue context

Dotta9454f76c0c7b
diff --git a/server/src/routes/agents.ts b/server/src/routes/agents.ts
index 80d84335d2..607c451a6a 100644
--- a/server/src/routes/agents.ts
+++ b/server/src/routes/agents.ts
@@ -1366,7 +1366,12 @@ export function agentRoutes(db: Db) {
}
if (!run && issue.assigneeAgentId && issue.status === "in_progress") {
- run = await heartbeat.getActiveRunForAgent(issue.assigneeAgentId);
+ const candidateRun = await heartbeat.getActiveRunForAgent(issue.assigneeAgentId);
+ const candidateContext = asRecord(candidateRun?.contextSnapshot);
+ const candidateIssueId = asNonEmptyString(candidateContext?.issueId);
+ if (candidateRun && candidateIssueId === issue.id) {
+ run = candidateRun;
+ }
}
if (!run) {
res.json(null);