Skip to content

Commit 52ab61e

Browse files
committed
fix(ios-runner): let a host deadline speak for nothing
A build the host killed at its own `buildTimeoutMs` arrives with no rule matched, and on a phone that happens to report its developer image down the enrichment answered with the image: a build that never finished cannot have been refused for want of device support, and the caller was sent to mount an image while their real problem was a 15-minute budget (#2690 review). The device now speaks only where nothing matched AND the host's deadline did not end the command. The build catch threads that fact the way it already threads `startupRuleMatched` — its wrapper buries the exec error too deep to inspect — and a failure that never passed through a catch is read with host-kit's `isCommandTimeoutError`, so the install and launch steps are covered by the exec's own `timeoutMs`. Two things the same catch was doing to the error it rebuilt: the cause is now passed through, so the reader of a daemon log still reaches the command that died, and the plumbing keys — whether a row matched, whether the deadline hit — are internal and stripped with the hoisted diagnostic meta, because a caller already holds the verdict they produced rather than the machinery that reached it.
1 parent 88b6b7d commit 52ab61e

13 files changed

Lines changed: 161 additions & 51 deletions

File tree

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
{"type":"replay_test_attempt_start","ts":"2026-09-19T14:32:46.818Z","replayPath":"/tmp/agent-device-test-run-75313-0YH0p7/agent-device-maestro-remote-test-pzCEKx/01-flow.yaml","session":"default:test:req-maestro-test-wire-true:1-01-flow:attempt-1","requestId":"req-maestro-test-wire-true:test:1:01-flow.yaml:attempt:1"}
2-
{"type":"replay_test_attempt_stop","ts":"2026-09-19T14:32:46.819Z","session":"default:test:req-maestro-test-wire-true:1-01-flow:attempt-1","ok":true,"timedOut":false,"durationMs":2}
3-
{"type":"replay_test_finalize_start","ts":"2026-09-19T14:32:46.819Z","session":"default:test:req-maestro-test-wire-true:1-01-flow:attempt-1"}
4-
{"type":"replay_test_finalize_stop","ts":"2026-09-19T14:32:46.820Z","session":"default:test:req-maestro-test-wire-true:1-01-flow:attempt-1","ok":true,"durationMs":1}
5-
{"type":"replay_test_cleanup_start","ts":"2026-09-19T14:32:46.820Z","session":"default:test:req-maestro-test-wire-true:1-01-flow:attempt-1"}
6-
{"type":"replay_test_cleanup_stop","ts":"2026-09-19T14:32:46.820Z","session":"default:test:req-maestro-test-wire-true:1-01-flow:attempt-1","ok":true,"durationMs":0}
1+
{"type":"replay_test_attempt_start","ts":"2026-09-20T16:55:26.227Z","replayPath":"/tmp/agent-device-test-run-79498-ISZQ6W/agent-device-maestro-remote-test-sRN7dQ/01-flow.yaml","session":"default:test:req-maestro-test-wire-true:1-01-flow:attempt-1","requestId":"req-maestro-test-wire-true:test:1:01-flow.yaml:attempt:1"}
2+
{"type":"replay_test_attempt_stop","ts":"2026-09-20T16:55:26.229Z","session":"default:test:req-maestro-test-wire-true:1-01-flow:attempt-1","ok":true,"timedOut":false,"durationMs":2}
3+
{"type":"replay_test_finalize_start","ts":"2026-09-20T16:55:26.229Z","session":"default:test:req-maestro-test-wire-true:1-01-flow:attempt-1"}
4+
{"type":"replay_test_finalize_stop","ts":"2026-09-20T16:55:26.229Z","session":"default:test:req-maestro-test-wire-true:1-01-flow:attempt-1","ok":true,"durationMs":0}
5+
{"type":"replay_test_cleanup_start","ts":"2026-09-20T16:55:26.229Z","session":"default:test:req-maestro-test-wire-true:1-01-flow:attempt-1"}
6+
{"type":"replay_test_cleanup_stop","ts":"2026-09-20T16:55:26.230Z","session":"default:test:req-maestro-test-wire-true:1-01-flow:attempt-1","ok":true,"durationMs":1}

‎.agent-device/test-artifacts/req-maestro-test-wire-true/01-flow.yaml/attempt-1/result.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
file: /tmp/agent-device-test-run-75313-0YH0p7/agent-device-maestro-remote-test-pzCEKx/01-flow.yaml
1+
file: /tmp/agent-device-test-run-79498-ISZQ6W/agent-device-maestro-remote-test-sRN7dQ/01-flow.yaml
22
session: default:test:req-maestro-test-wire-true:1-01-flow:attempt-1
33
attempt: 1/1
44
status: passed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
{"type":"replay_test_attempt_start","ts":"2026-09-19T14:32:46.820Z","replayPath":"/tmp/agent-device-test-run-75313-0YH0p7/agent-device-maestro-remote-test-pzCEKx/02-flow.yaml","session":"default:test:req-maestro-test-wire-true:2-02-flow:attempt-1","requestId":"req-maestro-test-wire-true:test:2:02-flow.yaml:attempt:1"}
2-
{"type":"replay_test_attempt_stop","ts":"2026-09-19T14:32:46.821Z","session":"default:test:req-maestro-test-wire-true:2-02-flow:attempt-1","ok":true,"timedOut":false,"durationMs":1}
3-
{"type":"replay_test_finalize_start","ts":"2026-09-19T14:32:46.821Z","session":"default:test:req-maestro-test-wire-true:2-02-flow:attempt-1"}
4-
{"type":"replay_test_finalize_stop","ts":"2026-09-19T14:32:46.821Z","session":"default:test:req-maestro-test-wire-true:2-02-flow:attempt-1","ok":true,"durationMs":0}
5-
{"type":"replay_test_cleanup_start","ts":"2026-09-19T14:32:46.821Z","session":"default:test:req-maestro-test-wire-true:2-02-flow:attempt-1"}
6-
{"type":"replay_test_cleanup_stop","ts":"2026-09-19T14:32:46.821Z","session":"default:test:req-maestro-test-wire-true:2-02-flow:attempt-1","ok":true,"durationMs":0}
1+
{"type":"replay_test_attempt_start","ts":"2026-09-20T16:55:26.230Z","replayPath":"/tmp/agent-device-test-run-79498-ISZQ6W/agent-device-maestro-remote-test-sRN7dQ/02-flow.yaml","session":"default:test:req-maestro-test-wire-true:2-02-flow:attempt-1","requestId":"req-maestro-test-wire-true:test:2:02-flow.yaml:attempt:1"}
2+
{"type":"replay_test_attempt_stop","ts":"2026-09-20T16:55:26.231Z","session":"default:test:req-maestro-test-wire-true:2-02-flow:attempt-1","ok":true,"timedOut":false,"durationMs":1}
3+
{"type":"replay_test_finalize_start","ts":"2026-09-20T16:55:26.231Z","session":"default:test:req-maestro-test-wire-true:2-02-flow:attempt-1"}
4+
{"type":"replay_test_finalize_stop","ts":"2026-09-20T16:55:26.231Z","session":"default:test:req-maestro-test-wire-true:2-02-flow:attempt-1","ok":true,"durationMs":0}
5+
{"type":"replay_test_cleanup_start","ts":"2026-09-20T16:55:26.231Z","session":"default:test:req-maestro-test-wire-true:2-02-flow:attempt-1"}
6+
{"type":"replay_test_cleanup_stop","ts":"2026-09-20T16:55:26.231Z","session":"default:test:req-maestro-test-wire-true:2-02-flow:attempt-1","ok":true,"durationMs":0}

‎.agent-device/test-artifacts/req-maestro-test-wire-true/02-flow.yaml/attempt-1/result.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
file: /tmp/agent-device-test-run-75313-0YH0p7/agent-device-maestro-remote-test-pzCEKx/02-flow.yaml
1+
file: /tmp/agent-device-test-run-79498-ISZQ6W/agent-device-maestro-remote-test-sRN7dQ/02-flow.yaml
22
session: default:test:req-maestro-test-wire-true:2-02-flow:attempt-1
33
attempt: 1/1
44
status: passed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
{"type":"replay_test_attempt_start","ts":"2026-09-19T14:32:46.823Z","replayPath":"/tmp/agent-device-test-run-75313-0YH0p7/agent-device-maestro-remote-test-Wnbhbp/01-flow.yaml","session":"default:test:req-maestro-test-wire-undefined:1-01-flow:attempt-1","requestId":"req-maestro-test-wire-undefined:test:1:01-flow.yaml:attempt:1"}
2-
{"type":"replay_test_attempt_stop","ts":"2026-09-19T14:32:46.823Z","session":"default:test:req-maestro-test-wire-undefined:1-01-flow:attempt-1","ok":true,"timedOut":false,"durationMs":0}
3-
{"type":"replay_test_finalize_start","ts":"2026-09-19T14:32:46.823Z","session":"default:test:req-maestro-test-wire-undefined:1-01-flow:attempt-1"}
4-
{"type":"replay_test_finalize_stop","ts":"2026-09-19T14:32:46.823Z","session":"default:test:req-maestro-test-wire-undefined:1-01-flow:attempt-1","ok":true,"durationMs":0}
5-
{"type":"replay_test_cleanup_start","ts":"2026-09-19T14:32:46.823Z","session":"default:test:req-maestro-test-wire-undefined:1-01-flow:attempt-1"}
6-
{"type":"replay_test_cleanup_stop","ts":"2026-09-19T14:32:46.823Z","session":"default:test:req-maestro-test-wire-undefined:1-01-flow:attempt-1","ok":true,"durationMs":0}
1+
{"type":"replay_test_attempt_start","ts":"2026-09-20T16:55:26.233Z","replayPath":"/tmp/agent-device-test-run-79498-ISZQ6W/agent-device-maestro-remote-test-1LweRb/01-flow.yaml","session":"default:test:req-maestro-test-wire-undefined:1-01-flow:attempt-1","requestId":"req-maestro-test-wire-undefined:test:1:01-flow.yaml:attempt:1"}
2+
{"type":"replay_test_attempt_stop","ts":"2026-09-20T16:55:26.233Z","session":"default:test:req-maestro-test-wire-undefined:1-01-flow:attempt-1","ok":true,"timedOut":false,"durationMs":0}
3+
{"type":"replay_test_finalize_start","ts":"2026-09-20T16:55:26.233Z","session":"default:test:req-maestro-test-wire-undefined:1-01-flow:attempt-1"}
4+
{"type":"replay_test_finalize_stop","ts":"2026-09-20T16:55:26.233Z","session":"default:test:req-maestro-test-wire-undefined:1-01-flow:attempt-1","ok":true,"durationMs":0}
5+
{"type":"replay_test_cleanup_start","ts":"2026-09-20T16:55:26.233Z","session":"default:test:req-maestro-test-wire-undefined:1-01-flow:attempt-1"}
6+
{"type":"replay_test_cleanup_stop","ts":"2026-09-20T16:55:26.233Z","session":"default:test:req-maestro-test-wire-undefined:1-01-flow:attempt-1","ok":true,"durationMs":0}

‎.agent-device/test-artifacts/req-maestro-test-wire-undefined/01-flow.yaml/attempt-1/result.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
file: /tmp/agent-device-test-run-75313-0YH0p7/agent-device-maestro-remote-test-Wnbhbp/01-flow.yaml
1+
file: /tmp/agent-device-test-run-79498-ISZQ6W/agent-device-maestro-remote-test-1LweRb/01-flow.yaml
22
session: default:test:req-maestro-test-wire-undefined:1-01-flow:attempt-1
33
attempt: 1/1
44
status: passed
Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
{"type":"replay_test_attempt_start","ts":"2026-09-19T14:32:46.824Z","replayPath":"/tmp/agent-device-test-run-75313-0YH0p7/agent-device-maestro-remote-test-Wnbhbp/02-flow.yaml","session":"default:test:req-maestro-test-wire-undefined:2-02-flow:attempt-1","requestId":"req-maestro-test-wire-undefined:test:2:02-flow.yaml:attempt:1"}
2-
{"type":"replay_test_attempt_stop","ts":"2026-09-19T14:32:46.824Z","session":"default:test:req-maestro-test-wire-undefined:2-02-flow:attempt-1","ok":true,"timedOut":false,"durationMs":0}
3-
{"type":"replay_test_finalize_start","ts":"2026-09-19T14:32:46.824Z","session":"default:test:req-maestro-test-wire-undefined:2-02-flow:attempt-1"}
4-
{"type":"replay_test_finalize_stop","ts":"2026-09-19T14:32:46.824Z","session":"default:test:req-maestro-test-wire-undefined:2-02-flow:attempt-1","ok":true,"durationMs":0}
5-
{"type":"replay_test_cleanup_start","ts":"2026-09-19T14:32:46.824Z","session":"default:test:req-maestro-test-wire-undefined:2-02-flow:attempt-1"}
6-
{"type":"replay_test_cleanup_stop","ts":"2026-09-19T14:32:46.824Z","session":"default:test:req-maestro-test-wire-undefined:2-02-flow:attempt-1","ok":true,"durationMs":0}
1+
{"type":"replay_test_attempt_start","ts":"2026-09-20T16:55:26.234Z","replayPath":"/tmp/agent-device-test-run-79498-ISZQ6W/agent-device-maestro-remote-test-1LweRb/02-flow.yaml","session":"default:test:req-maestro-test-wire-undefined:2-02-flow:attempt-1","requestId":"req-maestro-test-wire-undefined:test:2:02-flow.yaml:attempt:1"}
2+
{"type":"replay_test_attempt_stop","ts":"2026-09-20T16:55:26.234Z","session":"default:test:req-maestro-test-wire-undefined:2-02-flow:attempt-1","ok":true,"timedOut":false,"durationMs":0}
3+
{"type":"replay_test_finalize_start","ts":"2026-09-20T16:55:26.234Z","session":"default:test:req-maestro-test-wire-undefined:2-02-flow:attempt-1"}
4+
{"type":"replay_test_finalize_stop","ts":"2026-09-20T16:55:26.234Z","session":"default:test:req-maestro-test-wire-undefined:2-02-flow:attempt-1","ok":true,"durationMs":0}
5+
{"type":"replay_test_cleanup_start","ts":"2026-09-20T16:55:26.234Z","session":"default:test:req-maestro-test-wire-undefined:2-02-flow:attempt-1"}
6+
{"type":"replay_test_cleanup_stop","ts":"2026-09-20T16:55:26.234Z","session":"default:test:req-maestro-test-wire-undefined:2-02-flow:attempt-1","ok":true,"durationMs":0}

‎.agent-device/test-artifacts/req-maestro-test-wire-undefined/02-flow.yaml/attempt-1/result.txt‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
file: /tmp/agent-device-test-run-75313-0YH0p7/agent-device-maestro-remote-test-Wnbhbp/02-flow.yaml
1+
file: /tmp/agent-device-test-run-79498-ISZQ6W/agent-device-maestro-remote-test-1LweRb/02-flow.yaml
22
session: default:test:req-maestro-test-wire-undefined:2-02-flow:attempt-1
33
attempt: 1/1
44
status: passed

‎packages/kernel/src/errors.ts‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -414,11 +414,20 @@ function booleanDetail(
414414
return typeof value === 'boolean' ? value : undefined;
415415
}
416416

417+
/**
418+
* Facts a publisher leaves for a later catch in the same process, never for a caller: whether a rule
419+
* row named this failure, and whether the host's own deadline ended the command behind it. Both
420+
* describe our machinery rather than the caller's problem, and the caller was already handed the
421+
* verdict those facts produced as `reason` and `hint` (#2690 review).
422+
*/
423+
const INTERNAL_PLUMBING_DETAIL_KEYS = ['startupRuleMatched', 'startupHostDeadlineHit'] as const;
424+
417425
function stripDiagnosticMeta(
418426
details: Record<string, unknown> | undefined,
419427
): Record<string, unknown> | undefined {
420428
if (!details) return undefined;
421429
const output = { ...details };
430+
for (const key of INTERNAL_PLUMBING_DETAIL_KEYS) delete output[key];
422431
delete output.hint;
423432
delete output.diagnosticId;
424433
delete output.logPath;

‎packages/platform-apple/src/runner/__tests__/runner-startup-failure-fixtures.ts‎

Lines changed: 27 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ export type IosDeviceReadinessReport = Omit<
5555
* is how a non-zero `xcodebuild` arrives) or only in the thrown message (`message-only`, which is
5656
* how anything the exec layer raised as a plain `Error` arrives after the catch wraps `String(err)`).
5757
*/
58-
export type RunnerStartupFailureCarrier = 'exec-details' | 'message-only';
58+
export type RunnerStartupFailureCarrier = 'exec-details' | 'message-only' | 'host-timeout';
5959

6060
const UNOBSERVED = 'unobserved';
6161

@@ -67,6 +67,8 @@ export type RunnerStartupFailureFixture = Readonly<{
6767
/** Which throw site receives this output. */
6868
site: RunnerStartupFailureSite;
6969
carrier?: RunnerStartupFailureCarrier;
70+
/** The deadline the host killed this command at, for the `host-timeout` carrier. */
71+
hostTimeoutMs?: number;
7072
/** The invocation that produced {@link RunnerStartupFailureFixture.output}, once one is recorded. */
7173
command?: string;
7274
/** `xcodebuild -version` recorded from that run, or `unobserved`. */
@@ -261,6 +263,19 @@ export const RUNNER_STARTUP_FAILURE_FIXTURES: readonly RunnerStartupFailureFixtu
261263
deviceReport: { developerMode: 'enabled', developerDiskImage: 'unavailable' },
262264
note: 'The corroborated pairing (#2683 review): a build that names no cause, on a phone core read directly as reporting its image down. Naming the image beats cache-recovery advice; the state also travels as details.developerDiskImage.',
263265
},
266+
{
267+
id: 'host-killed-build-on-device-with-image-down',
268+
reason: 'build_failed_unclassified',
269+
site: 'build-for-testing',
270+
carrier: 'host-timeout',
271+
hostTimeoutMs: 900_000,
272+
xcodeVersion: UNOBSERVED,
273+
provenance: 'invented-shape',
274+
output:
275+
"note: Using target 'AgentDeviceRunner' for build-for-testing\nbuilding project 'AgentDeviceRunner' toward destination 'Example iPhone'\nCompileSwiftFile normal (in target 'AgentDeviceRunner' from project 'AgentDeviceRunner')\n",
276+
deviceReport: { developerMode: 'enabled', developerDiskImage: 'unavailable' },
277+
note: "The build the host killed at its own `buildTimeoutMs`, on a phone reporting its image down (#2690 review). A slow build and a build the device refuses are different facts, and the second one is not available from a command that never finished: the reason stays unclassified with cache-recovery advice, and the image state rides along as a detail only. The shape follows the exec layer's timeout error; the 15-minute budget and the partial log are ours, so no capture stands behind them.",
278+
},
264279
{
265280
id: 'conflicting-settings-on-device-with-image-down',
266281
reason: 'build_failed_unclassified',
@@ -361,6 +376,17 @@ export function buildForTestingExecFailure(
361376
if ((fixture.carrier ?? 'exec-details') === 'message-only') {
362377
return new Error(`xcodebuild exited with code ${exitCode}: ${fixture.output}`);
363378
}
379+
if (fixture.carrier === 'host-timeout') {
380+
// The exec layer's own kill-at-deadline error, which `isCommandTimeoutError` answers for.
381+
const timeoutMs = fixture.hostTimeoutMs ?? 900_000;
382+
return new AppError('COMMAND_FAILED', `xcodebuild timed out after ${timeoutMs}ms`, {
383+
cmd: 'xcodebuild',
384+
args: fixture.args ?? ['build-for-testing'],
385+
stdout: fixture.output,
386+
stderr: '',
387+
timeoutMs,
388+
});
389+
}
364390
return new AppError('COMMAND_FAILED', `xcodebuild exited with code ${exitCode}`, {
365391
stdout: fixture.output,
366392
stderr: '',

0 commit comments

Comments
 (0)