fix(core): detect tmux server death and clean up orphaned dashboard#696
Open
sreyom31 wants to merge 6 commits intoComposioHQ:mainfrom
Open
fix(core): detect tmux server death and clean up orphaned dashboard#696sreyom31 wants to merge 6 commits intoComposioHQ:mainfrom
sreyom31 wants to merge 6 commits intoComposioHQ:mainfrom
Conversation
…omposioHQ#695) The lifecycle manager's isAlive check swallowed runtime server crashes via .catch(() => true), masking tmux server death. This caused sessions to appear alive indefinitely, the dashboard to linger as an orphan holding the port, and ao start to fall back to wrong ports. - Fix .catch(() => true) → .catch(() => false) so isAlive failures mark sessions as killed - Add batch-death detection in pollAll() with onAllSessionsKilled callback - Lifecycle worker wires callback to SIGTERM the dashboard parent and self-shutdown - ao start cleans up orphaned dashboards from stale running.json before falling back to a new port Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…nitialized Declare lifecycle as let before shutdown handler so signal handlers can safely call lifecycle?.stop() even if getLifecycleManager hasn't resolved yet. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
…tance Snapshot the running.json PID when the lifecycle worker starts instead of reading it at callback time. Prevents killing a newer AO instance that overwrote running.json after the original parent died. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
- Pass AO_PARENT_PID env var when spawning lifecycle worker so it knows the dashboard parent PID without reading running.json (which isn't populated yet at worker startup) - Remove running.json dependency from orphan cleanup in ao start since isAlreadyRunning() already prunes stale entries before runStartup(); use stopDashboard() directly via lsof instead Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
A single session dying (agent crash, user kill, PR closure) should not trigger onAllSessionsKilled and tear down the dashboard. Require at least 2 sessions to die in the same poll cycle for the heuristic to fire. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 1 potential issue.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Author
|
@suraj-markup please review whenever available. |
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
Fixes #695 — tmux server dies silently causing orchestrator session crash loop.
.catch(() => true)→.catch(() => false)in lifecycle manager'sisAlivecheck — the core bug that masked tmux server death by treating thrown errors as "session alive"pollAll()— when all active sessions die in a single poll cycle, firesonAllSessionsKilledcallback and logslifecycle.runtime_server_deadeventrunning.json) and self-shutdown, preventing orphaned dashboardsao startcleans up orphaned dashboards — before falling back to a new port, checksrunning.jsonfor stale entries and kills the process holding the portTest plan
isAliverejection → session transitions tokilledonAllSessionsKilledcalledonAllSessionsKilledNOT calledao start→tmux kill-server→ verify sessions killed, dashboard shuts down,ao startrecovers on original port🤖 Generated with Claude Code