Repository navigation
Remember the setup command the user allowed per repo - #422
Conversation
create_worktree asks when the repo's .ness.json has a setupCommand, so anyone whose repo has one was prompted on every agent create_worktree, which nudges them toward a blanket 'Always allow'. Now allowing one of those prompts records that repo's command in the permissions slice (persisted next to the grants), and later calls go through while the command is unchanged. A changed command asks again. Only a human Allow records it: the reviewer's auto-approvals don't go through resolveApproval. The command is snapshotted when the card opens, so an edit to .ness.json while it's open isn't what gets approved. It's recorded only when the setup command was the sole reason to ask, so allowing a PR checkout remembers nothing. 'Remove all' clears approved commands too, and permissions:forgetSetupCommand drops one; there's no UI for listing them yet. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Settings button that sends permissions/cleared is labelled with the grant count, so wiping approved setup commands too was a side effect it didn't promise. Commands are forgotten per repo instead. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
❔ Evidence review: inconclusiveI could not reach the create_worktree approval card in either build, so the remembered-command behaviour is untested. Both agents created worktrees (demo-a, demo-b) with no prompt, including the before build, which should have asked for the "npm install" setup command. I did not confirm that the .ness.json I wrote was in the main repo root where the gate reads it, which is the most likely reason the gate never fired.
Test plan
E1Both builds ran the Chat create_worktree with .ness.json setupCommand "npm install" and created demo-b with no approval card, so the approval path was not exercised.
E2Auto-approve settings in both builds show "Enable auto-approve" unchecked, so the reviewer was not auto-approving the create_worktree calls.
Model
Automated evidence review of |
…p command A bare 'Always allow' or session grant for create_worktree answered after the policy said ask, so it let PR checkouts, unopened repos and any later setup command through. Grants now never answer for create_worktree. For navigate_tab / create_browser_tab they still cover http(s) URLs, which is how someone lets an agent browse without a prompt per page, but never file:, data: or javascript:. The card hides the session and Always-allow buttons where they'd do nothing, and Settings marks existing create_worktree grants as doing nothing. The card now shows the repo setup command it's asking about (new setupCommand on the pending approval), so Allow approves a command the user has read. Setup lookups are memoised per request instead of relying on the policy's call order. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…run one PR-checkout and unopened-repo cards also run the repo's .ness.json setup command on Allow, but only showed it when the command was the sole reason to ask. Show it on every create_worktree card; remembering it is still limited to the sole-reason case. Documents the edit-while-open race in the policy header. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>




Why
Since #418, an agent's
create_worktreeasks whenever the target repo's.ness.jsonhas asetupCommand. A repo withnpm installthere prompts on every new worktree, which pushes people toward an "Always allow" grant forcreate_worktree. That grant would also let a latercurl … | shthrough. This was a non-blocking follow-up from the #420 review.The global setup command in Settings already doesn't prompt; #418 exempted it.
What changes
repoRoot → command. Latercreate_worktreecalls for that repo go through while its command is unchanged. If the command changes, the next one asks again.resolveApproval..ness.jsonis edited while the card is open, the new command isn't the one that gets approved.approvedSetupCommandsfield on thepermissionsslice, persisted toconfig.approvedSetupCommandsnext to the grants. On load, only absolute repo paths with non-empty string commands are kept.Also in this PR (from review)
setupCommandfield, and the card shows "Runs this repo's setup command:" followed by the command. Allow then approves a command you have actually read. The card doesn't say that Allow will be remembered; that wording is left for you to decide.nessGrantsMayAnswer:create_worktree: grants never answer, so a bare "Always allow" can no longer let PR checkouts, repos not open in Ness, or later setup commands through. Settings marks existingcreate_worktreegrants "checked by Ness", and the banner offers to remove them.navigate_tab/create_browser_tab: grants still cover http(s) URLs, so someone can still let an agent browse without a prompt on every page, but neverfile:,data:orjavascript:.Verification
npm run typecheck: passesnpx electron-vite build: passesnpx vitest run: all 2829 tests pass (after merging main).🤖 Generated with Claude Code