perf(sessions): skip the pty list socket probe when the pid already proves life - #118
Merged
Merged
Conversation
…s life `listSessions` computed `socketReachable` unconditionally, so `pty list` did a wasted per-session socket connect for every live-pid entry — the probe result is ignored (running either way) and it adds exactly the socket-connect contention that gets flaky under concurrent multi-agent list load. Probe the control socket ONLY when the pid doesn't already prove life (dead-looking / unreadable), where it is the deciding signal (the #117 reachable-socket rescue). Behavior-preserving: full suite green (1417 passed), typecheck clean. Mirrors the pty-rust port's approach (4fba12f). Genuine defense-in-depth for the hot list path under the concurrent multi-agent load #117 was about.
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.
Skip the
pty listsocket probe when the pid already proves lifeFollow-up to #117 — perf/robustness hygiene, behavior-preserving.
listSessionscomputedsocketReachableunconditionally, sopty listdid a wasted per-session socket connect for every live-pid entry: the probe
result is ignored (the session is reported running either way), and it adds
exactly the socket-connect contention that turns flaky under concurrent
multi-agent list load.
Change (one line): probe the control socket ONLY when the pid doesn't
already prove life:
For a dead-looking or unreadable pid the socket is still the deciding signal
(the #117 reachable-socket rescue), so the correctness contract is unchanged —
only the wasted probe on the hot path is removed.
Verification: full suite green (1417 passed, 21 skipped), typecheck clean.
Mirrors the pty-rust port (
4fba12f), which already probes only when the pidlooks dead. Defense-in-depth for the concurrent multi-agent load #117 addressed.