Skip to content

fix(bot-relay): delivery works on Windows paths and PATH-less gateways (#93590, salvage #93601, credit #93597) - #93658

Merged
teknium1 merged 7 commits into
mainfrom
salv/93590-bot-relay-windows
Aug 24, 2026
Merged

teknium1 merged 7 commits into
mainfrom
salv/93590-bot-relay-windows

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Summary

bot_relay delivery works on Windows and in PATH-less service contexts: the generated waiter script no longer dies with a SyntaxError when the reply path contains \U... (MSYS backslash folding), and the delivery command no longer fails with "hermes not found" when the venv isn't on PATH. Fixes #93590.

Changes

Validation

Before After
Waiter with C:\Users\测试 path SyntaxError after backslash fold compiles
Delivery from PATH-less context FileNotFoundError: 'hermes' venv CLI resolved
Tests — 7 new regressions, 75 relevant green

Credit: @jdtimothy first (#93597, earliest — identified both mechanisms), salvaged on @liuhao1024's more complete #93601 (authorship preserved on both commits); utf-8 pin + which-step added on top.

Infographic

Bot relay delivers on Windows

liuhao1024 and others added 3 commits August 24, 2026 00:09
…ry ENOENT

Two failures on a Windows desktop install relaying to a remote gateway
(#93590):

1. waiter_command embeds the reply path in generated python -c source
   with !r. repr escapes each backslash, but the Windows execution layer
   folds \\ back to \, so \U in C:\Users\... parses as a unicode escape
   and SyntaxErrors the whole waiter script. Raw-string literals keep
   the folded single backslash a literal; POSIX paths have no
   backslashes so the prefix is a no-op there, and \' inside a raw
   literal still cannot terminate the string, keeping the #93091
   injection defense intact.

2. local_delivery_command hardcoded "hermes", relying on PATH — absent
   in service contexts (systemd units, desktop launchers, non-login SSH
   shells), so delivery died with ENOENT. It now resolves the CLI next
   to this gateway's own interpreter (venv bin/Scripts sibling,
   hermes.exe on Windows) with a bare-name fallback. The #93091
   per-profile turn-lock recognition in bot_mode_dm now matches the CLI
   element by basename (split on both separators) so resolved absolute
   paths still take the lock instead of silently bypassing it.

Fixes #93590
CI runners have a real hermes sibling next to the venv python, so
local_delivery_command now resolves an absolute path there — the exact
argv filters in the retry-policy fakes and the relay-methods pins must
match by basename instead of the literal "hermes", mirroring the
_delivery_lock matcher.
… decoding on delivery subprocess

Salvage hardening on top of #93601 (with #93597 covering the same core
mechanisms) for #93590:

- _hermes_cli(): after the venv-sibling check (hermes.exe on win32),
  try shutil.which('hermes') before the bare-name fallback, so
  environments with a PATH but no venv sibling resolve exactly what an
  interactive shell would. Platform test switched os.name -> sys.platform
  ('win32') per repo convention.
- tui_gateway/methods_bot_relay.py deliver: pin encoding='utf-8',
  errors='replace' on both subprocess.run sites — without them the
  child's UTF-8 output is decoded with the locale codec (cp1252/GBK on
  Windows), mangling non-ASCII replies or raising on undecodable bytes.
- Regression tests: shutil.which resolution step, bare-name fallback
  with which=None, and encoding-pin assertions in the deliver transport
  test.

Refs #93590, #93597, #93601
@alt-glitch alt-glitch added type/bug Something isn't working P2 Medium — degraded but workaround exists comp/tui Terminal UI (ui-tui/ + tui_gateway/) platform/windows Native Windows-specific behavior or breakage sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages labels Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/tui Terminal UI (ui-tui/ + tui_gateway/) P2 Medium — degraded but workaround exists platform/windows Native Windows-specific behavior or breakage sweeper:risk-message-delivery Sweeper risk: may drop, duplicate, misroute, or suppress messages sweeper:risk-platform-windows Sweeper risk: may break or behave differently on native Windows type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Windows bot_relay delivery fails: Unicode path crash and 'hermes' not found

3 participants