Skip to content

The agent that grows with you

fix(tools): keep PreDialError a ValueError, as the pre-dial refusals it wraps

Teknium79fe8f07e55b
diff --git a/tests/tools/test_bot_legacy_producer.py b/tests/tools/test_bot_legacy_producer.py
index 0cea065e57b..e32e212628a 100644
--- a/tests/tools/test_bot_legacy_producer.py
+++ b/tests/tools/test_bot_legacy_producer.py
@@ -1,11 +1,11 @@
"""A stale owner advertisement must never create another execution queue."""
import pytest
-from tools.bot_live_delivery import PreDialError, deliver_to_live_owner
+from tools.bot_live_delivery import deliver_to_live_owner
def test_legacy_owner_requires_a_live_authority_before_admission(tmp_path):
owner = dict(profile_home=str(tmp_path), session_id='legacy', lease_id='dead', live_session_id='old-ui')
- with pytest.raises(PreDialError, match='authority'):
+ with pytest.raises(ValueError, match='authority'):
deliver_to_live_owner(tmp_path, owner, 'message', delivery_id='e' * 32)
assert not (tmp_path / 'runtime' / 'bot_live_delivery' / ('e' * 32 + '.json')).exists()
diff --git a/tools/bot_live_delivery.py b/tools/bot_live_delivery.py
index b98c2f4f07d..b6da74cc3f9 100644
--- a/tools/bot_live_delivery.py
+++ b/tools/bot_live_delivery.py
@@ -62,10 +62,11 @@ def find_canonical_live_owner(profile_home: Path | str) -> dict[str, Any] | None
lease_id=discovery.endpoint.instance_id, live_session_id=tip or '')
-class PreDialError(RuntimeError):
+class PreDialError(ValueError):
"""The authority call died before its RPC reached the socket: nothing was admitted, so
this is a definite no-send the sender may safely retry — never the ambiguous
- post-admission state that orders 'do not resend' (#139303)."""
+ post-admission state that orders 'do not resend' (#139303). A ``ValueError`` like the
+ "authority is not ready" refusals it wraps, so existing ``except ValueError`` callers hold."""
def authority_delivery(home, params):