fix: detect stale tmux sessions on startInteractive/startShell

When Claude exits inside a tmux session, tmux destroys the session
(remain-on-exit is off), but the _muxSession reference persists.
On restart, startInteractive() treats it as a "restored session" and
tries to attach to the dead tmux — causing instant exit code 1.

Now checks tmux has-session before attaching. If the session is gone,
clears the stale reference and creates a fresh tmux session.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
arkon
2026-02-19 21:38:01 +01:00
co-authored by Claude Opus 4.6
parent cf0d9e7d83
commit dc6c65fd8b
5 changed files with 23 additions and 5 deletions
+4 -4
View File
@@ -35,7 +35,7 @@ When user says "COM":
1. Increment version in BOTH `package.json` AND `CLAUDE.md` (verify they match with `grep version package.json && grep Version CLAUDE.md`)
2. Run: `git add -A && git commit -m "chore: bump version to X.XXXX" && git push && npm run build && systemctl --user restart claudeman-web`
**Version**: 0.1557 (must match `package.json` for npm publish)
**Version**: 0.1558 (must match `package.json` for npm publish)
## Project Overview
@@ -63,9 +63,9 @@ npx tsx src/index.ts web --https # With TLS (only needed for remote access)
npm run typecheck # Type check
tsc --noEmit --watch # Continuous type checking
# Testing
npx vitest run # All tests
npx vitest run test/<file>.test.ts # Single file
# Testing (NEVER run full suite from inside Claudeman — kills tmux sessions)
# npx vitest run # ALL tests — DANGEROUS inside Claudeman
npx vitest run test/<file>.test.ts # Single file (SAFE)
npx vitest run -t "pattern" # Tests matching name
npm run test:coverage # With coverage report