fix: scope watchdog activity to selected stage

This commit is contained in:
Bryan Helmkamp 2026-07-24 22:57:29 -04:00
parent c81ea69c73
commit 205f886f33
No known key found for this signature in database
2 changed files with 5 additions and 2 deletions

View file

@ -884,7 +884,7 @@ describe("buildChatItems", () => {
});
describe("buildStageActivity pending tools", () => {
test("records watchdog settlement during the activity pass", () => {
test("records watchdog settlement only for the selected stage", () => {
const events: EventEnvelope[] = [
envelope(1, {
event: "watchdog.timeout",
@ -894,6 +894,7 @@ describe("buildStageActivity pending tools", () => {
];
expect(buildStageActivity(events, "plan@1").watchdogTimedOut).toBe(true);
expect(buildStageActivity(events, "code@1").watchdogTimedOut).toBe(false);
});
test("returns started-but-not-completed calls for the stage", () => {

View file

@ -291,12 +291,14 @@ export function buildStageActivity(
for (const e of events) {
const eventName = e.event;
if (activityEventStageId(e) !== stageId) {
continue;
}
if (eventName === "watchdog.timeout") {
watchdogTimedOut = true;
continue;
}
if (
activityEventStageId(e) !== stageId ||
!eventName ||
!STAGE_ACTIVITY_EVENT_SET.has(eventName)
) {