Expose the Codex version to commands and turn metadata (#42395)

## What changed

- Set `CODEX_VERSION` to the running package version in user shell and unified
  exec environments, overriding stale shell-policy or snapshot values.
- Add the reserved `codex_version` field to MCP turn metadata.

## Testing

- Cover version propagation through shell policies, shell snapshots, unified
  exec, and MCP metadata.

GitOrigin-RevId: 7846c70d668176530b1f467293b749dc9ddd79a0
This commit is contained in:
jif authored and copyberry committed 2026-09-03 00:17:19 +00:00
1 parent 91608236ea
commit 9bb1ea035f
11 files changed
+74 -17

No files matched your search

+2
View File
@@ -739,6 +739,7 @@ fn turn_metadata_state_merges_client_metadata_without_replacing_reserved_fields(
("workspace_kind".to_string(), "projectless".to_string()),
("source".to_string(), "client-source".to_string()),
("model".to_string(), "client-supplied".to_string()),
("codex_version".to_string(), "client-supplied".to_string()),
(
"reasoning_effort".to_string(),
"client-supplied".to_string(),
@@ -932,6 +933,7 @@ fn turn_metadata_state_merges_client_metadata_without_replacing_reserved_fields(
.current_meta_value_for_mcp_request(test_mcp_turn_metadata_context())
.expect("turn metadata should be present");
assert_eq!(meta["model"].as_str(), Some("gpt-5.4"));
assert_eq!(meta["codex_version"], env!("CARGO_PKG_VERSION"));
assert_eq!(meta["reasoning_effort"].as_str(), Some("high"));
assert!(meta.get(LEGACY_CODE_MODE_TOOL_NAMES_KEY).is_none());
assert!(meta.get(TOOL_NAMESPACES_INFO_KEY).is_none());