[Bugfix #418] Fix architect terminal auto-restart in dashboard - #419
Merged
waleedkadous merged 2 commits intoFeb 18, 2026
Merged
Conversation
The architect terminal already had shellper-level auto-restart configured (restartOnExit: true, restartDelay: 2000, maxRestarts: 50), but exit handling was defeating it by: 1. PtySession.cleanupShellper() clearing all WebSocket clients on exit 2. Tower exit handler clearing entry.architect and deleting the DB record This made the restarted process invisible to the dashboard even though it was running. Fix: Add a restartOnExit flag to PtySession that suppresses exit cleanup when auto-restart is configured. WebSocket clients stay connected, Tower references are preserved, and the dashboard seamlessly shows the restarted session. A 10-second timeout handles the edge case of max restarts being exceeded (falls through to normal cleanup if no new data arrives).
…t crash loop stacking Addresses Codex review feedback: - Clear exitCode when new data arrives after restart so write/resize continue working - Guard against stacked listeners/timeouts from rapid exit/restart cycles - Added test assertions for status='running' and write() working after restart
waleedkadous
deleted the
builder/bugfix-418-dashboard-auto-restart-archite
branch
February 18, 2026 05:42
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 #418
Root Cause
The architect terminal already had shellper-level auto-restart configured (
restartOnExit: true,restartDelay: 2000,maxRestarts: 50), but exit handling at the PtySession and Tower layers was defeating it:PtySession.cleanupShellper()cleared all WebSocket clients on exit — the restarted process had no connected clientsentry.architect = undefinedand deleted the DB record — the dashboard couldn't find the restarted sessionThe process was actually restarting at the shellper level, but was invisible to the dashboard.
Fix
Added a
restartOnExitflag toPtySessionthat suppresses exit cleanup when auto-restart is configured:entry.architectand DB record remain intact[Process exited — restarting...]to the terminal during the restart gapFiles changed
pty-session.ts— AddedrestartOnExitproperty; modified shellper exit handler to suppress cleanup when settower-instances.ts— SetrestartOnExit = trueon architect PtySession at creationtower-terminals.ts— SetrestartOnExit = trueon architect PtySession during reconciliation and on-the-fly reconnectionTest Plan
restartOnExitis truerestartOnExitis falseCMAP Review
To be added after review