You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Detect stdin readers through nested Linux child process trees #373
autonomous: likelyProbably hands-off: clearly worth fixing, agent can do it, minor judgment needed.from-prIssue created from an external PR during triagepriority: lowP3 - nice to have / minor / cosmetic
Linux stdin-reader detection does not traverse nested wrapper process chains (no recursive child-by-parent walk), so wrapped processes can evade detection.
Credit: originally proposed in PR #101. This repo no longer accepts external PRs, so the problem is tracked here instead.
Confirmed in crates/jcode-core/src/stdin_detect.rs. The Linux check_process_tree (lines 83-118) only walks direct children via direct_children(pid) (/proc/<pid>/task/<tid>/children, lines 129-156) and checks each once with check_inner(child_pid, true). There is no recursion into grandchildren, so a wrapper chain (e.g. sh -> wrapper -> reader) where an intermediate process is not itself reading stdin will not be detected.
Fix path: make the traversal recursive (BFS/DFS over direct_children), keeping the existing same-stdin-pipe gate (parent_stdin_link comparison at lines 104-110) at each hop and a visited-set / depth cap to bound cost and avoid cycles. The fallback children_via_proc_scan already returns the full PPid-based child set per node, so recursion composes naturally.
Labels: autonomous: likely (mechanical change, but needs care on the per-hop pipe-sharing check and CPU cost of deeper polling), priority: low (edge case; basic + direct-child detection already works).
autonomous: likelyProbably hands-off: clearly worth fixing, agent can do it, minor judgment needed.from-prIssue created from an external PR during triagepriority: lowP3 - nice to have / minor / cosmetic
Activity
1jehuang commentedon Jun 25, 2026
Triage: reproducible, clear fix path.
Confirmed in
crates/jcode-core/src/stdin_detect.rs. The Linuxcheck_process_tree(lines 83-118) only walks direct children viadirect_children(pid)(/proc/<pid>/task/<tid>/children, lines 129-156) and checks each once withcheck_inner(child_pid, true). There is no recursion into grandchildren, so a wrapper chain (e.g.sh -> wrapper -> reader) where an intermediate process is not itself reading stdin will not be detected.Fix path: make the traversal recursive (BFS/DFS over
direct_children), keeping the existing same-stdin-pipe gate (parent_stdin_linkcomparison at lines 104-110) at each hop and a visited-set / depth cap to bound cost and avoid cycles. The fallbackchildren_via_proc_scanalready returns the full PPid-based child set per node, so recursion composes naturally.Labels: autonomous: likely (mechanical change, but needs care on the per-hop pipe-sharing check and CPU cost of deeper polling), priority: low (edge case; basic + direct-child detection already works).
1jehuang commentedon Jun 25, 2026
Fixed in
b96dfa47(pending release). Built and tests pass on Linux. See commit message for the specific change for this issue.Fix several triaged GH issues (#369, #371, #373, #365, #374, #402)
1jehuang commentedon Jun 28, 2026
Released in v0.32.0. Run
jcode updateto get it.Fix several triaged GH issues (1jehuang#369, 1jehuang#371, 1jehuang#373…
Fix several triaged GH issues (1jehuang#369, 1jehuang#371, 1jehuang#373…