Skip to content

fix(ios): wait for host headroom before screenshot boot - #188014

Merged
joshavant merged 2 commits into
mainfrom
fix/ios-watch-screenshot-boot
Oct 30, 2026
Merged

joshavant merged 2 commits into
mainfrom
fix/ios-watch-screenshot-boot

Conversation

@joshavant

@joshavant joshavant commented Oct 30, 2026 •

Copy link
Copy Markdown
Collaborator

Closes #188012

What Problem This Solves

Screenshot capture can start a fresh Watch simulator while the host is still saturated after the phone/tablet captures. In CI 40981704279, all eight iPhone/iPad captures and their cleanup passed, but Watch boot ended during migration before installation. The runner had only 4–7% idle CPU around Watch boot. The same shutdown signature predates this branch (#172730); the precise Apple shutdown cause remains unknown.

User Impact

Before creating each screenshot simulator, require ten continuous seconds with at least 30% idle host CPU. A host that cannot meet that condition within five minutes fails before the next device starts. This is a contention mitigation. Both predeclared fresh hosted screenshot flows passed on their first attempts; the precise Apple shutdown cause remains unknown.

Why This Change Was Made

Reuse qualification's existing headroom helper through its native Node command-line entry point, within the existing simulator lifecycle owner. No new timer or readiness policy. Fresh devices, serial ownership, clean builds, exact Booted verification, cleanup, and all capture assertions remain intact. Boot and capture are not retried, and their deadlines are unchanged. The existing resource timeline recognizes the added headroom phase.

Evidence

  • The lane regression fails on the base with simulator created without CPU headroom. With the candidate, all 30 focused Fastlane, headroom, and resource timeline tests pass (1.20 s Vitest; 2.44 s complete wrapper). The lane fixture also proves that a Watch headroom timeout preserves the eight completed screenshots, starts no Watch simulator, and performs no installation.
  • Direct native Node command-line execution passed on local Node 26.5 and Node 24.18. Existing headroom tests retain sustained-idle, busy-reset, delayed-observer, timeout, frozen-counter, and cancellation coverage. Tooling-test typecheck, Ruby syntax, Node syntax, script erasability, formatting, and diff checks passed.
  • Independent AutoReview/Codex review against base f126f05fd9521e2977f2b7921ff49522fde0b552: scoped-clean at P0–P2, no findings; complete Fastfile, shared helper, qualification caller and timeline supplied. Hosted ClawSweeper found one P3 timeout-message issue, now addressed with explicit recovery guidance. Its pending-hosted-proof observation is resolved by the results below.
  • Author simplification kept one existing readiness owner and added no fallback or retry. No readiness algorithm or capture deadline was changed; regression growth: 17 lines with a separate exact allocation. No visual/product UI change.

Hosted acceptance, recorded before candidate execution

Run the complete combined iPhone/iPad/Watch screenshot flow on two fresh hosted runners at the same candidate SHA: the normal PR screenshot job and the existing screenshot-only workflow operation. Require all nine PNGs, both phone/tablet native capture groups, successful Watch boot/install/launch/capture, and owned-device cleanup. Record each headroom duration and full result, including failures. A passing run is not proof of Apple's internal crash cause or a measured performance improvement. No release upload, production service changes, runner upsize, weakened assertion, or blind retry.

Completed hosted acceptance

Both predeclared runs passed at candidate 7a19f1f5098cfd3c99388cd089aca688ac0b8cef on fresh hosted runners, without retries. The PR job tested merge revision d10f521563292ed3dc8265297aff5ebc06751e2a.

Run iPhone / iPad / Watch headroom waits Watch boot / capture Result
Screenshot-only 40985114310 60.18 / 76.26 / 14.27 s 37.37 / 26.60 s 9 PNGs; all captures and cleanup passed
PR CI 40985108133 46.17 / 10.11 / 14.12 s 37.48 / 23.89 s 9 PNGs; all captures and cleanup passed
  • All eight native phone/tablet screenshot tests passed; Watch boot, installation, launch, and capture passed. All three owned simulators were shut down and deleted, with zero active devices afterward.
  • Final Watch admission measured 98.60% and 78.02% idle CPU, respectively. Both Watch images were inspected and are byte-identical at 422×514 pixels.
  • Both runners used Xcode 27.1 (27A9275) and pinned Node 24.22.1, proving the native Node entry point on the hosted runtime. Release upload and qualification jobs were skipped in the screenshot-only operation.
  • Artifacts: ios-screenshots-40985114310-1, ios-release-screenshot-diagnostics-d10f521563292ed3dc8265297aff5ebc06751e2a, and ios-release-screenshot-capture-d10f521563292ed3dc8265297aff5ebc06751e2a.
  • Follow-up 74875a1899ed changes only the timeout text to tell operators to let competing host work finish or stop it, then rerun the screenshot lane. Seven headroom tests, focused type-aware lint, formatting, and diff checks passed after that wording change. Final-head PR CI settled with no failed or pending checks. The final revision also passed a third fresh PR screenshot capture and its screenshot-evidence check; the simulator implementation is unchanged from the two predeclared runs.

This adds an intentional readiness wait; it is not a performance-speedup claim or proof of Apple's internal shutdown cause.

@clawsweeper

clawsweeper Bot commented Oct 30, 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.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: ios App: ios scripts Repository scripts size: XS labels Oct 30, 2026
@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. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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 30, 2026
@clawsweeper

clawsweeper Bot commented Oct 30, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs changes before merge.

What this changes

This PR checks host CPU headroom before creating each iOS screenshot simulator.

Example: After eight iPhone and iPad screenshots, the host has only 7% idle CPU.

  • Before: The lane immediately creates and boots the Watch simulator.
  • After: The lane waits for ten continuous seconds with at least 30% idle CPU, failing before creation if that takes more than five minutes.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The implementation is focused and preserves lifecycle invariants; completed hosted acceptance is still unavailable, and one low-impact diagnostic defect remains.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored PR is outside the ordinary contributor proof gate; its explicitly planned hosted acceptance remains pending in both capture jobs, and the supplied lane fixture mocks the CPU command.
Patch quality 🐚 platinum hermit (4/6) 1 actionable review finding remain.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Hosted screenshot capture can reach Watch boot while the runner remains heavily loaded after phone and tablet captures.
Reason: The collaborator-approved mitigation reuses an established readiness contract without adding options, retries, state owners, or weaker capture assertions.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this maintainer-authored PR adds a focused mitigation through the existing readiness owner; the timeout diagnostic needs an actionable recovery instruction.

Priority: P2
Reviewed head: 7a19f1f5098cfd3c99388cd089aca688ac0b8cef

Before merge

  • Explain how to recover from the headroom timeout (P3) - When the host cannot sustain 30% idle CPU within five minutes, the new command exits unsuccessfully and says boot was not started, but gives the operator no recovery action. The repository requires changed error messages to explain the next step. Tell the operator to let competing host work finish or stop it, then rerun the screenshot lane.

Findings

  • [P3] Explain how to recover from the headroom timeout — scripts/lib/ios-simulator-headroom.ts:60

Tests

  • Missing end-to-end proof: Complete the two already-running hosted acceptance scenarios and retain headroom durations, nine PNGs, native capture results, Watch boot/install/launch/capture, and owned-device cleanup.
Agent review details

How this fits together

Fastlane owns serial screenshot simulator creation, capture, and cleanup; it now invokes qualification's shared CPU readiness helper before creating each device and records the phase through existing diagnostics.

flowchart TD
 A[Fastlane screenshot lane] --> B[Check simulator inactivity]
 B --> C[Shared CPU headroom helper]
 C --> D[Create and boot simulator]
 D --> E[Capture screenshots]
 E --> F[Shut down and delete simulator]
 C --> G[Stop on headroom timeout]
Loading

Technical review

Best possible solution:

Retain the shared readiness check, make its timeout explain recovery, and complete the planned hosted acceptance.

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

Current main demonstrably creates screenshot simulators without CPU admission, and the cited hosted capture job failed; this review did not reproduce a CPU-induced Watch shutdown or independently establish its cause.

Is this the best way to solve the issue?

Reusing the existing readiness owner is the smallest focused mitigation and preserves cleanup, exact boot-state checks, and capture assertions, but it does not establish why Apple terminated the earlier boot.

Full review comments:

  • [P3] Explain how to recover from the headroom timeout — scripts/lib/ios-simulator-headroom.ts:60
    When the host cannot sustain 30% idle CPU within five minutes, the new command exits unsuccessfully and says boot was not started, but gives the operator no recovery action. The repository requires changed error messages to explain the next step. Tell the operator to let competing host work finish or stop it, then rerun the screenshot lane.
    Confidence: 0.96

Overall correctness: patch is correct
Overall confidence: 0.89

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 0b81496b64ab.

Provenance checked

  • Shared CPU readiness helper keeps the original intent (a218de7: Prevent cold Simulator startup from consuming qualification pairing and test deadlines.)
  • Serial screenshot simulator lifecycle keeps the original intent (03f92a5: Capture using one fresh owned simulator at a time, preserving cleanup and leaving unrelated simulators untouched.)
  • Screenshot resource phase reporting keeps the original intent (765ae71: Separate simulator startup activity using bounded, sanitized resource observations.)
  • CI screenshot documentation keeps the original intent (5341ef2: Describe the combined serial capture flow and preserve its admission, retry, and evidence contracts.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

Acceptance criteria:

  • node scripts/run-vitest.mjs test/scripts/ios-simulator-headroom.test.ts test/scripts/ios-release-fastlane-gates.test.ts --maxWorkers=1
  • node scripts/run-oxlint.mjs --tsconfig tsconfig.scripts.json scripts/lib/ios-simulator-headroom.ts
  • git diff --check

What I checked:

Likely related people:

  • Josh Avant: Raw commit a218de7 adds scripts/lib/ios-simulator-headroom.ts:16 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a218de7ac235; files: scripts/lib/ios-simulator-headroom.ts)
  • Dallin Romney: Raw commit 7da37ac adds apps/ios/fastlane/Fastfile:256 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 7da37ac6dae4; files: apps/ios/fastlane/Fastfile)

PR surface

Source +4, Tests +17, Docs 0, Other +12. Total +33 across 6 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 1 4 0 +4
Tests 1 19 2 +17
Docs 1 1 1 0
Config 0 0 0 0
Generated 0 0 0 0
Other 3 14 2 +12
Total 6 38 5 +33

Root-cause cluster

Relationship: fixed_by_candidate
Canonical: #188012
Summary: This PR implements the linked issue's requested screenshot admission mitigation; the earlier boot-state diagnostic addresses an adjacent symptom.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Labels

Label changes:

  • add P2: The change addresses hosted screenshot and App Store preparation reliability, with no demonstrated urgent application-runtime regression.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: The change addresses hosted screenshot and App Store preparation reliability, with no demonstrated urgent application-runtime regression.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Retain and inspect the results of both planned hosted capture runs before landing.

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 29, 2026, 9:34 PM ET / October 30, 2026, 01:34 UTC.

@joshavant
joshavant merged commit 766f5e9 into main Oct 30, 2026
117 checks passed
@joshavant
joshavant deleted the fix/ios-watch-screenshot-boot branch October 30, 2026 01:59
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 30, 2026
)

* fix(ios): wait for host headroom before screenshot boot

* fix(ios): explain screenshot headroom timeout recovery
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: ios App: ios docs Improvements or additions to documentation P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XS 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.

iOS screenshots can start Watch boot while host CPU remains saturated

1 participant