Skip to content

Commit 8958314

Browse files
thymikeeclaude
andcommitted
fix(perf): pin the tree backend on a capture it serves, and share host readers
- The forced-tree step ran a raw capture. The runner honors a backend pin only on the regular plan, so the raw plan recovered through private AX and the expectation passed a degraded row. The step is now a regular pinned capture on the home screen, and its expectation requires the pinned backend with the runner's `requested-backend` code. - Perf metadata reads the revision, toolchain, and simulator through the readers of the iOS snapshot benchmark, moved to scripts/lib/bench-host.ts. - host-kit and the daemon client export the phase names that the profiler reads. - summary-fixture.ts becomes summary.fixtures.ts; the nightly header matches 3 rounds. Co-Authored-By: Claude Opus 5.5 <[email protected]>
1 parent fed2a4c commit 8958314

27 files changed

Lines changed: 163 additions & 136 deletions

‎.github/workflows/perf-nightly.yml‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,10 @@ name: Perf Nightly
44
# - Catches: a command whose daemon time moves beyond the noise of earlier nights, or that starts
55
# failing. PR lanes check behavior, not time.
66
# - Wanted for: tuning runner, snapshot, and settle paths while watching the effect. iOS medians
7-
# swing up to +122% between single nights at n=5, so a step is judged against the median of up to
8-
# seven earlier nights and must clear their spread, its own sampling error, 20%, and 50 ms.
7+
# swing up to +122% between single nights, so a step is judged against the median of up to seven
8+
# earlier nights and must clear their spread, its own sampling error, 20%, and 50 ms. A night
9+
# runs 3 rounds, the minimum for a timing verdict, so one failed sample withholds that step's
10+
# timing verdict.
911
# - Cost: one macos-26 job of about 45 minutes a night; summaries are kept 90 days, raw logs 30.
1012
# - Delete or park when: no flagged change has been acted on for 60 nights.
1113
# Android stays report-only and runs only on request.

‎packages/host-kit/src/command.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,4 @@ export {
2626
withCommandHost,
2727
withoutCommandExecutorOverride,
2828
} from './internal/exec.ts';
29+
export { EXEC_COMMAND_PHASE } from './internal/exec-trace.ts';

‎packages/host-kit/src/diagnostics.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
export {
22
countDiagnosticEventsByPhase,
33
createRequestId,
4+
DIAGNOSTIC_STDERR_PREFIX,
45
type DiagnosticEventInput,
56
emitDiagnostic,
67
flushDiagnosticsToSessionFile,

‎packages/host-kit/src/internal/diagnostics.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,9 @@ type DiagnosticsScope = DiagnosticsScopeOptions & {
5353
sortedSensitiveValues?: string[];
5454
};
5555

56+
/** Prefixes each diagnostic event that a `--debug` client without a log file writes to stderr. */
57+
export const DIAGNOSTIC_STDERR_PREFIX = '[agent-device][diag] ';
58+
5659
const diagnosticsStorage = new AsyncLocalStorage<DiagnosticsScope>();
5760

5861
export function createRequestId(): string {
@@ -164,7 +167,7 @@ export function emitDiagnostic(event: DiagnosticEventInput): void {
164167
appendDiagnosticLine(scope, scope.traceLogPath, fileLine);
165168
}
166169
if (scope.debug && !scope.logPath && !scope.traceLogPath) {
167-
process.stderr.write(`[agent-device][diag] ${fileLine}`);
170+
process.stderr.write(`${DIAGNOSTIC_STDERR_PREFIX}${fileLine}`);
168171
}
169172
} catch {
170173
// Best-effort diagnostics should not break request flow.

‎packages/host-kit/src/internal/exec-trace.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ import {
99
updateDiagnosticsScope,
1010
} from './diagnostics.ts';
1111

12+
/** The diagnostic phase of each host process lifecycle event. */
13+
export const EXEC_COMMAND_PHASE = 'exec_command';
14+
1215
export type ExecSettlementReason =
1316
| 'success'
1417
| 'exit_failure'
@@ -52,7 +55,7 @@ export function createExecTraceContext(
5255
pid = data.pid ?? pid;
5356
emitDiagnostic({
5457
level: 'debug',
55-
phase: 'exec_command',
58+
phase: EXEC_COMMAND_PHASE,
5659
durationMs: performance.now() - started,
5760
data: { execId, command, event, pid, timeoutMs, ...data },
5861
});

‎packages/host-kit/src/internal/retry.ts‎

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@ type RetryPolicy = {
99
shouldRetry?: (error: unknown, attempt: number) => boolean;
1010
};
1111

12+
/** The diagnostic phase of each retry attempt and outcome. */
13+
export const RETRY_PHASE = 'retry';
14+
1215
/**
1316
* The read side of a deadline. Holders are typed against this rather than the class so a caller
1417
* can hand one a substitute clock; {@link Deadline} is the production implementation.
@@ -281,7 +284,7 @@ export function sleep(ms: number, signal?: AbortSignal): Promise<void> {
281284
function publishRetryEvent(event: RetryTelemetryEvent): void {
282285
emitDiagnostic({
283286
level: event.event === 'attempt_failed' || event.event === 'exhausted' ? 'warn' : 'debug',
284-
phase: 'retry',
287+
phase: RETRY_PHASE,
285288
data: {
286289
...event,
287290
},

‎packages/host-kit/src/retry.ts‎

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,5 @@ export {
55
pollUntilSettled,
66
retryWithPolicy,
77
sleep,
8+
RETRY_PHASE,
89
} from './internal/retry.ts';

‎scripts/ios-snapshot-benchmark/benchmark-config.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import path from 'node:path';
22
import { parseLocalStates, parseRtt, parseSampleCount, parseScreenIds } from './definitions.ts';
3-
import { resolveRepoRoot } from './host.ts';
3+
import { resolveRepoRoot } from '../lib/bench-host.ts';
44
import {
55
assertBenchmarkOwner,
66
assertOwnedDerivedPath,

‎scripts/ios-snapshot-benchmark/run.test.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ import fs from 'node:fs';
44
import path from 'node:path';
55
import { test } from 'vitest';
66
import { mkdtempForTest } from '@agent-device/test-kit';
7-
import { resolveRepoRoot } from './host.ts';
7+
import { resolveRepoRoot } from '../lib/bench-host.ts';
88

99
test('CLI refuses an unmarked existing root before any descendant can be cleared', async () => {
1010
const repoRoot = resolveRepoRoot();

‎scripts/ios-snapshot-benchmark/run.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import { classifyFailure, formatCliFailure, openFixture, type CliContext } from
1010
import { BenchmarkControlError, runDeepButtonControls } from './deep-control.ts';
1111
import { CONTRACT, screenFixture } from './definitions.ts';
1212
import { deepButtonFixtureEvidence } from './deep-button.ts';
13-
import { readGitRevision, readHostIdentity, readTarget, readToolchain } from './host.ts';
13+
import { readGitRevision, readHostIdentity, readTarget, readToolchain } from '../lib/bench-host.ts';
1414
import {
1515
BenchmarkCellAdmissionError,
1616
BenchmarkContentionError,

0 commit comments

Comments
 (0)