Skip to content

Commit 4731eb0

Browse files
committed
fix(session): preserve explicit abort recovery
1 parent e50966b commit 4731eb0

4 files changed

Lines changed: 8 additions & 3 deletions

File tree

‎src/auto-reply/reply/reply-turn-admission.ts‎

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -258,9 +258,11 @@ async function admitReplyTurnWithWaitSignal(
258258
storePath &&
259259
!params.resetTriggered &&
260260
admittedSessionEntry &&
261-
(admittedSessionEntry.abortedLastRun === true ||
262-
admittedSessionEntry.restartRecoveryRuns !== undefined ||
263-
admittedSessionEntry.mainRestartRecovery !== undefined) &&
261+
((admittedSessionEntry.status === "running" &&
262+
(admittedSessionEntry.abortedLastRun === true ||
263+
admittedSessionEntry.restartRecoveryRuns !== undefined ||
264+
admittedSessionEntry.mainRestartRecovery !== undefined)) ||
265+
admittedSessionEntry.mainRestartRecovery?.tombstone !== undefined) &&
264266
isMainRestartRecoveryCandidate(admittedSessionEntry, params.sessionKey)
265267
) {
266268
const ownerClaim = await claimMainSessionRecoveryOwner({

‎src/gateway/server-methods/agent.create-event.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ vi.mock("../../config/config.js", () => ({
3737
}));
3838

3939
vi.mock("../../commands/agent.js", () => ({
40+
agentCommandFromGatewayIngress: agentIngressMocks.agentCommandFromIngress,
4041
agentCommandFromIngress: agentIngressMocks.agentCommandFromIngress,
4142
}));
4243

‎src/gateway/server-methods/agent.deleted-agent.test.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ const performGatewaySessionResetMock = vi.hoisted(() => vi.fn());
1313
const parseMessageWithAttachmentsMock = vi.hoisted(() => vi.fn());
1414

1515
vi.mock("../../commands/agent.js", () => ({
16+
agentCommandFromGatewayIngress: agentCommandFromIngressMock,
1617
agentCommandFromIngress: agentCommandFromIngressMock,
1718
}));
1819

‎src/gateway/test-helpers.mocks.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -251,6 +251,7 @@ vi.mock("../commands/status.js", () => ({
251251
}));
252252
vi.mock("../commands/agent.js", () => ({
253253
agentCommand,
254+
agentCommandFromGatewayIngress: agentCommand,
254255
agentCommandFromIngress: agentCommand,
255256
}));
256257
vi.mock("../agents/btw.js", () => ({

0 commit comments

Comments
 (0)