Repository navigation
Conversation
tony
force-pushed
the
flaky-investigations-000
branch
3 times, most recently
from
October 4, 2026 13:48
6e9988e to
f69e0b2
Compare
tony
force-pushed
the
flaky-investigations-000
branch
from
October 4, 2026 16:01
f69e0b2 to
ccda1cb
Compare
tony
force-pushed
the
flaky-investigations-000
branch
from
October 4, 2026 21:25
86aff61 to
5cc1805
Compare
why: Eleven macOS-15 CI runs from 09-26 to 10-04 failed on unrelated commits with a wait that gave up at 0.5 or 1.0 seconds: "tmux fixture exceeded event deadline", "attached client did not draw its terminal", "installed MCP did not return a frame" and a DeadlineExceeded inside MCPEnrollmentTest. Each wait already returns on an event (pipe readable, wait-for signal, thread join); only its bound was sized for a fast machine, and a tmux spawn or Ruby start on the hosted macOS runner can exceed it. The same tests pass on Linux at the same shas. what: - Add HANG_GUARD_SECONDS to test/test_helper.rb and use it for event waits in integration tests and TmuxFixture, which now reads it for its command and readiness deadline and for reap waits - Advance the transport clock by the guard in the two tests that expire a request deadline by clock offset, so they still expire it - Raise the same bounds in the shipped examples and their copies in docs/recipes.md and the libtmux-async README - Leave tests that prove a deadline elapsed (0.02 s transport limits, OperationBudgetTest's offset clock, a never-signalled wait-for)
why: test_one_deadline_covers_acquisition_and_mutation_and_preserves_ unknown_effects gave the request 0.1 s of real time to take a snapshot, run tmux's preflight commands and reach a held after-new-window hook. When that took longer on macOS-15 the deadline expired first, the hook never fired and the test raised "command deadline exceeded" from its own wait-for (CI jobs 108738309513, 108738309552, 111211994832). With a tmux shim on PATH that sleeps 10 ms per spawn, the old test fails; it cannot tell slow startup from an enforced deadline. what: - Give the request a long budget and advance Mutation's clock after target acquisition (or before it, for the not-sent case), so exactly 1 s of real time remains for the held command - Keep the assertions: the mutation budget is below the acquisition budget, both share one cancel token, delivery is possibly_sent with unknown effects after dispatch and not_sent with none before it - Wait on the wait-for channels and the pending request with the hang guard - With the same shim at 100 ms per spawn the new test passes
why: A macOS flake shows up once in about a hundred runs, so a single green pass proves nothing. A scheduled repeat gives each test a failure rate and an Ubuntu control to compare against. what: - Add scripts/stress: runs the real-tmux integration suite N times and writes each test's run and failure counts to failures.csv and a Markdown table - Add stress.yml: weekly and on dispatch (input repeat, default 10), one job per runner, macOS-15 and Ubuntu 24.04, tmux 3.7c, the table in the step summary and the CSV and logs as an artifact
Open
tony
force-pushed
the
flaky-investigations-000
branch
from
December 5, 2026 18:08
5cc1805 to
780166c
Compare
why: Darwin's sockaddr_un.sun_path holds 104 bytes, and the macOS temporary directory alone is long. An over-long path made tmux fail with an error that did not name the cause. what: - Make TmuxFixture raise a named error for a socket path of 104 bytes or more and remove its directory - Test a too-long TMPDIR against a short control
why: Tests that pass on Linux failed on the macOS runner through timing, path and process differences. Contributors need the rules and a way to reproduce each on Linux. what: - Add .github/MACOS_CI.md and link it from CONTRIBUTING.md - List the helpers this repository uses to follow it
why: `with_scope` wrapped every async test in `with_timeout(0.8)`. That one bound covers ruby child spawns, 32-request admission, control opens and `Async.open`. A slow process start on a loaded runner expired it, so tests failed with `Async::TimeoutError` although nothing hung. what: - Replace the 0.8 s bound with `HANG_GUARD_SECONDS` (10 s). - Tests still return as soon as their events happen; the bound fires only when a test hangs. Evidence: pinned to one CPU beside 40 busy loops, async_test had 1 failure and 12 errors in 22 tests before this series and none after it. The slowest macOS async test in the 50-repetition stress run (run 37201292911) took 0.29 s, so 10 s is more than 30x it.
why: `budget` capped every benchmark `timeout:` at 0.5 s, including `Server.start`, session creation, `wait_for` readiness and cleanup waits. A slow tmux or ruby start aborted the run with a deadline error. The benchmark times its own phases, so the cap only guards against hangs. what: - Raise `DEADLINE` from 0.5 s to 10 s. - Raise the 0.2 s `IO.select` that waits for the pipelined second request to be written to `DEADLINE`.
why: Several tests put a 0.08 to 1 s deadline around a step that starts a ruby or tmux client. On a loaded or slow-spawning runner the deadline fired before the process started, so the test failed on a hang-guard error, not on the behavior it checks. None of these tests asserts how fast a process starts. what: - Cleanup budgets that retire a TERM-ignoring child and assert empty `cleanup_errors` or a reaped pid use `HANG_GUARD_SECONDS`: two async_test tests (0.08 s) and one process_test test (0.1 s). The map-failure test also asserts ECHILD after cleanup, so it is not a deadline test and leaves the 0.08 s group. - `link.select` that must reach a tmux hook before the test cancels it (operation_budget_test, 0.5 s) and the terminal attach that covers client start (terminal_test, 1 s) use `HANG_GUARD_SECONDS`. - The installed MCP helper protocol deadline, executor timeout, connect wait and owner join (package_test, 0.5 s) share one `hang_guard` value passed in from `HANG_GUARD_SECONDS`. - The whole-command deadline on a ruby child that must write READY first (process_test, 0.1 s) becomes 2 s, and the join after it uses `HANG_GUARD_SECONDS`. The test checks that a deadline after dispatch reports possible effects. The executor has no injectable clock, so the deadline stays real; 2 s keeps the test short while leaving the child time to start. Evidence: with a `tmux` shim that sleeps before each exec, the operation_budget test errors at 0.7 s and 1.2 s per spawn before and passes after, and the terminal attach test errors at both delays before and passes after.
why: Joins and selects that wait for a spawned ruby child to start, connect, exit or be reaped used a 0.5 s literal beside `HANG_GUARD_SECONDS`, so the shared guard never applied to them. Each wait returns when its event arrives; the literal only failed a test whose child started late. what: - process_test: 16 asserted joins and selects, and the READY `read_event` deadline, move from 0.5 s to `HANG_GUARD_SECONDS`. - operation_budget_test: the join after cancelling a blocked preflight moves from 0.5 s to `HANG_GUARD_SECONDS`. - Joins inside `ensure` blocks stay at 0.5 s: they only release threads after a failure and assert nothing. Evidence: pinned to one CPU beside 40 busy loops, process_test had 11 failures in 21 tests before this series and none after it.
why: The shipped examples bounded readiness, held requests and process exits at 1 or 5 s. Each wait returns as soon as its event arrives, so the bound only fails a hung example, yet a slow tmux or ruby start on a loaded machine could still exhaust it. Readers copy these numbers, so they should be sized for the slowest start. what: - Raise every positive wait in examples/ from 1 or 5 s to 10 s: control exchanges, `wait_for`, held requests, `output.next`, MCP frame reads, shell connect and setup, and the MCP process exit. - Update the "five seconds" error text in api/capture.rb. - Regenerate the recipe and async README excerpts with `scripts/examples --write`. - With a `tmux` shim that sleeps 1.2 s before each exec, api/capture.rb fails with a control request deadline before this change and passes after.
why: Sizing a hang guard needs the slowest observed duration of the steps it bounds. The stress logs held per-test durations but the CSV and summary dropped them, and the unit tests that spawn ruby children never ran on macOS under repetition. what: - Add a `slowest_seconds` column to `failures.csv`. - Add a table of the five slowest tests to `summary.md`. - Include `test/unit/process_test.rb` in each repetition.
why: The paused-control test refused to see "async-missed" in the resumed stream, and failed about 3 runs in 30 on Linux. The pane runs `cat`, so each sent line produces two outputs: the tty echo, then cat's reply. The observer wait broke on the first copy and the test resumed the pane. The second copy then reached tmux after `%continue`, which sets the pane offset to the current end of output (`control_continue_pane`, tmux 3.7c control.c), so it was delivered to the resumed stream ahead of "async-resumed". Output written while the pane is paused is dropped (`control_pause_pane` discards queued blocks), so the library and tmux behave as the test expects; only the ordering of the test's own synchronization was wrong. what: - Collect the observer's output until both copies of "async-missed" have arrived, then resume the pane. - No sleep and no timing change; the wait still ends on the event and stays bounded by `HANG_GUARD_SECONDS`. Evidence: the old wait failed this test in 3 of 30 runs. A copy of the test whose pane echoes immediately and replies to "async-missed" 0.3 s later failed 3 of 3 runs with the leak before this change and passed 3 of 3 after. With the default cat pane as a control, the new wait failed 0 of 40 runs.
why: `ReleaseTest` builds a git repository, commits, then copies the whole tree with `FileUtils.cp_r`. Since git runs automatic maintenance after a commit, detached by default (`maintenance.autoDetach`), a background process can hold `.git/objects/maintenance.lock` (taken in builtin/gc.c before the detach) and remove it while the copy is walking the directory. The copy then fails with `ENOENT` on that file and 12 `ReleaseTest` cases error with "release source git check failed". It failed once on linux / Ruby 3.4.10 / tmux 3.7c in PR 18 (runner git 2.55.0). Release is an unrelated suite; nothing in this series touches it. what: - Set `maintenance.auto=false` and `gc.auto=0` in the fixture repository's config before its first commit, so no maintenance process starts in it. Evidence: with git 2.55.0, a commit spawned `git maintenance run --auto --quiet --detach` under the default config and none with the two settings. A seam that creates and deletes the lock during the copy failed 67 and 72 of 200 copies with the CI error text; the same copy with no lock activity failed 0 of 200. The race window under real maintenance was too short to hit locally (0 of 300 copies, also under 8 busy loops), so the seam stands in for it. Sources: git v2.55.0 builtin/gc.c lines 1791-1818 (lock, then detach) and run-command.c lines 1956-1985 (`--detach` unless autoDetach is false).
why: Current lint rejects unfreezing an interpolated string. Contributors also need the standalone stress command's supported options. what: Use the interpolated summary directly and document the invocation at the top of the script.
why: A Ruby warning interrupted a verbose Minitest line and the CSV silently omitted that test. what: Parse Minitest's output separately from diagnostics. Check the rows against the run total and keep both streams in the log.
why: The post-dispatch case waits for a real Ruby child to reach its deadline, so it belongs in the outer suite. what: - Run the deadline case in integration through the normal executor. - Check the child PID, possible delivery and complete reaping.
why: Contributors need to know how the integration runs report slow and failing tests. what: Record the longer event waits and weekly stress report under 0.1.4.
tony
force-pushed
the
flaky-investigations-000
branch
from
December 5, 2026 18:21
780166c to
5012c40
Compare
This branch was previously deployed
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.
Eleven macos-15 compatibility jobs in the September–October investigation failed on unrelated commits while waiting for process startup or fixture handoff. Linux passed at the same commits. This PR gives event-driven waits a 10-second hang guard, replaces one 0.1-second race with an advancing clock and adds a repeat-run workflow.
Root causes
MCPMutationTest#test_one_deadline_covers_acquisition_and_mutation_and_preserves_unknown_effects, "command deadline exceeded"MCPEnrollmentTestauthored-run tests, same errorregistry.run(..., timeout: 0.5)covered helper startup, a Ruby process start.HANG_GUARD_SECONDS.TmuxFixturebounded daemon readiness and each client at 0.5 s.HANG_GUARD_SECONDS.IO.selecton the pty master, 0.5 s.HANG_GUARD_SECONDS.HANG_GUARD_SECONDS(10 s) is intest/test_helper.rb. Tests that prove a deadline elapsed keep their short real or offset-clock deadlines (0.02 s transport limits,OperationBudgetTest, the never-signalledwait-for). The two transport tests that expire a request by clock offset now offset by the guard.Evidence
The December 5 rebase uses the v0.1.3 trunk commit. On Linux arm64, Ruby 4.0.7 and tmux 3.8 passed 369 unit, 344 integration and 8 installed-gem tests with zero skips. The outer check also validated types, checked generated examples and rendered 184 documentation pages. It took 128 seconds. Tested head
One stress repetition exposed a separate reporting defect. A Ruby warning interrupted a verbose Minitest line, so the original parser recorded 363 of 364 tests. The runner now parses test output separately from diagnostics and checks its count against Minitest’s total. A fresh Linux tmux 3.7c run recorded all 364 rows, including the process deadline. That case deliberately waits two seconds for a dispatched child to time out and checks that it was reaped. It now runs in the outer suite. Deadline test Original parser · Reporting fix
Original branch measurements
tmuxshim onPATHsleeping before each exec: the old mutation test fails at 10 ms per spawn; the new one passes at 100 ms.tmuxwrapper that sleeps before each exec): at 0.6 s per spawn the old 0.5 s fixture bound fails all 9 tests inserver_test.rbwith "tmux fixture exceeded event deadline" and the 10 s guard passes all 9. The installed examples fail at the old bounds from 0.1 s per spawn and pass with the new ones; the new 5 s example waits fail from 0.2 s per spawn. The 1.0 s frame wait was not isolated from the 0.5 s waits around it.At the historical 1.1% per-job failure rate, 50 clean repetitions would occur about 58% of the time (0.989^50). The recorded stress run bounds what that sample can establish. The delay-shim experiments above exercised the timing change directly.
macOS guide
.github/MACOS_CI.mddocuments event waits, private socket paths and terminal behavior. The fixture reports an overlong path before starting its private server. The released compatibility jobs run on Ubuntu. A required macOS compatibility lane is tracked in #47.Stress workflow
The proposed weekly or manually dispatched workflow runs macOS-15 and Ubuntu 24.04 in sequence with tmux 3.7c.
bundle exec scripts/stress --repeat 10repeats the integration suite and process tests and writes per-test runs, failure counts and slowest times.