Repository navigation
Description
Parent: #17
Depends on: #15, #19, #20, and #22
Goal
Let a user safely pause PickLab-managed agent input, control the isolated desktop through a temporary writable viewer, and return control with fresh visual state and an evidence record.
Authority model
Do not store control state in the last-writer-wins session JSON.
Use the session directory for:
- O_EXCL
human.lease.json - short-lived unique agent permit files
Human lease fields include random lease ID, owner PID/process identity, creation/expiry timestamps, 30-second TTL, 5-second heartbeat, and writable VNC PID metadata.
Every desktop input call and every DevTools relay request:
- Acquires an agent permit.
- Rechecks for a human lease.
- Executes only if allowed.
- Removes the permit in
finally.
Human acquisition creates the lease first, waits for existing permits to drain, then grants control. Timeout aborts cleanly. This closes the check-then-act race.
UX
picklab watch --control- Normal
picklab watchremains read-only. --controlacquires the human lease.- It starts a second temporary loopback VNC server without
-viewonly. - Writable VNC exists only while a valid lease is held.
- During human control, the DevTools relay rejects all forwarding with a stable busy error.
- On viewer exit/cancellation: stop writable VNC, capture a fresh screenshot, append the control transition, then remove the lease.
request_user_inputhandles conversational handoff where supported.- Expired leases recover only after the owner process identity is dead; recovery also kills recorded writable VNC.
The guarantee covers PickLab-managed desktop tools and bridge traffic, not arbitrary same-user local processes. Android viewing/takeover is out of scope for v1.
Checklist
- Atomic human lease and agent permits
- Process identity, TTL, heartbeat, and recovery
- Input/relay permit integration
- Temporary writable VNC lifecycle
-
picklab watch --control - Stable bridge busy response
- Fresh-state/evidence handoff
- Cancellation, crash, session-death, and destroy recovery
- Race/concurrency tests
- Live supervised proof
- README and
docs/releases/UNRELEASED.md - PR/review
Validation
bun run typecheck- focused lease/viewer/bridge tests
bun run testbun run test:coveragebun run build- two human acquisitions yield exactly one owner
- no agent operation reaches the fake sink after human acquisition completes
- relay fails closed during control
- writable VNC never outlives the lease
- heartbeat expiry, dead owner, cancellation, viewer crash, session death, and destroy recover safely
- one recorded pause → control → interact → close viewer → resume cycle
Current status: Planned
Next: implement after viewer, relay, evidence, and input-parity foundations are stable.
Activity
feat: add supervised pause and human takeover (#59)
ElbertePlinio commentedon Jul 23, 2026
Owner-run end-to-end takeover proof on Elberte-PC (2026-07-23), remote via SSH-tunneled VNC — recorded evidence:
picklab init --profile generic+session create --type desktop(desk-4ab266bb) +desktop launch konsolefrom a fresh project (picklab 0.2.0@09fcd78 from main).picklab watch --control: writable viewer opened; while the lease was held,picklab takeover statusindependently reported "session desk-4ab266bb is under human control (lease 741dcb49-…, since 2026-07-23T23:47:31.714Z)".~/.pickforge/picklab/projects/lab-smoke-451e303df6902ff8/runs/20260723-234731-computer-use/actions.jsonl) records the full cycle:takeover_start(23:47:31.933Z, ok) →takeover_return(23:48:31.975Z, ok, handback artifactscreenshots/b26998f8-….png); manifest statuscompleted, evidenceVersion 1, evidenceTruncated false.session destroy --allcleaned up;takeover statusafterwards correctly reports no running session.That closes the last acceptance box: lease/permit gating, live status reporting, viewer-close handback with fresh screenshot, and the recorded evidence trail all proven on the target machine. (Watchdog crash-reclaim was covered by the merged test suite in PR #59; not re-provoked here.)