Repository navigation
docs: plan contextual investigative guardrails - #1455
Conversation
jhrozek
left a comment
There was a problem hiding this comment.
Design review of the plan (docs-only PR, no code). Overall thorough and well-grounded, but flagging two load-bearing ambiguities that should be resolved in the plan text before this Split gate merges, plus two AC-quality issues and one hidden risk in the HMAC digest design. See inline comments.
|
Addressed all five review threads in the plan and replied inline. The implementation worktree also now has regression-tested corrections for concurrent pre-action review, completed-unresolved classification, and purpose-separated grant MACs; inbound release integration is still in progress, so these are not a claim that the implementation PR is complete. One mechanical follow-up: main assigned ADR 0334 to the ToolHive provider decision while this plan was open. Renumbered this plan's ADR to 0342 in 4d130ba and updated the named acceptance proofs accordingly; the design and review resolutions are unchanged. The plan now has 32 ACs, with report inspection distinct from executable proofs. Plan documentation checks and the renamed focused implementation tests pass. |
jhrozek
left a comment
There was a problem hiding this comment.
Re-reviewed after the 3 commits pushed since my last pass (5131f356e, beaa5fcdf, 4d130baf2). All 5 findings from the initial review are genuinely fixed, not just reworded:
- Dispatch-batch/action-gate concurrency — the new "Pre-action read-batch assessment and execution" section spells out the shape: assessments run concurrently into private records, no speculative execution, dispatcher drains decisions/asks in original order with at most one live ask, then dispatches approved reads concurrently. Explicitly no serial-LLM regression for WebSearch/WebFetch/Subagent/Parallel. New AC1.5 pins it.
unresolvedassessment disposition — the new "Completed-review disposition matrix" adds explicit rows forunresolvedunder bothactionandinboundjobs, per enforcing/advisory mode.- AC bundling code-testable + report-only claims — AC6.4 narrowed to the code-testable capacity/exhaustion claim; the report/rationale requirement split into a new inspection-only AC6.5 with no
verify:test attached. - AC spanning 5 heterogeneous artifact categories — moved to Definition of Done item 3 with an explicit "no single code test is treated as proof of prose/generated-artifact freshness/UI semantics" disclaimer; AC7.4 narrowed to the protobuf/mapper/stream-projection fields only.
- HMAC key reuse / domain separation — grant digest preimage now has a mandatory purpose-tag prefix (
mecatl/guardrail-grant/v1+ NUL byte) regardless of key choice, plus a newTestADR_0342_..._GrantDomainSeparationtest.
Resolving all 5 threads. Approving.
Integrate Plan PR #1455 head 4d130ba into the stacked implementation checkpoint. Co-Authored-By: mecatl <[email protected]>
bfaa5b7 to
4831b2a
Compare
aponcedeleonch
left a comment
There was a problem hiding this comment.
Two observations from reading through, neither blocking.
|
|
||
| Retain the existing `guardrails.rules[].prompt` field, but deliberately change it from full rubric replacement to additive operator policy. The reviewer prompt always starts with a fixed harness-owned rubric containing the authority/provenance model, source-aware false-positive requirements, distinct action/inbound protocol, evidence-handle rules, structured-output contract, and operational-failure behavior. A non-empty rule `prompt` is fenced and appended beneath that rubric as operator policy for task-specific risk classification within the caller's existing permissions; it cannot replace, weaken, or conceal the fixed security/protocol contract. No legacy full-override mode is retained. | ||
|
|
||
| Guardrails remain off unless the existing `--guardrails-model` or `models.slots.guardrail` enable path selects a model, and the existing kill switch still wins. Route precedence is: kill switch; an explicit `guardrail` slot; the current `cheap` tier fallback used by that slot; then the legacy gate model. Thus either existing slot path continues to supersede `--guardrails-model`/`guardrails.model`. The checker provider/model pair is resolved once at Build and captured by every main, per-session, and worker checker factory; changing a session's provider/model never changes that pair. |
There was a problem hiding this comment.
Side observation, not a blocker on this plan. Happy to move it to its own issue. I hit it while reading through and it seemed worth raising where the context already is.
The two-knob setup is hard to discover. --posture auto for the rule layer, guardrails.model in user-global settings.yaml for the checker. I went looking for an auto mode, found only default and accept-edits in the TUI, and didn't find posture at all until someone pointed me at --help. The combination that delivers the intended behaviour is the one an operator is least likely to stumble into, and --posture yolo looks like the obvious pick while actually demoting the checker to advisory.
Three directions, roughly in order of how much I believe in them.
One, collapse both into a single --posture with strict/auto/yolo. This was my first instinct and I don't think it survives contact with the code. A posture token can't name a checker model, it inverts the configure-to-enable convention from ADR 0046 and 0042, and a flag that silently starts spending per call is its own objection.
Two, go the other way and drop --posture entirely, YAML only. Default strict, and configuring guardrails is what moves you to auto. That fits the configure-to-enable convention instead of fighting it, and it's mostly a deletion rather than new machinery: posture: already exists as an operator-tier settings.yaml key, the CLI flag just out-ranks it. Two caveats worth weighing. It welds "I want a checker" to "I want allow-all", so anyone who wants both gates at strict loses that. And removing a flag breaks existing invocations, including mecak8s, which defaults to --posture auto today.
Three, leave the surface alone and just make the current state legible:
--posture autowith no checker configured prints a startup line saying nothing is supervising the session./posturereports guardrail state next to the tier.
I see #1510 adds /guardrails for coverage and checker health, which is good. It only registers once guardrails are wired though, so it helps people who already set it up rather than people trying to find it.
|
|
||
| Action and inbound review are separate jobs and separate prompts. Action review runs after one trusted inner mutation and deterministic permission/plan/system-scope re-evaluation of changed effective args. An unchanged call does not receive a redundant permission ask. Deny, configured Ask, plan mode, and Shell system-scope decisions always bind. Approval executes the byte-identical reviewed call without rerunning mutation. | ||
|
|
||
| Authority comes from harness provenance: current genuine user task, genuinely admitted project instructions, actual positive plan/approval callbacks, caller capabilities, exact environment, and current delegation-root trajectory. Text remains untrusted. No filename, repository, or domain is intrinsically trusted. The reviewer must find affirmative attempted authority crossing or redirection; imperative language, ordinary GitHub issue instructions, admitted `AGENTS.md`/`CLAUDE.md` project instructions, assistant-directed prose, or quoted security examples alone are not findings. Missing evidence does not itself increase intrinsic risk. The action-risk rubric is not reused wholesale for inbound content. |
There was a problem hiding this comment.
This is the line I got stuck on. What counts as the current genuine user task isn't defined anywhere in the plan, and the field it feeds is a list, so it could reasonably be the last prompt, the last few, or something the harness composes.
#1510 answers it as exactly one message. actionreview.go:150 emits a single genuine_user_task fact from r.currentPrompt.Text, set in recordPrompt from the prompt just recorded. Synthetic continuations never touch it, which is right.
So it's K=1, and I think that's a real design decision rather than an implementation detail. Worth stating here. If I say "deploy to staging" and then "check the logs first", only the second reaches the reviewer, and whatever authorization the first carried is invisible to it.
Suggestion: make K configurable and clamp it to [1, 3]. One keeps today's behaviour as the default, three is enough to catch an authorization a turn or two back without turning the fact list into a transcript. The clamp is the point, so it can't grow into a window that reintroduces the mixed-provenance problem this design avoids.
Two related things I noticed while checking:
establishPrincipalreturns early if already set, so the facts freeze at the first review of a root run. A later prompt in the same run doesn't update them. Is that intended, given a run can span several prompts?- The plan lists "actual positive plan/approval callbacks" as principal facts, but feat: integrate contextual guardrails into execution and approvals #1510 only emits
genuine_user_task,admitted_*_instruction,target_dependency_version, andrepeat_dependency_incomplete. An approved plan doesn't reach the reviewer as authority.
Separately, the provenance gating on instruction fragments reads right to me. PositiveVerdict only for project and rules, so soul and memory go in as context but not authority.
a9a07f7 to
0b917bd
Compare
0b917bd to
b15cb4b
Compare
fce19d8 to
0b10d21
Compare
Co-Authored-By: mecatl <[email protected]>
0b10d21 to
3e5207f
Compare
Collapse the operator posture ladder and the per-session permission mode into one ordered vocabulary, plan < default < accept-edits < trusted < auto < yolo, bound at two scopes: an operator ceiling set at boot and a session tier clamped to it. Add two boot refusals so a deployment whose ceiling promises supervision or project trust it does not actually have fails to start with an error naming the fix. ADR 0351 supersedes the "no new PermissionMode" clause of ADR 0022 only. Its decisions 2, 3 and 4 (subordinate to the governance invariants, no hardcoded circuit breaker, loud root/sandbox-gated opt-in) carry over verbatim as binding constraints: no tier bypasses governance.Evaluate, so deny-dominance and the configured-Ask floor hold at every tier including yolo. Plan / Interface stage only. No implementation. Relates to #1455 (comment) Co-Authored-By: Claude Opus 5 (1M context) <[email protected]>
Stage: Plan / Interface
Proposed contract, not an implementation PR. This is Architectural / Split work under
docs/development-process.md. The user completed the product decision walkthrough. All product decisions are resolved; implementation measurements are deliverables, not prerequisites for plan approval. The merged-plan gate has not been waived.Approved direction
models.slots.guardrail; propose the smallest shared-slot extension for an independent, Build-stable provider/model route rather than session-provider inheritance.Implementation measurements and release validation
The plan has 30 acceptance criteria and no unresolved human product decisions. The previous circular gate—requiring measurements from code before implementation could begin—has been removed.
Wider cloud-native work (replica coordination, restart-complete reviewer state, cross-process held-result recovery) stays deferred; only the narrow approval-provenance repair is included.
Verification and review
task docs: passed via dev toolbox and SDK-pinned pnpm 11.25.0; strict links passed.git diff --check: passed.Worktree:
.scratch/worktrees/plan-contextual-guardrails-20260914Branch:
plan/contextual-guardrails-20260914