Skip to content

DeepTutor: Lifelong Personalized Tutoring. https://deeptutor.info/.

fix(codex): expose Luna none reasoning effort

NoxsMedia3fcaa618bf96
diff --git a/deeptutor/services/codex_auth/catalog.py b/deeptutor/services/codex_auth/catalog.py
index b22f07c3d..a22efb08d 100644
--- a/deeptutor/services/codex_auth/catalog.py
+++ b/deeptutor/services/codex_auth/catalog.py
@@ -69,7 +69,8 @@ def parse_models_response(payload: Mapping[str, Any]) -> tuple[CodexModel, ...]:
visibility="list",
default_reasoning_level=_optional_string(raw_model.get("default_reasoning_level")),
supported_reasoning_levels=_reasoning_levels(
- raw_model.get("supported_reasoning_levels")
+ raw_model.get("supported_reasoning_levels"),
+ model_slug=slug,
),
supports_reasoning_summary=_summary_support(raw_model),
supports_parallel_tool_calls=(
@@ -94,18 +95,23 @@ def _optional_positive_int(value: object) -> int | None:
return value
-def _reasoning_levels(value: object) -> tuple[str, ...]:
- if not isinstance(value, list):
- return ()
+def _reasoning_levels(value: object, *, model_slug: str) -> tuple[str, ...]:
efforts: list[str] = []
- for item in value:
- effort: object
- if isinstance(item, dict):
- effort = item.get("effort")
- else:
- effort = item
- if isinstance(effort, str) and effort and effort not in efforts:
- efforts.append(effort)
+ if isinstance(value, list):
+ for item in value:
+ effort: object
+ if isinstance(item, dict):
+ effort = item.get("effort")
+ else:
+ effort = item
+ if isinstance(effort, str) and effort and effort not in efforts:
+ efforts.append(effort)
+
+ # The Codex catalog can lag the Luna API contract: ``none`` is accepted by
+ # the provider even when omitted here. Remove this compatibility entry once
+ # the catalog advertises it consistently.
+ if model_slug == "gpt-5.6-luna" and "none" not in efforts:
+ efforts.insert(0, "none")
return tuple(efforts)
diff --git a/tests/api/test_codex_oauth_scope.py b/tests/api/test_codex_oauth_scope.py
index 00d269c62..195e1e167 100644
--- a/tests/api/test_codex_oauth_scope.py
+++ b/tests/api/test_codex_oauth_scope.py
@@ -100,16 +100,24 @@ def test_an_ordinary_user_drives_their_own_codex_lifecycle(client, method, path)
assert service.calls, "the request must reach the owner-scoped service"
-def test_an_ordinary_user_sets_their_own_codex_reasoning_effort(client) -> None:
+ ("model", "reasoning_effort"),
+ [("gpt-5.6-sol", "high"), ("gpt-5.6-luna", "none")],
+)
+def test_an_ordinary_user_sets_their_own_codex_reasoning_effort(
+ client,
+ model: str,
+ reasoning_effort: str,
+) -> None:
test_client, service, _current = client
response = test_client.post(
"/api/settings/providers/openai-codex/models/reasoning-effort",
- json={"model": "gpt-5.6-sol", "reasoning_effort": "high"},
+ json={"model": model, "reasoning_effort": reasoning_effort},
)
assert response.status_code == 200
- assert service.calls == ["reasoning:gpt-5.6-sol:high"]
+ assert service.calls == [f"reasoning:{model}:{reasoning_effort}"]
@pytest.mark.parametrize(("method", "path"), CODEX_ROUTES)
diff --git a/tests/services/codex_auth/test_catalog.py b/tests/services/codex_auth/test_catalog.py
index 66fd56723..6d630e42a 100644
--- a/tests/services/codex_auth/test_catalog.py
+++ b/tests/services/codex_auth/test_catalog.py
@@ -77,6 +77,34 @@ def test_parse_catalog_keeps_only_picker_visible_raw_models() -> None:
assert models[0].supports_reasoning_summary is True
+def test_parse_catalog_adds_none_only_for_gpt_5_6_luna() -> None:
+ payload = {
+ "models": [
+ {
+ "slug": "gpt-5.6-luna",
+ "display_name": "GPT-5.6-Luna",
+ "visibility": "list",
+ "supported_reasoning_levels": ["low", "medium"],
+ },
+ {
+ "slug": "gpt-5.6-terra",
+ "display_name": "GPT-5.6-Terra",
+ "visibility": "list",
+ "supported_reasoning_levels": ["low", "medium"],
+ },
+ ]
+ }
+
+ models = {model.slug: model for model in parse_models_response(payload)}
+
+ assert models["gpt-5.6-luna"].supported_reasoning_levels == (
+ "none",
+ "low",
+ "medium",
+ )
+ assert models["gpt-5.6-terra"].supported_reasoning_levels == ("low", "medium")
+
+
def test_parse_catalog_supports_legacy_summary_field_and_sorts() -> None:
payload = {
"models": [
diff --git a/tests/services/codex_auth/test_service.py b/tests/services/codex_auth/test_service.py
index 91a80ea53..1086f3e86 100644
--- a/tests/services/codex_auth/test_service.py
+++ b/tests/services/codex_auth/test_service.py
@@ -770,6 +770,26 @@ async def test_owner_sets_supported_reasoning_effort_on_their_managed_model(
assert resolve_llm_runtime_config(catalog=catalog).reasoning_effort == "high"
+async def test_owner_persists_none_for_managed_luna(tmp_path: Path) -> None:
+ snapshot = _snapshot(
+ "live",
+ _model("gpt-5.6-luna", supported_reasoning_levels=("none", "low")),
+ )
+ service, model_catalog = _bound_reasoning_service(tmp_path, snapshot)
+ synced = model_catalog.load()
+ synced["services"]["llm"]["active_profile_id"] = CODEX_PROFILE_ID
+ synced["services"]["llm"]["active_model_id"] = codex_model_id("gpt-5.6-luna")
+ model_catalog.save(synced)
+
+ status = await service.set_reasoning_effort("gpt-5.6-luna", "none")
+
+ model = _managed_profile(model_catalog.load())["models"][0]
+ assert model["reasoning_effort"] == "none"
+ assert status["models"][0]["reasoning_effort"] == "none"
+ assert resolve_llm_runtime_config(catalog=model_catalog.load()).reasoning_effort == "none"
+
+
@pytest.mark.asyncio
async def test_runtime_validation_accepts_any_effort_for_a_bound_model(tmp_path: Path) -> None:
"""Effort is a per-request knob, not part of what binds a config to a token.
diff --git a/tests/services/llm/test_openai_codex_oauth_provider.py b/tests/services/llm/test_openai_codex_oauth_provider.py
index ea8180236..172ff0398 100644
--- a/tests/services/llm/test_openai_codex_oauth_provider.py
+++ b/tests/services/llm/test_openai_codex_oauth_provider.py
@@ -52,8 +52,14 @@ class FakeCodexService:
@pytest.mark.asyncio
-async def test_provider_uses_deeptutor_token_service_and_raw_sol_id(
+ ("model_slug", "reasoning_effort"),
+ [("gpt-5.6-sol", "medium"), ("gpt-5.6-luna", "none")],
+)
+async def test_provider_uses_deeptutor_token_service_and_raw_model_id(
monkeypatch: pytest.MonkeyPatch,
+ model_slug: str,
+ reasoning_effort: str,
) -> None:
service = FakeCodexService()
requests: list[tuple[str, dict[str, str], dict[str, Any]]] = []
@@ -81,8 +87,8 @@ async def test_provider_uses_deeptutor_token_service_and_raw_sol_id(
],
}
],
- model="openai-codex/gpt-5.6-sol",
- reasoning_effort="medium",
+ model=f"openai-codex/{model_slug}",
+ reasoning_effort=reasoning_effort,
tools=[
{
"type": "function",
@@ -99,12 +105,12 @@ async def test_provider_uses_deeptutor_token_service_and_raw_sol_id(
assert result.finish_reason == "stop"
assert service.token_calls == 1
assert service.guard_entries == 1
- assert service.runtime_validations == [(service.token, "gpt-5.6-sol", "medium")]
+ assert service.runtime_validations == [(service.token, model_slug, reasoning_effort)]
assert url == CODEX_RESPONSES_URL
assert headers["Authorization"] == "Bearer test-access-token"
assert headers["chatgpt-account-id"] == "account-123"
- assert body["model"] == "gpt-5.6-sol"
- assert body["reasoning"] == {"effort": "medium"}
+ assert body["model"] == model_slug
+ assert body["reasoning"] == {"effort": reasoning_effort}
assert body["tools"][0]["name"] == "lookup"
assert body["input"] == [
{
diff --git a/web/tests/reasoning-effort.test.ts b/web/tests/reasoning-effort.test.ts
index bfef7c9c4..26a1980a5 100644
--- a/web/tests/reasoning-effort.test.ts
+++ b/web/tests/reasoning-effort.test.ts
@@ -157,6 +157,12 @@ test("managed profiles use only the provider-supported reasoning levels", () =>
]).map((option) => option.value),
["", "high", "medium"],
);
+ assert.deepEqual(
+ reasoningEffortOptionsFromSupportedLevels(["none", "low", "none"]).map(
+ (option) => option.value,
+ ),
+ ["", "none", "low"],
+ );
});
test("Auto removes the catalog field instead of persisting an empty string", () => {