From b2cdd93ba66891629f8ece808b49e124c268812e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 3 Dec 2026 08:29:19 +0100 Subject: [PATCH 1/8] fix(remote): never write trace/perf output to a daemon-supplied path --- .../daemon-artifacts-capture.test.ts | 24 +++++++++++++++--- packages/remote/src/daemon-artifacts.ts | 25 +++++-------------- website/docs/docs/remote-proxy.md | 2 +- 3 files changed, 28 insertions(+), 23 deletions(-) diff --git a/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts b/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts index 4698ce5a51b..8b764b78ae0 100644 --- a/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts +++ b/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts @@ -140,12 +140,30 @@ test.for([ expected: 'cwd/clip.mp4', }, { - name: 'a perf cpu profile stop accepts the echo of its start destination', + name: 'a perf cpu profile stop refuses a hostile response localPath', command: 'perf', positionals: ['cpu', 'profile', 'stop'], - localPath: 'client/cpu.trace', + localPath: '../../etc/x', fileName: 'cpu.trace', - expected: 'client/cpu.trace', + generatedName: /^perf-[0-9a-f-]{36}$/, + }, + { + name: 'a trace stop refuses an absolute response localPath', + command: 'trace', + positionals: ['stop'], + field: 'outPath', + localPath: '/etc/x', + fileName: '../../x', + generatedName: /^trace-[0-9a-f-]{36}$/, + }, + { + name: 'a trace stop with its own --out writes there', + command: 'trace', + positionals: ['stop', 'client/t.trace'], + field: 'outPath', + registered: 'client/t.trace', + localPath: '/etc/x', + expected: 'client/t.trace', }, ...(process.platform === 'win32' ? [] : posixNameCases), ])('remote artifact materialization: $name', async (c, t) => { diff --git a/packages/remote/src/daemon-artifacts.ts b/packages/remote/src/daemon-artifacts.ts index 3c2ec3b9f38..c7864fd6b0f 100644 --- a/packages/remote/src/daemon-artifacts.ts +++ b/packages/remote/src/daemon-artifacts.ts @@ -730,29 +730,13 @@ function withoutScriptFieldOwner( return kept; } -/** - * Whether this request finishes a trace or perf capture whose destination the daemon echoes - * from an earlier request. The finishing actions mirror `request-finalization.ts`. - */ -function finishesEarlierClientCapture(req: DaemonWireRequest): boolean { - const [first, second, third] = (req.positionals ?? []).map((value) => value.toLowerCase()); - switch (req.command) { - case 'trace': - return first === 'stop'; - case 'perf': - return third === 'stop' || third === 'report' || (first === 'trace' && second === 'stop'); - default: - return false; - } -} - function isRecordStop(req: DaemonWireRequest): boolean { return req.command === 'record' && req.positionals?.[0]?.toLowerCase() === 'stop'; } /** * A path from this request wins. A record stop without one can use only a plain name in cwd. - * Trace and perf stop or report can still use an echoed destination from an earlier request. + * Trace and perf output without one goes to a locally named file in cwd. * A NUL in a response file name cannot provide a fallback destination. */ function resolveMaterializedArtifactPath( @@ -771,8 +755,11 @@ function resolveMaterializedArtifactPath( const fileName = localFileName(artifact.fileName) ?? `recording-${crypto.randomUUID()}`; return { path: path.resolve(req.meta?.cwd ?? host.cwd, fileName), fallback: true }; } - if (hasNonEmptyString(artifact.localPath) && finishesEarlierClientCapture(req)) { - return { path: artifact.localPath, fallback: false }; + if (req.command === 'trace' || req.command === 'perf') { + return { + path: path.resolve(req.meta?.cwd ?? host.cwd, `${req.command}-${crypto.randomUUID()}`), + fallback: false, + }; } const fallbackPath = resolveOrdinaryArtifactFallbackPath(artifact, req.meta?.cwd ?? host.cwd); return fallbackPath ? { path: fallbackPath, fallback: false } : undefined; diff --git a/website/docs/docs/remote-proxy.md b/website/docs/docs/remote-proxy.md index bea0453832d..a1db36c3345 100644 --- a/website/docs/docs/remote-proxy.md +++ b/website/docs/docs/remote-proxy.md @@ -100,7 +100,7 @@ Remote screenshots, recordings, performance captures, and trace logs use generat the daemon. When you specify an output path through the CLI, SDK, or MCP, it selects the download destination on your machine. A recording is different: it downloads to the path named by the `record stop` request, or otherwise to the working directory with a warning. The directory of a -`record start` path does not carry over; the working-directory fallback keeps only its file name. Direct RPC callers receive artifact IDs and download each result with +`record start` path does not carry over; the working-directory fallback keeps only its file name. A `trace stop` or `perf ... stop` download uses its own `--out` or path; the `--out` of the earlier `start` does not carry over, and without one the file goes to the working directory under a generated `trace-` or `perf-` name. Direct RPC callers receive artifact IDs and download each result with `GET /artifacts/` using the same authentication. For an artifact from a leased session, also send the lease id in the `x-agent-device-lease-id` header: without it, `GET /artifacts` does not list the artifact and the download fails with `UNAUTHORIZED` and reason `LEASE_OUTPUT_MISMATCH`. From 8d21ff3a8edd21336515723cf9df2fdbc4d378ac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 3 Dec 2026 09:13:46 +0100 Subject: [PATCH 2/8] fix(remote): keep format suffixes on generated capture files --- .../__tests__/daemon-artifacts-capture.test.ts | 18 +++++++++++++++++- packages/remote/src/daemon-artifacts.ts | 14 +++++++++++++- test/wire-compat/ledger.json | 6 +++--- website/docs/docs/remote-proxy.md | 2 +- 4 files changed, 34 insertions(+), 6 deletions(-) diff --git a/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts b/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts index 8b764b78ae0..57de4ff2ae0 100644 --- a/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts +++ b/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts @@ -154,7 +154,23 @@ test.for([ field: 'outPath', localPath: '/etc/x', fileName: '../../x', - generatedName: /^trace-[0-9a-f-]{36}$/, + generatedName: /^trace-[0-9a-f-]{36}\.log$/, + }, + { + name: 'a perf cpu profile report keeps a json suffix, not the daemon-supplied name', + command: 'perf', + positionals: ['cpu', 'profile', 'report', 'xctrace'], + localPath: '/etc/x', + fileName: 'report.sh', + generatedName: /^perf-[0-9a-f-]{36}\.json$/, + }, + { + name: 'an xctrace capture stop keeps an archive suffix', + command: 'perf', + positionals: ['trace', 'stop', 'xctrace'], + localPath: '/etc/x', + fileName: 'capture.exe', + generatedName: /^perf-[0-9a-f-]{36}\.tar\.gz$/, }, { name: 'a trace stop with its own --out writes there', diff --git a/packages/remote/src/daemon-artifacts.ts b/packages/remote/src/daemon-artifacts.ts index c7864fd6b0f..ccd01d2094f 100644 --- a/packages/remote/src/daemon-artifacts.ts +++ b/packages/remote/src/daemon-artifacts.ts @@ -757,7 +757,10 @@ function resolveMaterializedArtifactPath( } if (req.command === 'trace' || req.command === 'perf') { return { - path: path.resolve(req.meta?.cwd ?? host.cwd, `${req.command}-${crypto.randomUUID()}`), + path: path.resolve( + req.meta?.cwd ?? host.cwd, + `${req.command}-${crypto.randomUUID()}${generatedCaptureSuffix(req)}`, + ), fallback: false, }; } @@ -765,6 +768,15 @@ function resolveMaterializedArtifactPath( return fallbackPath ? { path: fallbackPath, fallback: false } : undefined; } +/** The suffix comes from the local command and capture kind, never from a daemon-supplied name. */ +function generatedCaptureSuffix(req: DaemonWireRequest): string { + if (req.command === 'trace') return '.log'; + const [area, ...rest] = (req.positionals ?? []).map((value) => value.toLowerCase()); + const [action, kind] = area === 'cpu' ? rest.slice(1) : rest; + if (area === 'cpu' && action === 'report') return '.json'; + return kind === 'xctrace' ? '.tar.gz' : ''; +} + function resolveOrdinaryArtifactFallbackPath( artifact: DaemonArtifact, cwd: string, diff --git a/test/wire-compat/ledger.json b/test/wire-compat/ledger.json index c36004bfe45..5e0a93ec374 100644 --- a/test/wire-compat/ledger.json +++ b/test/wire-compat/ledger.json @@ -163,7 +163,7 @@ "packages/remote/src/daemon-artifacts.ts#downloadRemoteArtifact": "sha256:3f3b6c01601c54ab2c76c8cb0946de623da4d24ba32254c75ae8a3993f66adcf", "packages/remote/src/daemon-artifacts.ts#isRemoteDaemon": "sha256:0f6a714c5f60ce4e8548d811b516d8b6241eca9f7e5414733732da395b8a00e7", "packages/remote/src/daemon-artifacts.ts#materializeRemoteArtifacts": "sha256:ec5fba6dc0c74701c058bd72f3797b907574b51d73816cfa686985e0bf3bc794", - "packages/remote/src/daemon-artifacts.ts#resolveMaterializedArtifactPath": "sha256:06dc215c06a9d2ea5a3821faf31b297a2e2f63928672c08c637b132beee726be", + "packages/remote/src/daemon-artifacts.ts#resolveMaterializedArtifactPath": "sha256:71ddbc51d56481a8a94b592bc70ed3e9caaa5a006857c9d59a895165286e298f", "packages/remote/src/daemon-artifacts.ts#resolveOrdinaryArtifactFallbackPath": "sha256:e8b1cb5243194e1d4fc7e376979ca5aae3aaf55cfdd33102e1410b2033fb3a4f", "packages/remote/src/remote-request-diagnostics.ts#DiagnosticsHandoff": "sha256:53cf957caab9bf59c7743373aa544e2e0904dc49db7d1ca84b03fe6be19f35ce", "packages/remote/src/remote-request-diagnostics.ts#RemoteDaemonErrorPayload": "sha256:8fbcbcdf4bae7b66a08e465a72593794f36364759f18f1a814cd39dfdb76f309", @@ -569,8 +569,8 @@ }, { "declaration": "packages/remote/src/daemon-artifacts.ts#resolveMaterializedArtifactPath", - "digest": "sha256:06dc215c06a9d2ea5a3821faf31b297a2e2f63928672c08c637b132beee726be", - "rationale": "#4518 and #4661 change client-side destination selection. Authorized destinations keep precedence. Fallbacks reject NUL names, and ordinary captures reject explicit non-string names and Windows drive-qualified basenames under Windows path rules. Daemons send the same artifact fields with the same framing." + "digest": "sha256:71ddbc51d56481a8a94b592bc70ed3e9caaa5a006857c9d59a895165286e298f", + "rationale": "#4518 and #4661 change client-side destination selection. Authorized destinations keep precedence. Fallbacks reject NUL names, and ordinary captures reject explicit non-string names and Windows drive-qualified basenames under Windows path rules. A trace or perf output without a requested path goes to a generated file in cwd, with a suffix from the local command and capture kind and never from a daemon-supplied name. Daemons send the same artifact fields with the same framing." }, { "declaration": "packages/daemon/src/server/http/http-server.ts#MAX_HTTP_RPC_BODY_BYTES", diff --git a/website/docs/docs/remote-proxy.md b/website/docs/docs/remote-proxy.md index a1db36c3345..7b0bc0213bf 100644 --- a/website/docs/docs/remote-proxy.md +++ b/website/docs/docs/remote-proxy.md @@ -100,7 +100,7 @@ Remote screenshots, recordings, performance captures, and trace logs use generat the daemon. When you specify an output path through the CLI, SDK, or MCP, it selects the download destination on your machine. A recording is different: it downloads to the path named by the `record stop` request, or otherwise to the working directory with a warning. The directory of a -`record start` path does not carry over; the working-directory fallback keeps only its file name. A `trace stop` or `perf ... stop` download uses its own `--out` or path; the `--out` of the earlier `start` does not carry over, and without one the file goes to the working directory under a generated `trace-` or `perf-` name. Direct RPC callers receive artifact IDs and download each result with +`record start` path does not carry over; the working-directory fallback keeps only its file name. A `trace stop` or `perf ... stop` download uses its own `--out` or path; the `--out` of the earlier `start` does not carry over, and without one the file goes to the working directory under a generated `trace-` or `perf-` name with a fixed suffix (`.log` for a trace, `.json` for a CPU profile report, `.tar.gz` for an xctrace capture). Direct RPC callers receive artifact IDs and download each result with `GET /artifacts/` using the same authentication. For an artifact from a leased session, also send the lease id in the `x-agent-device-lease-id` header: without it, `GET /artifacts` does not list the artifact and the download fails with `UNAUTHORIZED` and reason `LEASE_OUTPUT_MISMATCH`. From b3fa5a79fb6d780bf365cfa1bb409b277c2e56a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 3 Dec 2026 10:55:49 +0100 Subject: [PATCH 3/8] fix(remote): derive generated capture names from output artifacts and capture kind --- .../daemon-artifacts-capture.test.ts | 25 +++++++++ packages/remote/src/daemon-artifacts.ts | 56 ++++++++++++------- test/wire-compat/ledger.json | 4 +- website/docs/docs/remote-proxy.md | 2 +- 4 files changed, 63 insertions(+), 24 deletions(-) diff --git a/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts b/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts index 57de4ff2ae0..5ef8fc8c109 100644 --- a/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts +++ b/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts @@ -77,6 +77,7 @@ type MaterializationCase = { name: string; command: string; positionals?: string[]; + flags?: { kind: string }; registered?: string; localPath: string; field?: string; @@ -143,6 +144,7 @@ test.for([ name: 'a perf cpu profile stop refuses a hostile response localPath', command: 'perf', positionals: ['cpu', 'profile', 'stop'], + field: 'outPath', localPath: '../../etc/x', fileName: 'cpu.trace', generatedName: /^perf-[0-9a-f-]{36}$/, @@ -160,6 +162,7 @@ test.for([ name: 'a perf cpu profile report keeps a json suffix, not the daemon-supplied name', command: 'perf', positionals: ['cpu', 'profile', 'report', 'xctrace'], + field: 'outPath', localPath: '/etc/x', fileName: 'report.sh', generatedName: /^perf-[0-9a-f-]{36}\.json$/, @@ -168,10 +171,31 @@ test.for([ name: 'an xctrace capture stop keeps an archive suffix', command: 'perf', positionals: ['trace', 'stop', 'xctrace'], + field: 'outPath', localPath: '/etc/x', fileName: 'capture.exe', generatedName: /^perf-[0-9a-f-]{36}\.tar\.gz$/, }, + { + name: 'a perf memory snapshot keeps the suffix of its kind', + command: 'perf', + positionals: ['memory', 'snapshot'], + flags: { kind: 'android-hprof' }, + field: 'outPath', + localPath: '/etc/x', + fileName: 'heap.sh', + generatedName: /^perf-[0-9a-f-]{36}\.hprof$/, + }, + { + name: 'a perfetto trace stop keeps the suffix of its kind', + command: 'perf', + positionals: ['trace', 'stop'], + flags: { kind: 'perfetto' }, + field: 'outPath', + localPath: '/etc/x', + fileName: 'x.sh', + generatedName: /^perf-[0-9a-f-]{36}\.perfetto-trace$/, + }, { name: 'a trace stop with its own --out writes there', command: 'trace', @@ -197,6 +221,7 @@ test.for([ command: c.command, session: 'capture', positionals: c.positionals ?? ['stop'], + ...(c.flags ? { flags: c.flags } : {}), meta: { cwd: inRoot('cwd'), ...(c.registered ? { clientArtifactPaths: { [field]: inRoot(c.registered) } } : {}), diff --git a/packages/remote/src/daemon-artifacts.ts b/packages/remote/src/daemon-artifacts.ts index ccd01d2094f..08a1590c0b5 100644 --- a/packages/remote/src/daemon-artifacts.ts +++ b/packages/remote/src/daemon-artifacts.ts @@ -746,35 +746,49 @@ function resolveMaterializedArtifactPath( ): { path: string; fallback: boolean } | undefined { const requestedPath = req.meta?.clientArtifactPaths?.[artifact.field]; if (hasNonEmptyString(requestedPath)) return { path: requestedPath, fallback: false }; - if (isRecordStop(req)) { - const requested = artifact.field === 'outPath' ? req.positionals[1] : undefined; - if (hasNonEmptyString(requested)) { - return { path: resolveAbsoluteClientPath(requested, req.meta?.cwd, host), fallback: false }; - } - if (typeof artifact.fileName === 'string' && artifact.fileName.includes('\0')) return undefined; - const fileName = localFileName(artifact.fileName) ?? `recording-${crypto.randomUUID()}`; - return { path: path.resolve(req.meta?.cwd ?? host.cwd, fileName), fallback: true }; - } - if (req.command === 'trace' || req.command === 'perf') { - return { - path: path.resolve( - req.meta?.cwd ?? host.cwd, - `${req.command}-${crypto.randomUUID()}${generatedCaptureSuffix(req)}`, - ), - fallback: false, - }; + if (isRecordStop(req)) return resolveRecordStopPath(artifact, req, host); + if ((req.command === 'trace' || req.command === 'perf') && artifact.field === 'outPath') { + return { path: generatedCapturePath(req, host), fallback: false }; } const fallbackPath = resolveOrdinaryArtifactFallbackPath(artifact, req.meta?.cwd ?? host.cwd); return fallbackPath ? { path: fallbackPath, fallback: false } : undefined; } +function resolveRecordStopPath( + artifact: DaemonArtifact, + req: DaemonWireRequest, + host: HostEnvironment, +): { path: string; fallback: boolean } | undefined { + const requested = artifact.field === 'outPath' ? req.positionals?.[1] : undefined; + if (hasNonEmptyString(requested)) { + return { path: resolveAbsoluteClientPath(requested, req.meta?.cwd, host), fallback: false }; + } + if (typeof artifact.fileName === 'string' && artifact.fileName.includes('\0')) return undefined; + const fileName = localFileName(artifact.fileName) ?? `recording-${crypto.randomUUID()}`; + return { path: path.resolve(req.meta?.cwd ?? host.cwd, fileName), fallback: true }; +} + +function generatedCapturePath(req: DaemonWireRequest, host: HostEnvironment): string { + const name = `${req.command}-${crypto.randomUUID()}${generatedCaptureSuffix(req)}`; + return path.resolve(req.meta?.cwd ?? host.cwd, name); +} + +const CAPTURE_KIND_SUFFIXES = new Map([ + ['xctrace', '.tar.gz'], + ['perfetto', '.perfetto-trace'], + ['simpleperf', '.perf.data'], + ['android-hprof', '.hprof'], + ['memgraph', '.memgraph'], +]); + /** The suffix comes from the local command and capture kind, never from a daemon-supplied name. */ function generatedCaptureSuffix(req: DaemonWireRequest): string { if (req.command === 'trace') return '.log'; - const [area, ...rest] = (req.positionals ?? []).map((value) => value.toLowerCase()); - const [action, kind] = area === 'cpu' ? rest.slice(1) : rest; - if (area === 'cpu' && action === 'report') return '.json'; - return kind === 'xctrace' ? '.tar.gz' : ''; + const words = (req.positionals ?? []).map((value) => value.toLowerCase()); + if (words[0] === 'cpu' && words[2] === 'report') return '.json'; + const flagKind = typeof req.flags?.kind === 'string' ? req.flags.kind.toLowerCase() : undefined; + const kind = flagKind ?? words.find((word) => CAPTURE_KIND_SUFFIXES.has(word)); + return (kind && CAPTURE_KIND_SUFFIXES.get(kind)) || ''; } function resolveOrdinaryArtifactFallbackPath( diff --git a/test/wire-compat/ledger.json b/test/wire-compat/ledger.json index 5e0a93ec374..dbebbc598ea 100644 --- a/test/wire-compat/ledger.json +++ b/test/wire-compat/ledger.json @@ -163,7 +163,7 @@ "packages/remote/src/daemon-artifacts.ts#downloadRemoteArtifact": "sha256:3f3b6c01601c54ab2c76c8cb0946de623da4d24ba32254c75ae8a3993f66adcf", "packages/remote/src/daemon-artifacts.ts#isRemoteDaemon": "sha256:0f6a714c5f60ce4e8548d811b516d8b6241eca9f7e5414733732da395b8a00e7", "packages/remote/src/daemon-artifacts.ts#materializeRemoteArtifacts": "sha256:ec5fba6dc0c74701c058bd72f3797b907574b51d73816cfa686985e0bf3bc794", - "packages/remote/src/daemon-artifacts.ts#resolveMaterializedArtifactPath": "sha256:71ddbc51d56481a8a94b592bc70ed3e9caaa5a006857c9d59a895165286e298f", + "packages/remote/src/daemon-artifacts.ts#resolveMaterializedArtifactPath": "sha256:c525beb84bea4a443825f61d9d3682ccb1d212b1b5e479aec93fbb869551878b", "packages/remote/src/daemon-artifacts.ts#resolveOrdinaryArtifactFallbackPath": "sha256:e8b1cb5243194e1d4fc7e376979ca5aae3aaf55cfdd33102e1410b2033fb3a4f", "packages/remote/src/remote-request-diagnostics.ts#DiagnosticsHandoff": "sha256:53cf957caab9bf59c7743373aa544e2e0904dc49db7d1ca84b03fe6be19f35ce", "packages/remote/src/remote-request-diagnostics.ts#RemoteDaemonErrorPayload": "sha256:8fbcbcdf4bae7b66a08e465a72593794f36364759f18f1a814cd39dfdb76f309", @@ -569,7 +569,7 @@ }, { "declaration": "packages/remote/src/daemon-artifacts.ts#resolveMaterializedArtifactPath", - "digest": "sha256:71ddbc51d56481a8a94b592bc70ed3e9caaa5a006857c9d59a895165286e298f", + "digest": "sha256:c525beb84bea4a443825f61d9d3682ccb1d212b1b5e479aec93fbb869551878b", "rationale": "#4518 and #4661 change client-side destination selection. Authorized destinations keep precedence. Fallbacks reject NUL names, and ordinary captures reject explicit non-string names and Windows drive-qualified basenames under Windows path rules. A trace or perf output without a requested path goes to a generated file in cwd, with a suffix from the local command and capture kind and never from a daemon-supplied name. Daemons send the same artifact fields with the same framing." }, { diff --git a/website/docs/docs/remote-proxy.md b/website/docs/docs/remote-proxy.md index 7b0bc0213bf..1276d452df8 100644 --- a/website/docs/docs/remote-proxy.md +++ b/website/docs/docs/remote-proxy.md @@ -100,7 +100,7 @@ Remote screenshots, recordings, performance captures, and trace logs use generat the daemon. When you specify an output path through the CLI, SDK, or MCP, it selects the download destination on your machine. A recording is different: it downloads to the path named by the `record stop` request, or otherwise to the working directory with a warning. The directory of a -`record start` path does not carry over; the working-directory fallback keeps only its file name. A `trace stop` or `perf ... stop` download uses its own `--out` or path; the `--out` of the earlier `start` does not carry over, and without one the file goes to the working directory under a generated `trace-` or `perf-` name with a fixed suffix (`.log` for a trace, `.json` for a CPU profile report, `.tar.gz` for an xctrace capture). Direct RPC callers receive artifact IDs and download each result with +`record start` path does not carry over; the working-directory fallback keeps only its file name. A `trace stop` or `perf ... stop` download uses its own `--out` or path; the `--out` of the earlier `start` does not carry over, and without one the file goes to the working directory under a generated `trace-` or `perf-` name with a fixed suffix (`.log` for a trace, `.json` for a CPU profile report, `.tar.gz` for an xctrace capture, `.perfetto-trace`, `.perf.data`, `.hprof`, or `.memgraph` for the matching `--kind`). Direct RPC callers receive artifact IDs and download each result with `GET /artifacts/` using the same authentication. For an artifact from a leased session, also send the lease id in the `x-agent-device-lease-id` header: without it, `GET /artifacts` does not list the artifact and the download fails with `UNAUTHORIZED` and reason `LEASE_OUTPUT_MISMATCH`. From 1f5b3f31f360b4a3b8ee9a9198a8b42ed729207a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 3 Dec 2026 11:14:51 +0100 Subject: [PATCH 4/8] docs(remote): state when generated perf names get a suffix --- website/docs/docs/remote-proxy.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/website/docs/docs/remote-proxy.md b/website/docs/docs/remote-proxy.md index 1276d452df8..beab2b52c95 100644 --- a/website/docs/docs/remote-proxy.md +++ b/website/docs/docs/remote-proxy.md @@ -100,7 +100,7 @@ Remote screenshots, recordings, performance captures, and trace logs use generat the daemon. When you specify an output path through the CLI, SDK, or MCP, it selects the download destination on your machine. A recording is different: it downloads to the path named by the `record stop` request, or otherwise to the working directory with a warning. The directory of a -`record start` path does not carry over; the working-directory fallback keeps only its file name. A `trace stop` or `perf ... stop` download uses its own `--out` or path; the `--out` of the earlier `start` does not carry over, and without one the file goes to the working directory under a generated `trace-` or `perf-` name with a fixed suffix (`.log` for a trace, `.json` for a CPU profile report, `.tar.gz` for an xctrace capture, `.perfetto-trace`, `.perf.data`, `.hprof`, or `.memgraph` for the matching `--kind`). Direct RPC callers receive artifact IDs and download each result with +`record start` path does not carry over; the working-directory fallback keeps only its file name. A `trace stop` or `perf ... stop` download uses its own `--out` or path; the `--out` of the earlier `start` does not carry over, and without one the file goes to the working directory under a generated `trace-` or `perf-` name. A trace gets `.log`. A perf download gets a suffix only when the command names it: `.json` for a CPU profile report, `.tar.gz` for an xctrace capture, or `.perfetto-trace`, `.perf.data`, `.hprof`, or `.memgraph` for an explicit `--kind`; otherwise the file has no extension. Direct RPC callers receive artifact IDs and download each result with `GET /artifacts/` using the same authentication. For an artifact from a leased session, also send the lease id in the `x-agent-device-lease-id` header: without it, `GET /artifacts` does not list the artifact and the download fails with `UNAUTHORIZED` and reason `LEASE_OUTPUT_MISMATCH`. From 8442c27f90edb213ae163ce3dfadb5fcdc2721a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 3 Dec 2026 12:26:24 +0100 Subject: [PATCH 5/8] fix(remote): deliver trace and perf outPath artifacts as one file; fix stop examples --- .../src/__tests__/daemon-artifacts-capture.test.ts | 13 ++++++++++++- packages/remote/src/daemon-artifacts.ts | 12 ++++++++++-- src/commands/schema/cli-help-workflows.ts | 4 ++-- website/docs/docs/remote-proxy.md | 2 +- 4 files changed, 25 insertions(+), 6 deletions(-) diff --git a/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts b/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts index 5ef8fc8c109..f75b4f74e66 100644 --- a/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts +++ b/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts @@ -81,6 +81,7 @@ type MaterializationCase = { registered?: string; localPath: string; field?: string; + artifactType?: string; fileName?: string; expected?: string; generatedName?: RegExp; @@ -196,6 +197,16 @@ test.for([ fileName: 'x.sh', generatedName: /^perf-[0-9a-f-]{36}\.perfetto-trace$/, }, + { + name: 'a trace stop with its own --out writes one file for a directory-shaped response', + command: 'trace', + positionals: ['stop', 'client/t.trace'], + field: 'outPath', + artifactType: 'test-artifacts', + registered: 'client/t.trace', + localPath: '/etc/x', + expected: 'client/t.trace', + }, { name: 'a trace stop with its own --out writes there', command: 'trace', @@ -234,7 +245,7 @@ test.for([ { artifactId: 'a1', field, - artifactType: 'screenshot', + artifactType: c.artifactType ?? 'screenshot', path: '/daemon/x', localPath: inRoot(c.localPath), ...(c.fileName === undefined ? {} : { fileName: c.fileName }), diff --git a/packages/remote/src/daemon-artifacts.ts b/packages/remote/src/daemon-artifacts.ts index 08a1590c0b5..2f920146227 100644 --- a/packages/remote/src/daemon-artifacts.ts +++ b/packages/remote/src/daemon-artifacts.ts @@ -616,7 +616,11 @@ async function downloadOneArtifact( // response, before any bytes arrive, so cleanup-on-error can be decided up front instead of // racing the response headers (a directory destination must never be `rm`'d wholesale; see // `downloadRemoteArtifact`). - isDirectory: recording === undefined && artifact.artifactType === 'test-artifacts', + // A trace or perf `outPath` is always one file, whatever artifact type the daemon names. + isDirectory: + recording === undefined && + artifact.artifactType === 'test-artifacts' && + !isCaptureOutPath(req, artifact), stagedFile: recording !== undefined, }); recording?.add(artifact.field, materializedPath, destination.fallback); @@ -747,13 +751,17 @@ function resolveMaterializedArtifactPath( const requestedPath = req.meta?.clientArtifactPaths?.[artifact.field]; if (hasNonEmptyString(requestedPath)) return { path: requestedPath, fallback: false }; if (isRecordStop(req)) return resolveRecordStopPath(artifact, req, host); - if ((req.command === 'trace' || req.command === 'perf') && artifact.field === 'outPath') { + if (isCaptureOutPath(req, artifact)) { return { path: generatedCapturePath(req, host), fallback: false }; } const fallbackPath = resolveOrdinaryArtifactFallbackPath(artifact, req.meta?.cwd ?? host.cwd); return fallbackPath ? { path: fallbackPath, fallback: false } : undefined; } +function isCaptureOutPath(req: DaemonWireRequest, artifact: DaemonArtifact): boolean { + return (req.command === 'trace' || req.command === 'perf') && artifact.field === 'outPath'; +} + function resolveRecordStopPath( artifact: DaemonArtifact, req: DaemonWireRequest, diff --git a/src/commands/schema/cli-help-workflows.ts b/src/commands/schema/cli-help-workflows.ts index 038002f0650..df1d02a599b 100644 --- a/src/commands/schema/cli-help-workflows.ts +++ b/src/commands/schema/cli-help-workflows.ts @@ -163,10 +163,10 @@ Diagnostics and traces: perf xctrace keeps the .trace artifact on disk; CPU report returns a bounded weighted top-function summary. Do not dump .trace contents into context. For Android native CPU/trace evidence, use perf artifacts instead of raw adb/simpleperf/perfetto output: agent-device perf cpu profile start --kind simpleperf --out /tmp/cpu.perf.data - agent-device perf cpu profile stop --kind simpleperf + agent-device perf cpu profile stop --kind simpleperf --out /tmp/cpu.perf.data agent-device perf cpu profile report --kind simpleperf --out /tmp/cpu-report.json agent-device perf trace start --kind perfetto --out /tmp/app.perfetto-trace - agent-device perf trace stop --kind perfetto + agent-device perf trace stop --kind perfetto --out /tmp/app.perfetto-trace Treat native perf output as the agent evidence: for example, state=stopped, outPath=/tmp/app.perfetto-trace, sizeBytes=5392410, method=adb-shell-perfetto. The 5.3 MB raw trace stays in the artifact. Keep the saved Simpleperf profile at its stop output path until you generate the report. CPU reports return at most ten top functions in structured data and print five in default CLI output. diff --git a/website/docs/docs/remote-proxy.md b/website/docs/docs/remote-proxy.md index beab2b52c95..e61a794595a 100644 --- a/website/docs/docs/remote-proxy.md +++ b/website/docs/docs/remote-proxy.md @@ -100,7 +100,7 @@ Remote screenshots, recordings, performance captures, and trace logs use generat the daemon. When you specify an output path through the CLI, SDK, or MCP, it selects the download destination on your machine. A recording is different: it downloads to the path named by the `record stop` request, or otherwise to the working directory with a warning. The directory of a -`record start` path does not carry over; the working-directory fallback keeps only its file name. A `trace stop` or `perf ... stop` download uses its own `--out` or path; the `--out` of the earlier `start` does not carry over, and without one the file goes to the working directory under a generated `trace-` or `perf-` name. A trace gets `.log`. A perf download gets a suffix only when the command names it: `.json` for a CPU profile report, `.tar.gz` for an xctrace capture, or `.perfetto-trace`, `.perf.data`, `.hprof`, or `.memgraph` for an explicit `--kind`; otherwise the file has no extension. Direct RPC callers receive artifact IDs and download each result with +`record start` path does not carry over; the working-directory fallback keeps only its file name. A `trace stop ` or `perf ... stop --out ` download uses its own path; the path of the earlier `start` does not carry over, and without one the file goes to the working directory under a generated `trace-` or `perf-` name. A trace gets `.log`. A perf download gets a suffix only when the command names it: `.json` for a CPU profile report, `.tar.gz` for an xctrace capture, or `.perfetto-trace`, `.perf.data`, `.hprof`, or `.memgraph` for an explicit `--kind`; otherwise the file has no extension. Direct RPC callers receive artifact IDs and download each result with `GET /artifacts/` using the same authentication. For an artifact from a leased session, also send the lease id in the `x-agent-device-lease-id` header: without it, `GET /artifacts` does not list the artifact and the download fails with `UNAUTHORIZED` and reason `LEASE_OUTPUT_MISMATCH`. From e0c792287e70471e37584d5c2df1a025bd96c1af Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 3 Dec 2026 12:30:50 +0100 Subject: [PATCH 6/8] test(wire-compat): record client-local capture delivery digests --- test/wire-compat/ledger.json | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/test/wire-compat/ledger.json b/test/wire-compat/ledger.json index dbebbc598ea..dfb0569853a 100644 --- a/test/wire-compat/ledger.json +++ b/test/wire-compat/ledger.json @@ -569,8 +569,8 @@ }, { "declaration": "packages/remote/src/daemon-artifacts.ts#resolveMaterializedArtifactPath", - "digest": "sha256:c525beb84bea4a443825f61d9d3682ccb1d212b1b5e479aec93fbb869551878b", - "rationale": "#4518 and #4661 change client-side destination selection. Authorized destinations keep precedence. Fallbacks reject NUL names, and ordinary captures reject explicit non-string names and Windows drive-qualified basenames under Windows path rules. A trace or perf output without a requested path goes to a generated file in cwd, with a suffix from the local command and capture kind and never from a daemon-supplied name. Daemons send the same artifact fields with the same framing." + "digest": "sha256:19bb1646a1e2044844f4ec632a4218d7924955e6907437a3bd0824781bffb6e6", + "rationale": "#4518, #4661 and #5338 change client-side destination selection. Authorized destinations keep precedence. Fallbacks reject NUL names, and ordinary captures reject explicit non-string names and Windows drive-qualified basenames under Windows path rules. A trace or perf output without a requested path goes to a generated file in cwd, with a suffix from the local command and capture kind and never from a daemon-supplied name. Daemons send the same artifact fields with the same framing." }, { "declaration": "packages/daemon/src/server/http/http-server.ts#MAX_HTTP_RPC_BODY_BYTES", @@ -774,8 +774,8 @@ }, { "declaration": "packages/remote/src/daemon-artifacts.ts#downloadOneArtifact", - "digest": "sha256:9460cc0d14310109e198612e18d2f1b5ba5e146e5f12fe58195fd97dba37bdc0", - "rationale": "The file and directory download paths inherit the client-local handoff through their endpoint. Routes, headers and body framing are unchanged." + "digest": "sha256:ada768dad0b185ce5689b887671767207dcd7a748adf7a3f3a89aa1b506ea5b8", + "rationale": "The file and directory download paths inherit the client-local handoff through their endpoint. #5338 writes a trace or perf capture to its client-chosen or generated path as one file and keeps directory delivery for the suite directory only; this is a client-local choice. Routes, headers and body framing are unchanged." }, { "declaration": "packages/remote/src/artifact-download.ts#RemoteArtifactRequest", From 17408d5dd3a610d1bc13de093e41cf18dd193387 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 3 Dec 2026 12:36:25 +0100 Subject: [PATCH 7/8] test(wire-compat): pin current digests for client capture delivery --- test/wire-compat/ledger.json | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/test/wire-compat/ledger.json b/test/wire-compat/ledger.json index dfb0569853a..ea3df312813 100644 --- a/test/wire-compat/ledger.json +++ b/test/wire-compat/ledger.json @@ -163,7 +163,7 @@ "packages/remote/src/daemon-artifacts.ts#downloadRemoteArtifact": "sha256:3f3b6c01601c54ab2c76c8cb0946de623da4d24ba32254c75ae8a3993f66adcf", "packages/remote/src/daemon-artifacts.ts#isRemoteDaemon": "sha256:0f6a714c5f60ce4e8548d811b516d8b6241eca9f7e5414733732da395b8a00e7", "packages/remote/src/daemon-artifacts.ts#materializeRemoteArtifacts": "sha256:ec5fba6dc0c74701c058bd72f3797b907574b51d73816cfa686985e0bf3bc794", - "packages/remote/src/daemon-artifacts.ts#resolveMaterializedArtifactPath": "sha256:c525beb84bea4a443825f61d9d3682ccb1d212b1b5e479aec93fbb869551878b", + "packages/remote/src/daemon-artifacts.ts#resolveMaterializedArtifactPath": "sha256:19bb1646a1e2044844f4ec632a4218d7924955e6907437a3bd0824781bffb6e6", "packages/remote/src/daemon-artifacts.ts#resolveOrdinaryArtifactFallbackPath": "sha256:e8b1cb5243194e1d4fc7e376979ca5aae3aaf55cfdd33102e1410b2033fb3a4f", "packages/remote/src/remote-request-diagnostics.ts#DiagnosticsHandoff": "sha256:53cf957caab9bf59c7743373aa544e2e0904dc49db7d1ca84b03fe6be19f35ce", "packages/remote/src/remote-request-diagnostics.ts#RemoteDaemonErrorPayload": "sha256:8fbcbcdf4bae7b66a08e465a72593794f36364759f18f1a814cd39dfdb76f309", @@ -248,7 +248,7 @@ "packages/daemon-contracts/src/daemon-resolution.ts#DaemonCapability": "sha256:2a5acf280a72e3d54c5ad7b52aece3ced37a30e4e721ef106a98e3bbd18ddbc3", "packages/daemon-contracts/src/daemon-resolution.ts#readDaemonCapabilities": "sha256:e410d36be74d307f7e5d8ddae63af5aae77f8eef77951ce9eeb7724f2fefae88", "packages/remote/src/daemon-artifacts.ts#downloadResponseArtifacts": "sha256:5259010d194d123cb1a9f0eee38bbaef12337613c80b531c5f554953b8c1ada1", - "packages/remote/src/daemon-artifacts.ts#downloadOneArtifact": "sha256:9460cc0d14310109e198612e18d2f1b5ba5e146e5f12fe58195fd97dba37bdc0", + "packages/remote/src/daemon-artifacts.ts#downloadOneArtifact": "sha256:ada768dad0b185ce5689b887671767207dcd7a748adf7a3f3a89aa1b506ea5b8", "packages/remote/src/daemon-artifacts.ts#DroppedArtifact": "sha256:c340f0a9a4b99d0664f8c32ac78b3a054c95e7f171cf3531331f7cdc143e0cfb", "packages/remote/src/session-script-destination.ts#SessionScriptDelivery": "sha256:741fafbb8e2b43e2e967b2f4206f1d60017a636f63e3cde68b6258fd4efefa18", "packages/remote/src/script-version-publisher.ts#publishScriptVersion": "sha256:c5fd24804377237c8da43a5e17e5469496e7ac76f01a3a6099859e815a6c9c04", From 458b9d512442234c8d2a0217cde3e5841cd9a576 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Micha=C5=82=20Pierzcha=C5=82a?= Date: Thu, 3 Dec 2026 13:17:44 +0100 Subject: [PATCH 8/8] fix(remote): refuse a directory-shaped trace or perf output before preparing its path --- .../daemon-artifacts-capture.test.ts | 59 +++++++++++++++---- packages/remote/src/daemon-artifacts.ts | 19 ++++-- test/wire-compat/ledger.json | 6 +- website/docs/docs/error-reasons.md | 1 + 4 files changed, 65 insertions(+), 20 deletions(-) diff --git a/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts b/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts index f75b4f74e66..2fa0add82a7 100644 --- a/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts +++ b/packages/remote/src/__tests__/daemon-artifacts-capture.test.ts @@ -81,7 +81,6 @@ type MaterializationCase = { registered?: string; localPath: string; field?: string; - artifactType?: string; fileName?: string; expected?: string; generatedName?: RegExp; @@ -197,16 +196,6 @@ test.for([ fileName: 'x.sh', generatedName: /^perf-[0-9a-f-]{36}\.perfetto-trace$/, }, - { - name: 'a trace stop with its own --out writes one file for a directory-shaped response', - command: 'trace', - positionals: ['stop', 'client/t.trace'], - field: 'outPath', - artifactType: 'test-artifacts', - registered: 'client/t.trace', - localPath: '/etc/x', - expected: 'client/t.trace', - }, { name: 'a trace stop with its own --out writes there', command: 'trace', @@ -245,7 +234,7 @@ test.for([ { artifactId: 'a1', field, - artifactType: c.artifactType ?? 'screenshot', + artifactType: 'screenshot', path: '/daemon/x', localPath: inRoot(c.localPath), ...(c.fileName === undefined ? {} : { fileName: c.fileName }), @@ -269,6 +258,52 @@ test.for([ } }); +test('a directory-shaped trace response is refused and keeps the existing output file', async (t) => { + if (await skipWhenLoopbackUnavailable(t, 'remote artifact download')) return; + const root = mkdtempForTestSync('agent-device-remote-artifact-capture-dir-'); + const outPath = path.join(root, 't.trace'); + fs.writeFileSync(outPath, 'previous-bytes'); + let requests = 0; + const server = http.createServer((_req, res) => { + requests += 1; + res.writeHead(500).end(); + }); + try { + const port = await listenOnLoopback(server); + await expect( + materializeRemoteArtifacts( + { baseUrl: `http://127.0.0.1:${port}`, token: 'secret' }, + { + token: 'secret', + command: 'trace', + session: 'capture', + positionals: ['stop', outPath], + meta: { cwd: root, clientArtifactPaths: { outPath } }, + }, + { + ok: true, + data: { + artifacts: [ + { + artifactId: 'a1', + field: 'outPath', + artifactType: 'test-artifacts', + path: '/daemon/x', + }, + ], + }, + }, + createTestHostEnvironment(), + path.join(root, 'state'), + ), + ).rejects.toMatchObject({ details: { reason: 'remote_capture_output_directory_shaped' } }); + expect(requests).toBe(0); + expect(fs.readFileSync(outPath, 'utf8')).toBe('previous-bytes'); + } finally { + await closeLoopbackServer(server); + } +}); + type InvalidNameCase = { name: string; field: string; diff --git a/packages/remote/src/daemon-artifacts.ts b/packages/remote/src/daemon-artifacts.ts index 2f920146227..a3b96f2691e 100644 --- a/packages/remote/src/daemon-artifacts.ts +++ b/packages/remote/src/daemon-artifacts.ts @@ -584,6 +584,12 @@ async function downloadResponseArtifacts( return { ok: true, data: nextData }; } +/** Why a remote trace or perf capture is refused before any local path is prepared. */ +const REMOTE_CAPTURE_OUTPUT_REASONS = { + // The daemon returned a directory-shaped artifact for a trace or perf output, which is one file. + directoryShaped: { reason: 'remote_capture_output_directory_shaped' }, +} as const satisfies ReasonTable<'remote transfer'>; + async function downloadOneArtifact( endpoint: RemoteDaemonArtifactEndpoint, req: DaemonWireRequest, @@ -602,6 +608,13 @@ async function downloadOneArtifact( }, ): Promise { if (typeof artifact.field !== 'string' || isClientOwnedResponseField(artifact.field)) return; + if (isCaptureOutPath(req, artifact) && artifact.artifactType === 'test-artifacts') { + throw new AppError( + 'COMMAND_FAILED', + `The remote ${req.command} capture came back as a directory, so the client wrote nothing.`, + { reason: REMOTE_CAPTURE_OUTPUT_REASONS.directoryShaped.reason }, + ); + } const destination = resolveMaterializedArtifactPath(artifact, req, host); if (!destination || destination.path.includes('\0')) { dropped.push({ field: artifact.field, reason: 'artifact_name_invalid' }); @@ -616,11 +629,7 @@ async function downloadOneArtifact( // response, before any bytes arrive, so cleanup-on-error can be decided up front instead of // racing the response headers (a directory destination must never be `rm`'d wholesale; see // `downloadRemoteArtifact`). - // A trace or perf `outPath` is always one file, whatever artifact type the daemon names. - isDirectory: - recording === undefined && - artifact.artifactType === 'test-artifacts' && - !isCaptureOutPath(req, artifact), + isDirectory: recording === undefined && artifact.artifactType === 'test-artifacts', stagedFile: recording !== undefined, }); recording?.add(artifact.field, materializedPath, destination.fallback); diff --git a/test/wire-compat/ledger.json b/test/wire-compat/ledger.json index ea3df312813..0630d0f9832 100644 --- a/test/wire-compat/ledger.json +++ b/test/wire-compat/ledger.json @@ -248,7 +248,7 @@ "packages/daemon-contracts/src/daemon-resolution.ts#DaemonCapability": "sha256:2a5acf280a72e3d54c5ad7b52aece3ced37a30e4e721ef106a98e3bbd18ddbc3", "packages/daemon-contracts/src/daemon-resolution.ts#readDaemonCapabilities": "sha256:e410d36be74d307f7e5d8ddae63af5aae77f8eef77951ce9eeb7724f2fefae88", "packages/remote/src/daemon-artifacts.ts#downloadResponseArtifacts": "sha256:5259010d194d123cb1a9f0eee38bbaef12337613c80b531c5f554953b8c1ada1", - "packages/remote/src/daemon-artifacts.ts#downloadOneArtifact": "sha256:ada768dad0b185ce5689b887671767207dcd7a748adf7a3f3a89aa1b506ea5b8", + "packages/remote/src/daemon-artifacts.ts#downloadOneArtifact": "sha256:6e8daf83c809a30f95594ab77f0e5e02fe30f0000d73d0c6d6ac39b225320e7c", "packages/remote/src/daemon-artifacts.ts#DroppedArtifact": "sha256:c340f0a9a4b99d0664f8c32ac78b3a054c95e7f171cf3531331f7cdc143e0cfb", "packages/remote/src/session-script-destination.ts#SessionScriptDelivery": "sha256:741fafbb8e2b43e2e967b2f4206f1d60017a636f63e3cde68b6258fd4efefa18", "packages/remote/src/script-version-publisher.ts#publishScriptVersion": "sha256:c5fd24804377237c8da43a5e17e5469496e7ac76f01a3a6099859e815a6c9c04", @@ -774,8 +774,8 @@ }, { "declaration": "packages/remote/src/daemon-artifacts.ts#downloadOneArtifact", - "digest": "sha256:ada768dad0b185ce5689b887671767207dcd7a748adf7a3f3a89aa1b506ea5b8", - "rationale": "The file and directory download paths inherit the client-local handoff through their endpoint. #5338 writes a trace or perf capture to its client-chosen or generated path as one file and keeps directory delivery for the suite directory only; this is a client-local choice. Routes, headers and body framing are unchanged." + "digest": "sha256:6e8daf83c809a30f95594ab77f0e5e02fe30f0000d73d0c6d6ac39b225320e7c", + "rationale": "The file and directory download paths inherit the client-local handoff through their endpoint. #5338 writes a trace or perf capture to its client-chosen or generated path as one file and refuses a directory-shaped answer for it before any local path is prepared; suite directory delivery is unchanged. This is a client-local choice. Routes, headers and body framing are unchanged." }, { "declaration": "packages/remote/src/artifact-download.ts#RemoteArtifactRequest", diff --git a/website/docs/docs/error-reasons.md b/website/docs/docs/error-reasons.md index 7d9fa7d9cfc..26cc0b57868 100644 --- a/website/docs/docs/error-reasons.md +++ b/website/docs/docs/error-reasons.md @@ -1126,6 +1126,7 @@ These reasons can come from more than one command. | --- | --- | | `artifact_too_large` | The remote artifact is larger than the bytes this download may hold. | | `remote_script_lifecycle_unsupported` | `--save-script` was asked for on a command whose script lifecycle the daemon does not remote. | +| `remote_capture_output_directory_shaped` | The daemon returned a directory-shaped artifact for a trace or perf output, which is one file. | | `artifact_preparation_deadline_exceeded` | Preparing the artifact for upload, the read and the hop together, outlived its budget. | | `cross-origin-redirect` | The upload endpoint answered with a redirect to an origin the caller never named. |