docs+ux: make device ownership discoverable end to end

Merged
TH
3mo ago
+322-14

Summary

Stacked on #2162 (which stacks on #2160). The last slice of #1320: make the busy? → inspect → choose another device or release loop discoverable from every surface an agent actually reads, and retire the Stage-5 PID-hunting guidance.

  • devices now projects ownership: each row that a foreign open would be refused on carries claimedBy: { session, workspace } (text output: claimed by session "x" in /worktrees/y). Provably dead owners are deliberately not projected — the next open reconciles and replaces them automatically, so showing them would only scare agents off free devices. This is the observe-policy projection the #1320 design explicitly permitted, and it completes the third recovery path ("choose another device") that previously required guesswork.
  • help debugging gains a "Device busy and ownership" section separating the two DEVICE_IN_USE flavors (same-daemon session vs cross-worktree claim) with their exact recoveries, including "never recover by hunting PIDs".
  • AGENTS.md documents both flavors (previously described only the same-daemon one, whose close --session advice is wrong for a foreign claim).
  • docs/agents/device-verification.md retires the last ps/kill recovery guidance in favor of device status --stale, daemon stop --state-dir, and device release --stale — the Stage 5 deliverable of #1320.
  • ADR-0010 no longer calls DEVICE_IN_USE "the only retriable code" without naming the claim path's retriable: false override.
  • help-conformance: the rendered cross-worktree claim error sample (DEVICE_CLAIM_IN_USE_SAMPLE) was validated but bound to no quiz case; it now has one (sample-output-device-claim-inspects-owner) checking the model runs the exact device status recovery and forbidding retry-open/foreign-close/PID-hunting.
  • README points at device status / device release --stale.

Validation

All non-vitest gate checks green (format, lint, typecheck, layering, di-seams, fallow, mcp-metadata, build, package, node-integration, macos-coverage). The vitest step flaked on 9 load-timeout failures while a parallel agent session ran a full suite on this host (load avg 35–42); all 9 files pass when re-run at low concurrency, and the failures were 5s-timeouts in files this PR does not touch.

Live real-binary validation: planted a live foreign claim for the booted iPhone 17 Pro in an isolated claim store — devices rendered claimed by session "other-worktree-session" in /worktrees/other and --json carried claimedBy; a dead-owner claim was correctly not projected.

Closes #1320.