Skip to content

fix(agent-cli): detached readiness waits for this project's Metro - #141

Open
vonovak wants to merge 1 commit into
vonovak/metro-discovery-project-rootfrom
codex/detached-own-metro-ready
Open

vonovak wants to merge 1 commit into
vonovak/metro-discovery-project-rootfrom
codex/detached-own-metro-ready

Conversation

@vonovak

@vonovak vonovak commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

During parallel native builds, another worktree can claim a detached child’s initial port before its Metro starts. dev --detach --wait-ready previously accepted that foreign server’s ready response and reported success while its own build continued.

Follow the child’s lock throughout readiness, cancel the old status request when its port changes, and reject explicit project-root mismatches. Reusing an existing server now also honors --wait-ready, and final status checks reject a foreign root. The wait keeps one timeout budget, preserves child-failure reporting, and retains compatibility with older Metro versions without a root header.

This layer sits after #132 and before #133. Native command-connection cleanup remains separate Expo work.

Validation:

  • Regression tests fail against the original implementation.
  • 4,785 unit tests pass on this layer; 4,963 pass on the combined stack.
  • All 27 detached-start end-to-end tests pass, including real HTTP/lock-socket port changes and cancellation of an obsolete request.
  • The combined stack passes 27 stubbed EAS end-to-end tests and the smoke server-reuse case.
  • Typecheck, build and formatting pass on both this layer and the combined stack. Lint passes on this layer with existing warnings outside changed files.

@vonovak
vonovak added this pull request to stack #142 October 9, 2026 07:50
During parallel native builds, another worktree can claim a detached child's initial port before its Metro starts. The parent previously accepted that foreign server's ready response and reported success while its own build continued.

Follow the child's lock throughout the readiness wait, cancel the old status request when the port changes, and reject explicit project-root mismatches. Keep one timeout budget, preserve child-failure reporting and older Metro versions without a root header, and honor --wait-ready when reusing an existing server. Final status checks also reject a foreign root.

Validation: all 4,785 unit tests pass; all 27 detached-start end-to-end tests pass, including real HTTP/lock-socket port changes and cancellation of an obsolete request. Typecheck, build, formatting and lint pass (existing warnings outside changed files).

Place immediately after #132 and before #133. The regression tests reproduce the false success against the original implementation. Native command-connection cleanup is separate Expo work.
@vonovak
vonovak force-pushed the codex/detached-own-metro-ready branch from 3d8a01e to 7a1db8a Compare October 9, 2026 08:18
@vonovak
vonovak marked this pull request as ready for review October 9, 2026 15:33
@vonovak
vonovak requested review from Kudo and davidmokos October 9, 2026 18:06
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