Expand description
Is a command that has printed nothing for the idle timeout stuck, or busy?
The idle kill exists for a command stuck waiting for input that never
comes: a pager (less) in the PTY
(docs/retro/RETRO_BASHWRAP_PAGER_HANG_LEAK_2026_07_14.md). But a build or
test run with its output sent to a file is silent too, and it was killed in
the middle of its work (seen 2026-10-17, cargo test > log). A stuck
command uses no CPU and starts nothing; a busy one does. So when the
timeout is reached, the gate looks at the commandโs process tree twice,
a probe window apart: CPU used or a new process means busy, and the
timeout starts over; nothing means stuck, and the command is killed as
before.
Structsยง
- Idle
Gate ๐ - Tree
Sample ๐ - Each process of a tree, by key, with the CPU it had used.
Enumsยง
- Verdict ๐
- What the gate says when the command has been silent for the idle timeout.
Constantsยง
- PROBE_
MAX ๐ - The longest probe window: how much later than the idle timeout a stuck command is killed.
Functionsยง
- busy ๐
- Busy: a process that wasnโt there before, or one that used at least 1% of a core over the window (at least 10 ms).
- sample ๐
- tree_
sample ๐ rootand every process descended from it.- watch ๐
- The pipe pathโs idle watcher: every 200 ms, the time since the last byte
either stream read (
activity); pastidle_timeout, the gate decides, and a stuck command getsidle_tx. The look at the tree is a blocking snapshot, so it runs off the async runtime.