fix: classify codex steer proxy failures

This commit is contained in:
Codex
2026-05-20 15:01:35 +00:00
parent cab85fcdfb
commit 3b6a420d09
6 changed files with 280 additions and 9 deletions
+18
View File
@@ -32,6 +32,14 @@ export function coreInternalFetch(path: string, init?: { method?: string; body?:
const command = dockerCoreFetchCommand(path, init);
const result = runCommand(command, repoRoot);
if (result.exitCode !== 0) {
const parsedStdout = parseJsonRecord(result.stdout.trim());
if (parsedStdout !== null) {
return {
...parsedStdout,
commandExitCode: result.exitCode,
commandStderrTail: result.stderr.slice(-1200),
};
}
const codeQueueStableProxy = path.startsWith("/api/microservices/code-queue/");
return {
ok: false,
@@ -55,6 +63,16 @@ export function coreInternalFetch(path: string, init?: { method?: string; body?:
}
}
function parseJsonRecord(text: string): Record<string, unknown> | null {
if (text.length === 0) return null;
try {
const parsed = JSON.parse(text) as unknown;
return typeof parsed === "object" && parsed !== null && !Array.isArray(parsed) ? parsed as Record<string, unknown> : null;
} catch {
return null;
}
}
function requireId(value: string | undefined, command: string): string {
if (value === undefined || value.length === 0) throw new Error(`${command} requires microservice id`);
return value;