Flaky: api.rs run_wait_capture_history_search_export gets an empty last-command capture #60

Closed
opened 2026-10-02 11:42:49 +00:00 by jhgaylor · 1 comment
Owner

Found during #55 (while running api.rs 20 times for #35, under load from other worktrees): 1 of 20 runs failed at api.rs:172, capture?scope=last-command came back empty after wait?until=exit returned exit 4 for echo first-$((20+1)); echo second; exit 4.

Likely: the pane's wait thread reports the exit (and the command end is marked at the ring's end) before the reader thread has read the program's last output off the PTY, so the command's range is empty. A fix would be to drain the master (read until EIO) before handling the exit, or mark the end once the reader hits EOF.

Found during #55 (while running api.rs 20 times for #35, under load from other worktrees): 1 of 20 runs failed at api.rs:172, `capture?scope=last-command` came back empty after `wait?until=exit` returned exit 4 for `echo first-$((20+1)); echo second; exit 4`. Likely: the pane's wait thread reports the exit (and the command end is marked at the ring's end) before the reader thread has read the program's last output off the PTY, so the command's range is empty. A fix would be to drain the master (read until EIO) before handling the exit, or mark the end once the reader hits EOF.
Author
Owner

Fixed (merge of branch flakes). A real race: a pane's exit could be applied before the reader had taken the program's last output. The exit now waits (up to 1 s) for the reader to reach the terminal's hangup. Also fixed broken-pipe and closed-pane timing in the same test. Under load, 62 of 200 runs failed before and 0 of 400 after.

Fixed (merge of branch flakes). A real race: a pane's exit could be applied before the reader had taken the program's last output. The exit now waits (up to 1 s) for the reader to reach the terminal's hangup. Also fixed broken-pipe and closed-pane timing in the same test. Under load, 62 of 200 runs failed before and 0 of 400 after.
jhgaylor referenced this issue from a commit 2026-10-02 15:54:55 +00:00
Commenting is not possible because the repository is archived.
No milestone
No project
No assignees
1 participant
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set

Reference
jhgaylor/illogical#60
No description provided.