Skip to content

e2e supervisor.spec: (h) and (f) settle on the app's own state - #645

Merged
SSFSKIM merged 3 commits into
masterfrom
supervisor-settle-on-app-state
Nov 14, 2026
Merged

SSFSKIM merged 3 commits into
masterfrom
supervisor-settle-on-app-state

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Nov 14, 2026

Copy link
Copy Markdown
Owner

This fixes two e2e:supervisor-daemon flakes under R2: a scene settles on a state the app shows.

(h), the quit guard's count (supervisor.spec.ts:969, red at :994). Tracker row 2026-11-06 has five sightings; the fifth is 43520247669, on the mini's host under --lane no-hosted. The guard does not read a stale count. It calls pty.foreground live (busyReport, src/main/lifecycle/quit-guard.ts:89, through src/main/app.ts:1032), the same probe the case polled. For a freshly spawned shell, foregroundOf (src/pty-host/foreground.ts:28) reads busy while node-pty's spawn-helper execs, then idle until the shell reads its command, then busy. That was measured with node-pty 1.1.0 on a Mac: about 20 ms for /bin/sh and about 700 ms for zsh. The case took the spawn-time busy for its command running, and the guard probed in the idle gap after it.

  • Each command now prints a start marker. The case waits for it in both rings, read through the app's own pty.attach.
  • Each command then holds the terminal as one job until the case creates a release file after the quit.
  • Before quitting, the case polls the guard's own report() until it reads what the assertion accepts. It reads it through a test-only hook, globalThis.__maws_quit, installed only under MAWS_E2E=1 in an unpackaged build, as __maws_wake is.
  • The fixed 18 s wait after the quit is now a poll for files that each command writes when it ends.

Product verdict: not a defect. On the daemon shape a quit asks only about unsaved files, and the busy count only goes to the log.

(f) and its three siblings (supervisor.spec.ts:801, red at :834). This was a flaky pass in 43522613800. The first host.status read after the pid changes can still say 'build', because mawsd's own daemon.status reaches main separately. successorOfOwnBuild now waits for the pid to change, then polls the same read for 'same', bounded at 30 s. A successor that stays 'build' still fails.

Tracker.

  • Row 2026-11-06: the fifth sighting, the mechanism, the fix and the verdict.
  • Row 2026-10-28 (hosted-Mac flakes): entry (28) has its second sighting (transcript.spec.ts:111, 182 against at most 80, at 777f7ba), and a new entry (38) is the (f) race, repaired here.

A review finding is fixed too: the scratch paths reach the shell single-quoted.

Gates:

  • static plus e2e:supervisor-daemon on a hosted Mac: 43538176719 at the head, green. At a356816: 43531459170, 27 passed, 0 flaky.
  • R1's mini copy, e2e:supervisor-daemon on the mini's host (--lane no-hosted): 43531431935 at a356816, 27 passed, 0 flaky. The only commit since then quotes three paths.
  • unit: 43539268268, 4/4 green at the head.
  • unit:darwin: green on a hosted Mac in 43538093048 at a356816. In that same run, unit 4/4 failed on an unrelated new flake: test/endpoint/org-recovery.local.test.ts:110, 'no the fork refused within 5000 ms'. It goes into the daily flake collection.

Sminos-Session: CI-opt#a45b97a3 (doperpowers on macbook)

(h) quit with the guard reading "1 busy terminal" though the case had
polled both shells busy (fifth sighting, run 43520247669, 3.1 s into
the case, so neither 8 s command had ended). The guard reads nothing
cached: it asks the pty host's pty.foreground live, as the poll did.
The probe reads a freshly spawned shell busy while node-pty's
spawn-helper execs it and while a startup file runs a child, then idle
until the shell reads its command, then busy (node-pty 1.1.0, probed
locally: within 20 ms for /bin/sh, 700 ms for zsh). The poll took the
writer's spawn-time busy for its command; the guard probed it in the
idle stretch after. Each command now prints its start and holds the
terminal as one job until the case releases it after the quit; the
case waits for both starts in the app's ring, then for the guard's own
report (globalThis.__maws_quit, MAWS_E2E in an unpackaged build only)
to count two, and waits for both commands' end files with no app
instead of a fixed 18 s.

(f) read host.status once after the successor's pid moved and could
see matches 'build' (run 43522613800). matches compares the
successor's status with mawsd's daemon.status, which reach main apart,
and mawsd's engine-host build reads as the seam's 'stale' until it has
started a host of its own. The four cases asserting 'same' after a
stale-build update now poll the same read until it says 'same' (30 s),
so a successor that stays 'build' still fails.

Sminos-Session: CI-opt#a45b97a3 (doperpowers on macbook)
…ches race and transcript (28)'s second

The quit guard's row gets the fifth sighting (43520247669) with the
cause found there, C9's probe reading a starting shell busy, idle, then
busy, not a stale guard, the fix on this branch, and the verdict that
the guard's count is no product defect on the daemon shape. The
hosted-Mac row gets run 43522613800: transcript (28)'s second sighting
and case (f)'s red at :834 as a new entry (38), repaired here.

Sminos-Session: CI-opt#a45b97a3 (doperpowers on macbook)
… words

Review finding: the release and completion paths were interpolated inside
double quotes, where a $(...) or backtick in a tmpdir path would expand.
They are now single-quoted words.

Sminos-Session: CI-opt#a45b97a3 (doperpowers on macbook)
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