Skip to content

Commit 811e4a3

Browse files
committed
refactor(client): name the timed-out request fields the handler reads
The client timeout handler stays off the daemon request shape: R10 daemon-modularity holds external importers of that module at the merge-base count, so the fields arrive as named properties instead of the request object.
1 parent 8498d4c commit 811e4a3

2 files changed

Lines changed: 36 additions & 11 deletions

File tree

‎src/daemon-client/daemon-client-timeout.ts‎

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ import { isAgentDeviceDaemonProcess } from '../daemon/daemon-process.ts';
66
import { PUBLIC_COMMANDS } from '@agent-device/command-registry/catalog';
77
import { resolveCommandTimeoutPolicy } from '@agent-device/command-registry/registry';
88
import type { DaemonPaths } from '../daemon/config.ts';
9-
import type { DaemonRequest } from '../daemon/daemon-request.ts';
109
import type { PlatformSelector } from '@agent-device/kernel/device';
1110
import {
1211
removeDaemonInfo,
@@ -41,16 +40,18 @@ export function handleRequestTimeout(
4140
params: Readonly<{
4241
info: DaemonInfo;
4342
statePaths: DaemonPaths;
44-
/** The request that ran out of its window, so its command, session, and action cannot drift apart. */
45-
req: DaemonRequest;
4643
remote: boolean;
4744
timeoutMs: number;
45+
requestId: string | undefined;
46+
command: string | undefined;
47+
platform: PlatformSelector | undefined;
48+
/** Named together so the recovery hint cannot be assembled from a swapped session and action. */
49+
session?: string;
50+
action?: string;
4851
}>,
4952
): AppError {
50-
const { info, statePaths, req, remote, timeoutMs } = params;
51-
const command = req.command;
52-
const requestId = req.meta?.requestId;
53-
const platform = req.flags?.platform;
53+
const { info, statePaths, remote, timeoutMs, requestId, command, platform, session, action } =
54+
params;
5455
// Cleanup eligibility stays UNCONDITIONAL for every local (non-remote)
5556
// timeout, on purpose: the request's declared --platform is not
5657
// authoritative for session-bound execution. An existing session's real
@@ -98,8 +99,8 @@ export function handleRequestTimeout(
9899
resetDaemon,
99100
command,
100101
appleCleanupEvidence,
101-
session: req.session,
102-
action: req.positionals?.[0],
102+
session,
103+
action,
103104
}),
104105
});
105106
}

‎src/daemon-client/daemon-client-transport.ts‎

Lines changed: 26 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -335,7 +335,19 @@ async function sendSocketRequest(
335335
? setTimeout(() => {
336336
settled = true;
337337
socket.destroy();
338-
reject(handleRequestTimeout({ info, statePaths, req, remote: false, timeoutMs }));
338+
reject(
339+
handleRequestTimeout({
340+
info,
341+
statePaths,
342+
remote: false,
343+
timeoutMs,
344+
requestId: req.meta?.requestId,
345+
command: req.command,
346+
platform: req.flags?.platform,
347+
session: req.session,
348+
action: req.positionals?.[0],
349+
}),
350+
);
339351
}, timeoutMs)
340352
: undefined;
341353

@@ -452,7 +464,19 @@ async function sendHttpRequest(
452464
typeof timeoutMs === 'number'
453465
? setTimeout(() => {
454466
request.destroy();
455-
reject(handleRequestTimeout({ info, statePaths, req, remote, timeoutMs }));
467+
reject(
468+
handleRequestTimeout({
469+
info,
470+
statePaths,
471+
remote,
472+
timeoutMs,
473+
requestId: req.meta?.requestId,
474+
command: req.command,
475+
platform: req.flags?.platform,
476+
session: req.session,
477+
action: req.positionals?.[0],
478+
}),
479+
);
456480
}, timeoutMs)
457481
: undefined;
458482

0 commit comments

Comments
 (0)