Skip to content

Dodaios is an open-source agent OS for your desktop: it runs your coding agents, browser and apps by voice or chat, on your own machine. Formerly Personal Jarvis.

fix(core): admit the reasoning-effort levels callers already pass

Ruben Lütkeedd24e7fd652
diff --git a/jarvis/core/protocols.py b/jarvis/core/protocols.py
index eab7d1e0f3..53f4be3998 100644
--- a/jarvis/core/protocols.py
+++ b/jarvis/core/protocols.py
@@ -96,9 +96,18 @@ class BrainRequest:
# internal reasoning for THIS call — used by small deterministic
# structured-output calls (Computer-Use actions/judges) where thinking
# would eat the whole ``max_tokens`` budget and truncate the visible
- # reply. ``None`` keeps the provider default; providers without a
- # reasoning knob ignore the field (capability hint, never a hard switch).
- reasoning_effort: Literal["none"] | None = None
+ # reply. The graded levels serve callers whose OUTPUT is the product: the
+ # Agentic IDE's prompt composer passes "medium" because turning a spoken
+ # sentence plus a set of file outlines into a briefed task is judgement
+ # work, and "none" is what once made it a mere rephraser.
+ # ``None`` keeps the provider default; providers without a reasoning knob
+ # ignore the field (capability hint, never a hard switch).
+ #
+ # The graded levels were added 2026-07-26: the composer had been passing
+ # "medium" into a field declared to accept only "none" since it was
+ # written, which survived only because nothing validates this. An
+ # annotation that is wrong is worse than none — the next caller trusts it.
+ reasoning_effort: Literal["none", "low", "medium", "high"] | None = None
@dataclass(frozen=True, slots=True)
diff --git a/tests/unit/core/test_brain_request_reasoning_effort.py b/tests/unit/core/test_brain_request_reasoning_effort.py
new file mode 100644
index 0000000000..c7c39d55bd
--- /dev/null
+++ b/tests/unit/core/test_brain_request_reasoning_effort.py
@@ -0,0 +1,35 @@
+"""The reasoning-effort field must admit the values callers actually pass.
+
+Found while wiring the Agentic IDE writer: the composer has been passing
+"medium" since it was written, into a field declared to accept only "none". It
+survives only because nothing validates it — the annotation is documentation
+that is wrong, and the next person to trust it writes a bug.
+"""
+from __future__ import annotations
+
+import typing
+
+from jarvis.core.protocols import BrainRequest
+
+
+def test_declared_values_cover_every_level_in_use() -> None:
+ hints = typing.get_type_hints(BrainRequest)
+ literal = typing.get_args(typing.get_args(hints["reasoning_effort"])[0])
+ assert {"none", "low", "medium", "high"} <= set(literal)
+
+
+def test_medium_is_accepted_by_the_agentic_ide_composer() -> None:
+ """The composer's live value: judgement work, not transcription."""
+ request = BrainRequest(messages=(), reasoning_effort="medium")
+ assert request.reasoning_effort == "medium"
+
+
+def test_none_still_means_disable_thinking() -> None:
+ """The original meaning must survive the widening — structured-output
+ callers rely on it to keep thinking from eating their token budget."""
+ request = BrainRequest(messages=(), reasoning_effort="none")
+ assert request.reasoning_effort == "none"
+
+
+def test_unset_stays_the_provider_default() -> None:
+ assert BrainRequest(messages=()).reasoning_effort is None