Skip to content

CI(fix): Repair the advisory macOS trial - #9

Merged
tony merged 13 commits into
masterfrom
flaky-investigations-000
Dec 5, 2026
Merged

tony merged 13 commits into
masterfrom
flaky-investigations-000

Conversation

@tony

@tony tony commented Oct 10, 2026 •

Copy link
Copy Markdown
Contributor

Keep the hosted macOS trial advisory and add an on-demand stress run. This replaces #4, which closed when initial-pr merged into master and its branch was deleted; the commits are rebased onto master.

The socket readiness check retries inside its existing one-second deadline.

Root causes

Mechanism Cause Fix Proof
WorkspaceCorpus, WorkspaceApply and the Lifecycle guide tmux and /bin/sh report the kernel's physical path; the tests compared it with /tmp and /etc, which are symlinks on macOS Resolve expected directories per assertion; accept bash for /bin/sh A symlinked fixture root fails the assertions on Linux before the change and passes after
Fixture socket readiness tmux -D signals readiness only by creating its socket, and an FSEvents watch (.NET's FileSystemWatcher on macOS) never reports a Unix socket Watch the fixture directory with kqueue on macOS; delete a replaced daemon's socket first, since tmux leaves it at exit (server.c#L121) Runner probe: socket reported 46 to 226 ms after start, and disposing a watch with no socket returns in under 1 ms (run 38078677139)
Socket identity after notification The first tmux identity probe can fail while the owned daemon is starting Retry within the fixture’s original deadline and check the daemon PID A real daemon accepted the second identity probe after a forced first failure
Sandbox setgid fixture Directories under the shared temporary parent inherited a group outside the macOS runner’s memberships. Setting mode 02700 yielded 0700. Assign the effective group to both test-owned parents and check the resulting mode. Eight previous macOS Product cells failed the assertion. The standalone Sandbox suite passed on Apple Silicon in 15.7 s and on Ubuntu in 15.0 s. Two-architecture probe · Sandbox run
Product test startup The hosted SDK version differs from the pin in global.json Install the pinned SDK before Product compiles its recording tmux fixture The same installed Product suite ran zero commands with the SDK missing and all 50 with it installed
Guide example socket path The example put its socket under the long macOS temp directory Root it under /tmp TMPDIR set to a deep directory reproduces the error on Linux before and passes after
README and guide HTTP example HTTPServer.server_bind calls socket.getfqdn before the server prints its address (server.py#L138-L143); on the hosted macOS runner the reverse lookup of 127.0.0.1 takes 35 s in setup-python 3.13.15, Homebrew 3.14.7 and python.org 3.14.7, and 0.05 s in Apple's 3.9.6 (run 38066913812) Bind with socketserver.TCPServer and print the same line A seam that delays reverse lookups fails the old example with the CI message and passes the new one; without the seam both pass

MACOS_CI.md records the rules for contributors.

Before and after

Historical macOS stress runs, every real-tmux suite on macos-latest arm64, tmux 3.7c, PowerShell 7.4.20:

Head Repetitions macOS suites failing ubuntu control
9f4bb1b, master's HTTP example 10 ReadmeWorkflow 10/10 0
8001ad3, earlier branch revision 3 none 0

Remaining

WorkspaceCorpus exceeds its 30 s per-script deadline on two macos-15 arm64 cells when it shares the runner with a second worker (run 38082614210); alone it takes about 16 s. Each pane command in it launches about 18 tmux client processes, about 31 ms each on macOS against 2 ms on Linux, so one Invoke-TmuxPaneCommand takes 453 to 705 ms there (run 38083713742). The trial keeps these timings visible per cell. The broader macOS reliability work is tracked separately. Tracking issue

At 6e52f07, Sandbox passed in seven of the eight advisory cells. Intel on PowerShell 7.4.20 with tmux 3.3a reached its 30 s Sandbox deadline. The setgid assertion recorded zero failures. Across the full macOS matrix, Product passed in zero of eight cells and Documentation in six of eight. The two failing Documentation cells reached their Help worker deadlines. Trial results

On tmux 3.3a the no-pattern pane wait returned TimedOut on Intel. On Apple Silicon the wait finished before the test sent the suffix of a split line. Both PowerShell versions passed the same PaneTextWait suite on Linux. The existing fixture uses a timed pause after the first capture. The hosted results do not identify which observation consumed the one-second wait budget. Intel job · Apple Silicon job · Fixture history

CI notes

  • macos-trial.yml covers Intel and Apple Silicon, PowerShell 7.4.20 and 7.6.10, and tmux 3.3a and 3.7c. Its summary records each Product and Documentation outcome. These suites are advisory.
  • Trial and stress install the pinned tmux commit with the same installer and use its public build information. Stress verifies the chosen binary and source on Linux and macOS. Shared installer migration
  • macos-stress.yml runs on manual dispatch. Its suites input selects the suites to repeat.
  • The current branch has separate Linux and advisory macOS runs. Linux CI · macOS trial

@tony
tony force-pushed the flaky-investigations-000 branch 6 times, most recently from 6cc86a5 to 4b84426 Compare October 10, 2026 17:39
@tony
tony force-pushed the flaky-investigations-000 branch 6 times, most recently from 8001ad3 to 7bc2d9a Compare October 10, 2026 21:17
tony added 9 commits December 5, 2026 05:08
why: tmux reads a pane's directory from the kernel, which answers
/private/tmp for /tmp on macOS. A host script's /bin/sh does the same
for $PWD when it starts in a directory it did not inherit.
WorkspaceCorpus, WorkspaceApply and the workspace guide compared these
with the unresolved fixture path and failed on every hosted macOS cell
without naming the condition. With the fixture base set to a symlink
to a real directory, each fails on its path assertion before this
change and passes after it; each also passes without the override.

what:
- Move Resolve-PhysicalDirectory from Create.Tests into OwnedTmux.ps1.
- Resolve the expected directory per assertion in WorkspaceCorpus,
  WorkspaceApply and GuideExamples. The shared fixture root stays as
  created.
- Let LIBTMUX_POWERSHELL_TEST_ROOT replace the /tmp fixture base so a
  symlinked base reproduces the macOS mismatch on Linux.
why: The advisory trial and the optional stress runs need the same
locked module packages and pinned tools.

what:
- Share the package build and macOS tool setup between workflows.
- Keep the trial matrix, its reports and its advisory suite outcomes.
why: Repeating each installed suite exposes failures that a single
hosted run can miss.

what:
- Dispatch stress runs on macOS arm64 and Ubuntu with the same tmux and
  PowerShell versions. Allow a suite subset and repetition count.
- Collect each suite's receipts and report per-test failures, timeouts
  and elapsed times with PowerShell.
why: Tests that pass on Linux fail on the hosted macOS runners for a
short list of reasons. Contributors need them before writing a test.

what:
- Add MACOS_CI.md with the rules and how to reproduce each on Linux.
- Name this repository's helpers and workflows at the end.
- Link it from CONTRIBUTING.md.
why: Fixture setup waits for the foreground tmux daemon's socket, the
only readiness signal tmux -D gives: tmux loads its config only when a
first client connects, so no config command can report. The
FileSystemWatcher used for that signal is built on FSEvents on macOS,
which never reports a Unix socket, so setup fell back to two probes
inside one second and missed slow daemons. A kqueue NOTE_WRITE watch on
the directory fires when bind() adds the socket. bind() runs just
before listen(), so a refused connect after the event is retried across
that window only. On the hosted macOS runners the watch reported the
socket of tmux -D 46 to 226 ms after start, and disposing a watch with
no socket returned in under 1 ms.

what:
- Watch the fixture directory with kqueue on macOS and keep the
  FileSystemWatcher on Linux.
- Wait for the signal or the daemon's exit, then for an accepted
  connection and the daemon's identity, under a one second hang guard.
- Delete the replaced daemon's socket file before watching for the
  new one, because tmux leaves it at exit (server.c only unlinks
  before bind); a stale file signalled at once and failed to connect.
- Use the real signal in the Remove replacement test, replace the
  silent-watcher fixture tests with one that binds a socket in a
  watched directory, and keep the timeout diagnostics test at 50 ms.

refs:
- https://github.com/tmux/tmux/blob/3.7c/server.c#L107-L150
- https://github.com/tmux/tmux/blob/3.7c/server.c#L121
- https://github.com/tmux/tmux/blob/3.7c/server-client.c#L2572-L2581
- https://github.com/libtmux/libtmux-powershell/actions/runs/38078677139
why: WorkspaceCorpus and the Lifecycle guide still fail on macOS after
the fixture paths are resolved, for two Darwin userland reasons. /etc is
a symlink to /private/etc, so the kernel reports a different pane path.
/bin/sh is bash, so pane_current_command reads bash.

what:
- Resolve /usr and /etc before comparing them with pane paths.
- Accept sh or bash for the pane command of the shell window guide.
why: The owned-rename example created its socket under the platform
temp directory. macOS TMPDIR is about 50 bytes, so the socket path
passed the 104 bytes sun_path holds and tmux failed with "File name too
long". The Documentation suite failed in the OperationsInteraction
guide on the hosted Intel cells. With TMPDIR set to an 85 byte
directory the Guides suite fails with the same error before this change
and passes after it.

what:
- Create the example's private directory under /tmp in the guide script
  and in docs/watch.md, and say why.
why: python3 -m http.server prints its address only after
HTTPServer.server_bind resolves the bound host with socket.getfqdn. On
the hosted macOS runner that reverse lookup of 127.0.0.1 blocks for
35 s in setup-python 3.13.15, Homebrew 3.14.7 and python.org 3.14.7,
while Apple's /usr/bin/python3 3.9.6 answers in 0.05 s. The wait ends
first, so the README and guide tests timed out in every macOS cell and
in all 10 macOS stress repetitions. A longer wait would pass but spend
35 s per run; socketserver.TCPServer binds without the lookup and
printed its line in 0.19 s on the same runner.

what:
- Start the example's server with socketserver.TCPServer and
  SimpleHTTPRequestHandler, printing the line the wait already matches,
  in the README, docs/input.md and examples/Guides.ps1.
- Add the reverse-lookup rule to MACOS_CI.md.

refs:
- https://github.com/python/cpython/blob/v3.13.15/Lib/http/server.py#L138-L143
- https://github.com/python/cpython/blob/v3.13.15/Lib/socket.py#L797-L821
- https://github.com/libtmux/libtmux-powershell/actions/runs/38066913812
why: The event-driven watcher can miss a notification while the owned
tmux process has a usable socket.

what:
- Keep the socket notification fast path and probe an existing socket
  when the watcher is silent. Both paths verify the owned daemon PID.
- Share the readiness deadline across the notification, connection,
  and PID waits. Exercise startup and replacement with a silent watch.
@tony
tony force-pushed the flaky-investigations-000 branch from 7bc2d9a to e3b1756 Compare December 5, 2026 11:32
@tony
tony deployed to docs-preview December 5, 2026 11:44 — with GitHub Actions Active
tony added 2 commits December 5, 2026 06:20
why: Socket creation can precede a working tmux client. One failed
identity probe ended the wait while the owned daemon was still live.

what: Retry the client inside the existing deadline. Exercise a failed
first probe after the socket notification with a real owned daemon.
why: Product builds its recording tmux before starting a worker. The
hosted image supplies SDK 8.0.428 and the project pins 8.0.425.

what: Have each trial runner install the SDK named in global.json.
@tony tony changed the title CI(fix): Gate the hosted macOS lane and add a stress run CI(fix): Repair the advisory macOS trial Dec 5, 2026
@tony
tony deployed to docs-preview December 5, 2026 13:18 — with GitHub Actions Active
@tony tony mentioned this pull request Dec 5, 2026
4 tasks done
@tony
tony deployed to docs-preview December 5, 2026 13:34 — with GitHub Actions Active
tony added 2 commits December 5, 2026 08:50
why: The trial and stress workflows still called a tmux builder that
the setup-tmux migration removed.

what: Install the pinned commit through the shared macOS action. Pass
its reported binary and source to the consumers, and use the same
installer for the Linux stress control.
why: macOS gives a new directory its parent group. The runner can lose
the setgid bit when that group is outside its memberships.

what: Assign the effective group to the two fixture parents before
creating children. Check that the TMPDIR fixture retains setgid.
@tony
tony force-pushed the flaky-investigations-000 branch from 6e52f07 to 5fbc6da Compare December 5, 2026 14:51
@tony
tony merged commit 0eb8bef into master Dec 5, 2026
21 checks passed

This branch had an error being deployed

1 failed deployment
docs-preview — 5fbc6da8 Deployed Dec 5, 2026 by tony via publish (pr-9, pr, false, true, powershell) / publish #265
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant