fix(runner): detect active ACPX turns on close

This commit is contained in:
Dotta 2026-09-03 05:20:03 -05:00
parent a418938524
commit a55b6e6409
2 changed files with 14 additions and 4 deletions

View File

@ -104,6 +104,17 @@ it("identifies an active provider turn that must stop before suspension", () =>
providerSettled: false,
});
expect(
runnerdRecoveryInternals.providerDrainStateFromSnapshot({
activeTurnId: "acpx-turn-1",
pendingEvents: [],
}),
).toEqual({
pendingEventCount: 0,
activeProviderTurnId: "acpx-turn-1",
providerSettled: false,
});
expect(
runnerdRecoveryInternals.providerDrainStateFromSnapshot({
activeProviderTurnId: null,

View File

@ -340,10 +340,9 @@ function providerDrainStateFromSnapshot(state: Record<string, unknown>): {
? state.queuedEvents.length
: 0;
const activeProviderTurnId =
typeof state.activeProviderTurnId === "string" &&
state.activeProviderTurnId.length > 0
? state.activeProviderTurnId
: null;
[state.activeProviderTurnId, state.activeTurnId].find(
(value): value is string => typeof value === "string" && value.length > 0,
) ?? null;
return {
pendingEventCount: pending + queued,
activeProviderTurnId,