from pathlib import Path def test_agent_graph_does_not_tombstone_new_active_transaction_on_stale_terminal_status(): source = Path('app/workflows/agent_graph.py').read_text(encoding='utf-8') assert 'active_transaction_pending' in source assert 'and not active_transaction_pending' in source assert '"AWAITING_CONFIRMATION"' in source def test_terminal_reset_still_exists_when_no_active_pending_transaction(): source = Path('app/workflows/agent_graph.py').read_text(encoding='utf-8') assert '"COMPLETED", "FAILED", "CANCELLED", "BLOCKED", "OUT_OF_SCOPE"' in source assert 'reset_operational_context' in source def test_pending_confirmation_is_live_state_even_without_rehydrated_active_transaction(): source = Path('app/workflows/agent_graph.py').read_text(encoding='utf-8') assert 'pending_confirmation' in source assert 'state["transaction_status"] = "AWAITING_CONFIRMATION"' in source assert 'state["active_transaction"] = active_tx' in source