Hide unsupported MCP bearer_token from config schema (#19294)

## Summary

Fixes #19275.

Codex runtime rejects inline MCP `bearer_token` config entries and asks
users to configure `bearer_token_env_var` instead, but the generated
config schema still advertised `mcp_servers.<name>.bearer_token` as a
supported field. That made editor/schema validation disagree with
runtime validation.

This keeps `bearer_token` in `RawMcpServerConfig` so Codex can continue
producing the targeted runtime error for recent or existing configs, but
skips the field during schemars generation. The checked-in
`core/config.schema.json` fixture now exposes `bearer_token_env_var`
without exposing unsupported inline `bearer_token`.

## Verification

- Added `config_schema_hides_unsupported_inline_mcp_bearer_token` to
assert the generated schema hides `bearer_token` while preserving
`bearer_token_env_var`.
- Ran `cargo test -p codex-config`.
- Ran `cargo test -p codex-core config_schema`.
This commit is contained in:
Eric Traut
2026-04-24 00:17:43 -07:00
committed by GitHub
parent e083b6c757
commit 6f87eb0479
3 changed files with 27 additions and 5 deletions
+20
View File
@@ -53,3 +53,23 @@ Run `just write-config-schema` to overwrite with your changes.\n\n{diff}"
"fixture should match exactly with generated schema"
);
}
#[test]
fn config_schema_hides_unsupported_inline_mcp_bearer_token() {
let schema_json = config_schema_json().expect("serialize config schema");
let schema_value: serde_json::Value =
serde_json::from_slice(&schema_json).expect("decode schema json");
let properties = schema_value
.pointer("/definitions/RawMcpServerConfig/properties")
.expect("RawMcpServerConfig properties should exist")
.as_object()
.expect("RawMcpServerConfig properties should be an object");
assert_eq!(
(
properties.contains_key("bearer_token"),
properties.contains_key("bearer_token_env_var"),
),
(false, true),
);
}