You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[Bug]: Bound agent-device launcher omits --project-root, failing with self-inflicted DEVICE_IN_USE across working directories #38603
I searched existing issues and did not find a duplicate. (Checked #31303 and #38588 — both involve cross-thread or post-restart claims, whereas here a single thread's own bound launcher rejects itself when invoked from a second cwd.)
I included enough detail to reproduce or investigate the problem.
Because <stateDir>/device/targets/t3-<hash>/agent-device is already bound to that T3 thread's device_open session (--session t3-<hash>), invoking it from any working directory in that thread's shell commands should resolve to the same agent-device workspace/claim and succeed without requiring manual --project-root flags or cd workarounds.
Actual behavior
agent-device (0.21.36) derives workspace from the caller's process.cwd() whenever --project-root is not passed, sees a different directory than step 3's claim, and rejects its own t3-<hash> session with DEVICE_IN_USE:
Error (DEVICE_IN_USE): ios device <UDID> is owned by session "t3-<hash>" in workspace "/path/to/mobile-app/ios".
Hint: Inspect the owner with: agent-device device status --platform ios --udid <UDID>
(And following the hint via the bound launcher exits 1 because AgentDeviceShim.ts:110 blocks the device subcommand on bound launchers.)
Root cause on main (ce884e3a9d11):
apps/server/src/device/DeviceService.ts:1194,1224 binds ["--platform", ..., "--udid" | "--serial", ..., "--config", configPath, "--session", session] into targetArgs, without binding --project-root (e.g. the owning thread's workspace root or a fixed session directory).
apps/server/src/device/AgentDeviceShim.ts:132 (spawn(node, [entry, ...command], { stdio: "inherit", env })) inherits the caller shell's process.cwd() even though --project-root is already recognized in VALUE_FLAGS (line 94).
Impact
Slows down multi-directory / cross-repo mobile workflows (xcodebuild / Gradle in a subproject vs. coordinator workspace) and contradicts <t3_code_orchestration_instructions> ("never reuse or close another session; if it still fails, tell the user and stop"), causing obedient agents to abort when the "other" owner is actually their own session.
Version or commit
Verified in code on main (ce884e3a9d11, apps/server/src/device/DeviceService.ts:1194,1224 and apps/server/src/device/AgentDeviceShim.ts:94,132,175) with bundled agent-device0.21.36.
Workaround
Always cd into the exact directory where the first <target>/agent-device open ran (or pass the same --project-root <dir> on every invocation).
Activity