mirror of
https://github.com/nesquena/hermes-webui.git
synced 2026-07-16 20:50:18 +00:00
fix(#4130): coerce stale 'max' in get_reasoning_status read path too (Codex catch)
get_reasoning_status() returned the raw config reasoning_effort, so a stale saved 'max' surfaced on boot/status/chip even though streaming coerces it to xhigh. Now routes the status value through coerce_reasoning_effort_for_model() with the resolved model/provider/base_url, so all read paths agree. Added a stale-max->xhigh status regression test.
This commit is contained in:
+10
-1
@@ -2734,7 +2734,16 @@ def get_reasoning_status(
|
||||
return {
|
||||
# Match CLI default (True if unset in config.yaml)
|
||||
"show_reasoning": bool(show_raw) if isinstance(show_raw, bool) else True,
|
||||
"reasoning_effort": str(effort_raw or "").strip().lower(),
|
||||
# Report the COERCED effort (not the raw config value) so boot/status/chip
|
||||
# read paths agree with what streaming actually sends — e.g. a stale
|
||||
# `reasoning_effort: max` surfaces as `xhigh`, not the now-unsupported `max`.
|
||||
# (Codex review of the drop-max alignment.)
|
||||
"reasoning_effort": coerce_reasoning_effort_for_model(
|
||||
str(effort_raw or "").strip().lower(),
|
||||
resolve_model,
|
||||
provider_id=resolve_provider,
|
||||
base_url=resolve_base_url,
|
||||
),
|
||||
"supported_efforts": supported_efforts,
|
||||
"supports_reasoning_effort": bool(supported_efforts),
|
||||
}
|
||||
|
||||
@@ -140,3 +140,20 @@ def test_get_reasoning_status_for_reasoning_capable_model_has_no_max():
|
||||
assert status["supported_efforts"] == ["minimal", "low", "medium", "high", "xhigh"]
|
||||
assert status["supports_reasoning_effort"] is True
|
||||
assert "max" not in status["supported_efforts"]
|
||||
|
||||
|
||||
def test_get_reasoning_status_coerces_stale_max_to_xhigh(monkeypatch):
|
||||
"""A previously-saved `agent.reasoning_effort: max` (no longer a valid effort)
|
||||
must be reported as the coerced `xhigh`, not the raw stale `max`, so the
|
||||
boot/status/chip read paths agree with what streaming actually sends."""
|
||||
monkeypatch.setattr(
|
||||
cfg,
|
||||
"_load_yaml_config_file",
|
||||
lambda *a, **k: {"agent": {"reasoning_effort": "max"}},
|
||||
)
|
||||
status = cfg.get_reasoning_status(
|
||||
model_id="gpt-5.5",
|
||||
provider_id="openai-codex",
|
||||
)
|
||||
assert status["reasoning_effort"] == "xhigh"
|
||||
assert status["reasoning_effort"] != "max"
|
||||
|
||||
Reference in New Issue
Block a user