Add experimental context management activation (#42385)

## What changed

- Add the under-development `features.context_management.experimental_mode` configuration and schema.
- For eligible ChatGPT Plus, Pro, and Pro Lite sessions using the Codex backend, enable token-budget context, history notes, and the `new_context` tool when experimental context management is configured.
- Keep the feature disabled for custom providers, provider credentials, non-Codex endpoints, and temporary structured threads.

## Testing

- Cover subscription eligibility, backend restrictions, configuration resolution, token-budget guidance, and temporary-thread overrides.

GitOrigin-RevId: 19402af19c4d69e09a7cdb3687ee7d233f6a562a
This commit is contained in:
pmccrary-oai authored and copyberry committed 2026-09-02 23:37:39 +00:00
1 parent 312709252d
commit cff76fa96f
11 files changed
+236 -16

No files matched your search

@@ -407,7 +407,7 @@ async fn temporary_recap_threads_disable_memories_and_remote_mcp_servers() -> Re
let codex_home = tempdir()?;
std::fs::write(
codex_home.path().join("config.toml"),
"[mcp_servers.filesystem]\ncommand = 'true'\n",
"features.context_management.experimental_mode = true\n[mcp_servers.filesystem]\ncommand = 'true'\n",
)?;
app.config.codex_home = codex_home.path().to_path_buf().abs();
app.config.sqlite = codex_state::SqliteConfig::new_for_testing(codex_home.path().abs());
@@ -433,6 +433,7 @@ async fn temporary_recap_threads_disable_memories_and_remote_mcp_servers() -> Re
let starts = recorded_params(&requests, "thread/start");
assert_eq!(starts.len(), 1);
assert_eq!(starts[0]["config"]["features.memories"], false);
assert_eq!(starts[0]["config"]["features.context_management"], false);
assert!(starts[0]["config"].get("features.memory_tool").is_none());
assert_eq!(
starts[0]["config"]["mcp_servers"]["filesystem"]["enabled"],