Skip to content

The agent that grows with you

Revert "fix(agent): preserve local reasoning timeout opt-out"

Teknium587ad8748f9a
diff --git a/run_agent.py b/run_agent.py
index 7bfc418249d..b46cf9fdd16 100644
--- a/run_agent.py
+++ b/run_agent.py
@@ -1423,14 +1423,14 @@ class AIAgent:
# (Nemotron 3 Ultra, OpenAI o1/o3, Anthropic Opus 4.x thinking,
# DeepSeek R1, Qwen QwQ, xAI Grok reasoning, etc.) whose cloud
# gateways idle-kill before the model's thinking phase ends.
- # This is still an implicit default: only the model name selected the
- # value. Preserve that distinction so a local endpoint keeps the
- # existing no-watchdog behavior unless the user explicitly configures
- # a stale timeout. Cloud endpoints still use the finite floor below.
+ # uses_implicit_default is False here so the local-endpoint
+ # short-circuit in _compute_non_stream_stale_timeout does not
+ # disable stale detection for users running reasoning models on a
+ # local NIM endpoint.
from agent.reasoning_timeouts import get_reasoning_stale_timeout_floor
reasoning_floor = get_reasoning_stale_timeout_floor(self.model)
if reasoning_floor is not None:
- return reasoning_floor, True
+ return reasoning_floor, False
return 90.0, True
diff --git a/tests/agent/test_reasoning_stale_timeout_floor.py b/tests/agent/test_reasoning_stale_timeout_floor.py
index 497a512ba74..716c614dbe8 100644
--- a/tests/agent/test_reasoning_stale_timeout_floor.py
+++ b/tests/agent/test_reasoning_stale_timeout_floor.py
@@ -20,9 +20,10 @@ These tests pin the floor's behavior:
``run_agent.py:AIAgent._resolved_api_call_stale_timeout_base``
consults the floor at priority 4 (after explicit user config,
provider config, and env var; before the 90s default), and
- keeps it implicit so the local-endpoint short-circuit in
- ``_compute_non_stream_stale_timeout`` remains active. Explicitly configured
- local timeouts and cloud reasoning-model floors remain finite.
+ returns ``uses_implicit_default=False`` so the local-endpoint
+ short-circuit in ``_compute_non_stream_stale_timeout`` does not
+ disable stale detection for a reasoning model running on a local
+ NIM endpoint.
3. The stream stale-timeout resolution (mirrored here as in
``test_stream_read_timeout_floor.py`` because the real builder
lives inside a worker thread) consults the floor after the
@@ -152,72 +153,6 @@ def test_non_reasoning_model_keeps_default(monkeypatch, tmp_path):
assert implicit is True
-def test_automatic_reasoning_floor_preserves_local_nonstream_opt_out(
- monkeypatch, tmp_path
-):
- """An automatic model floor must not look like an explicit user timeout."""
- monkeypatch.setenv("HERMES_HOME", str(tmp_path))
- monkeypatch.delenv("HERMES_API_CALL_STALE_TIMEOUT", raising=False)
- _write_config(tmp_path, "")
-
- import run_agent
- monkeypatch.setattr(run_agent, "get_provider_stale_timeout", lambda *a, **k: None)
-
- agent = _make_agent(
- tmp_path,
- provider="openai-api",
- base_url="http://localhost:5001/v1",
- model="Qwen3.8-27B",
- )
-
- base, implicit = agent._resolved_api_call_stale_timeout_base()
- assert base == 180.0
- assert implicit is True
- assert agent._compute_non_stream_stale_timeout(
- {"messages": [{"role": "user", "content": "analyze this program"}]}
- ) == float("inf")
-
-
-def test_automatic_reasoning_floor_remains_finite_for_cloud_endpoint(
- monkeypatch, tmp_path
-):
- """The local opt-out must not disable the same floor for hosted models."""
- monkeypatch.setenv("HERMES_HOME", str(tmp_path))
- monkeypatch.delenv("HERMES_API_CALL_STALE_TIMEOUT", raising=False)
- _write_config(tmp_path, "")
-
- import run_agent
- monkeypatch.setattr(run_agent, "get_provider_stale_timeout", lambda *a, **k: None)
-
- agent = _make_agent(
- tmp_path,
- provider="openai-api",
- base_url="https://models.example.com/v1",
- model="Qwen3.8-27B",
- )
-
- assert agent._compute_non_stream_stale_timeout({"messages": []}) == 180.0
-
-
-def test_explicit_local_reasoning_timeout_remains_finite(monkeypatch, tmp_path):
- """A user-configured local timeout must continue to override the opt-out."""
- monkeypatch.setenv("HERMES_HOME", str(tmp_path))
- monkeypatch.delenv("HERMES_API_CALL_STALE_TIMEOUT", raising=False)
- _write_config(tmp_path, "")
-
- import run_agent
- monkeypatch.setattr(run_agent, "get_provider_stale_timeout", lambda *a, **k: 420.0)
-
- agent = _make_agent(
- tmp_path,
- provider="openai-api",
- base_url="http://localhost:5001/v1",
- model="Qwen3.8-27B",
- )
-
- assert agent._compute_non_stream_stale_timeout({"messages": []}) == 420.0
-
-
# ── stream-side mirror (the real builder lives in a worker thread) ────────