Repository navigation
fix(apple-runner): rebuild the shared runner cache only when a retry also fails - #4880
Conversation
…unner cache A runner startup deadline that expires while xcodebuild is alive is a slow boot on a loaded host, not evidence of a bad artifact. Classifying it as artifactSuspect made prepare clean and force-rebuild the shared cache-<key> that concurrent first opens were reading. Prepare now retries with a fresh session; only an exhausted endpoint probe indicts the cache. Fixes #4689 Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Size Report
Startup median (7 runs, lower is better):
|
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 8f5a400. The verdict and the full list are in the summary comment.
… fails A startup deadline with xcodebuild alive looks the same for a slow boot and for a corrupt artifact, so the classification cannot tell them apart. Restore runner_connect_refused as artifact-suspect, and let prepare retry once on the cached artifact before it cleans and rebuilds it. A single slow boot no longer destroys the shared cache; a corrupt artifact still recovers. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This comment has been minimized.
This comment has been minimized.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on faaa4cd. The verdict and the full list are in the summary comment.
… retry A restored artifact indicted on the first attempt was rebuilt only when the retry failed with artifact-suspect evidence again. A retry that failed differently, or never started because the first attempt spent the prepare deadline, left the corrupt artifact in place for every later prepare. The indictment now carries the artifact: any failed retry rebuilds it, and a spent deadline cleans it so the next prepare builds a fresh one. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Apex Sentinel · ✅ Approve · review of
|
| Where | Finding |
|---|---|
packages/apple-runner/src/runner-lifecycle.ts:134 |
🆕 One ambiguous refusal still cleans the shared cache when the retry has no budget left |
Reviewed with this repository's own Sentinel configuration (c37bb956307c).
💬 Talking to Sentinel
In a finding's thread, reply with:
| Command | What it does |
|---|---|
@apex-sentinel-staging note <context> |
Adds context; Sentinel re-checks the cited code |
@apex-sentinel-staging pivot <why> |
Says the finding is wrong; Sentinel re-checks the cited code |
@apex-sentinel-staging like |
Marks the finding as useful |
@apex-sentinel-staging dislike <why> |
Marks it as not useful, so it is not raised again |
On this conversation, comment @apex-sentinel-staging review to run a full review once again.
There was a problem hiding this comment.
Apex Sentinel: 1 new finding on 41ca72c. The verdict and the full list are in the summary comment.
|
The retry-then-rebuild change in 41ca72c reads correctly, but it is not ready to merge until the device run covers this commit. The only live run is at 8f5a400, before the lifecycle logic changed, and it did not reach the changed route. Not verified here: the runner start and app lifecycle behavior at 41ca72c. Please run Not blocking, and fine to take or leave: on routes without The two earlier inline threads on the connect-refused classification and the attempt-2 gate are fixed at this head and can be resolved: #4880 (comment) and #4880 (comment). The thread on the deadline cleanup still applies as a non-blocking note: #4880 (comment). Only Body rules fails in CI, and it is likely unrelated, since the diff touches only apple-runner lifecycle code and a test. The current body counts about 245 words, so the failure probably comes from an earlier body revision. Re-running that job should settle it, and if it still fails the body needs trimming. There are no conflicts. Before merge, the device run above is needed and Body rules must pass. Not verified here: tests and typecheck were not run, the open route's daemon request timeout, and the author's device run at 8f5a400. |
|
Device evidence at 41ca72c, using the worktree CLI ( How the cache was corrupted. I set Corrupt cache, iPhone 17 Pro:
Single slow boot, iPhone Air: same poison, but a watcher restored the original xctestrun and manifest 3 s after attempt 1 wrote its session xctestrun. No Explicit Loop-exit clean (optional note): I'm not taking it. The only exits it would add beyond the deadline branch are a cancel or a closed admission during attempt 2. Neither is evidence about the artifact, and cleaning on them would wipe a shared cache because a caller went away. A corrupt artifact cleared on the next prepare costs one more retry, which is the trade-off #4689 asks for. All devices were closed and shut down, and the contained caches were removed. |
|
The device evidence at 41ca72c (#4880 (comment)) covers what the review asked for: on a corrupted restored cache, attempt 1 retries without a clean and attempt 2 cleans, force-rebuilds and recovers with exit 0; on a single slow boot, the retry succeeds without a clean. All checks now pass. Nothing from review blocks this head; the non-blocking notes and #4886 stay as follow-ups. |
Summary
Fixes #4689. A startup deadline with xcodebuild still running (
runner_connect_refused) looks the same for a slow boot on a loaded host and for a corrupt artifact. Prepare used to clean and force-rebuild the sharedcache-<key>on the first such failure, which broke concurrent first opens that were reading it. Now the first indictment of a restored artifact retries on the cache. If that retry also fails, prepare runs the one forced rebuild. If no budget is left, prepare cleans the artifact so the next prepare builds a fresh one. A freshly built artifact is never rebuilt. No new timeouts or modes.Before / after
open --relaunchon a simulator whose restored cache refuses its first connection:clean, forced rebuild on attempt 1.ios_runner_prepare_health_retryon attempt 1 with the cache reused, then clean, forced rebuild andios_runner_prepare_bad_cache_recoveredon attempt 2 only.Validation
At
41ca72cdb7:pnpm typecheckpasses.🤖 Generated with Claude Code