fix(bot-mode): keep the relay waiter watching past the Desktop deliver deadline

The sender-side waiter gave up at 900s while the Desktop held bot_relay.deliver open for 1500s, so a turn finishing between minute 15 and minute 25 wrote a reply nobody read. REPLY_WAIT_SECONDS now rebuilds the Desktop budget from the same numbers and waits 60s past it. The two turn constants move into tools/bot_relay.py so the gateway handler and the waiter share one definition.
This commit is contained in:
Erosika
2026-09-08 16:31:18 -04:00
committed by Teknium
parent 8defaaad48
commit b1915cb02d
5 changed files with 69 additions and 20 deletions
+3 -7
View File
@@ -10,6 +10,9 @@ import os
import subprocess
from pathlib import Path
# Defined beside the sender-side waiter budget so the two Python sides cannot drift (#93911).
from tools.bot_relay import TURN_ATTEMPT_TIMEOUT_SECONDS
from .method_ctx import HandlerRegistry
_registry = HandlerRegistry()
@@ -22,13 +25,6 @@ def _relay_root() -> Path:
return home.parent.parent if home.parent.name == "profiles" else home
# Per-attempt turn timeout and attempt ceiling for bot_relay.deliver. The Desktop client mirrors
# both (apps/desktop/src/plugins/hermes-bots/relay.ts: RELAY_TURN_ATTEMPT_MS / RELAY_TURN_MAX_ATTEMPTS)
# and its relay-deliver-budget test reads these two lines, so a change here must be deliberate (#93911).
TURN_ATTEMPT_TIMEOUT_SECONDS = 600
TURN_MAX_ATTEMPTS = 2 # first attempt + the policy-gated re-run
def _run_delivery(profile: str, tmp: str) -> subprocess.CompletedProcess:
from tools.bot_relay import local_delivery_command
return subprocess.run(