fix(prompt-gate): harden internal prompt dispatch

This commit is contained in:
YeonGyu-Kim
2026-05-19 16:02:18 +09:00
parent 6c63372ef9
commit 1492bffd20
49 changed files with 1488 additions and 141 deletions
+3 -3
View File
@@ -3,7 +3,7 @@ import {
promptSyncWithModelSuggestionRetry,
promptWithModelSuggestionRetry,
} from "./model-suggestion-retry"
import { dispatchInternalPrompt } from "./prompt-async-gate"
import { dispatchInternalPrompt, isInternalPromptDispatchAccepted } from "./prompt-async-gate"
type OpencodeClient = PluginInput["client"]
@@ -70,10 +70,10 @@ export function promptAsyncInDirectory(
if (result.status === "failed") {
throw result.error
}
if (result.status !== "dispatched") {
if (!isInternalPromptDispatchAccepted(result)) {
throw new Error(`promptAsync skipped by gate: ${result.status}`)
}
return result.response
return result.status === "dispatched" ? result.response : undefined
})
}