Skip to content

Commit 8b89323

Browse files
committed
fix: preserve diagnostic active work owner boundary
1 parent 6cffb68 commit 8b89323

2 files changed

Lines changed: 4 additions & 23 deletions

File tree

src/logging/diagnostic.test.ts

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -988,7 +988,7 @@ describe("stuck session diagnostics threshold", () => {
988988
);
989989
});
990990

991-
it("recovers stale model calls without active embedded-run ownership", async () => {
991+
it("keeps stale processing model calls without active embedded-run ownership observe-only", async () => {
992992
const events: DiagnosticEventPayload[] = [];
993993
const recoverStuckSession = vi.fn();
994994
const stuckSessionWarnMs = 30_000;
@@ -1033,11 +1033,7 @@ describe("stuck session diagnostics threshold", () => {
10331033
lastProgressReason: "model_call:started",
10341034
},
10351035
);
1036-
expectRecoveryCall(
1037-
recoverStuckSession,
1038-
{ sessionId: "s1", sessionKey: "main", queueDepth: 0, allowActiveAbort: true },
1039-
["ageMs", "stateGeneration"],
1040-
);
1036+
expect(recoverStuckSession).not.toHaveBeenCalled();
10411037
});
10421038

10431039
it("does not recover a recent native tool call just because the session is old", async () => {

src/logging/diagnostic.ts

Lines changed: 2 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -544,21 +544,7 @@ function isStalledModelCallRecoveryEligible(params: {
544544
params.classification?.eventType === "session.stalled" &&
545545
params.classification.classification === "stalled_agent_run" &&
546546
params.classification.activeWorkKind === "model_call" &&
547-
typeof lastProgressAgeMs === "number" &&
548-
lastProgressAgeMs >= params.stuckSessionAbortMs
549-
);
550-
}
551-
552-
function isOrphanedActiveWorkRecoveryEligible(params: {
553-
classification: SessionAttentionClassification | undefined;
554-
activity?: DiagnosticSessionActivitySnapshot;
555-
stuckSessionAbortMs: number;
556-
}): boolean {
557-
const lastProgressAgeMs = params.activity?.lastProgressAgeMs;
558-
return (
559-
params.classification?.eventType === "session.stalled" &&
560-
params.classification.classification === "stalled_agent_run" &&
561-
params.classification.activeWorkKind !== undefined &&
547+
params.activity?.hasActiveEmbeddedRun === true &&
562548
typeof lastProgressAgeMs === "number" &&
563549
lastProgressAgeMs >= params.stuckSessionAbortMs
564550
);
@@ -572,8 +558,7 @@ function isActiveAbortRecoveryEligible(params: {
572558
return (
573559
isStalledEmbeddedRunRecoveryEligible(params) ||
574560
isBlockedToolCallRecoveryEligible(params) ||
575-
isStalledModelCallRecoveryEligible(params) ||
576-
isOrphanedActiveWorkRecoveryEligible(params)
561+
isStalledModelCallRecoveryEligible(params)
577562
);
578563
}
579564

0 commit comments

Comments
 (0)