Skip to content

fix(ios): stabilize Watch runtime before screenshot capture - #189217

Merged
joshavant merged 3 commits into
mainfrom
fix/ios-watch-runtime-admission
Oct 31, 2026
Merged

joshavant merged 3 commits into
mainfrom
fix/ios-watch-runtime-admission

Conversation

@joshavant

@joshavant joshavant commented Oct 31, 2026 •

Copy link
Copy Markdown
Collaborator

What Problem This Solves

Watch screenshot capture can lose its simulator when CoreSimulator periodically replaces a fallback-mounted Watch runtime. The hosted trace shows the runtime volume being unmounted and CoreSimulator explicitly ending the Watch session, even though bootstatus exits successfully.

User Impact

CI prepares a stable Watch runtime before creating its screenshot simulator. The shared lane still captures all nine images with one active simulator at a time, and boot or capture failures stop without retries. Local runtime installation remains operator-managed.

Why This Change Was Made

Waiting for initial cleanup and removing stale registrations is insufficient: retaining the MobileAsset lets the ten-minute scanner recreate the broken cryptex registration and unmount the running fallback.

The runtime repair owner now stages the same signed runtime DMG when the selected Watch runtime is a patchable cryptex mounted through the plain-volume fallback. It clones the DMG into an owned temporary directory, retires the original image with supported simctl runtime delete, requires the old MobileAsset to be gone, and uses simctl runtime add to stage and verify the clone. The replacement must be Ready and Verified with an existing runtime bundle. The temporary clone is cleaned up on success or failure.

The initial bounded cleanup is scoped to the selected watchOS runtime and retires only unmounted, unusable stale registrations beside one healthy replacement. Deleting registrations remain owned by CoreSimulator. The existing one-time missing-runtime repair and narrow code-30 reclamation recovery share the same owner. A newly downloaded fallback is stabilized by that repair, too. Healthy cryptex mounts and already staged disk images skip staging.

Evidence

  • Cause-linked reproduction: initial cleanup succeeds, but the periodic scanner recreates the registration and shuts down the Watch about nine minutes later.
  • Supported staging experiment: original MobileAsset removed; same watchOS 27.0 / 24R362 imported as a Verified disk image. All 72 observations report Booted from 09:20:20 through 09:32:30 UTC. The 09:28:34 ten-minute scan runs without replacement, shutdown, or a captured crash.
  • Fastlane boundary regression fails on the prior implementation with eight images and the Watch Shutdown guard. Candidate passes all 16 focused tests, including nine-image capture, missing-runtime staging, cleanup, and stopping before Watch creation for retained assets, rejected imports, unverified images, and ambiguous packages. Separate regressions cover an unrelated broken watchOS installation, Fastlane namespace logging, and code-30 recovery without requiring the unavailable runtime to be healthy first. Approximately two seconds wall time.
  • Focused tooling typecheck, lint, Ruby syntax, exact test-line budget, formatting, and git diff --check pass. The 149-line test allocation covers the verified regression growth.
  • AutoReview of the full candidate against 1b870b2c78e81fded72913ecba732b84b611ca12: scoped-clean P0–P2. Review findings about selected-runtime scoping and preserving unavailable-runtime deletion recovery were fixed and reviewed again.
  • Final-head production screenshot CI passed: the lane encountered a Ready fallback plus an unmounted Unusable registration, retired the stale registration, cloned the same watchOS 27.0 / 24R362 DMG, retired the original asset, and imported a Ready, Verified disk image before Watch creation. All nine PNGs were captured. iPhone 18 Pro Max and iPad Pro 13-inch (M5) each passed all four tests on attempt one; diagnostics show at most one active simulator, followed by successful shutdown/deletion for all three families. Runtime staging took approximately seven seconds after stale cleanup.
  • CI caught a test-only tuple inference error; the one-line correction passes the actual failing root-scripts typecheck, all 16 focused tests, lint, formatting, and scoped-clean AutoReview P0–P2. Final-head CI 41190266715 has settled successfully, including screenshot evidence validation. No failures remain.

No release uploads are performed by this validation. Temporary lifecycle logging and probe workflow changes are excluded from this PR.

@clawsweeper

clawsweeper Bot commented Oct 31, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@joshavant
joshavant marked this pull request as ready for review October 31, 2026 08:25
@joshavant
joshavant marked this pull request as draft October 31, 2026 08:31
@clawsweeper clawsweeper Bot added clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:bug Preliminary submission classification; full source review pending. clawsweeper:intake:needs-environment Preliminary submission classification; full source review pending. clawsweeper:intake:needs-repro Preliminary submission classification; full source review pending. labels Oct 31, 2026
@clawsweeper

clawsweeper Bot commented Oct 31, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR adds CI-only Watch runtime admission checks and cleanup of stale, unmounted runtime registrations before simulator creation.

Example: watchOS 27.0 has a mounted Ready image alongside an unmounted Unusable registration.

  • Before: The screenshot lane immediately creates the Watch simulator while runtime cleanup may still be pending.
  • After: The candidate retires the stale registration with --keep-asset and waits for admission, although successful native capture remains unproven.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) Useful investigation with focused regression coverage, but the candidate remains unproven and introduces a source-verifiable admission regression.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🦪 silver shellfish (2/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Native screenshot jobs can finish iPhone and iPad capture, then lose the Watch simulator during CoreSimulator runtime maintenance.
Reason: The maintainer-authored direction addresses an observed pipeline failure, but the candidate has not established that its cleanup prevents it.

Merge readiness

⛔ Needs changes before merge - 2 items remain

Keep this maintainer-authored draft open for investigation; its admission gate introduces an avoidable failure for healthy selected runtimes.

Priority: P2
Reviewed head: 909e51821dc6e2882c3237a5f19f861a2eb1e2ab

Before merge

  • Scope admission to the selected runtime (P2) - The inventory includes every Watch runtime, and readiness requires every entry to be mounted and Ready. With a healthy selected watchOS 27.0 runtime and an older watchOS 26.0 Unusable registration on a separate volume, the older entry can never satisfy readiness and has no Ready replacement to qualify for cleanup. After 120 seconds, the selected runtime is available, so the generic cleanup exception escapes without repair and stops capture. Previously, runtime selection ignored the unavailable older version. Filter admission and cleanup to the selected runtime, extending that scope only for a demonstrated shared-volume dependency.
  • Explain or restore the original intent of Admission scope across installed Watch runtimes - 07563dc: Select the newest available runtime and create a device from its supported types; the PR explains same-runtime shared-asset cleanup but gives no reason an unrelated runtime must be healthy.

Findings

  • [P2] Scope admission to the selected runtime — apps/ios/fastlane/watch_runtime_admission.rb:16-17

Provenance

  • Admission scope across installed Watch runtimes changes intended behavior without addressing why it exists (07563dc: Select the newest available runtime and create a device from its supported types; the PR explains same-runtime shared-asset cleanup but gives no reason an unrelated runtime must be healthy.)

Tests

  • Missing end-to-end proof: Provide a successful native screenshot-lane run exercising the observed stale-registration condition through Watch capture and cleanup, plus a regression covering a healthy selected runtime beside an unrelated unusable runtime.
Agent review details

How this fits together

The iOS Fastlane screenshot lane selects a Watch runtime, admits and creates a simulator, captures the Watch image, and cleans up the simulator; the existing owner permits one CI runtime repair.

flowchart TD
  A[Fastlane screenshot lane] --> B[Select available Watch runtime]
  B --> C[CI runtime admission]
  C --> D[Inspect mounts and registrations]
  D --> E[Retire stale registration]
  D --> F[Create and boot simulator]
  E --> D
  F --> G[Capture and clean up]
Loading

Technical review

Best possible solution:

Keep admission within the existing selected-runtime recovery boundary and retain only cleanup that native evidence shows prevents the observed shutdown.

Do we have a high-confidence way to reproduce the issue?

Source establishes the unrelated-runtime admission failure; the reported native shutdown has linked failed runs, but this read-only review did not reproduce it.

Is this the best way to solve the issue?

The shared admission boundary is appropriate, but requiring unrelated runtime registrations to become healthy expands the failure surface without resolving the demonstrated shutdown.

Full review comments:

  • [P2] Scope admission to the selected runtime — apps/ios/fastlane/watch_runtime_admission.rb:16-17
    The inventory includes every Watch runtime, and readiness requires every entry to be mounted and Ready. With a healthy selected watchOS 27.0 runtime and an older watchOS 26.0 Unusable registration on a separate volume, the older entry can never satisfy readiness and has no Ready replacement to qualify for cleanup. After 120 seconds, the selected runtime is available, so the generic cleanup exception escapes without repair and stops capture. Previously, runtime selection ignored the unavailable older version. Filter admission and cleanup to the selected runtime, extending that scope only for a demonstrated shared-volume dependency.
    Confidence: 0.94

Overall correctness: patch is incorrect
Overall confidence: 0.93

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 54a2fe137a70.

Provenance checked

  • Shared Watch simulator creation and one-time runtime repair keeps the original intent (598e945: Resolve and repair the selected Watch runtime at one shared boundary while preserving local installation ownership and stopping boot or capture failures.)
  • Runtime-registration cleanup ownership keeps the original intent (199928c: Leave Deleting registrations to CoreSimulator while permitting targeted repair of the remaining selected-runtime image.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

Likely related people:

  • Josh Avant: Raw commit 598e945 adds apps/ios/fastlane/Fastfile:320 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 598e945b9ff5; files: apps/ios/fastlane/Fastfile)
  • Vincent Koc: Raw commit 67480b5 adds apps/ios/fastlane/Fastfile:2430 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 67480b59ae5d; files: apps/ios/fastlane/Fastfile)

PR surface

Source +64, Tests +62, Docs +6, Other +2. Total +134 across 5 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 2 65 1 +64
Tests 1 64 2 +62
Docs 1 7 1 +6
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 5 138 4 +134

Labels

Label changes:

  • add P2: This affects native screenshot automation rather than ordinary application runtime behavior.
  • add merge-risk: 🚨 automation: The new admission condition can stop screenshot jobs despite a healthy selected Watch runtime.
  • add rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: This affects native screenshot automation rather than ordinary application runtime behavior.
  • merge-risk: 🚨 automation: The new admission condition can stop screenshot jobs despite a healthy selected Watch runtime.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦪 silver shellfish.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

Reviewed October 31, 2026, 4:45 AM ET / 08:45 UTC.

@joshavant joshavant changed the title fix(ios): prevent Watch screenshot shutdown during runtime cleanup fix(ios): stabilize Watch runtime before screenshot capture Oct 31, 2026
@joshavant
joshavant marked this pull request as ready for review October 31, 2026 09:42
@joshavant
joshavant merged commit 07ec4dc into main Oct 31, 2026
104 checks passed
@joshavant
joshavant deleted the fix/ios-watch-runtime-admission branch October 31, 2026 10:41
@joshavant

Copy link
Copy Markdown
Collaborator Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 1, 2026
…#189217)

* fix(ios): wait for Watch runtime cleanup before screenshots

* fix(ios): stabilize Watch runtime before screenshot capture

* test(ios): type Watch staging failure pairs as tuples
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. P2 Normal backlog priority with limited blast radius. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: M status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant