mirror of
https://github.com/openswarm-ai/openswarm.git
synced 2026-10-01 05:54:56 +02:00
[eric] browser: a clean success needs an explicit Done; recognize gather asks, steer them to BrowserExtract
This commit is contained in:
@@ -267,6 +267,21 @@ def test_done_tool_success_false_marks_not_done(monkeypatch):
|
||||
assert "login wall" in result["summary"]
|
||||
|
||||
|
||||
def test_run_that_never_calls_done_is_not_a_clean_success(monkeypatch):
|
||||
# A run that does real work but stops with plain text (never calls Done) is a
|
||||
# half-finish, not a clean success: done must be False so the fast path recovers
|
||||
# instead of shipping a silent stop (the 'Task completed.' that wasn't).
|
||||
BH._browser_history.clear(); BH._domain_notes.clear()
|
||||
primary = FakeLLM([
|
||||
Resp([_rp("click it"), _tu("BrowserClickIndex", index=3)]),
|
||||
Resp([Blk("text", "I clicked the thing.")], stop_reason="end_turn"),
|
||||
])
|
||||
aux = FakeAux()
|
||||
_install(monkeypatch, primary, aux)
|
||||
result = asyncio.run(BA.run_browser_agent(task="open the settings page", browser_id="b1", model="sonnet"))
|
||||
assert result.get("done") is False # no explicit Done -> not a clean success
|
||||
|
||||
|
||||
def test_early_perception_is_not_cut_short_before_any_action(monkeypatch):
|
||||
# Orienting on a cold/slow page can take several look-only turns; the stall
|
||||
# backstop must NOT fire before the agent has done anything (it only bounds a
|
||||
@@ -1402,6 +1417,16 @@ def test_informational_gate_strips_outcome_boilerplate_on_tie_break():
|
||||
assert deliverable_is_informational(listy, "")
|
||||
|
||||
|
||||
def test_find_me_and_most_viewed_asks_are_informational():
|
||||
from backend.apps.agents.browser.browser_loop import deliverable_is_informational
|
||||
# the exact MKBHD task that previously slipped past the gate ("find me" + "most viewed")
|
||||
assert deliverable_is_informational("", "find me his 50 most viewed vids")
|
||||
assert deliverable_is_informational("", "show me the top 10 trending repos")
|
||||
assert deliverable_is_informational("", "look up the cheapest flight")
|
||||
# a pure action ask still is not informational
|
||||
assert not deliverable_is_informational("", "send Tyler a message saying hi")
|
||||
|
||||
|
||||
def test_interstitial_dismiss_target_generalizable_and_safe():
|
||||
from backend.apps.agents.browser.browser_loop import interstitial_dismiss_target
|
||||
# a junk popup with a throwaway-dismiss control gets found (any site)
|
||||
|
||||
Reference in New Issue
Block a user