fix(agents): only models that send progress updates read thinking as progress

This commit is contained in:
hh committed 2026-09-22 20:53:05 +02:00
1 parent 120985deab
commit 1d1285de46
2 files changed
+28 -6

No files matched your search

+7 -3
View File
@@ -17,7 +17,10 @@ from beaver_gateway.agents.policy import PolicyRule # noqa: TC001
from beaver_gateway.agents.prompts import PromptSource # noqa: TC001 from beaver_gateway.agents.prompts import PromptSource # noqa: TC001
from beaver_gateway.conversations.kinds import KINDS, Kind from beaver_gateway.conversations.kinds import KINDS, Kind
__all__ = ["ClaudeAgent", "ClaudeOptions", "Prompts", "SkillSets"] __all__ = ["PROGRESS_MODELS", "ClaudeAgent", "ClaudeOptions", "Prompts", "SkillSets"]
PROGRESS_MODELS = frozenset({"claude-opus-5-5", "claude-fable-5-1"})
"""Models whose non-empty thinking is the text written between tool calls."""
class ClaudeOptions(BaseModel): class ClaudeOptions(BaseModel):
@@ -123,8 +126,9 @@ class ClaudeAgent(BaseAgent):
@property @property
def thinking_is_progress(self) -> bool: def thinking_is_progress(self) -> bool:
"""Reasoning arrives empty unless ``display`` is ``summarized``.""" """A progress model, unless ``display: summarized`` brings reasoning."""
return (self.options.thinking or {}).get("display") != "summarized" summarized = (self.options.thinking or {}).get("display") == "summarized"
return self.model in PROGRESS_MODELS and not summarized
def prompt_for(self, kind: Kind) -> tuple[PromptSource, ...] | None: def prompt_for(self, kind: Kind) -> tuple[PromptSource, ...] | None:
return self.prompts.for_kind(kind) return self.prompts.for_kind(kind)
+21 -3
View File
@@ -767,9 +767,28 @@ def test_read_conversation_keeps_progress_and_drops_reasoning() -> None:
) )
def test_only_claude_agents_read_their_thinking_as_progress(tmp_path: Path) -> None: @pytest.mark.parametrize(
("model", "expected"),
[
("claude-opus-5-5", True),
("claude-fable-5-1", True),
("claude-opus-5", False),
("claude-sonnet-5", False),
("claude-haiku-4-5-20251001", False),
("claude-next-unknown", False),
],
)
def test_only_progress_models_read_their_thinking_as_progress(
tmp_path: Path, model: str, expected: bool
) -> None:
assert (
ClaudeAgent(name="c", model=model, cwd=tmp_path).thinking_is_progress
is expected
)
def test_summarized_display_and_raycast_are_never_progress(tmp_path: Path) -> None:
raycast = RaycastAgent(name="r", model="google-gemini-3.1-pro", system_prompt="") raycast = RaycastAgent(name="r", model="google-gemini-3.1-pro", system_prompt="")
claude = ClaudeAgent(name="c", model="claude-opus-5-5", cwd=tmp_path)
summarized = ClaudeAgent( summarized = ClaudeAgent(
name="s", name="s",
model="claude-opus-5-5", model="claude-opus-5-5",
@@ -777,7 +796,6 @@ def test_only_claude_agents_read_their_thinking_as_progress(tmp_path: Path) -> N
options=ClaudeOptions(thinking={"type": "adaptive", "display": "summarized"}), options=ClaudeOptions(thinking={"type": "adaptive", "display": "summarized"}),
) )
assert not raycast.thinking_is_progress assert not raycast.thinking_is_progress
assert claude.thinking_is_progress
assert not summarized.thinking_is_progress assert not summarized.thinking_is_progress