fix(native): match only the terminal httpConnectionFailed 404

Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
DottaandClaude committed 2026-11-10 02:46:07 -06:00
1 parent 21befa1c5c
commit d2e8494e41
2 files changed
+4 -2

No files matched your search

@@ -68,6 +68,8 @@ describe("native provider failure observation", () => {
[real.replace(model, "other-model"), undefined, false],
[real, { httpConnectionFailed: { httpStatusCode: 500 } }, false],
[real, "other", false],
// Codex reports its retried 404s with this kind and willRetry; they never end the turn.
[real, { responseStreamDisconnected: { httpStatusCode: 404 } }, false],
[real, undefined, true],
] as const) {
const other = observation();
@@ -266,8 +266,8 @@ export function createNativeProviderFailureObservation(provider: { kind: string;
// terminal text (codex 0.160.0). Bind it to the configured model; store neither name nor text.
const info = record(failure.codexErrorInfo);
const infoKinds = Object.keys(info);
if (infoKinds.length === 1 && ["httpConnectionFailed", "responseStreamDisconnected"].includes(infoKinds[0]!) &&
record(info[infoKinds[0]!]).httpStatusCode === 404 &&
// Its retried 404s arrive as responseStreamDisconnected with willRetry; only the terminal kind counts.
if (infoKinds.length === 1 && infoKinds[0] === "httpConnectionFailed" && record(info.httpConnectionFailed).httpStatusCode === 404 &&
failure.message.startsWith(`unexpected status 404 Not Found: The model \`${provider.model}\` does not exist or you do not have access to it.`)) {
missingModelTurnId = event.turnId;
return;