Skip to content

feat: council-review-action runtime sandbox and review fixes - #425

Merged
sonupreetam merged 5 commits into
unbound-force:mainfrom
sonupreetam:opsx/council-review-sandbox
Aug 11, 2026
Merged

sonupreetam merged 5 commits into
unbound-force:mainfrom
sonupreetam:opsx/council-review-sandbox

Conversation

@sonupreetam

@sonupreetam sonupreetam commented Aug 3, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Enforce runtime tool restrictions for the council-review-action,
which processes untrusted PR diff content through an LLM on
Vertex AI. Prior to this change, the only protection was
prompt-level instruction — a soft boundary the model could
ignore via prompt injection.

This change adds three defense-in-depth layers:

  1. Runtime permissions — OPENCODE_CONFIG_CONTENT env var
    denies bash, edit, webfetch, websearch, and skill at the
    OpenCode runtime level (hard enforcement)
  2. Plugin isolation — --pure flag prevents external MCP
    plugins from loading
  3. Agent frontmatter — migrates all 9 Divisor agents from
    deprecated tools: to permission: syntax

Additionally: rewrites the README for clarity, adds quickstart
and architecture docs, expands the security risk register, and
adds 13 new test assertions (60 → 73).

Tracks under complytime/nunya#406 (Review Council Defense in Layers).
Supersedes #337 (closed as not planned — work moved to nunya#406).
Spec: openspec/changes/council-review-sandbox/
E2E evidence: complytime/org-infra#427

How to Test

# Run pipeline tests (73 assertions)
bash council-review-action/test/test-pipeline.sh

# Run full Go checks (includes scaffold drift detection)
make check

# Verify no tools: frontmatter remains in Divisor agents
grep -r "^tools:" .opencode/agents/divisor-*.md
# Expected: no output

# Verify permission config in run-review.sh
grep -A5 'PERMISSION_CONFIG' council-review-action/scripts/run-review.sh
# Expected: denies bash, edit, webfetch, websearch, skill

How to Demo

  1. Read council-review-action/scripts/run-review.sh — the
    OPENCODE_CONFIG_CONTENT construction at lines 45-56
    shows the permission denials
  2. Compare any .opencode/agents/divisor-*.md file with
    git diff main -- .opencode/agents/divisor-adversary.md
    to see the tools: → permission: migration
  3. Run bash council-review-action/test/test-pipeline.sh to
    see all 31 scenarios pass with 73 assertions

Key Files Changed

File Change
council-review-action/scripts/run-review.sh Add OPENCODE_CONFIG_CONTENT permission config, --pure flag, deny ask-defaults
.opencode/agents/divisor-*.md (9 files) Migrate tools: to permission: frontmatter
internal/scaffold/assets/.../divisor-*.md (9 files) Sync scaffold copies
council-review-action/test/test-pipeline.sh Add Tests 27-31 (73 assertions)
council-review-action/README.md Rewrite: benefit-first, inputs near top, security section
council-review-action/docs/architecture.md New: end-to-end flow, runtime sandbox, output handling
council-review-action/docs/quickstart.md New: 3-step onboarding guide
council-review-action/docs/security-risks.md Add A7 (npm supply chain), expand existing entries
council-review-action/docs/decisions.md Add runtime sandbox decision, version pinning
openspec/changes/council-review-sandbox/ New: proposal, design, spec, tasks
docs/decisions/001-opencode-over-claude-cli.md Fix stale --dangerously-skip-permissions claim
CHANGELOG.md Add sandbox entry
AGENTS.md Update CI table, docs description, assertion count

This PR was generated by /finale (AI-assisted).

Closes #426

Enforce runtime tool restrictions for the council-review-action
using OpenCode's permission system:

- OPENCODE_CONFIG_CONTENT permission config denies bash, edit,
  webfetch, websearch, skill at the runtime level
- --pure flag isolates external MCP plugins
- Explicit deny of ask-default permissions (external_directory,
  doom_loop) for headless CI
- Migrate 9 Divisor agents from deprecated tools: to permission:
  frontmatter syntax; sync scaffold assets

Documentation:
- Add docs/quickstart.md, docs/architecture.md
- Rewrite README (benefit-first, inputs near top, fix comment
  posting accuracy)
- Add A7 (npm supply chain) to security risk register
- Fix stale ADR-001 trade-off, design.md version reference
- Add CHANGELOG entry for sandbox change

Testing:
- Add 5 tests (Tests 27-31): MAX_PARSE_ATTEMPTS, noise filter
  categories, empty comments, rename headers, special chars
  (60 to 73 assertions)
- Fix extract-review-json.py: with statement, encoding, optional
  filename argument
- Add python3/jq pre-flight check, prefetch.sh API timeout
- Remove dead AGENT_MODE from test invocations

Spec: openspec/changes/council-review-sandbox/
Signed-off-by: sonupreetam <[email protected]>
shellcheck SC2016 flags single-quoted strings that look like
shell expansions. These are intentional:
- run-review.sh: JSON permission config (not shell)
- test-pipeline.sh: testing literal string preservation

Assisted-by: claude-opus
Generated with AI assistance (claude-opus)

Signed-off-by: sonupreetam <[email protected]>
sonupreetam added a commit to complytime/org-infra that referenced this pull request Aug 3, 2026
Points to dc82f77 (opsx/council-review-sandbox) which adds:
- Runtime permission enforcement via OPENCODE_CONFIG_CONTENT
  (denies bash, edit, webfetch, websearch, skill)
- Plugin isolation via --pure flag
- Divisor agent migration from tools: to permission: frontmatter
- 13 new test assertions (73 total)
- Expanded docs (quickstart, architecture, security risk A7)

Refs #428, unbound-force/unbound-force#425

Signed-off-by: sonupreetam <[email protected]>
sonupreetam added a commit to complytime/org-infra that referenced this pull request Aug 3, 2026
Artifact from previous collect run expired (1-day retention).
Fresh collect needed to test runtime sandbox changes from
unbound-force/unbound-force#425.

Signed-off-by: sonupreetam <[email protected]>
sonupreetam added a commit to complytime/org-infra that referenced this pull request Aug 3, 2026
* feat(ci): add production council review workflow chain

Three-file workflow chain for AI council review using OpenCode on
Vertex AI via ITPC WIF authentication:

- ci_council_review_collect.yml (synced): fork-safe diff collection
  on pull_request, uploads PR diff + metadata as artifact
- ci_council_review.yml (synced): thin consumer on workflow_run,
  calls reusable_council_review.yml with secrets
- reusable_council_review.yml (NOT synced): shared review logic —
  WIF auth, council-review-action composite action, cleanup of
  previous bot comments, inline comment posting via GitHub API

Also fixes the off-by-one truncation bug in generate-crapload-comment.sh
where the trailer was appended after the byte limit.

Signed-off-by: sonupreetam <[email protected]>

* chore: update council-review-action SHA after squash

Points to 78c8a65 (single squashed commit on
feat/council-review-action).

Signed-off-by: sonupreetam <[email protected]>

* feat(ci): gate council review on org membership

Only run AI review for PRs from org members (MEMBER, OWNER, or
COLLABORATOR). External contributors skip at the collect stage,
so no WIF tokens are consumed. Uses author_association from the
pull_request event — no extra PAT needed.

Requested by Trevor and Jason.

Signed-off-by: sonupreetam <[email protected]>

* chore: update council-review-action SHA for formatting fix

Points to eece8d4 (feat/council-review-action-v2) which includes
improved inline comment formatting with line breaks between severity
header and comment body.

Signed-off-by: sonupreetam <[email protected]>

* fix(ci): use ORG_CHECK_TOKEN for private org membership checks

GITHUB_TOKEN can only check public org membership. Private members
(the GitHub default) return 404. Falls back to GITHUB_TOKEN when
ORG_CHECK_TOKEN is not configured.

Matches the pattern from reusable_publish_ghcr.yml.

Signed-off-by: sonupreetam <[email protected]>

* fix(ci): add newline after bot marker in inline comments

The HTML comment <!-- council-review-bot --> was glued directly to the
bold severity header, preventing GitHub's markdown renderer from
applying bold formatting in some cases.

Signed-off-by: sonupreetam <[email protected]>

* fix(ci): address PR #428 review feedback

- Gate cleanup step on review success to prevent deleting previous bot
  comments without replacement on transient failures (HIGH, yvonnedevlinrh)
- Use GraphQL variables instead of string interpolation for
  minimizeComment mutation to eliminate injection risk (HIGH, gxmiranda +
  yvonnedevlinrh)
- Create tracking issue #440 for continue-on-error removal and add
  issue reference to TODO comment (MEDIUM, gxmiranda)
- Add regression tests for crapload comment truncation per TC-006
  (MEDIUM, gxmiranda + yvonnedevlinrh)
- Surface stderr on inline comment posting failures for diagnostics
  (LOW, yvonnedevlinrh)

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: sonupreetam <[email protected]>

* fix(ci): suppress SC2016 for intentional GraphQL variable in single quotes

The GraphQL query uses $id as a GraphQL variable, not a shell variable.
Single quotes are correct here — shellcheck SC2016 is a false positive.

Refs #428

Signed-off-by: sonupreetam <[email protected]>

* fix(ci): move SC2016 disable to offending line for actionlint

The shellcheck disable directive at the top of the run block was not
picked up by actionlint's embedded shellcheck. Moving it directly
before the line with the single-quoted GraphQL variable fixes the
CI failure.

Refs #428

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: sonupreetam <[email protected]>

* fix(ci): defer downstream sync and add provenance headers

Address staged rollout concern from review (marcusburghardt):

- Add provenance headers to consumer workflows indicating they are
  managed by org-infra and should not be edited locally (#415)
- Exclude all downstream repos from council review sync entries
  until prerequisites are met:
  - Composite action SHA on merged main (unbound-force#336)
  - Security hardening (#429) and cost controls (#430) in place
  - End-to-end chain validated on org-infra

Refs #415, #428, #429, #430

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: sonupreetam <[email protected]>

* fix: isolate test output via configurable COMMENT_FILE

Make COMMENT_FILE configurable via environment variable (defaulting
to /tmp/crapload-comment-body.md for backward compatibility). Tests
now use isolated temp files per invocation, preventing cross-test
interference through the shared /tmp path.

Refs #428

Assisted-by: OpenCode (claude-opus-4-6)
Signed-off-by: sonupreetam <[email protected]>

* chore: update council-review-action SHA to latest #336

Points to 26db3b7 (feat/council-review-action-v2) which includes all
review feedback fixes from jflowers and yvonnedevlinrh:
- Expression injection fix (github.action_path via env:)
- Path traversal validation on agents-pattern
- set -euo pipefail restored in run-review.sh
- Credential unset before opencode run (GH_TOKEN + GOOGLE_APPLICATION_CREDENTIALS)
- File permissions fix (prepare-diff.sh, filter-diff-lines.py)
- Spec artifacts updated to reference opencode run
- parse-output.sh extracted from action.yml
- Size/iteration limits on extract-review-json.py
- Pipeline tests wired into CI (26 scenarios, 60 assertions)
- Model input validation, timeout wrapper, CHANGELOG

Refs #428, unbound-force/unbound-force#336

Signed-off-by: sonupreetam <[email protected]>

* docs: add council review documentation to AGENTS.md and ops guide

- Add Council Review section to AGENTS.md with workflow chain diagram,
  required secrets table, sync/rollout status, and related issues
- Add docs/COUNCIL_REVIEW.md with full operational guide: architecture
  diagram, workflow files table, gate conditions, composite action
  pipeline, rollout plan, manual trigger instructions, bot comment
  lifecycle, and troubleshooting guide

Refs #428

Signed-off-by: sonupreetam <[email protected]>

* chore: update council-review-action SHA to 28b8b43

Picks up the GOOGLE_APPLICATION_CREDENTIALS fix (48c9d01):
only unset GH_TOKEN before opencode run, keep WIF credential
path so Vertex AI authentication works.

Also includes security risk A3 trade-off documentation (28b8b43).

Refs #428, unbound-force/unbound-force#336

Signed-off-by: sonupreetam <[email protected]>

* chore: update council-review-action SHA to test PR #425

Points to dc82f77 (opsx/council-review-sandbox) which adds:
- Runtime permission enforcement via OPENCODE_CONFIG_CONTENT
  (denies bash, edit, webfetch, websearch, skill)
- Plugin isolation via --pure flag
- Divisor agent migration from tools: to permission: frontmatter
- 13 new test assertions (73 total)
- Expanded docs (quickstart, architecture, security risk A7)

Refs #428, unbound-force/unbound-force#425

Signed-off-by: sonupreetam <[email protected]>

* chore: update council-review-action SHA to merged main

Points to 7836c07 — the merged main commit from
unbound-force/unbound-force#336 (feat: add council-review-action
composite GitHub Action). Fulfills the first post-merge checklist
item: pin to a stable main SHA now that #336 has landed.

Refs #428, unbound-force/unbound-force#336

Signed-off-by: sonupreetam <[email protected]>

---------

Signed-off-by: sonupreetam <[email protected]>
@trevor-vaughan trevor-vaughan self-assigned this Aug 5, 2026
@trevor-vaughan

Copy link
Copy Markdown

Hey @sonupreetam. This was a big one so I ran it through an LLM deep dive. Everything seems accurate from my spot checking. Full report below:


🦾 Written with LLM assistance [claude-opus-4-8]
💪 Spot checked by a human before submission


1. [HIGH] .opencode/agents/divisor-adversary.md:5

Details
  • Agent: divisor-adversary-code (validator: CONFIRMED; evidence corrected)

  • Constraint: Security gate integrity / least privilege: a tool that was previously RESTRICTED must not be silently re-opened by the migration (CWE-732 Incorrect Permission Assignment).

  • Description: The old tools: block set write: false, explicitly denying OpenCode's write tool (file creation/overwrite — a DISTINCT tool from edit, which only modifies existing files). The new permission: block denies only edit, bash, webfetch and OMITS write. Since OpenCode permissions default to allow for tools not listed, write is now OPEN. This exact regression repeats identically in divisor-architect.md, divisor-guard.md, divisor-sre.md, and divisor-testing.md (each was write: false before, none deny write now — see diff lines 43-50, 102-109, 161-168, 180-187). That write is a real, separate tool is corroborated by other agents in this repo still using it as a distinct key (.opencode/agents/constitution-check.md:7 write: false, muti-mind-po.md:7 write: true). These agents process UNTRUSTED PR diffs; a prompt injection could invoke write to create/overwrite files in the workspace (e.g. overwrite review_output.json to fabricate an APPROVE verdict).

  • Evidence:

    -tools:
    -  read: true
    -  write: false
    -  edit: false
    -  bash: false
    -  webfetch: false
    +permission:
    +  edit: deny
    +  bash: deny
    +  webfetch: deny
    
  • Recommendation: Add write: deny to the permission: block of all five pure-review agents (adversary, architect, guard, sre, testing) in BOTH the live tree and internal/scaffold/assets mirror, restoring the previously-closed privilege.

2. [HIGH] council-review-action/docs/decisions.md:57

Details
  • Agent: divisor-adversary-code (validator: CONFIRMED)

  • Constraint: Security documentation MUST NOT overstate the enforced guarantee (OWASP A09 / accurate mitigation status). A doc that claims a containment property the code does not enforce misleads consumers into an insecure deployment.

  • Description: The doc asserts the model has 'no write permissions beyond the review JSON output', but the runtime PERMISSION_CONFIG in run-review.sh (lines 49-55: edit/bash/webfetch/websearch/skill/external_directory/doom_loop) does NOT deny the OpenCode write tool, and neither does the migrated agent frontmatter. In OpenCode write (create/overwrite files) is a distinct tool from edit (modify existing files) — proven by other agents in this repo that set write: explicitly (e.g. .opencode/agents/muti-mind-po.md write: true, constitution-check.md write: false). The PR diff even REMOVED the prior explicit write: false from the review agents (diff lines 24, 44, 64, 103, 162, 181 show - write: false) and replaced it with a permission block that omits write. A prompt-injected model therefore retains a write tool path, directly contradicting the 'no write permissions' claim.

  • Evidence:

    **Scope**: This is a defense-in-depth measure. The primary defense is that the model runs in a sandboxed CI environment with no shell access, no network access beyond Vertex AI, and no write permissions beyond the review JSON output.
    
  • Recommendation: Either add "write": "deny" to PERMISSION_CONFIG in run-review.sh (and write: deny to the review agents' frontmatter), or correct this sentence to reflect that write is currently NOT denied. Do not claim a write restriction the sandbox does not enforce.

3. [HIGH] council-review-action/docs/security-risks.md:128

Details
  • Agent: divisor-adversary-code (validator: CONFIRMED)

  • Constraint: Threat-register residual-risk ratings MUST reflect the tools actually reachable. A3's own risk statement (lines 92-95) is scoped to secrets leaking via a 'non-denied tool path' — so an undenied tool path is squarely in scope and invalidates the 'no tool path' conclusion.

  • Description: A3 concludes the model has 'no tool path to read process environment' because bash is denied. But read is explicitly allowed (run-review.sh line 36: 'read, glob, grep — allowed by OpenCode defaults'), and the WIF credential file location is deterministic and present in the environment as GOOGLE_APPLICATION_CREDENTIALS (which the doc itself states on lines 91-99 'cannot be unset'). A prompt-injected model does not need bash: it can read the credential file directly with the allowed Read tool at the path the SDK is configured to use, then emit its contents in the review output that is posted publicly. The residual-risk 'Low' rests on a false premise (bash-only reasoning) and ignores the allowed read tool plus the known file path.

  • Evidence:

    **Residual risk**: Low. The model has no tool path to read process
    environment — bash is denied at the runtime level, not just by
    prompt instruction. A vulnerability in OpenCode's permission
    enforcement could bypass this, but that would be an OpenCode bug.
    
  • Recommendation: Revise A3 to acknowledge that read is allowed and the credential file path is known/derivable, so denying bash alone does not remove the exfiltration path. Re-rate residual risk accordingly or document a concrete compensating control (e.g., move the credential file outside the readable project root, or the deferred reverse-proxy approach in the options table).

4. [HIGH] council-review-action/scripts/run-review.sh:46

Details
  • Agent: divisor-adversary-code (validator: CONFIRMED)

  • Constraint: Defense-in-depth backstop must enforce the stated guarantee. decisions.md:57 asserts the primary defense is 'no write permissions beyond the review JSON output'.

  • Description: The runtime hard-boundary PERMISSION_CONFIG denies edit/bash/webfetch/websearch/skill/external_directory/doom_loop but does NOT deny write. Because the agent-frontmatter layer also omits write (previous finding), there is NO layer denying file creation. This directly contradicts decisions.md:57 ('no write permissions beyond the review JSON output'). The persona-discovery pattern .opencode/agents/divisor-*.md (action.yml:39) matches the write-capable content agents (envoy/herald/scribe, which deny only bash+webfetch), and the orchestrator's task tool is intentionally NOT denied (run-review.sh:37-39), so the model has a delegation path to a fully write-capable subagent on an untrusted-diff run. external_directory: deny confines writes to the workspace but does not prevent overwriting the review output or planting files inside it.

  • Evidence:

      "permission": {
        "edit": "deny",
        "bash": "deny",
        "webfetch": "deny",
        "websearch": "deny",
        "skill": "deny",
        "external_directory": "deny",
        "doom_loop": "deny"
      }
    
  • Recommendation: Add "write": "deny" to the runtime PERMISSION_CONFIG in run-review.sh so the hard-boundary layer enforces the documented 'no write permissions' guarantee regardless of per-agent frontmatter, and update decisions.md/security-risks.md deny lists to include write.

5. [HIGH] openspec/changes/council-review-sandbox/design.md:131

Details
  • Agent: divisor-adversary-code (validator: CONFIRMED)

  • Constraint: Design docs must accurately describe the security-relevant behavior of the change (NIST SSDF PW.4 verify; truthful security documentation). A false 'preserves semantics' claim conceals a real capability regression.

  • Description: D6 asserts the tools->permission migration 'preserves semantics', but the diff shows write: false was present on the review agents (e.g. divisor-adversary diff - write: false) and is dropped in the migrated permission: block (only edit/bash/webfetch denied). Because OpenCode write defaults to allow when unspecified, dropping write: false silently RE-ENABLES the write tool — the opposite of preserving semantics. The mapping table omits any tools: { write: false } -> permission: { write: deny } row, so the regression is neither documented nor justified.

  • Evidence:

    The migration preserves semantics:
    - `tools: { bash: false }` becomes `permission: { bash: deny }`
    - `tools: { read: true }` is dropped (read defaults to allow)
    - Review agents: deny edit, bash, webfetch
    
  • Recommendation: Either add permission: { write: deny } to the review-agent migration and correct the mapping table to include tools: { write: false } -> permission: { write: deny }, or, if intentionally relaxing write, document the explicit rationale and threat-model impact rather than claiming semantics are preserved.

6. [HIGH] openspec/changes/council-review-sandbox/proposal.md:44

Details
  • Agent: divisor-curator-code (validator: CONFIRMED)

  • Constraint: Documentation MUST accurately describe the shipped change (AGENTS.md doc-accuracy; docs describe the implemented config).

  • Description: The proposal asserts the runtime permission config denies the write tool ('denies write/execute/network tools'). The shipped PERMISSION_CONFIG in run-review.sh (diff lines 1056-1067) denies only edit, bash, webfetch, websearch, skill, external_directory, doom_loop. There is no "write": "deny" rule anywhere in the runtime config, nor in the migrated review-agent frontmatter (the prior write: false was dropped during migration). The spec artifact claims a write restriction the shipped config does not enforce. This is the cross-cutting doc-accuracy defect: docs assert a write denial that is absent from the implementation.

  • Evidence:

    `runtime-permission-config`: Hard tool boundary via
      `OPENCODE_CONFIG_CONTENT` env var that denies write/execute/
      network tools regardless of prompt instructions or agent config
    
  • Recommendation: Either (a) add "write": "deny" to the PERMISSION_CONFIG in run-review.sh and to review-agent frontmatter to match the documented claim, or (b) correct proposal.md to describe only the tools actually denied (edit, bash, webfetch, websearch, skill). The proposal, design D2/D6, spec, and run-review.sh comment must all name the same tool set.

7. [HIGH] openspec/changes/council-review-sandbox/specs/council-review-sandbox.md:9

Details
  • Agent: divisor-adversary-code (validator: CONFIRMED)

  • Constraint: OWASP A03:2021 Injection / defense-in-depth: a model reviewing untrusted PR diffs must not be able to create files on the CI runner (prompt-injection -> arbitrary file write). CWE-732 (incorrect permission assignment for critical resource).

  • Description: The normative permission-config requirement enumerates edit/bash/webfetch/websearch/skill but omits the write tool. In OpenCode write (create new files) and edit (modify existing files) are DISTINCT tools; denying only edit leaves file creation enabled. The prior tools: frontmatter for review agents explicitly set write: false (diff line 24: - write: false), and the shipped runtime PERMISSION_CONFIG (run-review.sh lines 46-57) likewise denies edit but not write. The spec thus codifies a weaker sandbox than the state it replaces, on the exact code path that processes untrusted diff content.

  • Evidence:

    The `run-review.sh` script MUST inject an `OPENCODE_CONFIG_CONTENT`
    env var containing a permission config that denies `edit`, `bash`,
    `webfetch`, `websearch`, and `skill`. Read, glob, and grep MUST
    remain allowed (OpenCode defaults).
    
  • Recommendation: Add write to the denied-tools list in this requirement (deny write, edit, bash, webfetch, websearch, skill) and add a corresponding assertion that the shipped PERMISSION_CONFIG contains "write": "deny".

8. [MEDIUM] .opencode/agents/divisor-adversary.md:5

Details
  • Agent: divisor-testing-code (evidence corrected)

  • Constraint: Security-relevant behavior should have a regression anchor (Testing convention: regression protection for security-relevant code paths).

  • Description: The permission migration is the security payload of this PR (README.md: 'each Divisor agent's permission: config denies dangerous tools as defense-in-depth'), yet no test asserts that any agent denies bash/edit/webfetch. A future edit that silently drops bash: deny or flips deny->allow (well-formed YAML, still has a description) would pass every existing test — validateAgents, the drift test (if applied to both trees), and the doctor frontmatter check all stay green. There is no regression anchor for the deny semantics.

  • Evidence:

    Migrated frontmatter block:
      permission:
        edit: deny
        bash: deny
        webfetch: deny
    No test in the repo asserts the semantic content of any divisor agent's `permission:` block. `internal/doctor/checks.go:991` validateAgents only checks `desc, _ := fm["description"].(string); if desc == ""` — it never inspects the `permission` key. `TestEmbeddedAssets_MatchSource` (internal/scaffold/scaffold_test.go:41) only asserts byte-equality between the two trees, not that the denies are present/correct.
    
  • Recommendation: Add a table-driven test that parses each divisor-*.md frontmatter and asserts the expected permission denies per agent (e.g. adversary/architect/guard/sre/testing => edit:deny,bash:deny,webfetch:deny; curator => edit:deny,webfetch:deny; envoy/herald/scribe => bash:deny,webfetch:deny). This locks the deny set as a contract and catches accidental reversions. Scoped as MEDIUM because this is defense-in-depth layer 3 — the hard enforcement boundary is OPENCODE_CONFIG_CONTENT at the OpenCode runtime (run-review.sh), not the agent frontmatter.

9. [MEDIUM] .opencode/agents/divisor-curator.md:5

Details
  • Agent: divisor-sre-code

  • Constraint: Migrations that change runtime behavior must preserve or intentionally document prior tool authority.

  • Description: The pre-migration tools: block for curator had bash: true (bash explicitly enabled). The new permission: block omits bash entirely, so bash falls back to OpenCode's default rather than the previously-explicit enabled state. This is a silent behavior change for the curator agent when run OUTSIDE the CI review sandbox. Within the council-review CI path it is moot because run-review.sh injects OPENCODE_CONFIG_CONTENT with "bash": "deny" globally, so bash is denied regardless. Impact is limited to any non-sandboxed invocation of the curator agent, where its bash access now depends on OpenCode defaults instead of the former explicit grant.

  • Evidence:

    permission:
      edit: deny
      webfetch: deny
    
  • Recommendation: Confirm curator does not require bash for its documentation-triage duties; if it does not, the omission is fine and the intent could be noted in the change proposal. If curator ever runs outside the CI sandbox and needs bash, add it explicitly.

10. [MEDIUM] council-review-action/README.md:48

Details
  • Agent: divisor-adversary-code

  • Constraint: Consumer-facing security summary MUST enumerate a denial set that matches enforcement; an incomplete list adjacent to a 'prevent tool misuse' claim understates residual risk.

  • Description: The README Security section lists denials as 'bash, edit, webfetch, websearch, and skill' (lines 52-54) framed as layers that 'prevent tool misuse', but omits that write is NOT denied and read remains allowed with the credential file reachable. A consumer reading only the README would reasonably conclude file-writes and credential reads are contained; run-review.sh (lines 46-57) shows they are not.

  • Evidence:

    The action processes untrusted PR diff content through an LLM.
    Three layers of defense prevent tool misuse:
    
  • Recommendation: Add a one-line caveat that read/glob/grep remain allowed and write is not currently denied, or close the gap in the config and keep the list accurate. Cross-link the corrected security-risks.md A3.

11. [MEDIUM] council-review-action/docs/architecture.md:104

Details
  • Agent: divisor-adversary-code

  • Constraint: Architecture security narrative MUST match enforced controls; misstatement propagates to consumers relying on the doc.

  • Description: Same overstatement as A3: 'the model has no tool path to read it [the WIF credentials]' is false because read is an allowed tool (run-review.sh line 36) and GOOGLE_APPLICATION_CREDENTIALS resolves to a concrete file path the model can Read directly. Denying bash does not remove that path.

  • Evidence:

    `GH_TOKEN` is unset before `opencode run` to remove GitHub
    API access. `GOOGLE_APPLICATION_CREDENTIALS` cannot be unset
    (breaks Vertex AI auth) but bash is denied at the runtime
    level, so the model has no tool path to read it.
    
  • Recommendation: Correct to state that bash denial removes shell-based access only, and note the residual Read-tool exposure of the credential file (cross-reference the corrected A3).

12. [MEDIUM] council-review-action/docs/decisions.md:63

Details
  • Agent: divisor-guard-code

  • Constraint: Cross-component consistency: the deny-list MUST be described identically across docs

  • Description: This decisions.md list of denied tools (edit, bash, webfetch, websearch, skill) omits external_directory and doom_loop, which run-review.sh (lines 54-55) also denies and which the same section later relies on (line 69: 'explicitly denies every tool that defaults to "ask" (external_directory, doom_loop)'). architecture.md line 96-98 and security-risks.md line 27-28 similarly enumerate only the five deny entries. The user-facing enumerations therefore under-report the actual runtime deny-list. This is a minor accuracy gap, not a contradiction like finding 1, but it means no single doc lists the complete shipped deny-set.

  • Evidence:

    1. **`OPENCODE_CONFIG_CONTENT` permission config** (hard boundary) — `run-review.sh` injects a runtime config via the `OPENCODE_CONFIG_CONTENT` env var that denies `edit`, `bash`, `webfetch`, `websearch`, and `skill`.
    
  • Recommendation: In the layer-1 enumeration (decisions.md line 63, architecture.md line 96-98, security-risks.md line 27-28) note that external_directory and doom_loop are also denied, or add a phrase such as 'plus the ask-default permissions external_directory and doom_loop' so the documented deny-list matches PERMISSION_CONFIG.

13. [MEDIUM] council-review-action/docs/decisions.md:65

Details
  • Agent: divisor-adversary-code

  • Constraint: Defense-in-depth documentation MUST accurately describe the fallback layer's coverage; a fallback described as protective but silent on write gives false assurance.

  • Description: This layer is presented as the safety net 'even if the runtime config were misconfigured'. But the frontmatter (confirmed in .opencode/agents/divisor-adversary.md lines 5-8 and diff lines 24-31) denies only edit/bash/webfetch and dropped the prior write: false. So the described fallback does NOT restrict write (or read of credentials) — the exact gap it is claimed to backstop. The doc should not imply the frontmatter layer covers file-write containment.

  • Evidence:

    3. **Agent frontmatter** (`permission:` in `divisor-*.md`) — Review-focused Divisor agents declare `edit: deny`, `bash: deny`, `webfetch: deny` in their frontmatter. This is defense-in-depth; even if the runtime config were misconfigured, the agent-level restrictions apply.
    
  • Recommendation: Either restore write: deny to the review-agent frontmatter (and mention it here) or qualify this bullet to state which tools the frontmatter actually denies, avoiding the implication of full write/tool containment.

14. [MEDIUM] council-review-action/docs/quickstart.md:121

Details
  • Agent: divisor-sre-code

  • Constraint: Documented customization steps must be operationally correct and runnable; a documented override that silently fails to take effect misconfigures a consumer.

  • Description: The quickstart documents overriding agents-pattern (e.g. to review-*.md) as a supported customization. But agents-pattern only feeds the detection step in action.yml (line 105: find . -path "./${AGENTS_PATTERN}" to set multi/single mode). The actual review prompt sent to the model is generated by build-prompt.sh, which hardcodes 3. .opencode/agents/divisor-*.md — each reviewer persona (build-prompt.sh line 24). A consumer who sets agents-pattern: .opencode/agents/review-*.md will pass detection (mode=multi) yet the model is still instructed to read only divisor-*.md, so their custom review-*.md personas are never applied. The documented feature does not work as described.

  • Evidence:

      agents-pattern: ".opencode/agents/review-*.md"
    
  • Recommendation: Either (a) fix build-prompt.sh to interpolate the AGENTS_PATTERN value into the prompt so the override actually changes which personas are read, or (b) remove/qualify the 'Agent pattern' customization section in quickstart.md to state that the pattern only affects multi-vs-single detection, not which agent files the model reads.

15. [MEDIUM] council-review-action/docs/quickstart.md:732

Details
  • Agent: divisor-sre-code (evidence corrected)

  • Constraint: Operational documentation must not teach consumers a pattern that contradicts the action's own documented supply-chain security decision.

  • Description: The new quickstart guide (added in this PR) instructs consumers to reference the action via the mutable @main ref. This directly contradicts the action's own SHA-pinning decision in decisions.md:39-41 ('Pin the council-review-action to a full commit SHA, not a branch or tag ... SHA-pinning is a supply-chain security best practice (scored by OSSF Scorecard)'). A consumer following the quickstart verbatim inherits a mutable, force-push-vulnerable reference to an action that processes untrusted PR diff content through an LLM with credentials in the environment (A3, security-risks.md). The security posture the sandbox change is strengthening is undercut by the onboarding doc it ships alongside.

  • Evidence:

      uses: unbound-force/unbound-force/council-review-action@main
    
  • Recommendation: In quickstart.md step 3, use a full commit SHA with a trailing # <tag> comment (matching the actions/checkout@3d3c42e5... # v7.0.1 convention used in the same file at line 701), or add an explicit callout that @main is for evaluation only and production consumers MUST pin a SHA per docs/decisions.md.

16. [MEDIUM] council-review-action/docs/security-risks.md:117

Details
  • Agent: divisor-adversary-code

  • Constraint: Mitigation claims MUST NOT assert completeness ('blocks all tool paths') the config does not achieve.

  • Description: The mitigation claims the permission config 'blocks all tool paths to process environment'. It only enumerates bash-based paths (env/printenv/arbitrary bash). It does not account for the allowed read tool reaching the WIF credential file, nor the undenied write tool. 'All tool paths' is an overstatement of the enforced surface described in run-review.sh lines 46-57.

  • Evidence:

    - `OPENCODE_CONFIG_CONTENT` permission config blocks all tool paths
      to process environment (`env`, `printenv`, arbitrary bash) at the
      OpenCode runtime level (bash: deny)
    
  • Recommendation: Change 'blocks all tool paths to process environment' to 'blocks shell-based access to process environment (bash denied)' and separately address the allowed Read tool + credential-file exposure.

17. [MEDIUM] council-review-action/docs/testing.md:70

Details
  • Agent: divisor-testing-code (calibrated HIGH->MEDIUM)

  • Constraint: Test documentation MUST accurately describe what the test actually validates; a doc that claims coverage which does not exist is a finding.

  • Description: testing.md's Test 15 row claims the test validates a 'no-subagent' constraint. This PR modified Test 15 to REMOVE that assertion (diff line 1144 assert_contains "no subagents" "Do NOT spawn subagents" was replaced by line 1145 assert_contains "no fix loops" "Do NOT iterate fix loops"). The actual Test 15 (test-pipeline.sh lines 383-385) asserts only 'untrusted input', 'Do NOT run shell commands', and 'Do NOT iterate fix loops' — grep for 'subagent' in test-pipeline.sh returns ZERO matches. Moreover the PR removed the subagent ban from the production prompt itself (build-prompt.sh diff line 981: - Do NOT spawn subagents or iterate fix loops becomes + Do NOT iterate fix loops or attempt to fix code), because subagents are now intentionally required (run-review.sh comment: 'task — required for multi-agent Divisor subagent invocation'). The doc thus claims test coverage of a security constraint that neither the test nor the production prompt contains anymore. The PR updated testing.md's scenario/assertion counts in the same hunk but left this Test 15 description stale.

  • Evidence:

    | 15 | Security instructions | Untrusted input warning, no-shell/no-subagent constraints |
    
  • Recommendation: Update testing.md line 70 to match the actual Test 15 assertions, e.g. 'Untrusted input warning, no-shell constraint, no-fix-loop constraint'. Remove the 'no-subagent' claim since the assertion and the corresponding prompt line were deliberately removed in this PR.

18. [MEDIUM] council-review-action/docs/testing.md:923

Details
  • Agent: divisor-testing-code (evidence corrected)

  • Constraint: Test documentation MUST accurately reflect what is testable; a testability claim in the spec must not be contradicted by the testing strategy doc that ships with the same change.

  • Description: The testing.md matrix declares run-review.sh 'No (requires OpenCode + Vertex AI)' — i.e. not locally testable — while the change's own proposal.md 'IV. Testability' assessment (PASS) asserts the permission config, frontmatter, and --pure flag ARE testable by env-var inspection, YAML parse, and argv inspection. Both statements are in this PR. The doc conflates 'requires live OpenCode to observe a tool being denied at runtime' (true, deferred to E2E) with 'the config-building shell logic cannot be tested' (false — it runs entirely before any opencode call). The doc's blanket 'No' is used to justify shipping the sandbox with no unit-level tests, masking the gap in Finding 1.

  • Evidence:

    | `run-review.sh` | No (requires OpenCode + Vertex AI) | — | — |  ... contradicted by proposal.md L108-113: 'The permission config is a JSON structure injected via env var, testable by inspecting OPENCODE_CONFIG_CONTENT. The agent frontmatter changes are testable by parsing YAML. The --pure flag is a CLI argument visible in the invocation.'
    
  • Recommendation: Split the run-review.sh row: mark the config/argv construction (OPENCODE_CONFIG_CONTENT contents, --pure presence, skip-flag absence) as locally testable and add the corresponding tests; keep only the live tool-denial observation as 'No (requires OpenCode + Vertex AI)'. Reconcile the wording with proposal.md IV.

19. [MEDIUM] council-review-action/scripts/extract-review-json.py:25

Details
  • Agent: divisor-testing-code (evidence corrected)

  • Constraint: Coverage completeness: error/edge-path coverage for changed input-handling contract.

  • Description: Input-read changed to explicit encoding=utf-8, errors=replace bounded read, altering input-handling contract for every caller including the production parse-output.sh path. The extractor processes untrusted LLM output that can contain invalid UTF-8, and errors=replace is precisely the branch that surfaces on such input, but no test feeds non-UTF-8 input. Replacement-character decoding path unexercised.

  • Evidence:

    with open(input_file, encoding="utf-8", errors="replace") as f: text = f.read(MAX_INPUT_BYTES + 1)
    
  • Recommendation: Add a test writing invalid UTF-8 bytes around a valid review JSON object and assert the extractor recovers the JSON or exits cleanly (no traceback).

20. [MEDIUM] council-review-action/scripts/prefetch.sh:64

Details
  • Agent: divisor-sre-code (evidence corrected)

  • Constraint: Runtime robustness: external I/O should have bounded execution time.

  • Description: timeout 10 added only to gh issue view inside the linked-issues loop, but four earlier network calls in the same script (gh pr checks line 19, gh api reviews line 27, gh api comments line 40, gh pr view line 54) remain without timeout. Their || fallback guards only trigger on non-zero exit, not on a hang: a stalled call blocks until the job-level timeout (default 6h). Hardening applied inconsistently.

  • Evidence:

    ISSUE=$(timeout 10 gh issue view "${num}" --repo "${REPO}" --json number,title,body,labels 2>/dev/null) || continue
    
  • Recommendation: Wrap the other gh pr checks, gh api, and gh pr view invocations in timeout for parity, so a hung API call fails fast into the warning+fallback path.

21. [MEDIUM] council-review-action/scripts/run-review.sh:46

Details
  • Agent: divisor-testing-code (calibrated HIGH->MEDIUM; evidence corrected)

  • Constraint: Coverage completeness: untested core functionality; testable portion must be isolated from untestable portion.

  • Description: The permission-config generation is the central new behavior yet has zero test coverage. The config-assembly logic is pure jq/bash requiring neither OpenCode nor Vertex, fully testable by inspecting OPENCODE_CONFIG_CONTENT, but is not isolated from the untestable opencode run invocation. No assertion verifies: deny rules present, Vertex jq merge produces both permission AND provider keys, non-Vertex else branch produces permission-only config, or that task is NOT denied. Spec defines explicit testable scenarios with no corresponding tests. grep confirms run-review.sh invoked by zero tests.

  • Evidence:

    PERMISSION_CONFIG='{ ... permission: { edit: deny, bash: deny, ... } }' ... OPENCODE_CONFIG_CONTENT=$(jq -n --arg model --argjson perms '$perms + { provider: {...} }') ... else export OPENCODE_CONFIG_CONTENT="${PERMISSION_CONFIG}"
    
  • Recommendation: Refactor config-assembly into a testable seam (function or a mode that prints OPENCODE_CONFIG_CONTENT and exits before opencode run). Add assertions covering both provider branches: seven deny keys present, provider present for vertex, omitted for non-vertex, and task NOT denied.

22. [MEDIUM] council-review-action/test/test-pipeline.sh

Details
  • Agent: divisor-testing-code (calibrated HIGH->MEDIUM; evidence corrected)

  • Constraint: Coverage Completeness — security-relevant code paths (input validation, privilege boundary config) must have tests exercising them.

  • Description: run-review.sh has ZERO coverage in this pipeline test file. Two security-critical, unit-testable code paths are untested: (1) the MODEL metacharacter-rejection regex, which is an untrusted-input validation boundary, and (2) generation of the OPENCODE_CONFIG_CONTENT permission-deny list, which is the sandbox mechanism that replaced --dangerously-skip-permissions per ADR 001. The MODEL-validation branch requires no opencode invocation to test (it exits before opencode run); the permission-config merge can be tested by stubbing opencode on PATH or extracting the jq merge into a callable function. This corroborates the separate subsystem review's HIGH finding, and in the Testing domain it is a coverage-completeness gap for core, security-defining functionality.

  • Evidence:

    grep for 'run-review|OPENCODE_CONFIG|permission|deny' in test-pipeline.sh returns no matches. run-review.sh contains testable security logic: MODEL validation regex `if ! [[ "${MODEL}" =~ ^[a-zA-Z0-9._/-]+$ ]]; then ... exit 1` (line 14) and the provider-conditional PERMISSION_CONFIG jq merge producing OPENCODE_CONFIG_CONTENT with edit/bash/webfetch/websearch/skill/external_directory/doom_loop = deny (lines 46-76).
    
  • Recommendation: Add tests that (a) assert run-review.sh exits 1 for a MODEL containing shell metacharacters (e.g. MODEL='a;rm -rf /'), (b) assert the generated OPENCODE_CONFIG_CONTENT contains each expected deny key for both the google-vertex-anthropic and non-vertex provider branches. Stub opencode/timeout on PATH or refactor the config build into a sourced function so the assertions run without a network model call.

23. [MEDIUM] council-review-action/test/test-pipeline.sh

Details
  • Agent: divisor-testing-code (calibrated HIGH->MEDIUM; evidence corrected)

  • Constraint: Coverage completeness — core functionality introduced by a change MUST have committed tests exercising its documented behavior; positive and negative paths for security-relevant sandbox logic must be tested.

  • Description: The sandbox is the entire subject of this PR, and its core enforcement logic in run-review.sh is deterministic, non-LLM shell code: it builds PERMISSION_CONFIG (edit/bash/webfetch/websearch/skill/external_directory/doom_loop = deny), branches on PROVIDER to produce OPENCODE_CONFIG_CONTENT with vs without a provider key, and adds --pure to the invocation. Every one of the spec's shell-testable scenarios (specs/council-review-sandbox.md: 'the JSON contains both permission and provider keys' L96-100; 'permission key only (no provider key)' L102-107; 'neither --dangerously-skip-permissions nor --auto is present' L82-86; frontmatter 'does NOT contain a tools: key' L116-123) is verifiable by running run-review.sh with a stubbed opencode/timeout and inspecting the exported env var and argv — exactly the stub-and-inspect pattern the existing suite already uses for build-prompt.sh and parse-output.sh (Tests 13-18). No such test was committed. This leaves the highest-value security behavior of the change with zero regression protection: a future edit that drops websearch from the deny list, flips the Vertex branch, or removes --pure would pass CI silently.

  • Evidence:

    test-pipeline.sh (all 31 tests) exercises only prepare-diff.sh, filter-diff-lines.py, extract-review-json.py, build-prompt.sh, and parse-output.sh. A grep for 'run-review|OPENCODE_CONFIG_CONTENT|--pure|permission|websearch|external_directory|doom_loop|--dangerously-skip-permissions' across council-review-action/test returned 'No files found'.
    
  • Recommendation: Add tests to test-pipeline.sh that invoke run-review.sh with a stubbed 'opencode' and 'timeout' on PATH (writing argv to a file) and MODEL set to (a) google-vertex-anthropic/... and (b) anthropic/..., then assert: OPENCODE_CONFIG_CONTENT parses as JSON with permission.{edit,bash,webfetch,websearch,skill,external_directory,doom_loop} == 'deny'; permission.task is absent; the provider key is present only in the Vertex case; captured argv contains '--pure' and contains neither '--dangerously-skip-permissions' nor '--auto'. Add YAML/grep assertions over the 9 divisor-*.md files asserting a 'permission:' block exists and no 'tools:' key remains.

24. [MEDIUM] openspec/changes/council-review-sandbox/design.md:132

Details
  • Agent: divisor-guard-code

  • Constraint: Constitution Alignment / External Standard Verification

  • Description: The design maps the old read-only reviewer policy (tools: write:false, edit:false, bash:false on adversary/architect/guard/sre/testing) onto the new blocks (edit:deny, bash:deny, webfetch:deny) with NO write key. Intent preservation depends entirely on the un-in-repo-verifiable claim that OpenCode's edit permission subsumes the legacy write boolean (i.e. the Write tool is governed by edit). If write were a separate surviving permission key, all 5 read-only reviewers plus curator would silently regain write capability — a policy regression from their formerly-read-only intent. The proposal (lines 15-16) and design D6 (lines 126-127) both assert the tools->permission merge, but network access is disabled and no vendored OpenCode permission schema exists in the changeset to confirm it. Per Guard protocol, an unverified compliance claim is flagged, not rubber-stamped. Severity kept LOW because both spec docs state the mapping consistently and webfetch:deny is a net tightening across every agent.

  • Evidence:

    The migration preserves semantics:
    - `tools: { bash: false }` becomes `permission: { bash: deny }`
    - `tools: { read: true }` is dropped (read defaults to allow)
    
  • Recommendation: Before merge, a human should confirm against OpenCode 1.15.13's permission schema that the Write tool is governed by the edit permission (so edit: deny blocks file creation as write: false did). If OpenCode exposes a distinct write permission, add write: deny to the five read-only reviewers (adversary, architect, guard, sre, testing) and the curator to preserve their original no-write policy. No code change required if the merge semantics hold as documented.

25. [MEDIUM] openspec/changes/council-review-sandbox/design.md:166

Details
  • Agent: divisor-sre-code (evidence corrected)

  • Constraint: Operational claims that gate the review's core function must be validated before merge, not asserted solely from external docs.

  • Description: The change adds --pure to opencode run (run-review.sh:88-91) and relies on the asserted-from-docs claim (D7, design.md:138-150) that --pure blocks only external MCP plugins while leaving native Divisor agent/subagent discovery intact. D3 (design.md:77-87) explicitly warns that silently degrading multi-agent review to single-agent mode 'defeats the purpose of the council review.' If the --pure behavior assumption is wrong, the sandbox would trigger exactly that failure mode. No finding in the specs demonstrates verification of --pure + multi-agent coexistence against the pinned [email protected]; task 5.1 only checks 'the flag exists' and task 5.2 is a config-acceptance smoke test — neither confirms subagents still load under --pure.

  • Evidence:

    **[R3] `--pure` blocks legitimate plugins**: If a future review enhancement relies on an MCP plugin, `--pure` would block it. Evaluate plugin needs when they arise.
    
  • Recommendation: Before relying on multi-agent output, run a local opencode run --pure --format json invocation against 1.15.13 that confirms at least one Divisor subagent is discovered and invoked, and record the result in tasks.md task 5.2. Add a ::notice:: in run-review.sh (or parse-output.sh) that logs the detected agent mode so silent degradation to single-agent is observable in CI logs.

26. [MEDIUM] openspec/changes/council-review-sandbox/proposal.md:44

Details
  • Agent: divisor-adversary-code

  • Constraint: Compliance-claim verification: security claims must match the spec'd/shipped config; overstated mitigations create a false sense of coverage in the risk register (OWASP A09 monitoring/assurance gap).

  • Description: The capability description claims the config 'denies write/execute/network tools', but neither the normative spec requirement nor the shipped PERMISSION_CONFIG (run-review.sh) denies the write tool. The proposal overstates the mitigation: 'write' is listed as denied when it is not. This contradiction propagates to security-risks.md T2/A3 which this change marks 'implemented'.

  • Evidence:

    - `runtime-permission-config`: Hard tool boundary via
      `OPENCODE_CONFIG_CONTENT` env var that denies write/execute/
      network tools regardless of prompt instructions or agent config
    
  • Recommendation: Make the claim accurate — either add write to the deny list so the statement is true, or amend the wording to reflect exactly which tools are denied (edit, not write).

27. [MEDIUM] openspec/changes/council-review-sandbox/specs/council-review-sandbox.md:12

Details
  • Agent: divisor-adversary-code (evidence corrected)

  • Constraint: OWASP ASVS testability: each security control MUST have a verifying scenario. A denial with no scenario is an unguarded gate — regressions (like the dropped write denial) pass silently.

  • Description: The spec defines Given/When/Then scenarios asserting denial for bash and webfetch and a positive scenario for read, but defines NO scenario asserting the write tool is denied. Combined with the omission of write from the deny requirement, there is no testable guard preventing the review model from creating files. This is the specific gap that let the write-denial regression ship unnoticed (task 5.x has no write-denial verification either).

  • Evidence:

    #### Scenario: Model attempts bash command
    
    - **GIVEN** `run-review.sh` sets `OPENCODE_CONFIG_CONTENT` with
      `"bash": "deny"`
    - **WHEN** the model attempts to use the `bash` tool
    - **THEN** OpenCode denies the tool call at the runtime level
    
  • Recommendation: Add a 'Model attempts file write' scenario: GIVEN OPENCODE_CONFIG_CONTENT with "write": "deny", WHEN the model attempts the write tool, THEN OpenCode denies the call — and reference it from tasks.md validation section 5.

28. [MEDIUM] openspec/changes/council-review-sandbox/specs/council-review-sandbox.md:95

Details
  • Agent: divisor-guard-code (evidence corrected)

  • Constraint: Intent Drift

  • Description: The spec defines multiple Given/When/Then scenarios that assert the content of OPENCODE_CONFIG_CONTENT and the CLI arguments (Vertex-with-permissions has both keys; non-Vertex has permission only per lines 102-107; 'No blanket skip flags' per lines 81-86; Divisor frontmatter contains permission and not tools per lines 116-131). These are shell-inspectable without live OpenCode, and proposal.md 'IV. Testability' (lines 106-113) explicitly claims they are 'testable by inspecting OPENCODE_CONFIG_CONTENT' / 'testable by parsing YAML' / 'a CLI argument visible in the invocation.' Yet test-pipeline.sh (31 tests) contains zero references to OPENCODE_CONFIG_CONTENT, permission, --pure, websearch, external_directory, doom_loop, or run-review.sh. tasks 5.1-5.4 record only manual one-off verifications, not committed regression tests. Spec-defined, non-live-dependent testable behavior therefore ships without corresponding tests, and the testability claims in proposal.md are unmet.

  • Evidence:

    #### Scenario: Vertex AI provider with permissions
    - **GIVEN** `MODEL` is `google-vertex-anthropic/claude-sonnet-4-6`
    - **WHEN** `run-review.sh` builds `OPENCODE_CONFIG_CONTENT`
    - **THEN** the JSON contains both `"permission"` and `"provider"` keys
    
  • Recommendation: Add pipeline tests that source/exercise run-review.sh's config-construction path (e.g., factor the PERMISSION_CONFIG merge into a testable function or assert the built OPENCODE_CONFIG_CONTENT for Vertex vs non-Vertex, and assert absence of --dangerously-skip-permissions/--auto and presence of --pure), plus a YAML-parse test asserting no tools: key remains in divisor-*.md. Alternatively, if these must remain live-only, correct proposal.md's testability claims to say so.

29. [MEDIUM] openspec/changes/council-review-sandbox/tasks.md:99

Details
  • Agent: divisor-testing-code (evidence corrected)

  • Constraint: tasks.md completion status MUST NOT overstate verification: a task marked complete on the basis of one-time manual inspection provides no committed regression protection and should be distinguished from automated coverage.

  • Description: The Validation section closes out the change on manual, non-repeatable checks (5.1-5.4) while the single test task (5.5) is deferred. No task exists for adding shell-level unit tests of the sandbox config, even though proposal.md IV claims that behavior is testable. Marking 5.3/5.4 '[x]' via one-off greps means the 'no tools: remains' and 'no --permissions remains' invariants have no standing guard; a regression reintroducing either would not be caught. The completion state therefore overclaims durable verification for behavior that has only been eyeballed once.

  • Evidence:

    Tasks 1.1-1.6, 2.1-2.9, 5.1-5.4 all marked '[x]'; the only automated-test-oriented task, '5.5 E2E test PR to confirm review quality is maintained', is '[ ] ... (deferred to integration testing via org-infra)'. Validation tasks record only manual/local checks.
    
  • Recommendation: Add a task under section 5 to commit automated tests for the shell-testable sandbox invariants (OPENCODE_CONFIG_CONTENT contents per provider branch, --pure present, skip flags absent, no tools: key in any divisor-*.md), and only mark it [x] once those assertions live in test-pipeline.sh. Keep 5.5 deferred, but do not treat manual greps (5.3/5.4) as equivalent to committed coverage.

30. [LOW] .opencode/agents/divisor-adversary.md:5

Details
  • Agent: divisor-sre-code

  • Constraint: Permission migrations should preserve prior write restrictions.

  • Description: Several review-only agents (adversary, architect, curator, guard, sre, testing) previously declared write: false in the tools: block but the new permission: block does not list a write/edit combination that denies file creation via the write tool. edit: deny covers edits/patches but write (new-file creation) is not explicitly denied. For the sandboxed CI review this is neutralized by the runtime config, and OpenCode may treat write under the edit permission, so operational impact is negligible. Noting for completeness since the explicit write: false guarantee was dropped.

  • Evidence:

    permission:
      edit: deny
      bash: deny
      webfetch: deny
    
  • Recommendation: Verify OpenCode's permission: schema maps the write tool under edit; if write is a separately-gated permission, consider adding write: deny to the review-only agents for parity with the prior explicit restriction.

31. [LOW] .opencode/agents/divisor-curator.md:32

Details
  • Agent: divisor-curator-code (evidence corrected)

  • Constraint: Internal consistency of documentation after permission migration

  • Description: The Curator body still asserts a hand-authored 'Bash Access Restriction' policy (three gh operations) that is now the ONLY place documenting that bash is available to this agent. After the migration the frontmatter no longer mentions bash at all, so this prose section is the sole record of the intended bash contract. This is not stale (bash genuinely remains allowed), but the coupling is fragile: a future editor who tightens the frontmatter to 'bash: deny' would break these documented workflows with no cross-reference warning them.

  • Evidence:

    ## Bash Access Restriction
    
    Your bash access is restricted to exactly three operations:
    
  • Recommendation: Add a one-line cross-reference in the 'Bash Access Restriction' section noting that bash is granted via the OpenCode default (frontmatter denies only edit/webfetch), so the two stay in sync.

32. [LOW] council-review-action/docs/architecture.md:71

Details
  • Agent: divisor-curator-code (evidence corrected)

  • Constraint: VB-003/FA-001: technical depictions SHOULD accurately reflect the invocation the doc describes elsewhere on the same page.

  • Description: The Authentication diagram depicts the opencode invocation without the --pure flag, while the same file's Runtime sandbox section (lines 99-100) and run-review.sh (line 99) state --pure is always passed. The diagram is a simplification of auth flow, not a literal command, but a reader cross-referencing the sandbox section may perceive an inconsistency in whether --pure is applied.

  • Evidence:

        opencode run --model google-vertex-anthropic/claude-sonnet-4-6
    
  • Recommendation: Optionally annotate the diagram (e.g. 'opencode run --pure --model ...') or add a note that flags are elided for clarity, to keep the invocation depiction consistent with the Runtime sandbox section.

33. [LOW] council-review-action/docs/testing.md:23

Details
  • Agent: divisor-testing-code

  • Constraint: Documented counts SHOULD match the test file exactly.

  • Description: Verification (not a defect): scenario count = 31 (grep of '# Test N' yields 31, highest test number 31) and assertion count = 73 (67 assert_* helper calls + 6 manual PASS increments at lines 323,338,373,462,491,636, excluding the 3 helper-body increments at lines 33,46,57). Per-script coverage matrix is also exact. run-review.sh and prefetch.sh are correctly marked untested and are not referenced in test-pipeline.sh. AGENTS.md line 75 ('73 assertions') and README.md all match. No count discrepancy found; recorded as LOW/informational so the confirmed-accurate counts are on record.

  • Evidence:

    **Total: 31 scenarios, 73 assertions** (includes empty diff,
    
  • Recommendation: No change required for the counts; they are accurate.

34. [LOW] council-review-action/docs/testing.md:70

Details
  • Agent: divisor-curator-code (evidence corrected)

  • Constraint: Test descriptions must accurately reflect what each test verifies (documentation-discoverability).

  • Description: The Test 15 row describes 'no-subagent constraints', but the test verifies a 'no fix loops' assertion ('Do NOT iterate fix loops'), not a no-subagent one, and the generated prompt contains no subagent instruction. The label mislabels an existing constraint and references one that is not tested. This row is a pre-existing context line the diff did not modify, hence LOW.

  • Evidence:

    | 15 | Security instructions | Untrusted input warning, no-shell/no-subagent constraints |  vs Test 15 asserts: assert_contains "no shell commands" "Do NOT run shell commands"; assert_contains "no fix loops" "Do NOT iterate fix loops". build-prompt.sh contains no 'subagent' string.
    
  • Recommendation: Change the Test 15 description to 'Untrusted input warning, no-shell/no-fix-loop constraints' to match the actual assertions in test-pipeline.sh lines 383-385.

35. [LOW] council-review-action/scripts/build-prompt.sh:15

Details
  • Agent: divisor-curator-code

  • Constraint: Non-obvious constructs should carry a rationale comment.

  • Description: The prompt uses a quoted heredoc that suppresses expansion, and the untrusted PR title is injected separately via printf. The security reason for the split (keeping untrusted title out of an expandable heredoc, validated by test 31) is not stated. A maintainer could inadvertently fold the title into the heredoc and reintroduce an injection surface.

  • Evidence:

    cat > review_prompt.txt << 'PROMPT_STATIC'
    
  • Recommendation: Add a brief comment noting the quoted-heredoc + separate printf pattern is deliberate to preserve the untrusted PR title literally.

36. [LOW] council-review-action/scripts/extract-review-json.py:23

Details
  • Agent: divisor-testing-code

  • Constraint: Coverage completeness: new code path untested.

  • Description: The new argv-based input-file selection has no test; every invocation in test-pipeline.sh and the production caller parse-output.sh rely on the default. LOW because no production consumer exercises the argv path, but documented Usage advertises a behavior with no regression anchor.

  • Evidence:

    input_file = sys.argv[1] if len(sys.argv) > 1 else "review_text.txt"
    
  • Recommendation: Add one assertion invoking the script with an explicit custom input-file path and verify extraction succeeds.

37. [LOW] council-review-action/scripts/run-review.sh:22

Details
  • Agent: divisor-curator-code

  • Constraint: Inline cross-references should be internally consistent.

  • Description: Header comment labels this script as implementing layers 2+4, but it implements the permission config AND --pure, which per this repo's decisions.md/design.md are layers 1 and 2. The 2+4 numbering references external nunya#406 which a maintainer reading only this repo cannot reconcile. Not security-misleading (deny list is correct), only a stale/ambiguous cross-reference.

  • Evidence:

    # Defense-in-depth sandbox (layers 2+4, see nunya#406).
    
  • Recommendation: Align layer numbers with decisions.md/design.md or note the numbering follows nunya#406's scheme.

38. [LOW] council-review-action/scripts/run-review.sh:27

Details
  • Agent: divisor-guard-code

  • Constraint: Structural Coherence

  • Description: The inline comment describes the edit denial as covering 'no file writes' while the config denies edit but not the distinct write tool. This conflation reinforces the incorrect assumption that write is covered, compounding the documentation-vs-config drift noted in the HIGH finding.

  • Evidence:

    #   edit               — no file writes, edits, or patches
    
  • Recommendation: Clarify the comment to distinguish edit (modify existing) from write (create new). If write is intentionally not denied, say why; if it should be denied, add it to the config and comment.

39. [LOW] council-review-action/scripts/run-review.sh:84

Details
  • Agent: divisor-adversary-code

  • Constraint: A3 residual-risk: GOOGLE_APPLICATION_CREDENTIALS remains in environment and the credential file it points to is on disk while read/glob/grep are allowed.

  • Description: GH_TOKEN unset but GOOGLE_APPLICATION_CREDENTIALS cannot be. read/glob/grep intentionally allowed. env var value unreadable without bash/env, and external_directory:deny confines read/glob/grep to project dir. On GitHub-hosted runners the WIF credential file lands in RUNNER_TEMP outside the workspace. Documented accepted LOW residual risk (A3). Path depends on external_directory:deny being honored and credential file being outside project dir.

  • Evidence:

    unset GH_TOKEN 2>/dev/null || true
    
  • Recommendation: Document/assert that GOOGLE_APPLICATION_CREDENTIALS must resolve outside the OpenCode project/working directory so external_directory:deny actually gates the credential file.

40. [LOW] council-review-action/scripts/run-review.sh:88

Details
  • Agent: divisor-sre-code (evidence corrected)

  • Constraint: Runtime observability: a defense-in-depth control that can silently no-op should be verifiable.

  • Description: The permission sandbox depends on OpenCode honoring OPENCODE_CONFIG_CONTENT while --pure is set. No runtime assertion verifies the injected permission config was loaded. If a future OpenCode version changes --pure semantics or drops config precedence, the sandbox degrades silently while the pipeline exits 0. Version pin mitigates drift today but coupling is undetectable at runtime.

  • Evidence:

    timeout 300 opencode run --model "${MODEL}" --format json --pure --file review_prompt.txt
    
  • Recommendation: Add a lightweight post-invocation check or integration smoke test asserting a denied tool is actually rejected under the pinned version.

41. [LOW] council-review-action/scripts/run-review.sh:96

Details
  • Agent: divisor-curator-code (evidence corrected)

  • Constraint: Non-obvious magic values should be explained.

  • Description: The exit-code capture idiom and magic value 124 as the timeout sentinel are not explained. 124 is coreutils timeout's exit code; a maintainer unfamiliar with that convention cannot tell why 124 is special.

  • Evidence:

    if [[ "${OPENCODE_EXIT}" -eq 124 ]]; then echo "::warning::OpenCode timed out after 300s"
    
  • Recommendation: Add a one-line comment noting timeout exits 124 when it kills the command after the limit.

42. [LOW] council-review-action/scripts/run-review.sh:104

Details
  • Agent: divisor-sre-code (evidence corrected)

  • Constraint: Runtime observability: distinct failure modes should remain distinguishable downstream.

  • Description: A 300s timeout (exit 124) and a non-zero OpenCode failure both fall through to the empty-output branch producing an identical No output payload with zero exit. Warning annotations preserve the distinction in logs, but the emitted artifact carries no signal of why the review is empty (timeout vs crash vs empty response).

  • Evidence:

    if [[ ! -s review_raw.txt ]]; then echo "::warning::OpenCode produced no output"; echo '{"summary": "No output.", "inline_comments": []}' > review_raw.txt; fi
    
  • Recommendation: Embed the failure mode in the fallback summary so the review artifact is self-diagnosing.

43. [LOW] council-review-action/test/test-pipeline.sh:14

Details
  • Agent: divisor-sre-code (evidence corrected)

  • Constraint: Runtime observability: pre-flight should cover the actual hard dependencies so a missing tool yields the FATAL message rather than a mid-run opaque failure.

  • Description: The pre-flight guard covers python3 and jq (the non-baseline deps) which is the high-value case, but grep/sed/wc/tr are also required. On a minimal container image lacking these, the failure would surface as a confusing mid-test error instead of the intended 'FATAL: required' message. POSIX-baseline assumption is reasonable, so this is informational.

  • Evidence:

    Pre-flight loop checks only `for tool in python3 jq`. The suite also invokes grep (line 44), sed (line 369), wc (line 456), tr (line 456), mktemp (line 23) — none are pre-flight-guarded.
    
  • Recommendation: Optionally extend the pre-flight loop to include the coreutils actually used (grep sed wc tr), or add a comment stating the POSIX-baseline assumption explicitly.

44. [LOW] council-review-action/test/test-pipeline.sh:371

Details
  • Agent: divisor-testing-code (evidence corrected)

  • Constraint: Assertion Quality — meaningfulness filter: prefer assertions that fail on plausible regressions.

  • Description: The -le 200 bound passes for any length 0..200, so it would still pass if a regression produced an empty or wrong-length title (e.g. off-by-one or a bad sed). Given the input is exactly 300 'x' chars truncated to 200, the expected value is deterministic.

  • Evidence:

    Test 14 truncation check: `if [[ "${TITLE_LEN}" -le 200 ]]; then PASS ...`. build-prompt.sh truncates via `PR_TITLE="${PR_TITLE:0:200}"` (line 13).
    
  • Recommendation: Assert exact length [[ "${TITLE_LEN}" -eq 200 ]] (and optionally that the content is all 'x') so truncation regressions that yield <200 chars are caught.

45. [LOW] council-review-action/test/test-pipeline.sh:401

Details
  • Agent: divisor-sre-code (evidence corrected)

  • Constraint: Test isolation / cleanup: temp dirs should be removed even on early abort.

  • Description: Auxiliary temp directories (PARSE_DIR, EMPTY_DIR, ATTEMPT_DIR) are cleaned only on the happy path. If an intermediate command errors under set -e, the script exits before their rm -rf, leaving /tmp artifacts. Harmless on ephemeral CI runners but real for local/repeated runs.

  • Evidence:

    Per-test temp dirs use `PARSE_DIR=$(mktemp -d)` ... `rm -rf "${PARSE_DIR}"` at end of each block (lines 401,431,448,573,595,622,638,708), but only the main WORK_DIR (line 24) is protected by `trap 'rm -rf "${WORK_DIR}"' EXIT`. Under `set -euo pipefail` (line 11), a command-substitution failure (e.g. jq/grep) between `mktemp -d` and the matching `rm -rf` aborts the script, leaking those dirs.
    
  • Recommendation: Register each auxiliary dir with the EXIT trap (accumulate into a cleanup list) or reuse subdirectories under the already-trapped WORK_DIR instead of independent mktemp -d roots.

46. [LOW] council-review-action/test/test-pipeline.sh:530

Details
  • Agent: divisor-sre-code (evidence corrected)

  • Constraint: Test runner robustness: tests should not silently depend on artifacts from prior test cases.

  • Description: Test 23 has a hidden ordering dependency on Test 14's output file. If Test 14 is reordered, renamed, or its output path changes, Test 23 will assert against stale or missing state rather than failing loudly. The coupling is documented but still fragile.

  • Evidence:

    Test 23 comment: 'Reads prompt file generated by Test 14 (intentional — the schema section is static and independent of PR title).' Test 23 reads "${WORK_DIR}/prompt-test/review_prompt.txt" (line 534) which is produced by Test 14 (lines 365-367).
    
  • Recommendation: Have Test 23 generate its own prompt via build-prompt.sh (as Tests 13/31 do) so each case is self-contained, or assert the source file's freshness before reading.

47. [LOW] council-review-action/test/test-pipeline.sh:631

Details
  • Agent: divisor-testing-code (evidence corrected)

  • Constraint: Assertion Quality — assertions should verify the specific expected behavior, not just a generic outcome shared by unrelated failure paths.

  • Description: Test 27's exit-code-only assertion cannot distinguish 'exceeded parse attempts' (the behavior it names) from the generic 'no valid JSON found' rejection already covered by Test 12. If the MAX_PARSE_ATTEMPTS guard were removed, this exact input ({"a":1} x600, none with required keys) would still exit 1 via the normal loop-exhaustion path, so the test would still pass — it does not actually lock down the parse-attempt cap as a distinct behavior.

  • Evidence:

    Test 27 asserts only the process exit code: `if (cd ... python3 .../extract-review-json.py > /dev/null 2>&1); then FAIL ... else PASS: rejects input exceeding parse attempts`. The comment claims it exercises MAX_PARSE_ATTEMPTS, and it does (verified: stderr emits 'Exceeded 500 parse attempts'), but the assertion never inspects stderr.
    
  • Recommendation: Capture stderr and assert it contains 'Exceeded' / 'parse attempts' (e.g. ERR=$(... 2>&1 >/dev/null); assert_contains ... "parse attempts" "${ERR}") so the test fails if the cap is removed or renamed.

48. [LOW] docs/decisions/001-opencode-over-claude-cli.md:36

Details
  • Agent: divisor-sre-code

  • Constraint: Operational documentation should describe the invocation flow that is actually used, so operators debugging a run are not misled about how the review is launched.

  • Description: ADR-001 states slash commands are reused in CI 'via --command', but the actual runtime invocation in run-review.sh (line 88-94) uses opencode run --model ... --format json --pure --file review_prompt.txt — there is no --command flag; methodology files are referenced from within the prompt text built by build-prompt.sh. The --command path is also listed as unresolved in this same ADR's Deferred Work table (line 65). The claim describes an approach that was not adopted. (Note: this file is not modified by this PR, so this is a pre-existing documentation drift surfaced during review.)

  • Evidence:

    - Slash commands (`/review-council`, `/review-pr`) reusable in CI
      via `--command`
    
  • Recommendation: Update ADR-001 to reflect the implemented --file review_prompt.txt invocation (methodology files referenced inside the prompt), and reconcile with the Deferred Work row that still lists --command review-council as untested.

49. [LOW] internal/scaffold/assets/opencode/agents/divisor-adversary.md

Details
  • Agent: divisor-adversary-code (evidence corrected)

  • Constraint: Defense-in-depth completeness: agent-level frontmatter should mirror the runtime deny set for tools reachable by subagents.

  • Description: Runtime OPENCODE_CONFIG_CONTENT denies edit, bash, webfetch, websearch, skill, external_directory, doom_loop, but migrated Divisor agent frontmatter denies only edit/bash/webfetch. Since task is intentionally NOT denied, the orchestrator spawns these subagents. design.md D3 claims subagents sandboxed by their own permission frontmatter, but frontmatter omits websearch and skill. Global config plus --pure still deny these at runtime, so practical exfiltration path is closed; this is a frontmatter consistency gap, not a reachable vulnerability.

  • Evidence:

    +permission:
    +  edit: deny
    +  bash: deny
    +  webfetch: deny
    
  • Recommendation: Add websearch: deny and skill: deny to the review-focused Divisor agent frontmatter so the agent-level layer matches the runtime deny set.

50. [LOW] internal/scaffold/scaffold_test.go:41

Details
  • Agent: divisor-testing-code (evidence corrected)

  • Constraint: Drift coverage for security-relevant embedded assets (AGENTS.md Testing Conventions: 'Tests MUST verify embedded assets match canonical sources').

  • Description: Drift coverage exists and the migration correctly updated both mirrored trees identically, so the drift anchor keeps working. This is a positive confirmation, not a defect — but note the drift test only guarantees the two copies agree, not that either copy has correct permission semantics (see the MEDIUM finding). If a reversion were applied to BOTH trees identically, the drift test would remain green.

  • Evidence:

    TestEmbeddedAssets_MatchSource compares embedded vs canonical byte-for-byte: `if !bytes.Equal(embedded, source) { t.Errorf("drift detected...") }`. Verified via diff -q that all 9 divisor-*.md files are byte-identical across .opencode/agents/ and internal/scaffold/assets/opencode/agents/, so this test stays green for the migration.
    
  • Recommendation: No change required for drift coverage. The semantic gap is tracked in the MEDIUM finding above.

51. [LOW] openspec/changes/council-review-sandbox/design.md:135

Details
  • Agent: divisor-curator-code

  • Constraint: Traceability of per-agent deny choices

  • Description: Decision D6 documents the review agents' policy precisely ('deny edit, bash, webfetch') but the content-agent policy is left as a single vague sentence. It does not record why Curator ships 'edit: deny, webfetch: deny' (dropping the old explicit 'bash: true') while Envoy/Herald/Scribe ship 'bash: deny, webfetch: deny' (dropping the old 'write: true, edit: true' which now default back to allow). The four content agents received three DIFFERENT resulting permission sets, and the design record does not make those individual choices traceable.

  • Evidence:

    - Content agents (curator, envoy, herald, scribe): deny only
      what they shouldn't use for interactive work
    
  • Recommendation: Expand D6 with a small table mapping each of the four content agents to its final deny set and one-line justification, so the deny choices are auditable against the shipped files.

52. [LOW] openspec/changes/council-review-sandbox/specs/council-review-sandbox.md:116

Details
  • Agent: divisor-curator-code

  • Constraint: Markdown structural correctness; documentation discoverability.

  • Description: Two #### Scenario: headings wrap across two physical lines (also at line 125, 'Content agent frontmatter (curator, envoy,\n herald, scribe)'). A Markdown ATX heading is single-line; the continuation line renders as body text rather than part of the heading, breaking heading anchors and TOC generation for these scenarios.

  • Evidence:

    #### Scenario: Review agent frontmatter (adversary, architect,
      guard, sre, testing)
    
  • Recommendation: Join each wrapped #### Scenario: heading onto a single line so it renders as one heading.

53. [LOW] openspec/changes/council-review-sandbox/tasks.md:99

Details
  • Agent: divisor-sre-code

  • Constraint: Runtime-behavior changes should have an integration validation path, and untested runtime scripts should be flagged as an operational gap.

  • Description: This change bumps opencode-ai across 13 minor versions (1.2.26 -> 1.15.13, action.yml:57) and adds a new runtime permission config plus --pure, all of which alter the opencode run runtime path. Per testing.md, run-review.sh is 'No (requires OpenCode + Vertex AI)' — it has no automated coverage — so the only end-to-end confirmation that the new sandbox preserves review quality and multi-agent operation is task 5.5, which is deferred out of this repo to org-infra integration testing. The deferral is explicitly documented and non-blocking, but it means this PR merges with zero executed verification of its primary runtime change within this repo.

  • Evidence:

    - [ ] 5.5 E2E test PR to confirm review quality is maintained
      (deferred to integration testing via org-infra)
    
  • Recommendation: Keep the deferral but add a tracking reference (org-infra issue number) next to task 5.5 so the integration gate is auditable, and note in decisions.md 'Runtime sandbox' that the 1.2.26->1.15.13 jump + --pure have not been E2E-validated in-repo, pending the org-infra integration run.

- Add sandbox config tests (Tests 32-35): Vertex/non-Vertex
  provider config, MODEL metachar rejection, agent frontmatter
  permission syntax (18 new assertions, 73->91 total)
- Fix assert_contains/assert_not_contains to handle patterns
  starting with -- (grep end-of-options)
- Add timeout 10 to all gh calls in prefetch.sh for parity
- Fix quickstart.md to use SHA-pinned ref instead of @main
- Clarify quickstart.md agents-pattern scope (mode detection only)
- Fix testing.md Test 15 description: no-fix-loop not no-subagent
- Clarify design.md D6: edit permission covers write/edit/patch
- Clarify proposal.md: list actual deny keys not 'write/execute'
- Fix security-risks.md A3: shell-based access not 'all tool paths'
- Fix architecture.md: add --pure to auth diagram, rewrite
  credential claim to reference external_directory and RUNNER_TEMP
- Fix decisions.md: clarify edit covers write/edit/patch
- Fix run-review.sh: descriptive sandbox label, clarify edit
  comment, add exit-code-124 comment
- Add security rationale comment for quoted heredoc in build-prompt.sh

Signed-off-by: sonupreetam <[email protected]>
@sonupreetam
sonupreetam requested a review from a team as a code owner August 6, 2026 10:42
@sonupreetam

Copy link
Copy Markdown
Contributor Author

Thanks @trevor-vaughan for the thorough review. Impressive depth —
53 findings across the full surface area. I went through every one.
Here’s the disposition and what I’ve pushed in response.

The write permission question (Findings 1-7, 10-11, 13, 24, 26-27, 30, 38, 49)

The core thesis across 7 HIGH and several MEDIUM findings is that
dropping tools: { write: false } without adding permission: { write: deny } silently re-enables the Write tool.

This is a false positive. Per OpenCode’s permission docs:

edit — all file modifications (covers edit, write, patch)

In OpenCode’s permission system, write is not a separate
permission key. The edit permission governs the Edit tool, Write
tool, and Patch tool together. So permission: { edit: deny }
blocks all three — including file creation. The old tools: { write: false, edit: false } mapped to a single permission: { edit: deny }.

The LLM review inferred that write and edit are separate
permission keys because the deprecated tools: frontmatter
listed them separately. The new permission: system unified them.

What I’ve done: Added an explicit clarifying line in
design.md D6 documenting that edit covers write and patch
with a link to the OpenCode docs, so future reviewers don’t hit
the same confusion. Also clarified the wording in decisions.md,
proposal.md, and run-review.sh comments to be precise about
what edit: deny covers.

Valid findings addressed

# Finding What I did
14 quickstart.md agents-pattern doesn’t affect prompt Added caveat that pattern only affects multi/single mode detection
15 quickstart.md uses @main instead of SHA pin Changed to SHA-pinned ref (dc82f77...@main)
16 security-risks.md A3 overstates "blocks all tool paths" Reworded to "blocks shell-based access" and documented the read tool + external_directory: deny + credential file location
17 testing.md Test 15 says "no-subagent" but that assertion was removed Fixed to "no-shell/no-fix-loop constraints"
18 testing.md says run-review.sh is not locally testable Split: config generation is now tested via stub; live denial observation remains integration-only
20 prefetch.sh inconsistent timeout wrapping Added timeout 10 to all 4 remaining gh calls
21-23, 28-29 run-review.sh sandbox config has zero test coverage Added Tests 32-35: Vertex config, non-Vertex config, MODEL metachar rejection, agent frontmatter syntax (18 new assertions, 73→91 total)
32 architecture.md diagram missing --pure Added --pure to the auth flow diagram
35 build-prompt.sh quoted heredoc not explained Added comment explaining the security rationale
37 run-review.sh layer numbering references external nunya#406 Changed to descriptive label
38 run-review.sh "no file writes" comment conflates edit/write Clarified that edit covers edit, write, and patch tools per OpenCode docs
41 run-review.sh exit code 124 unexplained Added comment about coreutils timeout sentinel

Valid findings not addressed (intentional deferral)

# Finding Reason
11 architecture.md credential claim Addressed — rewrote to reference external_directory: deny and RUNNER_TEMP
12 decisions.md deny-list omits external_directory/doom_loop The paragraph immediately following explains these. Redundant to repeat in the summary enumeration.
19 Invalid UTF-8 test for extract-review-json.py Valid gap but low priority — errors=replace is a safety net, not a feature. Can address separately.
25 --pure + multi-agent coexistence not verified in-repo Verified via org-infra E2E (complytime/org-infra#427). Adding a local verification would require a live OpenCode install.
44 Test 14 truncation uses -le 200 not -eq 200 Agree the assertion is weak but not a regression risk. Can tighten separately.
45-46 Temp dir cleanup / test ordering Agreed, but cleanup-on-error is cosmetic for CI runners. Can address in a follow-up.
47 Test 27 exit-code-only assertion Valid but low priority — the test does exercise the code path, just doesn’t inspect stderr.
48 ADR-001 mentions --command but we use --file Pre-existing doc drift, not introduced by this PR.
51 design.md D6 doesn’t itemize per-agent deny sets Can add if the table adds clarity, but the deny sets are already visible in the agent files themselves.
53 tasks.md 5.5 deferred without org-infra issue ref E2E evidence is complytime/org-infra#427, already linked in the PR body.

Informational findings (no action needed)

# Finding Note
9 Curator bash access now implicit not explicit Correct — bash defaults to allow in OpenCode. The Curator’s bash restriction section still documents the allowed operations. Intentional.
33 Assertion/scenario counts verified Confirmed accurate (now 35/91 after new tests)
50 Drift test confirms both trees match Working as intended

All tests pass: make check (Go) + bash council-review-action/test/test-pipeline.sh (91 assertions, 0 failures).

@trevor-vaughan

Copy link
Copy Markdown

Thanks @sonupreetam, this seems good to me and I appreciate you making the updates.

For the items that are deferred, would you mind dropping the ones you think we should do into follow on issues that link back to this one as the source?

We might want to think about 48 - ADR-001 mentions --command but we use --file a bit somewhere else. I think this is a side effect of the constitution and AGENTS.md file making doc drift a "critical". That both makes the LLM dig through the entire history every time and bubbles up things like this regardless of the context.

@jflowers jflowers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

/uf.review-pr — PR #425 Review

Verdict: COMMENT

Overall this PR correctly implements a three-layer runtime sandbox for the council-review-action. The implementation is well-documented, backed by 13 new test assertions (60→73), and the security reasoning is sound. Two informational findings below.

Findings

  1. [MEDIUM] jq right-side-wins merge semantics in run-review.sh undocumented — see inline comment.

  2. [LOW] Agent frontmatter omits websearch: deny — All 9 Divisor agent files (.opencode/agents/divisor-*.md) deny edit, bash, and webfetch in their permission: frontmatter, but do not include websearch: deny. The runtime PERMISSION_CONFIG in run-review.sh correctly denies all five tools including websearch. This is intentional by design — the spec explicitly limits agent-level denials to those three tools, and decisions.md documents the runtime config as the hard boundary (Layer 1) while agent frontmatter is defense-in-depth (Layer 3). The asymmetry is worth acknowledging in a brief note in the agent frontmatter section of decisions.md.

This review was generated by /uf.review-pr (AI-assisted).

- Document jq right-side-wins merge semantics in run-review.sh
  to prevent future key-collision bugs (Finding 1)
- Acknowledge frontmatter deny asymmetry in decisions.md:
  agent Layer 3 intentionally omits websearch/skill, which
  are denied only at the runtime Layer 1 (Finding 2)

Signed-off-by: sonupreetam <[email protected]>
@sonupreetam

sonupreetam commented Aug 10, 2026 •

Copy link
Copy Markdown
Contributor Author

@trevor-vaughan Filed follow-on issues for the deferred items:

Finding Issue Priority
19 #446 — Invalid UTF-8 input test for extract-review-json.py Medium
44, 45-46, 47 #447 — Council review action test quality improvements Low
48 #448 — ADR-001 --command vs --file doc drift Low
51 #449 — Per-agent deny set table in design.md D6 Low

Re: finding 48 and the doc drift severity — agreed, this is worth discussing. The constitution's "critical" classification for doc drift doesn't distinguish between "drift introduced by this change" and "pre-existing drift surfaced during review." The LLM reviewer correctly flagged ADR-001 as stale, but it's a pre-existing issue unrelated to this PR. I've noted that distinction in #448 so we can think about whether the severity rules need a "pre-existing" qualifier or whether the reviewer should scope findings to the PR's own changes.


Re: @jflowers review

Thanks for the review. Addressed both findings in 5887692:

Finding 1 (MEDIUM) — jq right-side-wins merge semantics: Added a 5-line comment to run-review.sh documenting the merge behavior and the constraint that permission must never appear in the Vertex-specific right-side block. Currently safe (no key overlap), but the comment prevents a future maintainer from accidentally overwriting the deny config.

Finding 2 (LOW) — Agent frontmatter omits websearch: deny: Added a note to decisions.md Layer 3 acknowledging the asymmetry is intentional — agent frontmatter focuses on the three highest-risk tools (edit, bash, webfetch), while websearch and skill are denied only at Layer 1 (runtime OPENCODE_CONFIG_CONTENT).

Also filed two process issues from the post-mortem on why the review council didn't catch these before submission:

Issue Description
#451 /uf.finale should warn when no review council was run (the gap that let this PR ship without pre-PR review)
#452 Pre-commit checks for common code comment gaps (jq merge semantics, magic numbers, heredoc rationale)

@sonupreetam
sonupreetam requested a review from jflowers August 10, 2026 18:02

@jflowers jflowers left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@sonupreetam
sonupreetam merged commit 762cac7 into unbound-force:main Aug 11, 2026
15 checks passed
@sonupreetam
sonupreetam deleted the opsx/council-review-sandbox branch August 11, 2026 08:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat: runtime sandbox for council-review-action

3 participants