mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-08-24 21:42:22 +02:00
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_014wtspwSFzZmjCx9UNPAorQ
23 lines
913 B
Python
23 lines
913 B
Python
"""ENG-371: the browser loop must continue on a tool_use BLOCK, never on the router's stop_reason.
|
|
|
|
Wire-captured 2026-08-20: 9router stamps every Codex tool call stop_reason='end_turn' (6/6). The
|
|
old check `if response.stop_reason != "tool_use": break` therefore ended every ChatGPT-sub browser
|
|
child before its first tool ran. This pins the decision to the reply's content.
|
|
"""
|
|
|
|
import ast
|
|
import pathlib
|
|
|
|
SRC = pathlib.Path("backend/apps/agents/browser/browser_agent.py").read_text()
|
|
|
|
|
|
def test_the_loop_no_longer_keys_on_stop_reason():
|
|
"""A structural pin: the only remaining mention of stop_reason in the loop must not be a break
|
|
condition. If someone reintroduces the label check, this fails before any drill has to."""
|
|
assert 'if response.stop_reason != "tool_use":' not in SRC
|
|
assert "if not tool_uses:\n break" in SRC
|
|
|
|
|
|
def test_the_file_still_parses():
|
|
ast.parse(SRC)
|