Skip to content

Commit 51fc4e2

Browse files
committed
fix: skip metadata tables in nested provider recovery
1 parent d700c98 commit 51fc4e2

2 files changed

Lines changed: 10 additions & 0 deletions

File tree

cli.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -322,6 +322,11 @@ function isRecoverableNestedProviderConfig(value) {
322322

323323
function collectNestedProviderConfigs(node, pathPrefix, collector) {
324324
if (!isPlainObject(node)) return;
325+
const segments = String(pathPrefix || '').split('.');
326+
const lastSegment = segments.length > 0 ? segments[segments.length - 1] : '';
327+
if (lastSegment === 'metadata') {
328+
return;
329+
}
325330
if (isRecoverableNestedProviderConfig(node)) {
326331
collector.push([pathPrefix, node]);
327332
return;

tests/e2e/test-config.js

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -562,6 +562,9 @@ module.exports = async function testConfig(ctx) {
562562
assert(exportProviderNew.payload.baseUrl === updatedUrl, 'export-provider(e2e-api) baseUrl mismatch');
563563
assert(exportProviderNew.payload.apiKey === 'sk-e2e-api-upd', 'export-provider(e2e-api) apiKey mismatch');
564564

565+
// quotedApiKey is the runtime value used for API update/export round-trip.
566+
// configPath/configAfterQuotedUpdate validates the persisted TOML line where
567+
// quotes/backslashes are escaped for TOML syntax.
565568
const quotedApiKey = 'sk-e2e-"quoted"-\\\\path';
566569
const updateProviderQuoted = await api('update-provider', { name: 'e2e-api', key: quotedApiKey });
567570
assert(updateProviderQuoted.success === true, 'update-provider should handle quoted API key');
@@ -570,6 +573,8 @@ module.exports = async function testConfig(ctx) {
570573
assert(exportProviderQuoted.payload.apiKey === quotedApiKey, 'quoted API key should round-trip');
571574
const configPath = path.join(tmpHome, '.codex', 'config.toml');
572575
const configAfterQuotedUpdate = fs.readFileSync(configPath, 'utf-8');
576+
// Expected TOML fragment:
577+
// preferred_auth_method = "sk-e2e-\\\"quoted\\\"-\\\\\\\\path"
573578
assert(
574579
configAfterQuotedUpdate.includes('preferred_auth_method = "sk-e2e-\\"quoted\\"-\\\\\\\\path"'),
575580
'quoted API key should be escaped in config.toml'

0 commit comments

Comments
 (0)