Skip to content

fix: wait for POSIX companion shutdown before restart - #155

Open
jamilahmadzai wants to merge 1 commit into
monk-io:mainfrom
jamilahmadzai:codex/monk-bounty-20260723
Open

fix: wait for POSIX companion shutdown before restart#155
jamilahmadzai wants to merge 1 commit into
monk-io:mainfrom
jamilahmadzai:codex/monk-bounty-20260723

Conversation

@jamilahmadzai

Copy link
Copy Markdown

Summary

  • wait up to 10 seconds for the managed POSIX companion to stop before launching its replacement
  • fail safely if the old process does not stop, instead of starting a competing process
  • keep the root, packaged Monk, and Antigravity launcher copies byte-identical
  • add a deterministic restart-handoff regression to Linux and macOS CI

Root cause

The POSIX background launcher sent SIGTERM to the recorded process and immediately started the replacement. If the old companion still owned the port, the replacement could defer to the apparently healthy old process and exit. The launcher's first readiness check could then succeed against the process being stopped, so SessionStart returned success shortly before both companions were gone.

Waiting for the managed process to exit closes that handoff window. The bounded timeout also prevents the launcher from hanging indefinitely or creating a competing replacement when shutdown fails.

Validation

  • ./tests/start-monk-agent-restart-handoff.sh (five consecutive passes)
  • sh -n on all three launcher copies and the new regression
  • byte-for-byte comparison of all three launcher copies
  • workflow YAML parse
  • git diff --check

Fixes #154.

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.

[Bug bounty] POSIX restart can report success after both companions exit

1 participant