Python
Fix session auto-titling on plan-backed sessions
Rohit C Prasad5c8a60e7ee38
diff --git a/coworker/providers/codex_provider.py b/coworker/providers/codex_provider.pyindex e180c1d6..7fe9010f 100644--- a/coworker/providers/codex_provider.py+++ b/coworker/providers/codex_provider.py@@ -87,6 +87,13 @@ class CodexProvider(OpenAIResponsesProvider):kwargs = super()._request_kwargs(model=model, messages=messages, tools=tools, settings=settings)+ # This backend 400s ("Unsupported parameter") on standard sampling/cap knobs —+ # max_output_tokens and temperature confirmed live, top_p same family — which+ # silently killed every autotitle attempt on plan sessions (owner catch+ # 2026-08-24). Callers may pass them freely; they just cannot ride to this+ # backend.+ for unsupported in ("max_output_tokens", "temperature", "top_p"):+ kwargs.pop(unsupported, None)# Unlike stock /v1/responses, this backend honors a reasoning effort knob.effort = settings.get("reasoning_effort")if isinstance(effort, str) and effort:diff --git a/coworker/server/manager.py b/coworker/server/manager.pyindex c70790f7..69afe258 100644--- a/coworker/server/manager.py+++ b/coworker/server/manager.py@@ -5156,7 +5156,10 @@ class SessionManager:# A failed title must never surface as a session error — but it must# not be invisible either (a silent provider 400 hid the max_tokens# rejection for a whole owner test pass, 2026-07-20).- logger.debug("autotitle failed for %s", session_id, exc_info=True)+ # warning, not debug: debug was invisible in packaged builds, which re-hid+ # exactly the class of failure this comment warns about (2026-08-24: the plan+ # backend 400-ing on max_output_tokens went unseen for a whole test pass).+ logger.warning("autotitle failed for %s", session_id, exc_info=True)finally:self._autotitle_inflight.discard(session_id)diff --git a/tests/test_codex_provider.py b/tests/test_codex_provider.pyindex 89abe6aa..3c0e0e3f 100644--- a/tests/test_codex_provider.py+++ b/tests/test_codex_provider.py@@ -563,3 +563,23 @@ async def test_manager_signin_failure_lands_in_status(tmp_path, monkeypatch):status = client.get("/v1/providers/openai-codex/status").json()assert "1455" in status["last_error"]assert status["authorizing"] is False+++def test_request_strips_backend_unsupported_params(tmp_path):+ # The plan backend 400s on standard sampling/cap knobs ("Unsupported parameter:+ # max_output_tokens" / "temperature") — which silently killed every autotitle attempt+ # on plan sessions (owner catch 2026-08-24). The provider strips them; the reasoning+ # effort knob still rides.+ from coworker.secrets import SecretStore++ provider = CodexProvider(secrets=SecretStore(tmp_path / "s.json"))+ kwargs = provider._request_kwargs(+ model="gpt-5.6-sol",+ messages=[{"role": "user", "content": "hi"}],+ tools=None,+ settings={"max_tokens": 64, "temperature": 0.2, "top_p": 0.9, "reasoning_effort": "none"},+ )+ assert "max_output_tokens" not in kwargs+ assert "temperature" not in kwargs+ assert "top_p" not in kwargs+ assert kwargs["reasoning"]["effort"] == "none"