Repository navigation
feat: task-scoped guard profiles (command/agent) and guard lock - #51
Conversation
Per-agent trace-check exemptions from the global config file only (FR-072..FR-074) and a global guard lock (FR-075). Co-Authored-By: Claude Opus 5.5 <[email protected]>
FR-072: record each session's agent from the latest user message. FR-073: agentOverrides honored only from the global config file; project file and plugin options lose the key with a warning; bad entries drop individually without rejecting the global file. FR-074: traceCheck.exemptTools tool-name globs skip the file-path trace check for that agent only; entries matching a file-mutating builtin are rejected; reward-hacking, directives, and gates still apply. FR-075: global lockGuards strips guard-disabling false values from the project file and plugin options; env and global stay authoritative. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jflowers
left a comment
There was a problem hiding this comment.
Council Verdict: APPROVE WITH ADVISORIES
Reviewers: divisor-adversary, divisor-architect, divisor-curator, divisor-guard, divisor-sre
Iterations: 2
Input: origin/main@5c9c50a...opsx/agent-guard-overrides@7d9e089e plus uncommitted working-tree fixes from iteration 1 — this verdict covers the working tree, not the pushed head. The pushed head still carries the two HIGH findings fixed in iteration 1; commit and push before merging.
Council approved with advisories — no unresolved HIGH/CRITICAL findings; one MEDIUM advisory remains (below).
Dispatch Provenance
| Run | Agent | Source | Requested | Resolved parent | Reported |
|---|---|---|---|---|---|
| 9882f6be | divisor-adversary | advisor | enmaas/rits/zai-org/glm-5-3 | — | enmaas/rits/zai-org/glm-5-3 |
| 98610cc1 | divisor-architect | advisor | enmaas/rits/zai-org/glm-5-3 | — | enmaas/rits/zai-org/glm-5-3 |
| a33edbd4 | divisor-curator | advisor | enmaas/rits/zai-org/glm-5-3 | — | enmaas/rits/zai-org/glm-5-3 |
| 19ae5ff5 | divisor-guard | advisor | enmaas/rits/zai-org/glm-5-3 | — | enmaas/rits/zai-org/glm-5-3 |
| 83203602 | divisor-sre | advisor | enmaas/rits/zai-org/glm-5-3 | — | enmaas/rits/zai-org/glm-5-3 |
Iteration 1 — REQUEST CHANGES (resolved in the working tree)
19 findings (2 HIGH, 7 MEDIUM, 10 LOW); 15 fixed, 3 left as advisories. Key fixes: the guard lock now also strips mode: "repair-only" from project config and plugin options; applied exemptions log once per agent+tool per session; protected-state, approve-gate, and enforce-directive survival of an exempt call is pinned by tests; __proto__-keyed entries warn-drop; exempt-tool globs carry complexity caps; test:node includes the new test file; the delta spec gained a Purpose section and a Principle V assessment; website capabilities issue unbound-force/website#412 and blog issue #52 are filed and pinned.
divisor-sre (APPROVE WITH ADVISORIES)
- [MEDIUM] config-management — index.ts:1502: the guard lock fails open when the global config file has any malformed sibling key.
validateSupervisorConfigrejects the whole file and returns an empty config, solockGuards: truenext to a typo'dmemoLimits(or a trailing comma) silently drops the lock and the agent overrides, after which a committed project config can disable the guards and setmode: "repair-only". The warning says only "file ignored" and never states the lock is inactive. Resolving the lock key independently of whole-file validation, or naming the inactive lock in the warning, closes the gap. - 1 LOW finding omitted.
divisor-adversary (APPROVE WITH ADVISORIES)
- 1 LOW finding omitted.
divisor-architect (APPROVE WITH ADVISORIES)
- 4 LOW findings omitted (one shared with divisor-guard).
divisor-curator (APPROVE WITH ADVISORIES)
- 1 LOW finding omitted.
divisor-guard (APPROVE WITH ADVISORIES)
- 1 LOW finding omitted.
Full finding text for the omitted LOWs is in the local terminal report and the dispatch artifact.
Linked Issues
| Issue | Title |
|---|---|
| #48 | feat: per-agent guard overrides (global-config only, narrowing only) and guard lock |
| #47 | feat: configurable trace-check exemptions for knowledge-store MCP tools |
This review was generated by /uf.review-council (AI-assisted).
Fixes from the /uf.review-council run in OpenCode (committed as left): - lockGuards also drops a lower-tier mode: "repair-only", so a project config cannot unregister the guards under the lock - applied trace-check exemptions log once per agent+tool per session - exemptTools globs bounded (512 chars, 32 wildcards); "__proto__" agent key dropped - spec: protected-state check (FR-061) still applies to exempt calls; Purpose section; constitution V assessment - test:node script includes test/agent-overrides.test.ts; docs follow Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replace per-agent agentOverrides with global profiles matched on slash command and/or agent, inherited by subagent sessions through parentID (FR-072..FR-074, design D1/D2/D4/D7). gh-hud dispatches every unattended task as the autonomy agent, so the command is the only in-session signal that identifies the task. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Replace per-agent agentOverrides with global `profiles` matched on the session's slash command and/or agent, inherited by subagent sessions (FR-072..FR-074). gh-hud dispatches every unattended task as the autonomy agent, so the command is what identifies the task. - command.execute.before records the session's latest slash command (sticky until another command runs) - session.created/updated events record parentID; an unknown parent is looked up once via session.get (2 s bound, cached; failure = root) - profiles apply when they match the session or an ancestor (8 levels); grants union; review-round guarantees kept (builtin rejection, glob bounds, protected state, gates, lock incl. repair-only mode) - src/agent-overrides.ts -> src/guard-profiles.ts (+ test rename) Co-Authored-By: Claude Opus 5.5 <[email protected]>
- lockGuards fails closed: a global file rejected for another key (or malformed JSON) still keeps lockGuards: true - the lock also ignores guard-disabling environment variables, which per-directory env tools (mise.toml [env], .envrc) let a repo set; XDG_CONFIG_HOME cannot point around a lock in the home-directory file (home from the OS account, not HOME) - a slash command scopes one task: cleared by the first human-typed message after the session goes idle; plugin-injected messages during the task keep it - failed parent lookups are retried after a 30 s backoff instead of being cached as a root session - lineage resolves only when some profile could exempt the tool; exempt-tool globs compile once - the exemption notice logs only when the exemption decided the call - wildcard exempt globs must start with an MCP server prefix - command.execute.before no longer sits under dispose's JSDoc Tests for each fix on Bun and Node, each confirmed by a mutation check. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…ll automation Apply 21 findings (6 HIGH + 15 LOW/MEDIUM) from iteration 1: - spec.md: harden supervisor-prerequisite to fail-closed (no tightest-achievable fallback, unattended mode disabled until jflowers/opencode-supervisor#51 ships, records no-op artifact + notice) - contracts/scope.md: bound distill-policy.yaml (16 KiB, depth 3, 100 entries), deny overly-broad ["*"], define durable no-op artifact path and provenance persistence - contracts/rolling-pr.md: define branch sanitization charset/length/collision (FR-011), sanitization gate for critical/high findings, human-commit preservation guard (FR-015), concurrency CAS via force-with-lease - contracts/distiller-allowlist.md: enumerate execution surface (filesystem/git/GitHub/MCP registration), deny push --force and non-distill writes, clarify global-only widening remains fail-closed Fulfills manual-apply directive from iteration 1 human decisions (all APPLY). Co-Authored-By: internal-model
… (T036-T039) Phase 7 / US5: the unattended pipeline's three server-side stages (scope, group_learners, rolling_pr) registered as MCP tools (tools/distill_tools.go) so the distiller agent drives the pipeline entirely through the guarded server surface; new dewey gate distill-unattended startup gate (gate.go) enforces the FR-016 global-only widening rule — only the global opencode-supervisor command: dewey-distill-auto profile may widen, repo-local .opencode/supervisor.yaml is never read, refusal is fail-closed until jflowers/opencode-supervisor#51 ships and records the FR-021 no-op artifact; distiller frontmatter gains the distill-unattended bash allow and both gate copies (tracked file + agents.go mirror) stay byte-identical, guarded by shape and parity tests in cli_test.go; interactive /dewey-distill verified unchanged (T038). Handler-level tests cover the MCP surface including the no-op artifact recording; CRAPload 48/48, GazeCRAPload 41/45.
…ll automation Apply 21 findings (6 HIGH + 15 LOW/MEDIUM) from iteration 1: - spec.md: harden supervisor-prerequisite to fail-closed (no tightest-achievable fallback, unattended mode disabled until jflowers/opencode-supervisor#51 ships, records no-op artifact + notice) - contracts/scope.md: bound distill-policy.yaml (16 KiB, depth 3, 100 entries), deny overly-broad ["*"], define durable no-op artifact path and provenance persistence - contracts/rolling-pr.md: define branch sanitization charset/length/collision (FR-011), sanitization gate for critical/high findings, human-commit preservation guard (FR-015), concurrency CAS via force-with-lease - contracts/distiller-allowlist.md: enumerate execution surface (filesystem/git/GitHub/MCP registration), deny push --force and non-distill writes, clarify global-only widening remains fail-closed Fulfills manual-apply directive from iteration 1 human decisions (all APPLY). Co-Authored-By: internal-model
… (T036-T039) Phase 7 / US5: the unattended pipeline's three server-side stages (scope, group_learners, rolling_pr) registered as MCP tools (tools/distill_tools.go) so the distiller agent drives the pipeline entirely through the guarded server surface; new dewey gate distill-unattended startup gate (gate.go) enforces the FR-016 global-only widening rule — only the global opencode-supervisor command: dewey-distill-auto profile may widen, repo-local .opencode/supervisor.yaml is never read, refusal is fail-closed until jflowers/opencode-supervisor#51 ships and records the FR-021 no-op artifact; distiller frontmatter gains the distill-unattended bash allow and both gate copies (tracked file + agents.go mirror) stay byte-identical, guarded by shape and parity tests in cli_test.go; interactive /dewey-distill verified unchanged (T038). Handler-level tests cover the MCP surface including the no-op artifact recording; CRAPload 48/48, GazeCRAPload 41/45.
…issue notice `dewey gate distill-unattended` probed ~/.config/opencode-supervisor/supervisor.yaml for a YAML `commands.dewey-distill-auto` key — a placeholder written before jflowers/opencode-supervisor#51 shipped. The supervisor (v2.9.1) reads profiles only from opencode/supervisor/config.json under an absolute XDG_CONFIG_HOME, else under $HOME/.config, as strict JSON with a `profiles` array, so the gate refused on every machine. The gate now checks exactly that one file and passes iff a profile's `match.command` (trimmed, leading "/" stripped) is dewey-distill-auto. Absent file or no matching profile refuses as supervisor-unavailable; unreadable, invalid JSON or a non-array `profiles` refuses naming the file. The Fix shows the profile to add. Refusals still record the no-op artifact; the `Notice:` line is gone. `/dewey-distill-auto` and the `distiller` agent drop the `#N` issue argument and the issue-comment step (a stray argument is ignored), and `gh issue comment` leaves the distiller's bash allowlist. Tracked scaffold copies are regenerated with fresh markers so untouched copies refresh on re-init. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Closes #48. Closes #47. Part of unbound-force/dewey#153.
Summary
Guard settings were all-or-nothing per project, and project config outranks global config. The curation workaround, a committed
requireStepReferenceInTools: false, turned the trace check off for every agent in the repo, and anywhere that file was copied.Fleet dispatch makes per-instance settings the wrong unit. gh-hud starts every unattended session as
autonomyand picks the task with a slash command. Config is deployed once per machine, and instances aren't restarted per task. So this change picks grants per session, from what the session is doing:command.execute.before. It stays until another command runs.OpenSpec change:
openspec/changes/agent-guard-overrides/. The spec artifacts were pushed before each implementation commit.chat.message), slash command (command.execute.before, without the/, kept until the next command), and parent (session.created/session.updatedevents). If the parent is unknown, it falls back to onesession.getlookup (2 s limit, cached; a failed lookup counts as no parent).profilesis honored only from the global file. In the project file or plugin options it's ignored with a warning. A bad profile is dropped with a warning; the rest of the global file, includinglockGuards, stays in force. At most 64 profiles.matchkey (agentand/orcommand) equals the session's value or an ancestor's, up to 8 levels. MatchingtraceCheck.exemptToolscalls skip only the file-path trace check. Reward-hacking, directive, protected-state and approve/review gate checks still run. Globs that matchbash,edit,write,patch,multieditorapply_patch(so*too) are rejected, as are unknown keys. Globs are capped at 512 characters and 32 wildcards.lockGuards: truein the global file stripsblockRewardHacking: false,requireStepReferenceInTools: falseandmode: "repair-only"from the project file and plugin options, with a warning. The environment and the global file stay authoritative.The identity log line now also reports
lockGuards=<bool>and the profile names. An applied exemption logs once per profile and tool.History on this branch
7d9e089: the first cut, with per-agentagentOverrides.d0f23ce: review-council round 1, committed as the OpenCode run left it:repair-onlymode;ca473f3+acbf641: per-agent overrides replaced with task-scopedprofiles(command and/or agent, with inheritance), following the fleet-dispatch discussion. The review round's guarantees are kept.Scope decisions
rewardHackingScopeknob. FR-071 (fix: scope reward-hacking markers to execution surfaces (#46) #49) already made execution-surface scanning the default.lockGuards.command.execute.beforefires before or after the command'schat.message.Residual risks
command.execute.beforefires for a TUI started with--prompt "/<command> <args>"(gh-hud'sdispatch_mode = "tui") before the command's first tool call. If the prompt is sent as plain text instead of running the command, or the hook fires late, those sessions get no command grant (fail closed).Verification
bun test: 421 pass, 0 fail.node --test test/*.test.ts: 421 pass, 0 fail (Node 26).XDG_CONFIG_HOME.Not done (repo process)
/uf.review-councilround 2, for the profiles change.🤖 Generated with Claude Code