Skip to content

The agent that grows with you

test(bot-mode): pin the waiter budget from Python constants, not relay.ts text

Erosika37eb6e1b0582
diff --git a/tests/tools/test_bot_relay.py b/tests/tools/test_bot_relay.py
index dd9f8e7ffac..bf39b93ea3d 100644
--- a/tests/tools/test_bot_relay.py
+++ b/tests/tools/test_bot_relay.py
@@ -154,28 +154,17 @@ def test_waiter_command_quotes_and_targets_reply_file(root):
assert "rm -rf" not in cmd # sanity: single quoted -c payload
-_DESKTOP_RELAY_TS = Path(__file__).resolve().parents[2] / "apps" / "desktop" / "src" / "plugins" / "hermes-bots" / "relay.ts"
-
-
-def _desktop_relay_ms(name: str) -> int:
- """Literal ``const <name> = N`` from relay.ts. No shared anchor links a TS constant to a Python
- one, so this regex is the seam, mirroring relay-deliver-budget.test.ts on the Desktop side."""
- match = re.search(rf"^const {name} = ([0-9_]+)", _DESKTOP_RELAY_TS.read_text(encoding="utf-8"), re.M)
- assert match, f"{name} must stay a literal in relay.ts"
- return int(match.group(1).replace("_", ""))
-
-
def test_waiter_outlives_the_desktop_deliver_deadline():
"""The Desktop posts its timeout reply when RELAY_DELIVER_TIMEOUT_MS passes. A waiter that gave
- up first left that reply, and any turn finishing after minute 15, in a file nobody read (#93911)."""
+ up first left that reply, and any turn finishing after minute 15, in a file nobody read (#93911).
+ relay-deliver-budget.test.ts pins the TS constants against these Python ones."""
desktop_budget_s = (
- _desktop_relay_ms("RELAY_TURN_LOCK_WAIT_MS")
- + _desktop_relay_ms("RELAY_TURN_ATTEMPT_MS") * _desktop_relay_ms("RELAY_TURN_MAX_ATTEMPTS")
- + _desktop_relay_ms("RELAY_DELIVER_SETTLEMENT_MARGIN_MS")
- ) // 1000
+ bot_relay.TURN_WAIT_SECONDS_FALLBACK
+ + bot_relay.TURN_ATTEMPT_TIMEOUT_SECONDS * bot_relay.TURN_MAX_ATTEMPTS
+ + bot_relay.DESKTOP_DELIVER_SETTLEMENT_MARGIN_SECONDS
+ )
assert bot_relay.DESKTOP_DELIVER_TIMEOUT_SECONDS == desktop_budget_s
assert bot_relay.REPLY_WAIT_SECONDS > desktop_budget_s
- assert bot_relay.TURN_WAIT_SECONDS_FALLBACK * 1000 == _desktop_relay_ms("RELAY_TURN_LOCK_WAIT_MS")
def test_waiter_give_up_message_states_the_real_budget(root):