feat(#186): Phase 6 — foreign-flow arbitration + canonical Maestro surface#276
Merged
Conversation
…cal maestro surface Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
- BLOCKER: teardown grace (FOREIGN_GRACE_MS) — our own dying maestro driver matches the detector for seconds after lease release; cache-busting can't fix it, an arbiter-side lastFlowReleasedAt window does - ps axww (mid-path udid truncation = production false negatives) - RN_IOS_FOREIGN_GUARD knob (WARN stays as deprecated alias, loudly documented) - udid-gated in-flight dedup + screenshot lastActive clarification Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…tection (+ps -ww) Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… fast at the arbiter Includes the plan-review teardown grace (FOREIGN_GRACE_MS): our own dying maestro driver matches the detector for seconds after lease release. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
…rState Live-gate finding: the resolver returned the INSTALLED container path as --app-file, but clearState uninstalls the app and deletes that container before maestro-runner reinstalls from it — 'No such file or directory' mid-flow, app left uninstalled. The container resolution is now snapshotted to a temp dir (APFS clonefile cp -Rc, plain copy fallback) that survives the uninstall; DerivedData stays the fallback. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
… rule Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
You have reached your Codex usage limits for code reviews. You can see your limits in the Codex usage dashboard. |
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
This was referenced Jun 11, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
#202 Phase 6 — the final phase of the re-think spec (
docs/superpowers/specs/2026-06-10-device-control-phase4-6-rethink-design.md§3). Closes #186.A detected foreign Maestro/XCUITest session (standalone maestro-mcp, raw CLI) is now an arbiter input: while it drives the target simulator (UDID-scoped
ps axwwscan, 5 s TTL, fail-open), local L2device_*and L3 flow tools refuse fast withBUSY_FOREIGN_FLOW— pointing at the safe L1 reads — instead of colliding into the ~44 s runner-leak cascade #186 reported. L1 introspection stays free by contract;device_screenshotserves pixels via its simctl fallback; a 10 s teardown grace after the plugin's own flows prevents self-false-positives while WDA dies (plan-review BLOCKER). The plugin'smaestro_runis declared the canonical Maestro surface.Live gate (b) — foreign refusal end-to-end (booted iPhone 17 Pro)
~830× faster failure (53 ms vs ~44 s), and it's an explained refusal instead of a cascade.
Live gate (a) — escape hatches verified closed (#201 closed)
The gate caught one more real bug in the shipped #201 fix: the resolver passed the installed container path as
--app-file, butclearStatedeletes that container before maestro-runner reinstalls from it ("No such file or directory", app left uninstalled). Fixed: the container resolution is snapshotted outside the device container (APFS clonefilecp -Rc) first (8119ba1).Plan-review hardening (Gemini + Claude research, pre-code)
DeviceSessionArbiter.lastFlowReleasedAtgates the scan.ps axww— command-column truncation could silently drop a mid-path UDID (production false negatives).RN_IOS_FOREIGN_GUARD=0(authoritative; gates a refusal now, not a log line);RN_IOS_FOREIGN_WARN=0stays as a deprecated alias with the same full effect.Tests
1985/1985 (
test:all): 8 gate + 12 arbiter-foreign unit tests (incl. teardown grace, L1-never-scans, own-flow skip, envelope extras), 2 snapshot-resolver tests + 2 updated contract tests, wiring pins. Composite one-call-one-lease verified (internal handler calls never re-enter the gate).This is the last open front of #202 — the issue closes when this merges.
🤖 Generated with Claude Code