Repository navigation
fix(acp): check directory trust before starting the ACP server - #1847
Conversation
`nanocoder --acp` now refuses a directory that isn't trusted, the same check `nanocoder run` makes, before it loads that directory's project config. `--trust-directory` bypasses it for one run. The VS Code extension passes `--trust-directory` only when the workspace is trusted in VS Code's Workspace Trust. The refusal message is now shared (`directoryTrustRefusal`) between ACP and `verify`.
nc-review: comments — 2 nits@addyCooks — a few things worth a look, none blocking. PR #1847 closes a real gap: ⚪ nit ·
⚪ nit · The test titled 🔴 blocking · 🟠 a reviewer would ask for a change · ⚪ optional Automated code review — correctness, security, design, tests, plus duplicates and scope. A human still decides; this is not a substitute for review and is not exhaustive. The required status checks separately cover lint, formatting, types, unused dependencies, the test suite and the build. This bot never merges. Maintainers can rerun with |
…TrustRefusal The existing test was titled for a changed fingerprint but exercised the path-only upgrade case. Rename it and add a case with a stale fingerprint.
Description
nanocoder --acpnow checks directory trust before it loads the working directory's project config, the same checknanocoder run, the daemon andverifymake. Previously only those entry points did.--acprefuses a directory that isn't trusted, before any project config is loaded. The refusal is printed on stderr (stdout carries the protocol) and the process exits 1.--trust-directorybypasses it for one run;NANOCODER_TRUST_DIRECTORY=1trusts and saves the directory, as forrun.--trust-directoryonly when the workspace is trusted in VS Code's Workspace Trust, so it keeps working in folders you've trusted there. In Restricted Mode it doesn't pass the flag.directoryTrustRefusal(config/preferences.ts) and is shared by--acpandverify.--acpin an untrusted checkout, so it now passes--trust-directoryto keep measuring real startup rather than the refusal.Behaviour change: editors other than VS Code (Zed etc.) that launch
nanocoder --acpin a folder that hasn't been trusted will now be refused until the folder is trusted,NANOCODER_TRUST_DIRECTORY=1is set, or--trust-directoryis added to the agent'sargs. This is covered indocs/features/acp.md.Type of Change
Changeset
pnpm changeset) describing this change for the changelogTesting
Automated Tests
.spec.ts/tsxfilespnpm test:allcompletes successfully)Manual Testing
Checklist