Skip to content

(sessions): probe descriptor liveness on both sides, verify the pid before a tmux attach - #262

Merged
devsuitup merged 1 commit into
mainfrom
fix/descriptor-liveness
Sep 11, 2026
Merged

(sessions): probe descriptor liveness on both sides, verify the pid before a tmux attach#262
devsuitup merged 1 commit into
mainfrom
fix/descriptor-liveness

Conversation

@devsuitup

Copy link
Copy Markdown
Owner

Audit 2026-09-11, findings 2, 9, 10 and 6 (.work-files/switchboard/audit-fable-2026-09-11.md, local note), plus the comment sweep owed on #259.

Why

What

  • cli-session-state.js: getStatus() keeps the pid and re-probes liveness lazily, throttled per pid (5 s, injectable clock); a dead pid drops the entry.
  • remote-transport.js: LIST_COMMAND prints an STX-prefixed ALIVE:0|1 marker after each descriptor from /proc/<pid> — same ssh round-trip; parseSessions drops dead ones and reports the count, an older host output without markers is kept as before.
  • remote-attach.js: the probe appends whether /proc/<pid>/cmdline names a claude CLI; an explicit "no" refuses the attach before any set or spawnPty (pid N now belongs to a process that is not a claude CLI). procStart matching was not used: the CLI's value is a Windows-style start time, not comparable to Linux starttime without a format the repo has not measured. ConnectTimeout=5 on the non-interactive ssh calls.
  • Comment sweep on the (activity): remote decay clears busy without claiming response-ready; PTY purge skips remote rows #259 files (one-line pointers).

Proof

Mutations on the shipped modules: disable the lazy re-probe → "dead between two calls" test red; drop the ALIVE filter → dead-descriptor test red (the shell test runs the real LIST_COMMAND under sh -c with a live and a dead pid); drop the cmdline check → refuse test red.

task check (two-stage runner from #261): 1155 pass + 119 pass, 0 fail, 8 pre-existing skips.

Not verified on the wire: the ALIVE marker and cmdline segment against the real host (tests only).

…efore a tmux attach

A killed local CLI leaves its descriptor behind and read as busy until the app
restarted; getStatus now re-probes the pid lazily, throttled. The remote
inventory prints an ALIVE marker per descriptor from /proc so dead CLIs are
dropped without a second ssh. The attach probe checks /proc/<pid>/cmdline is a
claude CLI before attaching to a recycled pid, and probe/restore ssh calls get
ConnectTimeout=5. Comment sweep on the activity files merged in #259.
@devsuitup
devsuitup merged commit 72729fc into main Sep 11, 2026
10 checks passed
@devsuitup
devsuitup deleted the fix/descriptor-liveness branch September 11, 2026 14:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant