YeonGyu-Kim
104523051d
feat(tmux): sweep stale omo-agents-<pid> sessions on first spawn
...
Follow-up to PR #3507 addressing the Oracle-noted operational limitation:
per-PID isolated session names (getIsolatedSessionName(process.pid)) mean
that when an opencode process is SIGKILL'd (or the machine hard-reboots),
the old omo-agents-<old-pid> tmux session survives forever because nothing
is around to kill it.
Added sweepStaleOmoAgentSessions() that:
1. Lists tmux sessions matching /^omo-agents-(\d+)$/
2. For each, checks process.kill(pid, 0) to detect a dead PID
3. Skips our own PID
4. Calls killTmuxSessionIfExists for every session whose owner process is gone
Wired into TmuxSessionManager.onSessionCreated() as a one-shot (guarded by
staleSweepCompleted flag) so it runs lazily on the first subagent spawn when
isolation="session". The flag is reset in cleanup() so subsequent process
restarts re-run the sweep.
6 new tests cover: outside-tmux no-op, no matching sessions, multiple dead
PIDs, current PID skip, live PID skip, list-sessions failure.
Manual E2E verified on real tmux:
- Created omo-agents-99999, sweep killed it
- Spawned our own omo-agents-<pid>, closeTmuxPane returned true even after
pane auto-destroy from Ctrl+C
- Final tmux list-sessions shows zero omo-agents-* orphans
2026-04-18 20:22:00 +09:00
..
2026-02-21 16:45:18 -07:00
2026-03-03 00:27:53 +09:00
2026-04-17 15:35:11 +09:00
2026-04-03 19:38:26 +09:00
2026-04-18 20:22:00 +09:00
2026-04-04 21:32:52 +09:00
2026-04-10 15:53:37 +09:00
2026-04-17 14:51:52 +09:00
2026-04-11 22:28:58 +09:00
2026-04-11 22:28:58 +09:00
2026-04-15 10:57:17 +09:00
2026-04-17 14:51:52 +09:00
2026-04-15 10:46:41 +09:00
2026-04-18 01:21:20 +09:00
2026-04-04 01:16:21 +09:00
2026-04-04 01:16:37 +09:00
2026-03-29 04:53:43 +09:00
2026-04-04 01:16:37 +09:00
2025-12-26 23:28:33 +09:00
2025-12-26 23:28:33 +09:00
2026-02-08 15:01:42 +09:00
2026-03-08 02:23:11 +09:00
2026-04-10 15:53:09 +09:00
2025-12-19 02:20:46 +09:00
2026-04-17 15:35:11 +09:00
2026-04-03 19:36:56 +09:00
2026-04-03 17:14:40 +09:00
2026-04-17 14:51:52 +09:00
2026-04-17 14:51:52 +09:00
2026-04-10 11:16:16 +09:00
2026-02-01 16:47:50 +09:00
2025-12-13 14:23:04 +09:00
2026-02-06 18:58:48 +09:00
2026-03-11 21:45:45 +09:00
2026-03-11 21:45:45 +09:00
2026-04-18 14:04:45 +09:00
2026-04-18 14:04:45 +09:00
2026-04-04 16:44:40 +09:00
2026-04-10 11:16:16 +09:00
2026-03-25 11:04:49 +01:00
2026-03-25 11:14:04 +01:00
2026-03-02 16:38:22 +09:00
2026-04-02 14:55:35 +09:00
2026-04-02 14:55:35 +09:00
2026-02-12 12:12:40 +01:00
2026-02-14 22:06:13 +09:00
2026-02-01 16:47:50 +09:00
2026-01-13 04:37:51 +00:00
2026-02-01 16:47:50 +09:00
2026-01-05 05:38:17 +09:00
2025-12-09 17:31:15 +09:00
2026-04-18 14:04:45 +09:00
2026-04-08 15:58:02 +09:00
2026-04-08 15:58:02 +09:00
2026-04-03 18:51:10 +09:00
2026-04-03 19:36:56 +09:00
2026-04-18 14:12:50 +09:00
2026-04-18 14:12:50 +09:00
2026-04-18 14:12:55 +09:00
2026-03-25 11:04:49 +01:00
2026-04-04 19:42:18 +09:00
2026-03-31 17:25:00 -07:00
2026-04-18 14:09:46 +09:00
2026-04-18 14:10:45 +09:00
2026-04-18 02:52:10 +09:00
2026-04-18 02:52:10 +09:00
2026-04-10 11:16:16 +09:00
2026-04-17 14:51:52 +09:00
2026-02-11 13:52:20 +09:00
2026-04-12 02:27:56 +09:00
2026-04-12 02:27:56 +09:00
2026-04-04 02:10:27 +09:00
2026-04-17 14:52:02 +09:00
2026-02-07 19:51:22 +09:00
2026-04-17 14:51:52 +09:00
2026-04-17 14:51:52 +09:00
2026-04-02 15:45:39 +09:00
2026-03-25 15:09:25 +01:00
2026-04-03 19:36:56 +09:00
2026-04-17 14:51:52 +09:00
2026-04-17 14:51:52 +09:00
2026-04-17 15:35:11 +09:00
2026-04-17 14:51:52 +09:00
2026-03-25 22:11:45 +01:00
2026-03-25 15:09:25 +01:00
2026-04-17 14:51:52 +09:00
2026-04-06 17:40:12 +09:00
2026-04-17 14:51:52 +09:00
2026-02-23 17:42:53 +01:00
2026-03-02 16:38:22 +09:00
2026-03-02 16:38:22 +09:00
2026-04-17 14:51:52 +09:00
2026-04-17 14:51:52 +09:00
2026-04-09 14:19:17 +09:00
2026-03-03 00:38:20 +09:00
2026-03-25 11:14:04 +01:00
2026-04-17 14:51:52 +09:00
2026-04-03 19:39:55 +09:00
2025-12-14 12:24:59 +09:00
2026-04-17 14:51:52 +09:00
2026-04-12 02:28:36 +09:00
2026-04-18 03:01:51 +09:00
2026-03-07 05:46:05 +09:00
2026-04-03 19:39:55 +09:00
2026-02-16 18:20:19 +09:00
2026-04-12 00:07:10 +09:00
2026-03-26 13:02:12 +09:00
2026-03-26 13:02:12 +09:00
2026-02-08 13:57:26 +09:00
2026-04-05 14:27:24 +09:00
2026-04-05 14:27:24 +09:00
2026-02-16 16:13:40 +09:00
2026-02-16 16:52:23 +09:00
2026-04-05 09:30:19 +09:00
2026-04-05 09:30:19 +09:00
2026-04-16 14:28:56 +09:00
2026-04-16 14:28:56 +09:00
2026-04-10 15:53:37 +09:00
2026-02-12 18:12:54 +09:00
2026-04-03 19:39:55 +09:00
2026-02-16 16:52:25 +09:00
2026-02-16 16:13:40 +09:00
2026-02-01 16:47:50 +09:00
2026-02-16 16:13:40 +09:00
2026-04-15 10:58:16 +09:00
2026-02-06 16:33:34 +09:00
2026-03-18 14:19:00 +09:00
2026-02-06 21:35:30 +09:00
2026-04-17 16:42:43 +09:00
2026-03-03 00:14:01 +09:00
2026-03-03 00:14:01 +09:00
2026-04-04 02:10:27 +09:00
2026-03-26 18:04:31 +09:00
2026-04-10 11:15:42 +09:00
2026-03-18 13:17:01 +09:00
2026-02-05 09:55:15 +09:00
2026-04-11 21:25:27 +09:00
2026-04-11 21:25:27 +09:00
2026-04-14 02:50:50 +09:00
2026-04-15 15:30:40 +09:00
2026-04-18 14:11:24 +09:00
2026-04-18 14:11:24 +09:00
2026-02-26 20:59:53 +09:00
2026-02-18 21:10:21 +09:00
2026-02-18 21:10:21 +09:00
2026-04-17 14:51:52 +09:00
2026-03-11 19:42:46 +09:00
2026-02-08 16:24:52 +09:00
2026-04-15 10:58:16 +09:00
2026-04-15 10:57:54 +09:00
2026-03-09 12:43:30 +09:00
2026-04-18 03:01:51 +09:00
2026-04-10 15:53:37 +09:00
2026-02-07 13:32:45 +09:00
2026-04-04 02:02:12 +09:00
2026-02-01 16:47:50 +09:00
2026-03-29 04:53:43 +09:00
2026-02-17 01:45:14 +09:00
2026-02-17 01:45:14 +09:00
2026-01-31 15:46:14 +09:00
2026-02-21 03:03:57 +09:00
2026-02-20 17:45:53 +02:00
2026-04-08 17:14:17 +09:00
2026-04-08 17:14:17 +09:00
2026-04-08 13:02:51 +09:00
2026-02-14 14:58:25 +09:00
2026-02-21 16:44:59 -07:00
2026-02-16 20:43:09 +09:00
2026-04-15 10:43:44 +09:00
2026-04-15 10:43:44 +09:00
2026-04-12 02:28:46 +09:00
2026-04-12 02:28:46 +09:00
2026-01-31 15:46:14 +09:00
2026-02-26 21:00:40 +09:00
2026-04-08 15:58:02 +09:00
2026-04-08 15:58:02 +09:00
2026-04-03 18:31:26 +09:00
2026-02-07 13:12:47 +09:00
2026-02-07 13:12:47 +09:00
2026-02-07 19:13:35 +09:00
2026-02-07 19:13:35 +09:00
2026-03-08 02:20:25 +09:00
2026-04-12 02:28:05 +09:00
2026-04-12 02:28:05 +09:00
2026-04-03 18:34:12 +09:00
2026-04-03 18:34:12 +09:00