fix(vexa-bot): browser-session entrypoint exits when node exits (#258)#260
Open
DmitriyG228 wants to merge 1 commit intomainfrom
Open
fix(vexa-bot): browser-session entrypoint exits when node exits (#258)#260DmitriyG228 wants to merge 1 commit intomainfrom
DmitriyG228 wants to merge 1 commit intomainfrom
Conversation
`wait` (no args) blocks on every background child including `x11vnc -forever` and `websockify`, both of which never return. So after `node dist/docker.js` exited cleanly, the container stayed alive forever and K8s saw the pod as Running. A "stop" from the dashboard had no visible effect — the bot saved state and exited, but the pod hung around until idle_timeout or manual deletion. Default `VEXA_BROWSER_SESSION_VNC_KEEPALIVE_SECONDS=0` → exit immediately on node-exit. Operators who want the post-exit VNC debug window set the env var to a positive integer (e.g. 3600) in the runtime profile. Exit code is preserved so K8s sees a clean 0 vs. a crash. Real-world impact (release-005 dogfood, 2026-04-25): two browser-session pods staged Running for 6+ hours after node exited, ignoring the user's Stop click. Implementation note: `timeout N wait` doesn't work because `wait` is a shell builtin, not a binary. `sleep N` achieves the same bounded-keep-alive: the parent shell sleeps, then exits, and the kernel reaps the still-running x11vnc / websockify children. Closes #258 Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Contributor
Author
|
Planned for merge in the current hardening release (cycle |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
waitin the browser-session entrypoint blocks forever onx11vnc -foreverandwebsockify, so the container never exits afternode dist/docker.jsreturns. K8s sees the pod as Running indefinitely and "stop" from the dashboard appears to do nothing.VEXA_BROWSER_SESSION_VNC_KEEPALIVE_SECONDS(default0) controls a bounded post-exit debug window. Default behavior: container exits as soon asnodedoes.0for clean exits and≠0for crashes.Diff
services/vexa-bot/core/entrypoint.sh(browser-session branch only — meeting-mode branch unchanged):Implementation note
The issue body sketched
timeout $N wait— that doesn't actually work becausewaitis a shell builtin andtimeoutonly runs binaries.sleep $Nachieves the equivalent bounded keep-alive: the parent shell sleeps, then exits, and the kernel cleans up the still-runningx11vnc/websockify/sshdchildren.Non-numeric values fall through to the default branch (
[[ ... =~ ^[0-9]+$ ]]guard) so a typo can't crash the script.How to opt back into the post-exit debug window
In
services/runtime-api/runtime_api/profiles.pyprofile YAML:profiles.pyalready passes theenvblock straight into the container — no code change needed there.Test plan
bash -n services/vexa-bot/core/entrypoint.sh(syntax)EXIT_CODEis preservedVEXA_BROWSER_SESSION_VNC_KEEPALIVE_SECONDS=60in a profile, exercise stop, confirm container stays for ~60s then exits with the original exit code🤖 Generated with Claude Code