From 164956965e2d79de34fac7850eae0505f6d286d1 Mon Sep 17 00:00:00 2001 From: ciregenz Date: Mon, 24 Aug 2026 23:15:03 -0700 Subject: [PATCH] [eric] tests: follow the code the file splits moved, without loosening any assertion Co-Authored-By: Claude Opus 5 (1M context) Claude-Session: https://claude.ai/code/session_018foyDoK19jjbYdudfzQVkZ --- backend/tests/test_every_error_carries_an_envelope.py | 6 ++++-- backend/tests/test_user_stop_is_final.py | 9 +++++---- 2 files changed, 9 insertions(+), 6 deletions(-) diff --git a/backend/tests/test_every_error_carries_an_envelope.py b/backend/tests/test_every_error_carries_an_envelope.py index 082a7b53..1ea1ca55 100644 --- a/backend/tests/test_every_error_carries_an_envelope.py +++ b/backend/tests/test_every_error_carries_an_envelope.py @@ -46,7 +46,9 @@ def test_the_cli_missing_class_specifically_is_covered(): def test_silent_quit_diagnostic_carries_a_full_envelope(): """A silent quit is the hardest class to diagnose later, so it must not ship envelope-less. Found live: empty_finish_nudge was the ONE family writing only kind/model/session_id.""" - import backend.apps.agents.manager.run.empty_finish as ef - src = inspect.getsource(ef.maybe_nudge_empty_finish) if hasattr(ef, "maybe_nudge_empty_finish") else inspect.getsource(ef) + # The telemetry moved next door when empty_finish.py crossed the 300-line ceiling; the assertion + # is about the ENVELOPE, so it follows the code rather than pinning a file name. + import backend.apps.agents.manager.run.empty_finish_telemetry as ef + src = inspect.getsource(ef.report_nudge) assert "build_envelope" in src, "empty_finish_nudge must attach a flight envelope" assert '"flight"' in src, "the envelope must ride under the standard 'flight' key" diff --git a/backend/tests/test_user_stop_is_final.py b/backend/tests/test_user_stop_is_final.py index 68e1e75b..16cf5197 100644 --- a/backend/tests/test_user_stop_is_final.py +++ b/backend/tests/test_user_stop_is_final.py @@ -16,6 +16,7 @@ from backend.apps.agents.agents import close_session as user_close_route from backend.apps.agents.agents import stop_agent as user_stop_route from backend.apps.agents.core.models import AgentSession from backend.apps.agents.manager.streaming import unwedge_sidecar +from backend.apps.agents.manager.streaming import delegation_watchdog def p_live(name="t") -> AgentSession: @@ -58,7 +59,7 @@ def test_a_user_stopped_parent_is_never_a_lost_result(): child.status = "stopped" agent_manager.sessions[child.id] = child asyncio.run(user_stop_route(parent.id)) - assert unwedge_sidecar.delegation_children_settled(parent.id, 0.0) is False + assert delegation_watchdog.delegation_children_settled(parent.id, 0.0) is False def test_a_genuinely_lost_result_still_settles(): @@ -70,7 +71,7 @@ def test_a_genuinely_lost_result_still_settles(): child.parent_session_id = parent.id child.status = "completed" agent_manager.sessions[child.id] = child - assert unwedge_sidecar.delegation_children_settled(parent.id, 0.0) is True + assert delegation_watchdog.delegation_children_settled(parent.id, 0.0) is True # --- DOOR 2: a machine send into a stopped or closed session ------------------------------------- @@ -81,7 +82,7 @@ def test_the_watchdog_resend_cannot_restart_a_user_stopped_session(): asyncio.run(user_stop_route(s.id)) started, real = p_spy_loop() try: - asyncio.run(unwedge_sidecar.force_recover(s.id, s)) + asyncio.run(delegation_watchdog.force_recover(s.id, s)) finally: agent_manager.run_agent_loop = real assert started == [] @@ -93,7 +94,7 @@ def test_the_watchdog_resend_still_fires_on_a_session_nobody_stopped(): s = p_live() started, real = p_spy_loop() try: - asyncio.run(unwedge_sidecar.force_recover(s.id, s)) + asyncio.run(delegation_watchdog.force_recover(s.id, s)) finally: agent_manager.run_agent_loop = real assert started == [s.id]