mirror of
https://github.com/Ark0N/Codeman.git
synced 2026-10-04 06:29:42 +02:00
fix: improve screen cleanup and add ghost screen discovery
- killScreen now uses 4 strategies for reliable cleanup: 1. Kill all child processes recursively (SIGTERM then SIGKILL) 2. Kill entire process group (-PID) to catch orphans 3. Kill screen by name (screen -X quit) 4. Direct SIGKILL as final fallback - Refresh screen PID from screen -ls before killing (handles stale PIDs) - reconcileScreens now discovers unknown claudeman screens from screen -ls This prevents "ghost" screens that persist after screens.json is lost - restoreScreenSessions handles newly discovered screens The rapid session creation test now fails because discovery is working - it finds screens that weren't killed fast enough (test timing issue) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
+8
-4
@@ -1246,11 +1246,15 @@ export class WebServer extends EventEmitter {
|
||||
|
||||
private async restoreScreenSessions(): Promise<void> {
|
||||
try {
|
||||
// Reconcile screens to find which ones are still alive
|
||||
const { alive, dead } = await this.screenManager.reconcileScreens();
|
||||
// Reconcile screens to find which ones are still alive (also discovers unknown screens)
|
||||
const { alive, dead, discovered } = await this.screenManager.reconcileScreens();
|
||||
|
||||
if (alive.length > 0) {
|
||||
console.log(`[Server] Found ${alive.length} alive screen session(s) from previous run`);
|
||||
if (discovered.length > 0) {
|
||||
console.log(`[Server] Discovered ${discovered.length} unknown screen session(s)`);
|
||||
}
|
||||
|
||||
if (alive.length > 0 || discovered.length > 0) {
|
||||
console.log(`[Server] Found ${alive.length + discovered.length} alive screen session(s) from previous run`);
|
||||
|
||||
// For each alive screen, create a Session object if it doesn't exist
|
||||
const screens = this.screenManager.getScreens();
|
||||
|
||||
Reference in New Issue
Block a user