fix: avoid same-column task move errors and keep durable agents active
This commit is contained in:
@@ -277,10 +277,12 @@ export class EphemeralWorkerManager {
|
||||
this.pendingDeletions.add(agentId);
|
||||
}
|
||||
|
||||
const effectiveTerminalState = reason === "error" && !ephemeral ? "active" : terminalState;
|
||||
|
||||
try {
|
||||
await this.agentStore.updateAgentState(agentId, terminalState);
|
||||
await this.agentStore.updateAgentState(agentId, effectiveTerminalState);
|
||||
} catch (err) {
|
||||
this.log.warn(`Failed to update agent ${agentId} to ${terminalState} (${reason}): ${this.formatError(err)}`);
|
||||
this.log.warn(`Failed to update agent ${agentId} to ${effectiveTerminalState} (${reason}): ${this.formatError(err)}`);
|
||||
}
|
||||
try {
|
||||
await this.agentStore.syncExecutionTaskLink(agentId, undefined);
|
||||
|
||||
@@ -921,7 +921,7 @@ describe("InProcessRuntime", () => {
|
||||
await vi.advanceTimersByTimeAsync(5000);
|
||||
|
||||
const updated = await store.getAgent(durable.id);
|
||||
expect(updated?.state).toBe("error");
|
||||
expect(updated?.state).toBe("active");
|
||||
expect(updated?.taskId).toBeUndefined();
|
||||
expect(deleteAgentSpy).not.toHaveBeenCalledWith(durable.id);
|
||||
} finally {
|
||||
|
||||
Reference in New Issue
Block a user