fix: classify codex steer proxy failures
This commit is contained in:
@@ -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;
|
||||
|
||||
Reference in New Issue
Block a user