Skip to content

Commit f2e37bb

Browse files
committed
test(run-state): track the stream failure per stream in the checker
1 parent 25d6c8f commit f2e37bb

1 file changed

Lines changed: 7 additions & 2 deletions

File tree

‎scripts/check-run-state-kernel.ts‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ interface ModelState {
1515
askCount: number
1616
completionAsks: number[]
1717
lastEndedStreamFailedAndCleaned: boolean
18+
currentStreamFailed: boolean
1819
}
1920

2021
interface ModelEvent {
@@ -294,6 +295,7 @@ function initialState(): ModelState {
294295
askCount: 0,
295296
completionAsks: [],
296297
lastEndedStreamFailedAndCleaned: false,
298+
currentStreamFailed: false,
297299
}
298300
}
299301

@@ -439,9 +441,12 @@ function apply(options: Options, state: ModelState, { event }: ModelEvent): Appl
439441
next.askCount = event.ask.askTs
440442
if (event.ask.tag === "completion") next.completionAsks = [...state.completionAsks, event.ask.askTs]
441443
}
444+
if (event.tag === "reasonSet" && event.reason === "streaming_failed" && state.run.stream.tag === "live") {
445+
next.currentStreamFailed = state.currentStreamFailed || state.run.latches.reason === undefined
446+
}
442447
if (event.tag === "streamEnded" && state.run.stream.tag === "live") {
443-
next.lastEndedStreamFailedAndCleaned =
444-
state.run.stream.cleanupFinished && state.run.latches.reason === "streaming_failed"
448+
next.lastEndedStreamFailedAndCleaned = state.run.stream.cleanupFinished && state.currentStreamFailed
449+
next.currentStreamFailed = false
445450
}
446451
return { next, accepted, problems }
447452
}

0 commit comments

Comments
 (0)