Skip to content

The agent that grows with you

fix(codex): send the base slug for -900k picker variants to the app-server

kshitijk4poor922eb16da7e6
diff --git a/agent/codex_runtime.py b/agent/codex_runtime.py
index c2c2862a796..8c7cd95c4fc 100644
--- a/agent/codex_runtime.py
+++ b/agent/codex_runtime.py
@@ -534,6 +534,14 @@ def _start_codex_thread(agent) -> str:
return agent._codex_session.ensure_started()
+def _codex_wire_model(agent) -> str | None:
+ """The slug codex should run: ``-900k`` picker variants are Hermes-side aliases the backend rejects
+ ("not supported when using Codex with a ChatGPT account"); codex already applies the catalog's
+ extended window to the base slug itself."""
+ from agent.model_metadata import strip_codex_context_variant_suffix
+ return strip_codex_context_variant_suffix(getattr(agent, "model", None)) or None
+
+
def _ensure_codex_session(agent, messages: List[Dict[str, Any]] | None = None) -> None:
"""Lazily spawn one CodexAppServerSession per AIAgent (reused across turns, closed by the _cleanup hook).
A live session whose thread was started with a different prompt composition (TUI/Desktop ``/personality``
@@ -594,7 +602,7 @@ def _ensure_codex_session(agent, messages: List[Dict[str, Any]] | None = None) -
request_routing=_ServerRequestRouting(auto_approve_exec=auto_approve_requests, auto_approve_apply_patch=auto_approve_requests),
on_event=make_codex_app_server_event_bridge(agent),
developer_instructions=developer_instructions or None,
- model=getattr(agent, "model", None), model_provider=model_provider,
+ model=_codex_wire_model(agent), model_provider=model_provider,
resume_thread_id=resume_thread_id, history_seed=history_seed,
)
diff --git a/tests/agent/transports/test_codex_app_server_session.py b/tests/agent/transports/test_codex_app_server_session.py
index 14c3fc89808..c47a456f82a 100644
--- a/tests/agent/transports/test_codex_app_server_session.py
+++ b/tests/agent/transports/test_codex_app_server_session.py
@@ -227,6 +227,9 @@ class TestLifecycle:
assert thread_start_params(provider="openai-codex", requested_provider="openai-codex", model="gpt-5.4") == {
**base, "model": "gpt-5.4"}
assert thread_start_params(provider="custom", requested_provider="custom", model="gpt-5.4") == {**base, "model": "gpt-5.4"}
+ # ``-900k`` is a Hermes-side alias the backend rejects; codex gets the base slug.
+ assert thread_start_params(provider="openai-codex", requested_provider="openai-codex",
+ model="gpt-5.6-sol-900k")["model"] == "gpt-5.6-sol"
def test_stored_thread_is_resumed_and_an_unresumable_one_falls_back_to_a_fresh_start(self):
"""#100531: a stored id goes out as ``thread/resume`` (same params as thread/start, never a