gateway: run simplex-chat bot under a PTY so it pumps WS events

Plain bot mode under systemd has no controlling terminal, so the CLI accepts
the WebSocket socket but never emits receivedContactRequest/newChatItems —
contact requests hung unaccepted. Wrap ExecStart in script(1) to allocate a
PTY; the events then flow and the gateway auto-accepts. Add util-linux to
bootstrap prereqs.
This commit is contained in:
Denton Social committed 2026-09-26 18:45:19 -05:00
1 parent 6059bec1e4
commit c92aff5038
3 files changed
+14 -7

No files matched your search

+1 -1
View File
@@ -136,7 +136,7 @@ echo "== runtime tree: $RUNTIME"
mkdir -p "$RUNTIME" "$MODELS" "$HF_CACHE" "$TOOLDIR" "$SIMPLEX_DB" "$UNITS" "$USER_UNITS"
# --- stage 0: system prereqs + linger ----------------------------------------
PKGS=(ca-certificates curl git rsync build-essential python3-dev python3-venv pkg-config cmake)
PKGS=(ca-certificates curl git rsync build-essential python3-dev python3-venv pkg-config cmake util-linux)
missing=()
for p in "${PKGS[@]}"; do
dpkg -s "$p" >/dev/null 2>&1 || missing+=("$p")
+4 -1
View File
@@ -8,7 +8,10 @@ Type=simple
# Bot mode: a local WebSocket chat server with a bot user. Do NOT add
# --headless here — in SimpleX Chat v7 --headless means "chat relay" and
# requires --relay, which yields a relay address, not a user contact address.
ExecStart=@REPO@/.runtime/bin/simplex-chat -p @PORT@ -d @REPO@/.runtime/simplex/simplex_v1 -k "" --create-bot-display-name "@DISPLAY_NAME@"
# The CLI only pumps WebSocket events (receivedContactRequest, newChatItems)
# when it has a controlling terminal, so `script` allocates a PTY; without it
# systemd's TTY-less process receives no events and contact requests hang.
ExecStart=/usr/bin/script -q -e -c "@REPO@/.runtime/bin/simplex-chat -p @PORT@ -d @REPO@/.runtime/simplex/simplex_v1 -k '' --create-bot-display-name '@DISPLAY_NAME@'" /dev/null
Restart=always
RestartSec=10
StandardOutput=journal