fix(compat-fallout): repoint 8 test files off dropped facade names (run_agent._DB_PERSISTED_MARKER/_EPHEMERAL_SCAFFOLDING_FLAGS/_is_ephemeral_scaffolding, cli.AIAgent, main._make_tui_argv/_print_curator_recent_run_notice/_format_time_ago, model_switch._collect_authed_provider_slugs, acp has_provider shim); arg_coercion test imports model_tools to populate registry
This commit is contained in:
@@ -34,7 +34,6 @@ class TestDetectProviderEntra:
|
||||
side_effect=_fake_runtime,
|
||||
):
|
||||
assert _acp_auth.detect_provider() == "azure-foundry"
|
||||
assert _acp_auth.has_provider() is True
|
||||
|
||||
def test_string_api_key_still_works(self):
|
||||
from acp_adapter import auth as _acp_auth
|
||||
|
||||
@@ -140,6 +140,8 @@ def test_parity_token_memo():
|
||||
def test_parity_persist_bounded_scan():
|
||||
print("=== parity: _flush_messages_to_session_db bounded scan ===")
|
||||
import run_agent as ra
|
||||
from agent.context_compressor import _DB_PERSISTED_MARKER
|
||||
from agent.session_persistence import _is_ephemeral_scaffolding
|
||||
|
||||
class FakeDB:
|
||||
def __init__(self):
|
||||
@@ -187,10 +189,10 @@ def test_parity_persist_bounded_scan():
|
||||
for lst in (la, lb):
|
||||
head = [dict(m) for m in lst[:3]]
|
||||
for m in head:
|
||||
m.pop(ra._DB_PERSISTED_MARKER, None)
|
||||
m.pop(_DB_PERSISTED_MARKER, None)
|
||||
tail = [dict(m) for m in lst[-4:]]
|
||||
for m in tail:
|
||||
m.pop(ra._DB_PERSISTED_MARKER, None)
|
||||
m.pop(_DB_PERSISTED_MARKER, None)
|
||||
lst[:] = head + [{"role": "user", "content": "SUMMARY"}] + tail
|
||||
A._db_flush_scan_prefix = None
|
||||
A._flush_messages_to_session_db_unlocked(la, None)
|
||||
@@ -232,15 +234,15 @@ def bench():
|
||||
flushed = copy.deepcopy(msgs)
|
||||
for m in flushed:
|
||||
if isinstance(m, dict):
|
||||
m[ra._DB_PERSISTED_MARKER] = True
|
||||
m[_DB_PERSISTED_MARKER] = True
|
||||
|
||||
def old_scan():
|
||||
for _idx, m in enumerate(flushed):
|
||||
if not isinstance(m, dict):
|
||||
continue
|
||||
if ra._is_ephemeral_scaffolding(m):
|
||||
if _is_ephemeral_scaffolding(m):
|
||||
continue
|
||||
if m.get(ra._DB_PERSISTED_MARKER):
|
||||
if m.get(_DB_PERSISTED_MARKER):
|
||||
continue
|
||||
|
||||
prefix = flushed[:]
|
||||
@@ -254,9 +256,9 @@ def bench():
|
||||
m = flushed[_idx]
|
||||
if not isinstance(m, dict):
|
||||
continue
|
||||
if ra._is_ephemeral_scaffolding(m):
|
||||
if _is_ephemeral_scaffolding(m):
|
||||
continue
|
||||
if m.get(ra._DB_PERSISTED_MARKER):
|
||||
if m.get(_DB_PERSISTED_MARKER):
|
||||
continue
|
||||
|
||||
pold = timeit(old_scan)
|
||||
|
||||
@@ -29,21 +29,22 @@ def _fresh_run_agent(hermes_home):
|
||||
|
||||
def test_verification_flags_registered_as_ephemeral(tmp_path, monkeypatch):
|
||||
monkeypatch.setenv("HERMES_HOME", str(tmp_path / ".hermes"))
|
||||
ra = _fresh_run_agent(tmp_path)
|
||||
_fresh_run_agent(tmp_path)
|
||||
from agent.session_persistence import _EPHEMERAL_SCAFFOLDING_FLAGS, _is_ephemeral_scaffolding
|
||||
|
||||
assert "_verification_stop_synthetic" in ra._EPHEMERAL_SCAFFOLDING_FLAGS
|
||||
assert "_pre_verify_synthetic" in ra._EPHEMERAL_SCAFFOLDING_FLAGS
|
||||
assert "_verification_stop_synthetic" in _EPHEMERAL_SCAFFOLDING_FLAGS
|
||||
assert "_pre_verify_synthetic" in _EPHEMERAL_SCAFFOLDING_FLAGS
|
||||
|
||||
# The nudge messages ARE scaffolding (they carry the synthetic flag).
|
||||
assert ra._is_ephemeral_scaffolding(
|
||||
assert _is_ephemeral_scaffolding(
|
||||
{"role": "user", "content": "[System: run tests]", "_pre_verify_synthetic": True}
|
||||
)
|
||||
assert ra._is_ephemeral_scaffolding(
|
||||
assert _is_ephemeral_scaffolding(
|
||||
{"role": "user", "content": "[System: run tests]", "_verification_stop_synthetic": True}
|
||||
)
|
||||
# Real messages (including the assistant candidate) are not.
|
||||
assert not ra._is_ephemeral_scaffolding({"role": "user", "content": "hi"})
|
||||
assert not ra._is_ephemeral_scaffolding({"role": "assistant", "content": "premature done"})
|
||||
assert not _is_ephemeral_scaffolding({"role": "user", "content": "hi"})
|
||||
assert not _is_ephemeral_scaffolding({"role": "assistant", "content": "premature done"})
|
||||
|
||||
|
||||
def _make_agent(ra, session_id, tmp_path):
|
||||
|
||||
@@ -31,12 +31,12 @@ def curator_env(tmp_path, monkeypatch, capsys):
|
||||
importlib.reload(hermes_constants)
|
||||
from agent import curator
|
||||
importlib.reload(curator)
|
||||
from hermes_cli import main as hermes_main
|
||||
importlib.reload(hermes_main)
|
||||
from hermes_cli import update_cmd_maint
|
||||
importlib.reload(update_cmd_maint)
|
||||
|
||||
yield {
|
||||
"curator": curator,
|
||||
"main": hermes_main,
|
||||
"main": update_cmd_maint,
|
||||
"capsys": capsys,
|
||||
}
|
||||
|
||||
|
||||
@@ -241,7 +241,8 @@ def test_init_agent_forwards_single_query_flag(monkeypatch):
|
||||
"ensure_mcp_discovery_before_agent_build",
|
||||
_fake_ensure,
|
||||
)
|
||||
monkeypatch.setattr(cli_mod, "AIAgent", lambda *_a, **_k: types.SimpleNamespace())
|
||||
import run_agent
|
||||
monkeypatch.setattr(run_agent, "AIAgent", lambda *_a, **_k: types.SimpleNamespace())
|
||||
|
||||
assert cli._init_agent() is True
|
||||
assert seen.get("single_query") is True
|
||||
@@ -269,7 +270,8 @@ def test_init_agent_defaults_to_interactive(monkeypatch):
|
||||
"ensure_mcp_discovery_before_agent_build",
|
||||
_fake_ensure,
|
||||
)
|
||||
monkeypatch.setattr(cli_mod, "AIAgent", lambda *_a, **_k: types.SimpleNamespace())
|
||||
import run_agent
|
||||
monkeypatch.setattr(run_agent, "AIAgent", lambda *_a, **_k: types.SimpleNamespace())
|
||||
|
||||
assert cli._init_agent() is True
|
||||
assert seen.get("single_query") is False
|
||||
|
||||
@@ -203,7 +203,7 @@ class TestNousPrefetch:
|
||||
|
||||
def test_nous_is_not_collected_for_prefetch(self, monkeypatch):
|
||||
import hermes_cli.auth as auth_mod
|
||||
import hermes_cli.model_switch as ms
|
||||
import hermes_cli.model_switch_providers as ms
|
||||
|
||||
monkeypatch.setattr(
|
||||
auth_mod, "_load_auth_store",
|
||||
|
||||
@@ -4695,11 +4695,11 @@ class TestPtyWebSocket:
|
||||
|
||||
|
||||
def test_resolve_chat_argv_injects_gateway_ws_url(monkeypatch):
|
||||
import hermes_cli.main as cli_main
|
||||
import hermes_cli.main_tui_launch as tui_launch
|
||||
import hermes_cli.web_server as ws
|
||||
|
||||
monkeypatch.setattr(
|
||||
cli_main,
|
||||
tui_launch,
|
||||
"_make_tui_argv",
|
||||
lambda *_args, **_kwargs: (["node", "fake-tui.js"], Path("/tmp")),
|
||||
)
|
||||
|
||||
@@ -8,6 +8,7 @@ against the tool's JSON Schema before dispatch.
|
||||
|
||||
from unittest.mock import patch
|
||||
|
||||
import model_tools # noqa: F401 — populates the tool registry the "real schema" tests read
|
||||
from tools.arg_coercion import (
|
||||
coerce_tool_args,
|
||||
_coerce_value,
|
||||
|
||||
Reference in New Issue
Block a user