Node-based terminal manager for AI coding agents — tmux-backed terminals and parallel agent sessions as draggable nodes on an infinite pan/zoom canvas. macOS, Linux, and a browser Server Edition.
TypeScript adhdagent-orchestrationai-agentscanvasclaude-codecodexcoding-agentsdeveloper-toolselectrongeminilinuxmacosmultiplexeropencodeparallel-agentsterminalterminal-emulatorterminal-multiplexertmuxworkspace-manager
fix(canvas-control): every agent confirm offers "don't ask again for agents in <project>"
reviewbc734ed7d607
diff --git a/CLAUDE.md b/CLAUDE.mdindex ac446301f..240ad7014 100644--- a/CLAUDE.md+++ b/CLAUDE.md@@ -4205,11 +4205,17 @@ command-bearing opens; this does not add a human-confirm dialog or change mobilewith 14 ids the user cannot audit the list themselves. Capped at `CLOSE_BULK_MAX` (50) and thedialog spells out at most 12 names then counts the rest — a name the user cannot see is notconsent.- - **"Don't ask again" is bounded by SCOPE, not by permanence** (2026-09, revised). The checkbox- offers two reaches and defaults to the narrower: **"while nodeterm is running"** — the+ - **"Don't ask again" is bounded by SCOPE, not by permanence** (2026-09, revised 2026-10). The+ dialog offers three RADIOS, visible from the start (`waiveChoices`): **"ask me again next+ time"** (pre-selected, and not a waiver — an untouched dialog grants nothing), **"don't ask+ again for agents in <project name>"**, persisted in `settings.controlConfirmWaivers.projects` as+ `{ [projectId]: verbs }`, or **"don't ask again in any project until nodeterm quits"** — thetransient `state/controlConfirm.ts`, memory only (not `settings.json`, not `localStorage`), per- VERB, so quitting restores the gate — or **"always in <project name>"**, persisted in- `settings.controlConfirmWaivers.projects` as `{ [projectId]: verbs }`. The machine-WIDE+ VERB in every project, so quitting restores the gate. It used to be a checkbox whose two reaches+ appeared only once ticked, defaulting to the app-run one: the per-project answer was invisible+ until the user had already said yes, and the 2026-10 report read it as missing. The labels say+ what each reach covers because the two are different shapes — "until nodeterm quits" must not+ sit under a project name, since the app-run waiver has no project bound. The machine-WIDE`always` is still reachable only from Settings → Agents, where the option says "permanently":a dialog that appeared under the user's hands must not switch a destructive gate off*everywhere* on one stray click. The per-project scope is what makes the offer honest — an@@ -4247,11 +4253,20 @@ command-bearing opens; this does not add a human-confirm dialog or change mobilenobody chose it, and reading an unset setting as a deliberate choice is reading consent intosilence. The claude version gate is deliberately NOT applied here (it exists to degrade `auto`for an old CLI; a security decision must not hang on a `claude --version` probe).- - **`open-project` can never be waived**, by table (`CONFIRM_WAIVABLE_VERBS`) rather than by a- line somebody forgot at one of three call sites. It widens the app's blast radius (a new- directory registered as a project, plus a grant the caller feeds to `--project`) instead of- acting inside it, and it cannot produce the dialog storm the waiver exists to end —- `recordAttachConsent` already dedupes it per (caller, project).+ - **`settings` can never be waived**, by table (`CONFIRM_WAIVABLE_VERBS`) rather than by a line+ somebody forgot at a call site: a settings change can GRANT a capability, and a CLI that could+ waive its own consent would make the consent decorative.+ - **`open-project` IS waivable (2026-10)** — it was excluded on the claim that it "cannot produce+ the dialog storm — `recordAttachConsent` already dedupes it per (caller, project)". That+ dedupe is keyed on the caller's NODE id, in memory, for one app run: every new orchestrator,+ every station a team spawns and every restart asked again about the same two projects, with no+ box to stop it (the field report: "an orchestrator in another project opens a node, a dialog+ each time"). Waiving it changes only whether the human is asked — main still requires a+ verified, local caller, an absolute existing `--cwd` and the grant cap, still records the+ grant from the reply, and the registration still never focuses a tab. Its waiver is keyed on+ the CALLER's project like `write`/`close` (the open-project block resolves that project+ itself, under the same `ctlProject` name, because it runs before the dispatch computes one);+ the waived and confirmed legs register through ONE `opFinish(opAdopt)`.**An agent-requested dialog knows its own request's lifetime** (`ConfirmState.expiresAt` /`onExpire`, `CONTROL_REQUEST_TIMEOUT_MS` now shared with main). Main abandons a control requestafter 120 s and tells the renderer NOTHING, so the dialog stayed on screen asking about workdiff --git a/CONTRIBUTING.md b/CONTRIBUTING.mdindex c0ddf27e0..2f9ffd9c1 100644--- a/CONTRIBUTING.md+++ b/CONTRIBUTING.md@@ -328,10 +328,11 @@ anything else. Board-level fields survive every transform — `pullLinks` is onenever grants anything, a waived action still announces itself on screen and NAMES the waiver thatlet it through, and which gates may be waived at all is a TABLE, not an `if` at each call site —so "this one can never be waived" is a tested fact rather than a line somebody forgot to write.- **What a dialog may grant is bounded by SCOPE, not by permanence.** It offers "while nodeterm is- running" (in-memory — not `settings.json`, not `localStorage`, so quitting restores the gate) or- "always in this project" (machine-local, keyed by project id, pruned like- `settings.sidebarCollapsedItems`). The machine-WIDE waiver stays Settings-only, because that is+ **What a dialog may grant is bounded by SCOPE, not by permanence.** It offers, as radios visible+ from the start with "ask me again" selected, "don't ask again for agents in <project>"+ (machine-local, keyed by project id, pruned like `settings.sidebarCollapsedItems`) or "don't ask+ again in any project until nodeterm quits" (in-memory — not `settings.json`, not `localStorage`,+ so quitting restores the gate). Hiding a reach behind a checkbox made it read as missing. The machine-WIDE waiver stays Settings-only, because that isthe one a stray click in a dialog that appeared under the user's hands must not be able to grant.Offering only the app-run one was its own failure: it is not what a user who ticks "don't askagain" means, so the real choices were "be asked forever" or "turn it off everywhere". Two rulesdiff --git a/src/core/canvas-control-core.ts b/src/core/canvas-control-core.tsindex f64716978..5727a414a 100644--- a/src/core/canvas-control-core.ts+++ b/src/core/canvas-control-core.ts@@ -947,7 +947,8 @@ export function buildCanvasControlInstructions(shimPath: string): string {` cwd always returns the same project, never a duplicate. A \`--name\` over ${PROJECT_NAME_MAX} characters is`,' cut to that length when the project is created. Creating/adding asks the user to',' confirm (your first open of an already-registered project asks once too) and may be denied —',- ' a denial is final, do not retry it. Local only (refused from an SSH project), and it never',+ ' a denial is final, do not retry it. The user may have turned that dialog off for agents in',+ ' your project, in which case it simply applies. Local only (refused from an SSH project), and it never',' focuses the new project\'s tab. The returned id is what `--project` accepts.',' Server Edition is narrower: it can only re-open an exact local project already saved in its',' workspace (pass `--cwd` only); it never creates, adds, renames, recolors, or focuses one.',@@ -1533,7 +1534,8 @@ ${reportOutcomeDocLines().join('\n')}its real name). A \`--name\` over ${PROJECT_NAME_MAX} characters is cut to that length when theproject is created. Creating/adding asks the user to confirm (your first open of analready-registered project asks once too) and may be denied — a denial is final, do not retry- it. Local only (refused from an SSH project), and it never focuses the new project's tab: use+ it. The user may have turned that dialog off for agents in your project, in which case it simply+ applies. Local only (refused from an SSH project), and it never focuses the new project's tab: usethe returned id with \`--project\` to open sessions there.On Server Edition this is a restart-recovery operation only: pass \`--cwd\` for an exact localproject already saved in that Server workspace. It never creates, adds, renames, recolors, ordiff --git a/src/renderer/canvas/Canvas.tsx b/src/renderer/canvas/Canvas.tsxindex 750beb4f7..c66fce455 100644--- a/src/renderer/canvas/Canvas.tsx+++ b/src/renderer/canvas/Canvas.tsx@@ -811,8 +811,10 @@ import { useExpiringDialog } from '../lib/useExpiringDialog'import {confirmExpiresAt,isWaivableVerb,+ waiveChoices,waivedNotice,- CONTROL_REQUEST_TIMEOUT_MS+ CONTROL_REQUEST_TIMEOUT_MS,+ type ConfirmWaiveChoice} from '@shared/control-confirm'import { useControlConfirm } from '../state/controlConfirm'import { controlConfirmDecision, waiveControlConfirmForProject } from '../state/controlConfirmGate'@@ -2117,14 +2119,12 @@ export function Canvas() {confirmFlags.current.confirm = !!vsetConfirmState(v)}, [])- // "Don't ask again" on an agent-requested destructive confirm. Canvas state rather than a field- // on `ConfirmState` so the checkbox reads and writes LIVE (see `ConfirmState.waiveVerb`); reset- // by the dispatch every time it raises one of those dialogs, so a tick never carries over to the- // next request.- const [controlWaive, setControlWaive] = useState(false)- /** How far the tick above reaches. `session` is the DEFAULT and the pre-existing behaviour — a- * waiver a dialog grants must stay the bounded one unless the user says otherwise. */- const [controlWaiveScope, setControlWaiveScope] = useState<'session' | 'project'>('session')+ // "Don't ask again" on an agent-requested destructive confirm (@shared/control-confirm+ // `waiveChoices`). Canvas state rather than a field on `ConfirmState` so the radios read and+ // write LIVE (see `ConfirmState.waiveVerb`); reset to `ask` by the dispatch every time it raises+ // one of those dialogs, so a choice never carries over to the next request. `ask` is the DEFAULT+ // and is not a waiver: an untouched dialog grants nothing.+ const [controlWaiveChoice, setControlWaiveChoice] = useState<ConfirmWaiveChoice>('ask')/*** An agent-requested confirm collects itself when its REQUEST has expired.*@@ -13086,7 +13086,9 @@ export function Canvas() {// never reaches this process, so the dialog below can only ever show the resolved form// (P5). The renderer's job: validate the source live-or-stored, decide the consent branch// (planOpenProject — every grant passes a human decision exactly once, spec Q1), raise the- // dialog, apply the NON-ACTIVATING registerProject (P6 — no setActive/travel in any+ // dialog — unless the human already decided for every such call, through the same+ // "don't ask again" `write`/`close` honour (@shared/control-confirm) — apply the+ // NON-ACTIVATING registerProject (P6 — no setActive/travel in any// branch), and reply exactly once on confirm AND cancel (GC 12). The grant itself is// recorded MAIN-side when this reply lands ok && verified (recordOpenProjectGrant) —// nothing in this block authorizes anything.@@ -13111,6 +13113,16 @@ export function Canvas() {}const opTitle =oneLine((opLive?.data.title as string) ?? opStored?.title ?? '') || sourceNodeId+ // The CALLER's project — the same name and meaning as the dispatch's own `ctlProject`+ // further down, which this early block runs before. A node on the live canvas belongs to+ // the active project (React Flow holds only that one); any other caller is found in the+ // store. It is what this verb's "don't ask again" is keyed on, exactly as for `write` and+ // `close`: the trust being expressed is "the agents in that repo", and for a create/adopt+ // there is no target project yet to key on (@shared/control-confirm).+ const opStore = useProjects.getState()+ const ctlProject = opLive+ ? opStore.getProject(opStore.activeProjectId ?? '')+ : opStore.projects.find((p) => p.nodes.some((n) => n.id === sourceNodeId))// A project color is the ACTIVE TAB's TEXT color, so it takes the narrower system subset// (see isSystemNodeColor) — and it takes a subset at ALL because this flag reached// `registerProject` unvalidated: an agent-supplied string persisted into project.json and@@ -13125,8 +13137,9 @@ export function Canvas() {}// Apply one consent decision: register (create/adopt/idempotent hit) without activating,// persist, remember the (caller, project) pair for dialog dedupe — authorization stays- // main-side — and reply with the id the caller can feed `--project`.- const opFinish = (adoptProbed?: Project) => {+ // main-side — and reply with the id the caller can feed `--project`. Returns the reply's+ // sentence, so a WAIVED registration can announce exactly what it did.+ const opFinish = (adoptProbed?: Project): string => {const r = useProjects.getState().registerProject({resolvedCwd,name: args.name,@@ -13135,7 +13148,9 @@ export function Canvas() {})recordAttachConsent(sourceNodeId, r.project.id)void writeDisk()- reply({ ok: true, ...openProjectReply(r.project, r.created, r.adopted) })+ const done = openProjectReply(r.project, r.created, r.adopted)+ reply({ ok: true, ...done })+ return done.message}// The probe only matters when no project owns this cwd yet (adopt-vs-create copy) — an// idempotent hit must not pay a folder read.@@ -13157,27 +13172,44 @@ export function Canvas() {opFinish()return}+ // What an answer adopts, decided once so the waived path and the confirmed path register+ // the SAME thing.+ const opAdopt =+ opPlan.confirmKind === 'adopt' && opProbed ? { ...opProbed, closed: false } : undefined+ // Has the user said "don't ask again" for the agents in the caller's project (or for this+ // app run, or permanently in Settings)? The SAME shared decision `write`/`close` read. It+ // skips only the human — main has already gated the caller (verified, local, cwd, grant+ // cap) and still records the grant from this reply.+ const opWaiver = controlConfirmDecision(verb, ctlProject?.id)+ if (opWaiver.via) {+ // A waived registration still announces itself, naming the waiver that let it through.+ const opDone = opFinish(opAdopt)+ setNotice({+ kind: 'info',+ text: waivedNotice(`Agent "${opTitle}" ${opDone}`, opWaiver.via, ctlProject?.name)+ })+ return+ }// One confirm dialog at a time — the write/close rule, read off the shared set.if (isDestructiveVerb(verb) && confirmBusy()) {reply({ ok: false, error: 'a confirmation is already pending — try again' })return}+ setControlWaiveChoice('ask')setConfirm({message: opPlan.message,confirmLabel: opPlan.confirmLabel,requestedBy: opTitle,- // NO `waiveVerb`. `open-project` is outside `CONFIRM_WAIVABLE_VERBS` and must stay- // outside it: it widens the app's blast radius (a new directory registered as a project,- // plus a grant the caller then feeds to `--project`) rather than acting inside it, and it- // cannot produce the dialog storm the waiver exists to end — `recordAttachConsent`- // already dedupes it per (caller, project). The table refuses it too; this is the belt.+ // Waivable since the 2026-10 report — see `CONFIRM_WAIVABLE_VERBS` for why the old+ // "already deduped" reason did not hold (the dedupe is per caller NODE, per app run).+ waiveVerb: isWaivableVerb(verb) ? verb : undefined,+ waiveProjectId: ctlProject?.id,+ waiveProjectName: ctlProject?.name,expiresAt: confirmExpiresAt(Date.now()),onExpire: () => reply({ ok: false, error: 'expired before the user answered' }),onConfirm: () => {setConfirm(null)- opFinish(- opPlan.confirmKind === 'adopt' && opProbed ? { ...opProbed, closed: false } : undefined- )+ opFinish(opAdopt)},onCancel: () => reply({ ok: false, error: 'denied by user' })})@@ -15736,8 +15768,7 @@ export function Canvas() {return}// Destructive → confirm. Replies on confirm AND cancel.- setControlWaive(false)- setControlWaiveScope('session')+ setControlWaiveChoice('ask')setConfirm({message: `Agent "${srcTitle}" wants to send to ${args.node}:\n\n${args.text ?? ''}`,confirmLabel: 'Send',@@ -15845,8 +15876,7 @@ export function Canvas() {return}// Destructive → confirm. Replies on confirm AND cancel.- setControlWaive(false)- setControlWaiveScope('session')+ setControlWaiveChoice('ask')setConfirm({message: closeMessage,requestedBy: srcTitle,@@ -19544,46 +19574,38 @@ export function Canvas() {// The user did not open this one — an agent did. It appeared under their hands, so it is// answered by a click, never by a keystroke aimed somewhere else (components/confirm-key).enterConfirms={!confirm.requestedBy}- // "Don't ask again" — offered ONLY for a verb the shared table admits, and offered with- // a SCOPE, because the app-run-only waiver this used to grant is not what a user who- // ticks that box means: it lasts until they quit, and the only durable answer lived in- // Settings as a MACHINE-WIDE switch, so the realistic choices were "be asked forever" or- // "turn it off everywhere". The narrower durable grant is per project, which is the most- // a dialog that appeared under the user's hands may hand out — the machine-wide `always`- // stays Settings-only for exactly the reason it always did. Default stays `session`, so- // a user who ticks and clicks through gets the old, bounded behaviour.- // Built here rather than stored on `ConfirmState` because the checkbox is live state and+ // "Don't ask again" — offered ONLY for a verb the shared table admits, as three radios+ // that are visible from the start (@shared/control-confirm `waiveChoices`): ask next time+ // (selected, and not a waiver), never again for the agents in the CALLER's project+ // (durable and machine-local, through `waiveControlConfirmForProject`), or never again in+ // any project until nodeterm quits. It used to be a checkbox whose reaches appeared only+ // once ticked, defaulting to the app-run one — so the per-project answer read as+ // missing. The machine-wide `always` stays Settings-only: a dialog that appeared under+ // the user's hands must not switch a gate off everywhere, permanently, on one stray click.+ // Built here rather than stored on `ConfirmState` because the choice is live state and// that object is a snapshot.- option={+ choice={confirm.waiveVerb? {label: "Don't ask again",- checked: controlWaive,- onChange: setControlWaive,- scopes: [- { value: 'session', label: 'While nodeterm is running' },- {- value: 'project',- // The project NAME, not "this project": the call may well be acting on a- // canvas the user is not looking at, so "this" would point at the wrong one.- label: confirm.waiveProjectName- ? `Always in "${confirm.waiveProjectName}"`- : 'Always in this project'- }- ],- scope: controlWaiveScope,- onScopeChange: (v) => setControlWaiveScope(v === 'project' ? 'project' : 'session')+ options: waiveChoices({+ id: confirm.waiveProjectId,+ name: confirm.waiveProjectName+ }),+ value: controlWaiveChoice,+ onChange: (v) =>+ setControlWaiveChoice(v === 'project' || v === 'session' ? v : 'ask')}: undefined}onConfirm={() => {- // Granted on CONFIRM only. A denial must never widen anything, whatever is ticked.- if (confirm.waiveVerb && controlWaive) {+ // Granted on CONFIRM only. A denial must never widen anything, whatever is selected.+ if (confirm.waiveVerb && controlWaiveChoice !== 'ask') {// The per-project grant can FAIL (no project owns this call), and it must not fail- // silently into nothing: fall back to the app-run waiver the user would have got- // before, so a tick always buys what the box promised.+ // silently into nothing: fall back to the app-run waiver, so a choice always buys at+ // least the bounded thing it asked for.const scoped =- controlWaiveScope === 'project' &&+ controlWaiveChoice === 'project' &&waiveControlConfirmForProject(confirm.waiveVerb, confirm.waiveProjectId)if (!scoped) useControlConfirm.getState().waiveForSession(confirm.waiveVerb)}diff --git a/src/renderer/canvas/control-confirm-scope.source.test.ts b/src/renderer/canvas/control-confirm-scope.source.test.tsindex d56e3c911..fc1276f11 100644--- a/src/renderer/canvas/control-confirm-scope.source.test.ts+++ b/src/renderer/canvas/control-confirm-scope.source.test.ts@@ -1,9 +1,12 @@import { describe, it, expect } from 'vitest'import { readFileSync } from 'node:fs'+import { CONFIRM_WAIVABLE_VERBS } from '@shared/control-confirm'/**- * STRUCTURAL pins for the canvas-control confirm's "Don't ask again" SCOPE — the checkbox that now- * offers "while nodeterm is running" or "always in this project".+ * STRUCTURAL pins for the canvas-control confirm's "Don't ask again" SCOPE — three radios, visible+ * from the start: ask next time (selected, not a waiver), never again for the agents in the+ * caller's project, or never again in any project until nodeterm quits (@shared/control-confirm+ * `waiveChoices`, whose labels are tested there).** Source-level for the usual reason: the dialog is built inline in a 14,000-line component's render* and the grant happens in its `onConfirm`, neither of which has a unit seam. The BEHAVIOUR of both@@ -33,31 +36,40 @@ function dialogBody(): string {}describe('the "Don’t ask again" scope (source pins)', () => {- it('defaults to the app-run waiver — the pre-existing, bounded behaviour', () => {- // A dialog that appeared under the user's hands must not pre-select the durable grant. Ticking- // and clicking through has to buy exactly what it always bought.+ /** One per waivable verb: write, close and open-project each raise this dialog. Derived from the+ * table so a verb that joins it must bring every pin below with it. */+ const RAISERS = CONFIRM_WAIVABLE_VERBS.size++ it('defaults to "ask" — an untouched dialog grants nothing', () => {+ // A dialog that appeared under the user's hands must not pre-select any waiver. The per-project+ // choice is now VISIBLE from the start (it used to hide behind a checkbox, which read as+ // missing), so this default is the whole of the old guarantee.expect(src).toContain(- "const [controlWaiveScope, setControlWaiveScope] = useState<'session' | 'project'>('session')"+ "const [controlWaiveChoice, setControlWaiveChoice] = useState<ConfirmWaiveChoice>('ask')")})- it('resets BOTH the tick and the scope every time the dispatch raises one', () => {- // A scope carried over from the previous dialog would grant a durable, project-scoped waiver- // to a user who only meant to tick the box this time. Both destructive cases must reset both.- const resets = [...src.matchAll(/setControlWaive\(false\)\n\s*setControlWaiveScope\('session'\)/g)]- expect(resets.length, 'write and close both reset both').toBe(2)- // …and no case resets only one of the two.- const lone = [...src.matchAll(/setControlWaive\(false\)(?!\n\s*setControlWaiveScope)/g)]- expect(lone.length, 'every setControlWaive(false) is followed by a scope reset').toBe(0)+ it('resets the choice every time the dispatch raises one', () => {+ // A choice carried over from the previous dialog would grant a durable, project-scoped waiver+ // to a user who never picked it this time. Every raiser resets it immediately before raising.+ const resets = [...src.matchAll(/setControlWaiveChoice\('ask'\)\n\s*setConfirm\(\{/g)]+ expect(resets.length, 'every waivable verb resets before raising').toBe(RAISERS)+ // …and nothing else sets a non-default choice: only the dialog's own radios may.+ const sets = [...src.matchAll(/setControlWaiveChoice\(/g)]+ expect(sets.length, 'the resets plus the one radio onChange').toBe(RAISERS + 1)})- it('offers the project by NAME, not as "this project"', () => {+ it('offers the choices from the shared, tested list, with the project by NAME', () => {// Canvas control answers a background agent in its OWN project without moving the user's tab,// so "this project" would name whatever they happen to be looking at while the waiver landed- // somewhere else. The fallback wording is only for a call whose project could not be resolved.+ // somewhere else. `waiveChoices` names it (and drops the choice when there is none).const body = dialogBody()- expect(body).toContain('confirm.waiveProjectName')- expect(body).toMatch(/Always in "\$\{confirm\.waiveProjectName\}"/)+ expect(body).toContain('waiveChoices({')+ expect(body).toContain('id: confirm.waiveProjectId')+ expect(body).toContain('name: confirm.waiveProjectName')+ // Radios from the start (`choice`), not a checkbox whose reaches appear only once ticked.+ expect(src).toMatch(/choice=\{\s*confirm\.waiveVerb/)+ expect(src).not.toMatch(/option=\{\s*confirm\.waiveVerb/)})it('grants on CONFIRM only — a denial must never widen anything', () => {@@ -67,6 +79,8 @@ describe('the "Don’t ask again" scope (source pins)', () => {const onCancel = src.slice(end, src.indexOf('/>', end))expect(onConfirm).toContain('waiveControlConfirmForProject(confirm.waiveVerb, confirm.waiveProjectId)')expect(onConfirm).toContain('waiveForSession(confirm.waiveVerb)')+ // "ask" is not a waiver: the grant is gated on a choice other than it.+ expect(onConfirm).toContain("controlWaiveChoice !== 'ask'")// Nothing that grants anything may appear on the cancel path.expect(onCancel).not.toContain('waiveControlConfirmForProject')expect(onCancel).not.toContain('waiveForSession')@@ -82,14 +96,14 @@ describe('the "Don’t ask again" scope (source pins)', () => {)expect(onConfirm).not.toContain('activeProjectId')for (const field of ['waiveProjectId: ctlProject?.id', 'waiveProjectName: ctlProject?.name']) {- expect(countOf(src, field), field).toBe(2)+ expect(countOf(src, field), field).toBe(RAISERS)}})it('a failed durable grant falls back to the app-run waiver, never to nothing', () => {- // `waiveControlConfirmForProject` returns false when no project owns the call. Losing the tick- // there would silently give the user nothing for a box they ticked — and they would find out- // by being asked again on the very next call.+ // `waiveControlConfirmForProject` returns false when no project owns the call. Losing the+ // choice there would silently give the user nothing — and they would find out by being asked+ // again on the very next call.const onConfirm = src.slice(src.indexOf('onConfirm={() => {', src.indexOf('confirm.waiveVerb\n ? {')),src.indexOf('onCancel={() => {', src.indexOf('confirm.waiveVerb\n ? {'))@@ -97,20 +111,24 @@ describe('the "Don’t ask again" scope (source pins)', () => {expect(onConfirm).toMatch(/if \(!scoped\) useControlConfirm\.getState\(\)\.waiveForSession/)})- it('the gate is asked about the CALLER’s project, in both destructive cases', () => {+ it('the gate is asked about the CALLER’s project, in every waivable case', () => {// The per-project waiver AND the permission mode the bypass lock reads both belong to the- // project the call acts on. Off canvas that is not the active one.- expect(countOf(src, 'controlConfirmDecision(verb, ctlProject?.id)')).toBe(2)+ // project the call acts on. Off canvas that is not the active one — and `open-project` runs+ // before the dispatch's own `ctlProject`, so it resolves the caller's project itself under the+ // same name.+ expect(countOf(src, 'controlConfirmDecision(verb, ctlProject?.id)')).toBe(RAISERS)expect(src).not.toMatch(/controlConfirmDecision\(verb\)/)})- it('the waived NOTICE names the project, in both cases', () => {+ it('the waived NOTICE names the project, in every case', () => {// Losing the dialog must not mean losing the record, and "which waiver let this through" is// the part of the record that lets a user revoke the right one.- expect(countOf(src, 'waivedNotice(')).toBe(2)- expect(- countOf(src, 'ctlProject?.name\n )'),- 'both notices pass the project name'- ).toBe(2)+ const calls = src.split('waivedNotice(').slice(1)+ expect(calls.length).toBe(RAISERS)+ for (const call of calls) {+ // The project name is the call's LAST argument — read the call up to its own closing paren.+ const head = call.slice(0, 400)+ expect(head, 'every notice passes the project name').toMatch(/ctlProject\?\.name\s*\)/)+ }})})diff --git a/src/renderer/canvas/control-destructive.test.ts b/src/renderer/canvas/control-destructive.test.tsindex 2bd03f5a5..8947ec936 100644--- a/src/renderer/canvas/control-destructive.test.ts+++ b/src/renderer/canvas/control-destructive.test.ts@@ -146,16 +146,23 @@ describe('the confirm-gated set and the dispatch that reads it stay in agreement})}- it('open-project raises the SAME dialog but can never be waived', () => {- // It is outside CONFIRM_WAIVABLE_VERBS on purpose (it registers a new directory and records a- // grant), and it is already deduped per (caller, project), so it cannot produce the dialog- // storm the waiver exists to end. Both halves are asserted: no waiver, but still a deadline.- expect(isWaivableVerb('open-project')).toBe(false)+ it('open-project raises the SAME dialog, and its waived and confirmed legs register the SAME thing', () => {+ // It joined CONFIRM_WAIVABLE_VERBS in 2026-10: the old reason to keep it out ("already deduped+ // per (caller, project)") did not hold, because that dedupe is per caller NODE per app run.+ // The derived loop above already pins the decision, the notice and the waiver field; what is+ // specific to this verb is that a waiver must change WHETHER the human is asked and nothing+ // else — so both legs go through one `opFinish(opAdopt)`, never two hand-built registrations.+ expect(isWaivableVerb('open-project')).toBe(true)const body = dispatchBody('open-project')- // The FIELD, not the word: the block carries a comment explaining why it has no waiver, and- // that comment is the thing a future reader needs most.- expect(body).not.toMatch(/waiveVerb:/)- expect(body).not.toContain('controlConfirmDecision(')+ expect(body.split('opFinish(opAdopt)').length - 1, 'the waived leg and the confirm leg').toBe(2)+ // The decision runs AFTER the idempotent-hit shortcut (a silent repeat needs no waiver) and+ // BEFORE the one-dialog-at-a-time refusal (a waived call never needed a dialog slot).+ const silent = body.indexOf("opPlan.kind === 'silent'")+ const decide = body.indexOf('controlConfirmDecision(verb, ctlProject?.id)')+ const busy = body.indexOf('isDestructiveVerb(verb) && confirmBusy()')+ expect(silent).toBeGreaterThan(-1)+ expect(decide).toBeGreaterThan(silent)+ expect(busy).toBeGreaterThan(decide)expect(body).toContain('expiresAt: confirmExpiresAt(')})diff --git a/src/renderer/components/ConfirmDialog.tsx b/src/renderer/components/ConfirmDialog.tsxindex c129ba900..e284cafd7 100644--- a/src/renderer/components/ConfirmDialog.tsx+++ b/src/renderer/components/ConfirmDialog.tsx@@ -16,24 +16,16 @@ interface ConfirmDialogProps {* "Cancel / Delete" reads as though dismissing it will delete something. */alert?: boolean/** An explicit opt-in shown above the buttons (e.g. "Delete the worktree directory from disk- * too"). The caller owns the value, so it can also swap the confirm label / danger styling.- *- * `scopes` turns it into an opt-in plus a HOW FAR, rendered as radios that appear only once the- * box is ticked — the canvas-control "Don't ask again" needs to offer "this app run" or "always- * in this project" without asking the user to make that choice before they have said yes to the- * first one. Radios, not a second checkbox: the scopes are alternatives, and two checkboxes- * would let a user tick neither while the box above says they chose something. */+ * too"). The caller owns the value, so it can also swap the confirm label / danger styling. */option?: {label: stringchecked: booleanonChange: (checked: boolean) => void- scopes?: { value: string; label: string }[]- scope?: string- onScopeChange?: (scope: string) => void}/** A required pick among alternatives, shown from the start with `value` selected (e.g. the reason- * a GitHub issue is closed). Unlike `option`, there is no "off": the caller always gets a value,- * so it owns a sensible default. */+ * a GitHub issue is closed, or the canvas-control "don't ask again" reach). Unlike `option`,+ * there is no "off": the caller always gets a value, so it owns a sensible default — which, for+ * a waiver, is the choice that grants nothing. */choice?: {label: stringoptions: { value: string; label: string }[]@@ -154,34 +146,14 @@ export function ConfirmDialog({</div>)}{option && (- <>- <label className="confirm__option">- <input- type="checkbox"- checked={option.checked}- onChange={(e) => option.onChange(e.target.checked)}- />- {option.label}- </label>- {/* Only once they have said yes: an untouched dialog must read as "no waiver", and a- scope sitting there pre-selected reads as a decision the user has already made. */}- {option.checked && option.scopes?.length ? (- <div className="confirm__scopes" role="radiogroup" aria-label={option.label}>- {option.scopes.map((s) => (- <label key={s.value} className="confirm__scope">- <input- type="radio"- name={`${id}-option-scope`}- value={s.value}- checked={option.scope === s.value}- onChange={() => option.onScopeChange?.(s.value)}- />- {s.label}- </label>- ))}- </div>- ) : null}- </>+ <label className="confirm__option">+ <input+ type="checkbox"+ checked={option.checked}+ onChange={(e) => option.onChange(e.target.checked)}+ />+ {option.label}+ </label>)}<div className="confirm__actions">{/* The DESTRUCTIVE button never takes focus: autoFocus on it is what turned a stray Enterdiff --git a/src/renderer/components/settings/sections/AgentsSection.controlConfirm.test.tsx b/src/renderer/components/settings/sections/AgentsSection.controlConfirm.test.tsxindex 07c2843de..53582d01a 100644--- a/src/renderer/components/settings/sections/AgentsSection.controlConfirm.test.tsx+++ b/src/renderer/components/settings/sections/AgentsSection.controlConfirm.test.tsx@@ -48,6 +48,7 @@ function bypassSwitch(): HTMLElement {const CLOSE_LABEL = 'Ask before an agent closes nodes'const WRITE_LABEL = 'Ask before an agent types into a node'+const OPEN_PROJECT_LABEL = 'Ask before an agent opens or adds a project'async function render(): Promise<void> {host = document.createElement('div')@@ -79,9 +80,13 @@ describe('destructive canvas-control confirmations in Settings', () => {it('shows one row per waivable verb, derived from the shared table', () => {// Derived, not hand-listed: a verb that becomes waivable in code but invisible here would be a// loosening the user cannot see or revoke.- expect(CONFIRM_WAIVABLE_VERBS.size).toBe(2)+ expect(CONFIRM_WAIVABLE_VERBS.size).toBe(3)selectFor(WRITE_LABEL)selectFor(CLOSE_LABEL)+ // `open-project` joined the table (2026-10) — and must arrive with its own sentence, not the+ // honest-but-ugly fallback that only names the verb.+ selectFor(OPEN_PROJECT_LABEL)+ expect(host.textContent).not.toContain('Ask before an agent runs `open-project`')})it('defaults to Always ask with no setting stored', () => {@@ -110,7 +115,7 @@ describe('destructive canvas-control confirmations in Settings', () => {useSettings.setState((s) => ({settings: {...s.settings,- controlConfirmWaivers: { always: ['open-project', 'close', 'close'] } as never+ controlConfirmWaivers: { always: ['settings', 'close', 'close'] } as never}}))})diff --git a/src/renderer/components/settings/sections/AgentsSection.tsx b/src/renderer/components/settings/sections/AgentsSection.tsxindex 38f33a05c..14c609f8f 100644--- a/src/renderer/components/settings/sections/AgentsSection.tsx+++ b/src/renderer/components/settings/sections/AgentsSection.tsx@@ -285,6 +285,11 @@ const CONTROL_CONFIRM_VERB_COPY: Record<string, { label: string; description: stlabel: 'Ask before an agent closes nodes',description:'The `close` verb deletes nodes and ends their terminal sessions. Waiving the dialog lets any canvas-control agent do that without asking.'+ },+ 'open-project': {+ label: 'Ask before an agent opens or adds a project',+ description:+ 'The `open-project` verb lets an agent open sessions in another project you already have, or add a folder as a new project, so it can start work there. Waiving the dialog lets any canvas-control agent do that without asking.'}}@@ -644,7 +649,7 @@ export function AgentsSection({ isActive }: { isActive: boolean }): React.JSX.Elalways? undefined: sessionWaived- ? 'Waived until nodeterm quits (you ticked "Don\u2019t ask again"). Revoke restores the dialog now.'+ ? 'Waived until nodeterm quits, in every project (you chose that in an agent\u2019s dialog). Revoke restores the dialog now.': inProjects.length? `Waived permanently in ${inProjects.map((r) => `"${r.name}"`).join(', ')} \u2014 revoke below.`: undefined@@ -682,7 +687,7 @@ export function AgentsSection({ isActive }: { isActive: boolean }): React.JSX.El// per-project waiver is granted from a DIALOG, which is gone the moment it is// answered — so without this row the grant would be permanent, invisible, and// findable only by hand-editing settings.json.- description="You ticked \u201cDon\u2019t ask again\u201d and chose one project. These survive restarts, and apply only inside the project named. A project you delete takes its waivers with it."+ description="You chose \u201cDon\u2019t ask again for agents in \u2026\u201d in an agent\u2019s dialog. These survive restarts, and apply only to agents running in the project named. A project you delete takes its waivers with it."control={<div className="flex flex-col items-end gap-2">{projectWaiverRows.map((row) =>diff --git a/src/renderer/state/controlConfirm.test.ts b/src/renderer/state/controlConfirm.test.tsindex f4ecc0212..2784a3eaf 100644--- a/src/renderer/state/controlConfirm.test.ts+++ b/src/renderer/state/controlConfirm.test.ts@@ -22,8 +22,8 @@ describe('the app-run waiver store', () => {it('refuses a verb the shared table does not admit', () => {// The gate is applied here as well as in the decision: a caller cannot grant a waiver for- // `open-project` by passing the wrong string into the wrong function.- useControlConfirm.getState().waiveForSession('open-project')+ // `settings` by passing the wrong string into the wrong function.+ useControlConfirm.getState().waiveForSession('settings')useControlConfirm.getState().waiveForSession('list')expect(useControlConfirm.getState().sessionWaived).toEqual([])})diff --git a/src/renderer/state/controlConfirm.ts b/src/renderer/state/controlConfirm.tsindex fc99b45f0..de975f66f 100644--- a/src/renderer/state/controlConfirm.ts+++ b/src/renderer/state/controlConfirm.ts@@ -3,8 +3,10 @@ import { create } from 'zustand'import { isWaivableVerb } from '@shared/control-confirm'/**- * Canvas-control confirm waivers granted for THIS APP RUN — the "Don't ask again" checkbox in the- * destructive-verb dialog.+ * Canvas-control confirm waivers granted for THIS APP RUN — the "don't ask again in any project+ * until nodeterm quits" choice in the destructive-verb dialog (@shared/control-confirm+ * `waiveChoices`). Per VERB, in every project: there is no project in the key, which is why that+ * choice's label says "any project".** **In memory, and that is the feature, not a shortcut.** It is neither persisted here nor mirrored* into `settings.json` (`localStorage` included — a browser-origin store would outlive the processdiff --git a/src/renderer/state/controlConfirmGate.test.ts b/src/renderer/state/controlConfirmGate.test.tsindex 99a29c0a3..d35c1bb46 100644--- a/src/renderer/state/controlConfirmGate.test.ts+++ b/src/renderer/state/controlConfirmGate.test.ts@@ -117,10 +117,10 @@ describe('waiveControlConfirmForProject — the durable grant the dialog may mak})it('refuses a verb the shared table does not admit, and a missing project', () => {- // The table decides here as well as in the decision: a caller cannot grant `open-project` by+ // The table decides here as well as in the decision: a caller cannot grant `settings` by// passing the wrong string into the wrong function. Returning false matters — the dialog falls- // back to the app-run waiver on a false, so a silent no-op would lose the user's tick.- expect(waiveControlConfirmForProject('open-project', 'other')).toBe(false)+ // back to the app-run waiver on a false, so a silent no-op would lose the user's choice.+ expect(waiveControlConfirmForProject('settings', 'other')).toBe(false)expect(waiveControlConfirmForProject('close', undefined)).toBe(false)expect(useSettings.getState().settings.controlConfirmWaivers).toBeUndefined()})diff --git a/src/shared/control-confirm.test.ts b/src/shared/control-confirm.test.tsindex 5d6dd59df..415175240 100644--- a/src/shared/control-confirm.test.ts+++ b/src/shared/control-confirm.test.ts@@ -9,6 +9,7 @@ import {isWaivableVerb,pruneControlConfirmWaivers,sanitizeControlConfirmWaivers,+ waiveChoices,waivedNotice} from './control-confirm'import { DESTRUCTIVE_VERBS } from './control-verbs'@@ -19,18 +20,27 @@ describe('which verbs may be waived', () => {expect(CONFIRM_WAIVABLE_VERBS.size).toBeLessThan(DESTRUCTIVE_VERBS.size)})- it('never admits open-project, whatever the user asks for', () => {- expect(isWaivableVerb('open-project')).toBe(false)- // Every lever: the app-run set, the persisted list, and the bypass pair.+ it('never admits settings, whatever the user asks for', () => {+ // A settings change can GRANT a capability; a standing waiver covering it would let an agent+ // hand itself a power on an answer the human gave about something else.+ expect(isWaivableVerb('settings')).toBe(false)+ // Every lever: the app-run set, the persisted list, the per-project map, and the bypass pair.expect(- decideControlConfirm({ verb: 'open-project', sessionWaived: new Set(['open-project']) })+ decideControlConfirm({ verb: 'settings', sessionWaived: new Set(['settings']) })).toEqual({ skip: false, via: null })expect(- decideControlConfirm({ verb: 'open-project', persisted: { always: ['open-project'] } })+ decideControlConfirm({ verb: 'settings', persisted: { always: ['settings'] } })).toEqual({ skip: false, via: null })expect(decideControlConfirm({- verb: 'open-project',+ verb: 'settings',+ persisted: { projects: { p1: ['settings'] } },+ projectId: 'p1'+ })+ ).toEqual({ skip: false, via: null })+ expect(+ decideControlConfirm({+ verb: 'settings',persisted: { bypassMode: true },permissionMode: 'bypassPermissions',permissionModeSource: 'global'@@ -38,6 +48,39 @@ describe('which verbs may be waived', () => {).toEqual({ skip: false, via: null })})+ it('admits open-project — its dedupe is per caller NODE per app run, so it DID repeat', () => {+ // The 2026-10 report: an orchestrator in one project opening sessions in another got the+ // "Allow?" dialog again from every new orchestrator, every spawned station and every restart,+ // with no box to stop it. It now reads every lever exactly like write/close.+ expect(isWaivableVerb('open-project')).toBe(true)+ expect(+ decideControlConfirm({ verb: 'open-project', sessionWaived: new Set(['open-project']) })+ ).toEqual({ skip: true, via: 'session' })+ expect(+ decideControlConfirm({+ verb: 'open-project',+ persisted: { projects: { p1: ['open-project'] } },+ projectId: 'p1'+ })+ ).toEqual({ skip: true, via: 'project' })+ // Keyed on the CALLER's project: a grant for p1's agents says nothing about p2's.+ expect(+ decideControlConfirm({+ verb: 'open-project',+ persisted: { projects: { p1: ['open-project'] } },+ projectId: 'p2'+ }).skip+ ).toBe(false)+ // …and a waiver for `close` in p1 does not reach `open-project` in p1.+ expect(+ decideControlConfirm({+ verb: 'open-project',+ persisted: { projects: { p1: ['close'] } },+ projectId: 'p1'+ }).skip+ ).toBe(false)+ })+it('does not answer for a verb that has no dialog at all', () => {expect(isWaivableVerb('list')).toBe(false)expect(decideControlConfirm({ verb: 'list', sessionWaived: new Set(['list']) }).skip).toBe(false)@@ -73,7 +116,7 @@ describe('decideControlConfirm — the default is to ask', () => {// Reachable: settings.json is hand-editable and the sanitizer runs at read, but the decision// must not depend on somebody having called it.expect(- decideControlConfirm({ verb: 'open-project', persisted: { always: ['open-project'] } }).skip+ decideControlConfirm({ verb: 'settings', persisted: { always: ['settings'] } }).skip).toBe(false)})})@@ -140,8 +183,12 @@ describe('the bypassPermissions branch needs BOTH locks', () => {describe('sanitizeControlConfirmWaivers — settings.json is hostile input', () => {it('drops unwaivable and unknown verb names', () => {expect(- sanitizeControlConfirmWaivers({ always: ['close', 'open-project', 'rm -rf', 42] })+ sanitizeControlConfirmWaivers({ always: ['close', 'settings', 'rm -rf', 42] })).toEqual({ always: ['close'] })+ // A waivable verb survives — the table decides, not a list here.+ expect(sanitizeControlConfirmWaivers({ always: ['open-project'] })).toEqual({+ always: ['open-project']+ })})it('collapses duplicates and omits an empty list', () => {@@ -241,8 +288,8 @@ describe('the per-project waiver — a "don\'t ask again" that lasts, without goit('is outranked by the unwaivable table, like every other lever', () => {expect(decideControlConfirm({- verb: 'open-project',- persisted: { projects: { p1: ['open-project'] } },+ verb: 'settings',+ persisted: { projects: { p1: ['settings'] } },projectId: 'p1'})).toEqual({ skip: false, via: null })@@ -284,15 +331,15 @@ describe('sanitizeControlConfirmWaivers — the per-project map is hostile inputit('applies the verb table per project, exactly as it does to `always`', () => {expect(sanitizeControlConfirmWaivers({- projects: { p1: ['close', 'open-project', 'nonsense', 'close'] }+ projects: { p1: ['close', 'settings', 'nonsense', 'close', 'open-project'] }})- ).toEqual({ projects: { p1: ['close'] } })+ ).toEqual({ projects: { p1: ['close', 'open-project'] } })})it('drops an entry that would waive nothing, key and all', () => {// An entry waiving nothing is indistinguishable from no entry to every reader, and keeping it// would put a row in Settings offering to revoke a waiver that does not exist.- expect(sanitizeControlConfirmWaivers({ projects: { p1: [], p2: ['open-project'] } })).toEqual({})+ expect(sanitizeControlConfirmWaivers({ projects: { p1: [], p2: ['settings'] } })).toEqual({})})it('degrades a non-object `projects` to nothing rather than throwing', () => {@@ -355,3 +402,42 @@ describe('waivedNotice names the per-project waiver by project', () => {expect(waivedNotice('x', 'bypass')).toContain('Bypass')})})++describe('waiveChoices — what the dialog offers, and what each choice promises', () => {+ it('starts on "ask", which grants nothing — an untouched dialog must not waive anything', () => {+ const choices = waiveChoices({ id: 'p1', name: 'web-app' })+ expect(choices[0]).toEqual({ value: 'ask', label: expect.stringContaining('Ask') })+ })++ it('offers the per-project choice BY NAME, visible without ticking anything first', () => {+ // The report: the per-repo answer read as missing, because it only appeared after a checkbox.+ const choices = waiveChoices({ id: 'p1', name: 'web-app' })+ expect(choices.map((c) => c.value)).toEqual(['ask', 'project', 'session'])+ const project = choices.find((c) => c.value === 'project')!+ expect(project.label).toContain('"web-app"')+ // Names the AGENTS whose calls it covers — the key is the caller's project, not the target.+ expect(project.label).toContain('agents in')+ })++ it('says the app-run choice covers EVERY project — it is per verb, not per project', () => {+ // `state/controlConfirm.ts` keys the app-run waiver on the verb alone. A label implying a+ // project bound would promise something the grant does not keep.+ const session = waiveChoices({ id: 'p1', name: 'web-app' }).find((c) => c.value === 'session')!+ expect(session.label).toContain('any project')+ expect(session.label).toContain('until nodeterm quits')+ expect(session.label).not.toContain('web-app')+ })++ it('does not offer a per-project grant when no project owns the call', () => {+ // `waiveControlConfirmForProject` would refuse it; offering it would be a promise the grant+ // cannot keep.+ for (const project of [undefined, {}, { name: 'x' }, { id: '' }]) {+ expect(waiveChoices(project).map((c) => c.value)).toEqual(['ask', 'session'])+ }+ })++ it('never prints undefined when the name is missing', () => {+ const project = waiveChoices({ id: 'p1' }).find((c) => c.value === 'project')!+ expect(project.label).not.toContain('undefined')+ })+})diff --git a/src/shared/control-confirm.ts b/src/shared/control-confirm.tsindex 17fb109ee..a82221aa6 100644--- a/src/shared/control-confirm.ts+++ b/src/shared/control-confirm.ts@@ -50,17 +50,32 @@ export function confirmExpiresAt(receivedAt: number): number {* The destructive verbs whose confirm a user MAY waive — a deliberate subset of* `DESTRUCTIVE_VERBS`.*- * `open-project` is absent ON PURPOSE and must stay absent. It is the only one of the three that- * widens the app's blast radius rather than acting inside it: it registers a new directory as a- * project and records a grant the caller then feeds to `--project`. It also cannot produce the- * dialog storm this waiver exists to end — its consent is already deduped per (caller, project)- * by `recordAttachConsent`, so a repeat registration is silent anyway. A verb here must be one- * whose repetition is the problem; `open-project`'s repetition is already solved.+ * `settings` is absent ON PURPOSE and must stay absent: a settings change can GRANT a capability+ * (`agentMessaging`, @shared/settings-verb), and a standing "don't ask again" that covered it would+ * let an agent hand itself a power on the strength of an answer the human gave about something+ * else. A CLI that could waive its own consent would make the consent decorative.+ *+ * `open-project` WAS absent, on the claim that it "cannot produce the dialog storm this waiver+ * exists to end — its consent is already deduped per (caller, project) by `recordAttachConsent`".+ * Read what that dedupe is keyed on: the caller's NODE id, in memory, for one app run+ * (`lib/projectOpen.ts`). So every new orchestrator session asks again, every station a team+ * spawns that calls `open-project` asks again, and every restart asks again, about the same two+ * projects the user already said yes to — which is the field report (2026-10): an orchestrator in+ * one project opening sessions in another, a dialog each time, and no box to stop it. The dedupe+ * stays (it still silences an idempotent repeat by the same caller); it was never a reason to+ * withhold the box.+ *+ * Waiving it does not widen what the verb CAN do, only whether the human is asked. Everything that+ * bounds it is enforced before the renderer sees the request and is untouched: a verified caller,+ * local projects only, an absolute existing `--cwd`, the per-caller grant cap, and a registration+ * that never focuses a tab. Its waiver is keyed on the CALLER's project like `write`/`close` — the+ * trust being expressed is "the agents in that repo", and for a create/adopt there is no target+ * project yet to key on — and a waived registration still announces itself (`waivedNotice`).*/-export const CONFIRM_WAIVABLE_VERBS: ReadonlySet<string> = new Set(['write', 'close'])+export const CONFIRM_WAIVABLE_VERBS: ReadonlySet<string> = new Set(['write', 'close', 'open-project'])-/** May this verb's confirm be waived at all? Table-driven, so "open-project can never be waived"- * is a tested fact rather than a line somebody forgot to write at one of three call sites. */+/** May this verb's confirm be waived at all? Table-driven, so "settings can never be waived" is a+ * tested fact rather than a line somebody forgot to write at one of the call sites. */export function isWaivableVerb(verb: string): boolean {return CONFIRM_WAIVABLE_VERBS.has(verb)}@@ -129,6 +144,51 @@ export type PermissionModeSource = 'project' | 'global' | 'default'* user needs in order to revoke the right one. */export type ConfirmWaiverVia = 'session' | 'project' | 'always' | 'bypass'+/**+ * What the user picked under an agent-requested confirm: no waiver (`ask`), the durable+ * per-project one, or the app-run one.+ */+export type ConfirmWaiveChoice = 'ask' | 'project' | 'session'++/**+ * The "don't ask again" choices an agent-requested confirm offers, in display order — ONE+ * definition, because each label is a promise the grant in Canvas's `onConfirm` has to keep.+ *+ * Shown as radios from the start, with `ask` selected. It used to be a checkbox whose reaches+ * appeared only once it was ticked, defaulting to the app-run one — so the per-project answer+ * ("stop asking me about the agents in this repo") was invisible until the user had already said+ * yes to something else, which is how it read as missing (2026-10 report). Radios keep the old+ * guarantee that an untouched dialog grants nothing: `ask` is pre-selected and is not a waiver.+ *+ * The labels say exactly what each reach covers, because the two are not the same shape: the+ * project choice is keyed on the CALLER's project and survives restarts; the app-run choice is+ * per VERB in every project (`state/controlConfirm.ts`) and dies with the process. A label that+ * hung "until nodeterm quits" under "for agents in A" would promise a project bound the app-run+ * waiver does not have.+ *+ * The project is NAMED, never "this project": canvas control answers a background agent in its+ * own project without moving the user's tab (@shared/control-off-screen), so "this" would point at+ * whatever canvas the user happens to be looking at. With no project to name (the call's project+ * could not be resolved) the per-project choice is not offered at all — offering it would promise a+ * grant `waiveControlConfirmForProject` would then refuse.+ */+export function waiveChoices(project?: {+ id?: string+ name?: string+}): { value: ConfirmWaiveChoice; label: string }[] {+ const out: { value: ConfirmWaiveChoice; label: string }[] = [+ { value: 'ask', label: 'Ask me again next time' }+ ]+ if (project?.id) {+ out.push({+ value: 'project',+ label: `Don\u2019t ask again for agents in "${project.name || 'this project'}"`+ })+ }+ out.push({ value: 'session', label: 'Don\u2019t ask again in any project until nodeterm quits' })+ return out+}+export interface ControlConfirmDecision {/** True = apply the verb without a dialog. */skip: boolean@@ -146,7 +206,7 @@ const ASK: ControlConfirmDecision = { skip: false, via: null }* component.** Order is precedence, and it is fail-closed at every step: an unwaivable verb never skips (the- * `open-project` rule, applied before anything else is even read), a hand-edited `always` entry+ * `settings` rule, applied before anything else is even read), a hand-edited `always` entry* naming an unwaivable verb is ignored rather than honoured, and the bypass lock demands both keys.*/export function decideControlConfirm(input: {@@ -181,8 +241,8 @@ export function decideControlConfirm(input: {return { skip: true, via: 'project' }}// No second table check here: the `isWaivableVerb(verb)` gate above already refuses a- // hand-edited `always: ["open-project"]` before this line is reached (proven by the- // open-project test's `always` case, and by mutating that gate). A duplicate check would be+ // hand-edited `always: ["settings"]` before this line is reached (proven by the+ // settings test's `always` case, and by mutating that gate). A duplicate check would be// unreachable code claiming to be a safeguard — this repo has shipped that mistake, and a// safeguard no test can turn red is a comment, not a mechanism.if (persisted?.always?.includes(verb)) return { skip: true, via: 'always' }@@ -217,7 +277,7 @@ export function sanitizeControlConfirmWaivers(raw: unknown): ControlConfirmWaiveconst out: ControlConfirmWaivers = {}if (always.length) out.always = always// Per-project entries get the SAME treatment as `always` — the verb table decides, so a- // hand-edited `{"p1":["open-project"]}` is dropped rather than honoured — plus a key check the+ // hand-edited `{"p1":["settings"]}` is dropped rather than honoured — plus a key check the// flat list does not need. An empty verb list is dropped with its key: an entry that waives// nothing is indistinguishable from no entry to every reader, and keeping it would leave a row// in Settings offering to revoke a waiver that does not exist.