fix(prompt): treat post-dispatch failures as accepted

This commit is contained in:
YeonGyu-Kim
2026-05-20 11:42:32 +09:00
parent f540249838
commit d3e218f912
31 changed files with 503 additions and 76 deletions
+34 -1
View File
@@ -1,6 +1,9 @@
import { describe, expect, test } from "bun:test"
import { isAmbiguousPromptDispatchFailure } from "./prompt-failure-classifier"
import {
isAmbiguousPostDispatchPromptFailure,
isAmbiguousPromptDispatchFailure,
} from "./prompt-failure-classifier"
describe("prompt failure classifier", () => {
test("#given prompt dispatch reports a generic JSON parse error #when classifying ambiguity #then it treats the dispatch as possibly accepted", () => {
@@ -24,4 +27,34 @@ describe("prompt failure classifier", () => {
// then
expect(ambiguous).toBe(true)
})
test("#given ambiguous failure before dispatch #when classifying post-dispatch acceptance #then it is not treated as accepted", () => {
// given
const result = {
status: "failed" as const,
dispatchAttempted: false,
error: new Error("JSON Parse error: Unexpected EOF"),
}
// when
const ambiguous = isAmbiguousPostDispatchPromptFailure(result)
// then
expect(ambiguous).toBe(false)
})
test("#given ambiguous failure after dispatch #when classifying post-dispatch acceptance #then it is treated as accepted", () => {
// given
const result = {
status: "failed" as const,
dispatchAttempted: true,
error: new Error("JSON Parse error: Unexpected EOF"),
}
// when
const ambiguous = isAmbiguousPostDispatchPromptFailure(result)
// then
expect(ambiguous).toBe(true)
})
})