fix: parse escaped retryable error messages

This commit is contained in:
2026-07-08 10:08:25 +08:00
parent a62f2cf1b9
commit 5d48ef5880
4 changed files with 64 additions and 15 deletions
+9 -5
View File
@@ -15,6 +15,7 @@ import {
DEFAULT_REASONING_MATCH_MODE,
DEFAULT_STATE_ROOT,
ensureDirectory,
expandEscapedLineBreaks,
getCodexProviderContext,
getGatewayBaseUrl,
getGatewayStatePaths,
@@ -47,13 +48,16 @@ function parseEnvFile(content) {
}
const key = line.slice(0, separatorIndex).trim();
let value = line.slice(separatorIndex + 1).trim();
if (
(value.startsWith('"') && value.endsWith('"')) ||
(value.startsWith("'") && value.endsWith("'"))
) {
if (value.startsWith('"') && value.endsWith('"')) {
try {
value = JSON.parse(value);
} catch {
value = value.slice(1, -1);
}
} else if (value.startsWith("'") && value.endsWith("'")) {
value = value.slice(1, -1);
}
parsed[key] = value;
parsed[key] = typeof value === "string" ? expandEscapedLineBreaks(value) : value;
}
return parsed;
}