Never stop coding. Free MIT AI gateway: one endpoint, 375 providers (150+ free), 1,400+ models Kimi, Claude, GPT, Gemini, GLM, DeepSeek, MiniMax. Works with Claude Code, Codex, Cursor, OpenCode, Cline & Copilot. Quota-aware auto-fallback, RTK+Caveman compression saves 15-95% tokens, MCP/A2A, Desktop/PWA. Built by 900+ contributors
TypeScript a2aai-agentsai-gatewayanthropicclaudeclaude-codeclinecodexcopilotcursordeepseekfree-aigeminikimillm-gatewaymcpopenaiopenai-proxyqwentoken-saver
fix(dashboard): correct TOML round-trip corruption in codex config serializer (#1438)
Benson K B77f326e0ddcc
diff --git a/src/app/api/cli-tools/codex-settings/route.ts b/src/app/api/cli-tools/codex-settings/route.tsindex deac929dae..5cf1151a1d 100644--- a/src/app/api/cli-tools/codex-settings/route.ts+++ b/src/app/api/cli-tools/codex-settings/route.ts@@ -38,9 +38,16 @@ const parseToml = (content: string) => {// Key = valueconst kvMatch = trimmed.match(/^([^=]+)\s*=\s*(.+)$/);if (kvMatch) {- const key = kvMatch[1].trim();+ let key = kvMatch[1].trim();let value = kvMatch[2].trim();- // Remove quotes+ // Strip quotes from key (TOML quoted keys like "gpt-5.3-codex")+ if (+ (key.startsWith('"') && key.endsWith('"')) ||+ (key.startsWith("'") && key.endsWith("'"))+ ) {+ key = key.slice(1, -1);+ }+ // Remove quotes from string values only (not arrays, booleans, numbers)if ((value.startsWith('"') && value.endsWith('"')) ||(value.startsWith("'") && value.endsWith("'"))@@ -58,13 +65,23 @@ const parseToml = (content: string) => {return result;};+// Format a TOML value: arrays and booleans stay unquoted, strings get quoted+const formatTomlValue = (value: unknown): string => {+ if (typeof value === "boolean") return value ? "true" : "false";+ if (typeof value === "number") return String(value);+ // Preserve pre-formatted TOML arrays (e.g. ["a", "b"])+ if (typeof value === "string" && value.startsWith("[") && value.endsWith("]")) return value;+ if (typeof value === "string") return `"${value}"`;+ return `"${value}"`;+};+// Convert parsed object back to TOML stringconst toToml = (parsed: Record<string, any>) => {let lines: string[] = [];// Root level keysObject.entries(parsed._root).forEach(([key, value]) => {- lines.push(`${key} = "${value}"`);+ lines.push(`${key} = ${formatTomlValue(value)}`);});// Sections@@ -73,7 +90,7 @@ const toToml = (parsed: Record<string, any>) => {lines.push(`[${section}]`);Object.entries(values).forEach(([key, value]) => {const formattedKey = key.includes(".") ? `"${key}"` : key;- lines.push(`${formattedKey} = "${value}"`);+ lines.push(`${formattedKey} = ${formatTomlValue(value)}`);});});