Skip to content

fix: report refused agent permits as no input and resolve home from the env HOME - #291

Merged
ElbertePlinio merged 3 commits into
mainfrom
fix/284-285-permit-report-home
Oct 7, 2026
Merged

ElbertePlinio merged 3 commits into
mainfrom
fix/284-285-permit-report-home

Conversation

@ElbertePlinio

@ElbertePlinio ElbertePlinio commented Oct 7, 2026 •

Copy link
Copy Markdown
Member

Two small product fixes.

#284: withAgentPermit throws HumanControlActiveError before it runs any input. MCP now treats that error like a text preparation failure and records the input as not-attempted, in the tool result and in the evidence record. A failure after input dispatch began still records attempted. Without capture, a failed input now also returns its inputState in the tool result, with the error text unchanged. The check is shared by all MCP input tools, so click, double click, drag, scroll, key and focus report a refused permit the same way. The CLI desktop type path records no input state, so it is unchanged.

#285: when PICKFORGE_HOME is unset or empty, pickforgeHome(env) and legacyPickforgeHomes(env) now use the env object's HOME, and fall back to os.homedir() when that is missing. Product callers pass process.env or ctx.env. Constructed envs with a private HOME only go to child processes, whose os.homedir() already follows HOME. So resolved paths do not change for users.

Closes #284
Closes #285

Requirement Verified by Scenario Result Evidence
#284 refused permit reported as no input sent, in result and evidence Device pass, automated test Isolated desktop session with zenity; human lease held; desktop_type with capture after, both, and none; desktop_click with capture All four record not-attempted in evidence; captured results report not-attempted; no input reached the app ~/Artifacts/pickforge-batch2-2026-10-07/qa-284/out2.txt, actions-*.jsonl
#284 typed value never exposed Device pass, automated test Search QA home, results and evidence for the typed values Absent everywhere qa-284/
#284 input after release still works Device pass Lease released, desktop_type with capture completed; text shown in the dialog qa-284/out3.txt, qa-284/qa284.png
#284 uncaptured result carries the state (review round 1) Device pass, automated test Lease held, no capture: desktop_type and desktop_key; every input tool with a preparation failure and a dispatch failure ok: false with not-attempted for refusal and preparation, attempted for dispatch qa-284/r2-out2.txt, qa-284/r2-out3.txt
#284 test with and without capture Automated test desktop-input-captures.test.ts: refused permit for all seven input tools with capture; desktop_type refused without capture; dispatch failure still attempted Pass CI
#285 decide and document the fallback Code review Doc comments in paths.ts Env HOME, else os.homedir() Diff
#285 cover CLI, MCP and desktop callers Automated test paths.test.ts, pickforge-home-env.test.ts (doctor), session-status.test.ts, home-policy.test.ts; each failed before the fix Pass CI
Repo checks lint, typecheck, build, PickCheck, coverage Final head fe067d9 All pass; 2965 tests passed, thresholds hold ~/Artifacts/pickforge-batch2-2026-10-07/291-cov-r2.log

QA device pass for #285: skipped. A real process's os.homedir() already follows its HOME, so the change is not visible from the CLI or MCP. The automated tests cover it.

A human takeover refuses the agent permit before any input is sent.
MCP input tools now record that refusal as not-attempted, in the tool
result and in evidence, by checking HumanControlActiveError.

Closes #284
pickforgeHome and legacyPickforgeHomes now fall back to the HOME of
the env object they get when PICKFORGE_HOME is unset or empty, and to
os.homedir() only when that HOME is unset or empty.

Closes #285
@ElbertePlinio
ElbertePlinio merged commit 3a5c13c into main Oct 7, 2026
10 checks passed
@ElbertePlinio
ElbertePlinio deleted the fix/284-285-permit-report-home branch October 7, 2026 23:48
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

core: pickforgeHome ignores the HOME of the env object it is given mcp: desktop_type records 'attempted' when the agent permit is refused

1 participant