Skip to content

Commit ffc2599

Browse files
committed
fix(daemon): let a waiting open re-wait when the device is retaken
An `--wait` budget ended as soon as no session held the device, but nothing reserved the device until the request took its execution lock, so two waiters could both see one free device and the loser refused with most of its budget left. The open now looks at the device again under its own locks, hands them back when another session took it in that window, and waits for what remains of its budget. The recorded spend moves to that same look, so only a budget that ran out with a holder visible reports a spent wait, and a refusal stops offering `--wait` to a caller that arrived carrying it. The target device is resolved once, as part of the request's execution-lock plan, and contention is polled in the session store alone. A budget that reaches the daemon anywhere but through the CLI is now checked against the bounds the option declares, which the Node client never enforced.
1 parent da2d5f8 commit ffc2599

14 files changed

Lines changed: 587 additions & 232 deletions

File tree

‎packages/command-registry/src/flag-definitions-workflow.ts‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ export const WORKFLOW_FLAG_DEFINITIONS: readonly FlagDefinition[] = [
9999
usageDescription:
100100
'Open: wait up to n ms for a device another session is holding before failing with DEVICE_IN_USE',
101101
inputDescription:
102-
"Block this open for up to n milliseconds while another session holds the device, then fail with DEVICE_IN_USE naming that session. Only session contention is waited for: a device claim held by another workspace is refused at once with its recovery command. A device that never frees costs the full budget, which extends this command's timeout envelope rather than eating into it.",
102+
"Block this open for up to n milliseconds (100-120000) while another session holds the device, then fail with DEVICE_IN_USE naming that session. Only session contention is waited for: a device claim held by another workspace is refused at once with its recovery command. A device that never frees, or is taken again while this open waits, costs the full budget, which extends this command's timeout envelope rather than eating into it.",
103103
projectConfig: false,
104104
recorded: false,
105105
},

‎packages/contracts/src/client-app.ts‎

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,11 +69,11 @@ export type AppOpenOptions = AgentDeviceRequestOverrides &
6969
/** Startup budget in milliseconds: bounds the Simulator boot wait on a cold device. */
7070
timeoutMs?: number;
7171
/**
72-
* Block this open for up to n milliseconds while another session holds the device, then fail
73-
* with DEVICE_IN_USE naming that session. Only session contention is waited for: a device
74-
* claim held by another workspace is refused at once with its recovery command. A device that
75-
* never frees costs the full budget, which extends this command's timeout envelope rather
76-
* than eating into it.
72+
* Block this open for up to n milliseconds (100-120000) while another session holds the device,
73+
* then fail with DEVICE_IN_USE naming that session. Only session contention is waited for: a
74+
* device claim held by another workspace is refused at once with its recovery command. A device
75+
* that never frees, or is taken again while this open waits, costs the full budget, which
76+
* extends this command's timeout envelope rather than eating into it.
7777
*/
7878
waitMs?: number;
7979
// Editor documentation for a public type: a `.d.ts` is read where no

0 commit comments

Comments
 (0)