Skip to content

e2e:supervisor-daemon case (n): the need may find the host parked or still settling its idle exit - #413

Merged
SSFSKIM merged 1 commit into
masterfrom
need-state-race
Oct 31, 2026
Merged

SSFSKIM merged 1 commit into
masterfrom
need-state-race

Conversation

@SSFSKIM

@SSFSKIM SSFSKIM commented Oct 31, 2026

Copy link
Copy Markdown
Owner

The failure

e2e:supervisor-daemon case (n) from #411 failed twice, attempt and retry, on the merge gate for #410 (run 41231090341). The failing line asserted that the need's log line read which is parked: waking it. In both attempts it read which is restarting: waking it. Both attempts answered within the bound from a newly spawned engine host, so the product behaved correctly.

Is restarting after an exit-when-idle a normal transient? Yes

From the code:

  1. The idle exit closes the engine host's connection. The detached transport's closed() reports disconnected, and the link reads restarting.
  2. One pid poll later (PID_POLL_MS, 200 ms), with the pid gone and the exit asked as idle, the transport reports lost('deliberate').
  3. The supervisor's deliberate() then does one of two things:
    • parks the host;
    • launches a successor at once, if a request is held for the host.

So the link cannot stay restarting. In the failing run the window was stretched by the command's own spine load, which held mawsd's event loop for about 170 ms. The need landed inside it, and the supervisor held the wake's engine.ping. Then:

  • attempt 1: the host exited at .575, the need came at .767, a successor was spawned at .781;
  • the retry: the host exited at .245, the need came at .560, a successor was spawned at .563.

This is #411's held-ping path through the closing window, working as designed.

The fix (test only)

The case now accepts both state words, parked or restarting. A comment explains why. I chose this over waiting for the park because, apart from mawsd's own status read, nothing outside the daemon shows the park, and that read (daemon.status's host.supervisorStatus) wakes the host itself. A fixed sleep would only shorten the window, not remove it. The case still asserts:

  • the need's line;
  • an answer within the bound;
  • a new engine host, alive;
  • the park ask at least the idle time after the need;
  • mawsd's own idle exit.

Note from reading the code (not observed)

There is one path where an idle exit does not end in a park: the host's pid is still alive one poll after its socket closed. That is read as a quiet loss (lost('quiet')), and the host is relaunched after the restart backoff instead of parked. It needs the process to outlive its socket by more than 200 ms. In these logs the exit came about 30 ms after the ask, so I have not acted on it.

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)

…still settling its idle exit (restarting for one pid poll, longer while the command's own load holds mawsd's event loop, the supervisor then holding the wake's ping and launching at the close); both state words are the need's wake, the need's line and the new host still asserted (merge gate 41231090341, attempt and retry)

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 31, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-31T19:06:45.134694Z d9560f1 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@SSFSKIM
SSFSKIM merged commit b321a34 into master Oct 31, 2026
SSFSKIM added a commit that referenced this pull request Oct 31, 2026
…estarting (PR #413, master b321a34); O4 M3 accepted at its first stop; ledger names for O4 M3 and O7 M4a1; two tracker rows

Sminos-Session: GUI AI agent workspace charter#37052769 (MAWS on macbook)
SSFSKIM added a commit that referenced this pull request Nov 1, 2026
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