You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
mcpx: a write policy -- ask, allow, deny -- with the exact call shown when asking #1979
Relocated from dezren39/darwin-nix#340 on 2026-10-28 (placement audit): mcpx's single source lives in developing-today/code (pkgs/mcpx); re-home tracked at #309. Original body below; issue references inside it are historical (dezren39/nix numbering).
mcpx's daemon decides this, for every call it forwards upstream, whichever client made it: a gateway-side setting, per server and globally.
ask (default): confirm any call to a tool not marked read-only, through the caller's elicitation or mcpx's question queue, showing the exact tool and arguments. A caller that can answer neither gets a clear refusal.
allow: no confirmation; the caller's own approval is trusted.
deny: refuse tools not marked read-only, and every tool marked destructive.
Today elicit.confirmDestructive covers part of ask for tools annotated destructive (and, since #308, unannotated ones). This generalises it. Annotations are hints from the upstream, not proof (#257, annotation trust). Interacts with the autonomy dial and its ceiling (decision 0002).
A gateway-side write policy setting exists per server and globally, with ask as the default
ask: any call to a tool not marked read-only requires confirmation showing the exact tool and arguments (via the caller's elicitation or mcpx's question queue); a caller that can answer neither gets a clear refusal
allow: no confirmation; deny: tools not marked read-only are refused, and every destructive-marked tool is refused
The generalization subsumes today's elicit.confirmDestructive behavior without regressing it, and the interaction with the autonomy dial and its ceiling (decision 0002) is implemented and documented
From the user: confirmation should be selectable per tool or by pattern, not only all-or-nothing by annotation. For example, confirm execute_datadog_workflow and *_delete_* but let create_datadog_notebook through. Today mcpx has one switch, consumer.confirmDestructive (off by default), which applies to every tool annotated destructive or not marked read-only. Proposed: a list of rules -- server and tool glob -> ask / allow / deny -- evaluated in order, falling back to the annotation-based default. Also worth a per-server default.
Still live.elicit.confirmDestructive still covers only the destructive-annotation slice; the generalized policy does not exist yet.
Related:#346 (parent tracker), #355 (argument rules — the static, argument-level complement to this runtime policy), #257 (annotation trust: annotations are hints, which is why deny must not rest on them alone), decision 0002 (autonomy dial ceiling).
Risks: a gateway-wide ask default changes behavior for every client on upgrade — the cannot-answer refusal path is the sharp edge and is pinned in the acceptance criteria.
Suggested approach: implement behind the existing elicitation path first (extend confirmDestructive's plumbing to all non-read-only tools under ask), then add deny/allow as policy short-circuits.
Design architect (pass 12, 2026-10-29): this issue is Phase 1 of design #2126 (mcpx write policy — one gate for writes), adopted as a sub-issue of #2126; design doc: files/designs/code-mcpx-write-policy.md in the keep-the-four-repos-healthy goal workspace.
Phase 1 scope is this issue's own acceptance checklist. Design decisions that bind it (recorded on #2126 and in the doc): plumb args into resolveAndGuard (all three call paths hold args today; the guard is argument-blind); one evaluator in a new internal/policy package with the shared write classification (write iff readOnlyHint is not true — spec defaults, destructiveHint at internal/daemon/consumer.go:439-444 inverted); mode as settings-registry policy.write (daemon scope, ask default) with per-server writePolicy override; ask renders the exact call through the existing broker confirmation; elicit.confirmDestructive subsumed as a floor (destructive asks even under allow); policy documented as a consent gate, not the autonomy dial (decision 0002). Leave the chain's argument-rule and unknown-write-ledger steps as no-op hooks — they are Phases 2 (#1986) and 3 (#1977), gated on this phase.
Triage note: this issue already has a queued triage packet (relocation). Triage should NOT re-file or split this scope — the implementation issue is this one; verdict should point at #2126 and this phase structure.
Task: Phase 1 implemented — PR mcpx: write policy gate (policy.write ask/allow/deny) — #1979 Phase 1 #2829 opened (commit 8067e16): internal/policy evaluator in resolveAndGuard with args plumbed from all three call paths, policy.write (default ask) + per-server writePolicy, exact-call ask with cannot-answer refusal, confirmDestructive floor via the unchanged existing path, docs + tests
Expectation: parked 20m on CI — mcpx-docs build passed (1m39s); stress PR-changed-tests still pending after a 5-minute poll and the Codex review is still running with no findings posted yet. Resume: fresh checks + Codex disposition, merge if green per the standing directive, then complete the queue task
Codex findings undispositioned (merge gate, instruction §5): the Codex review of 8067e16f reports has_unresolved_findings: true. Each finding must be fixed in the PR or answered on its thread before any merge.
Stress job FAILED (run 41127192342, stress: PR changed tests): (a) failures that cite files this PR does not touch — TestNoPackageRedeclaresADefault (execsvc/hooks.go, progspec.go constants), TestEverySettingHasAnEffectProbeOrAnExemption (model.* / script.* settings), TestEveryDocumentHasAChapter (TESTING.md), stale docs/environment.md — these look pre-existing on current main and must be confirmed against main, not fixed in this PR; (b) TestACallInFlightAtTheHandoverIsAnsweredByTheOldDaemon failed with a race-detector dump in internal/daemon (origin.go:65 / server.go:463) — that package IS touched by this PR, so the resume must disposition it (re-run / compare against main) before merging.
Green so far: build: nix build .#mcpx-docs passed; internal/policy package tests passed inside the stress run.
Expectation: resume = disposition every Codex finding, prove (a) pre-existing and (b) PR-clean or fixed, merge under the standing directive when green, then complete task 3274. Issue labels stay queue/parked + status/parked + work/assigned.
Agent: queue worker (repo-worker-code), Lane D shift
Session / ID: queue task 3274 (resume)
All 4 Codex findings on PR mcpx: write policy gate (policy.write ask/allow/deny) — #1979 Phase 1 #2829 fixed in 749ccfd7, each answered on its thread: (P1) per-server override now read from the requested server's view (rebuilt on Reload), not the shared pool's creating config — new regression test TestWritePolicyViewOverrideBeatsPoolConfig; (P2) Classify discards partially decoded annotations on unmarshal error — new test with the finding's exact malformed input; (P2) initConsumer uses the daemon's already-resolved settings set (flags like --policy-write survive), falling back to source resolution only when no set exists; (P2) gate refreshes expired schema caches before classifying (new Pool.SchemaExpired()), failing closed on refresh error.
Stress failure (b) dispositioned — it was a real PR bug, now fixed:TestACallInFlightAtTheHandoverIsAnsweredByTheOldDaemon passed on the PR's base (a047d531) and on current main, failed at PR head. Root cause: the fake server's slow tool is unannotated → a write → default ask parked it on the broker (no answerer in that test), the takeover drain waited on it, and the successor hit its takeover deadline (EOF). Fix: the handover lifecycle test daemons now run with policy.write=allow in their test settings — they test handover mechanics with raw clients that cannot answer questions; the gate's behaviour is covered by write_policy_test.go. Stress failures (a) (files this PR does not touch) remain as Lane E recorded: pre-existing on main, not fixed here.
Laptop verification:go test ./internal/daemon/ ./internal/policy/ ./internal/pool/ all pass (daemon 54.8s). Parked for the fresh CI run + Codex re-review of 749ccfd7; resume = merge when green/clean, then complete the task.
🤖 Agent note (queue task 3274, Lane C): done — PR #2829 merged (squash bd48deb, head 749ccfd). Phase 1 delivered per #2126 design: internal/policy evaluator in resolveAndGuard with args plumbed from Call/CallReporting/CallAsk, policy.write (default ask) + per-server writePolicy, exact-call ask via broker, deny refusals, confirmDestructive floor under allow, autonomy-dial interaction documented. Verification: Codex review of head 749ccfd completed with no findings; mcpx-docs build PASS; policy/daemon package tests passed in the PR stress run. The stress job's 6 failures are pre-existing guard tests in internal/settings + internal/defaults citing files this PR does not touch (internal/execsvc/hooks.go, internal/progspec/progspec.go, TESTING.md compendium, routes_settings.go env read) — main's mcpx workflow is failing on the same class; not introduced here. Phase 2 (#1986) and Phase 3 (#1977) remain separate gated issues. Closing as implemented.
Activity
developing-today commentedon Oct 28, 2026
CODE-904
dezren39 commentedon Oct 28, 2026
History carried over from dezren39/darwin-nix#340 (verbatim, oldest first):
@dezren39 · 2026-10-02T09:57:05Z
From the user: confirmation should be selectable per tool or by pattern, not only all-or-nothing by annotation. For example, confirm
execute_datadog_workflowand*_delete_*but letcreate_datadog_notebookthrough. Today mcpx has one switch,consumer.confirmDestructive(off by default), which applies to every tool annotated destructive or not marked read-only. Proposed: a list of rules -- server and tool glob -> ask / allow / deny -- evaluated in order, falling back to the annotation-based default. Also worth a per-server default.@dezren39 · 2026-10-27T11:14:57Z
Intake review — fleet monitor (2026-10-27)
Still live.
elicit.confirmDestructivestill covers only the destructive-annotation slice; the generalized policy does not exist yet.Related: #346 (parent tracker), #355 (argument rules — the static, argument-level complement to this runtime policy), #257 (annotation trust: annotations are hints, which is why
denymust not rest on them alone), decision 0002 (autonomy dial ceiling).Risks: a gateway-wide
askdefault changes behavior for every client on upgrade — the cannot-answer refusal path is the sharp edge and is pinned in the acceptance criteria.Suggested approach: implement behind the existing elicitation path first (extend
confirmDestructive's plumbing to all non-read-only tools underask), then adddeny/allowas policy short-circuits.dezren39 commentedon Oct 29, 2026
Design architect (pass 12, 2026-10-29): this issue is Phase 1 of design #2126 (mcpx write policy — one gate for writes), adopted as a sub-issue of #2126; design doc:
files/designs/code-mcpx-write-policy.mdin the keep-the-four-repos-healthy goal workspace.Phase 1 scope is this issue's own acceptance checklist. Design decisions that bind it (recorded on #2126 and in the doc): plumb
argsintoresolveAndGuard(all three call paths hold args today; the guard is argument-blind); one evaluator in a newinternal/policypackage with the shared write classification (write iffreadOnlyHintis not true — spec defaults,destructiveHintatinternal/daemon/consumer.go:439-444inverted); mode as settings-registrypolicy.write(daemon scope,askdefault) with per-serverwritePolicyoverride;askrenders the exact call through the existing broker confirmation;elicit.confirmDestructivesubsumed as a floor (destructive asks even underallow); policy documented as a consent gate, not the autonomy dial (decision 0002). Leave the chain's argument-rule and unknown-write-ledger steps as no-op hooks — they are Phases 2 (#1986) and 3 (#1977), gated on this phase.Triage note: this issue already has a queued triage packet (relocation). Triage should NOT re-file or split this scope — the implementation issue is this one; verdict should point at #2126 and this phase structure.
28 remaining items
dezren39 commentedon Oct 30, 2026
🤖 Agent note · parked
dezren39 commentedon Oct 30, 2026
🤖 Agent note · parked
8067e16f). Lane D parked expecting CI pending + Codex running; both have now landed, and neither is clean, so this stays parked — with the blockers named precisely:8067e16freportshas_unresolved_findings: true. Each finding must be fixed in the PR or answered on its thread before any merge.stress: PR changed tests): (a) failures that cite files this PR does not touch —TestNoPackageRedeclaresADefault(execsvc/hooks.go, progspec.go constants),TestEverySettingHasAnEffectProbeOrAnExemption(model.* / script.* settings),TestEveryDocumentHasAChapter(TESTING.md), staledocs/environment.md— these look pre-existing on current main and must be confirmed against main, not fixed in this PR; (b)TestACallInFlightAtTheHandoverIsAnsweredByTheOldDaemonfailed with a race-detector dump ininternal/daemon(origin.go:65 / server.go:463) — that package IS touched by this PR, so the resume must disposition it (re-run / compare against main) before merging.build: nix build .#mcpx-docspassed;internal/policypackage tests passed inside the stress run.queue/parked+status/parked+work/assigned.queue/3274-1979-write-policy· failed run https://github.com/developing-today/code/actions/runs/41127192342fix(mcpx): write policy gate — view-resolved overrides, flag-resolved…
dezren39 commentedon Oct 30, 2026
🤖 Agent note · parked — Codex findings fixed, awaiting CI + Codex re-review
749ccfd7, each answered on its thread: (P1) per-server override now read from the requested server's view (rebuilt on Reload), not the shared pool's creating config — new regression testTestWritePolicyViewOverrideBeatsPoolConfig; (P2)Classifydiscards partially decoded annotations on unmarshal error — new test with the finding's exact malformed input; (P2)initConsumeruses the daemon's already-resolved settings set (flags like--policy-writesurvive), falling back to source resolution only when no set exists; (P2) gate refreshes expired schema caches before classifying (newPool.SchemaExpired()), failing closed on refresh error.TestACallInFlightAtTheHandoverIsAnsweredByTheOldDaemonpassed on the PR's base (a047d531) and on current main, failed at PR head. Root cause: the fake server'sslowtool is unannotated → a write → defaultaskparked it on the broker (no answerer in that test), the takeover drain waited on it, and the successor hit its takeover deadline (EOF). Fix: the handover lifecycle test daemons now run withpolicy.write=allowin their test settings — they test handover mechanics with raw clients that cannot answer questions; the gate's behaviour is covered bywrite_policy_test.go. Stress failures (a) (files this PR does not touch) remain as Lane E recorded: pre-existing on main, not fixed here.go test ./internal/daemon/ ./internal/policy/ ./internal/pool/all pass (daemon 54.8s). Parked for the fresh CI run + Codex re-review of749ccfd7; resume = merge when green/clean, then complete the task.mcpx: write policy gate (policy.write ask/allow/deny) — #1979 Phase 1 (…
dezren39 commentedon Oct 30, 2026
🤖 Agent note (queue task 3274, Lane C): done — PR #2829 merged (squash bd48deb, head 749ccfd). Phase 1 delivered per #2126 design: internal/policy evaluator in resolveAndGuard with args plumbed from Call/CallReporting/CallAsk, policy.write (default ask) + per-server writePolicy, exact-call ask via broker, deny refusals, confirmDestructive floor under allow, autonomy-dial interaction documented. Verification: Codex review of head 749ccfd completed with no findings; mcpx-docs build PASS; policy/daemon package tests passed in the PR stress run. The stress job's 6 failures are pre-existing guard tests in internal/settings + internal/defaults citing files this PR does not touch (internal/execsvc/hooks.go, internal/progspec/progspec.go, TESTING.md compendium, routes_settings.go env read) — main's mcpx workflow is failing on the same class; not introduced here. Phase 2 (#1986) and Phase 3 (#1977) remain separate gated issues. Closing as implemented.
mcpx: argument rules -- per-tool/per-argument JSON Schema call constr…
mcpx: argument rules — per-tool/per-argument JSON Schema call constra…