feat(review): operator OpenCode config overlay + file-based base (ADR-0099) - #464
Conversation
|
✅ AI Governance check passedThis PR declares AI usage, references a source of truth, and provides verification evidence. Thank you. |
There was a problem hiding this comment.
Code Review
This pull request implements ADR-0099, introducing support for operator-supplied OpenCode config overlays (review.opencode) in review runs. It adds a base review.jsonc configuration file, updates the agent runner configuration to parse, fallback, and redact overlays (scrubbing inline credentials), and enhances the review agent to deep-merge overlays with base and runtime configurations. It also adds floor breach detection to warn when an overlay relaxes read-only or mediated coverage invariants, along with comprehensive unit and integration tests. There are no review comments to address, and no additional feedback is provided.
Important
The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.
…-0099) Move the review OpenCode config off the Rust `json!` blob onto a checked-in, human-readable `integrations/opencode/config/review.jsonc` base (mirroring `open` mode), and add a trusted operator overlay merged host-side with full override. Three layers, last-writer-wins, merged in Rust so the untrusted checkout is never a config source (ADR-0097 #6 reaffirmed): 1. base — review.jsonc (invariants + {env:*}/{file:*} placeholders), baked in via include_str!; opencode resolves the placeholders at load. 2. runtime injection — attribution headers (#89, dynamic keys), the tier reasoning flag (ADR-0069), temperature; the per-task system prompt is written to review-prompt.md beside the config and referenced {file:*}. 3. operator overlay — `review.opencode` from ai-helm-values (trusted), deep-merged LAST with full override (objects recurse; arrays/scalars replace). Full override is intentional; the system makes relaxations visible, not impossible: render diffs the merged config against the base floor and WARNs each relaxation (built-in re-enabled, permission opened, lightbridge MCP or a plugin dropped/replaced), and notes it on the review's coverage disclosure. The overlay is captured (redacted) in the run-config audit trail. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
d1a7ec5 to
6bb571d
Compare
1. Summary
This PR changes:
json!blob inrender_review_configonto a checked-in, human-readable base atintegrations/opencode/config/review.jsonc(mirrors theopen-mode precedent). It carries the invariants + defaults with a documented injection/override header.review.opencodein ai-helm-values, surfaced asReviewFile.opencode→ReviewConfig.opencode_overlay), deep-merged last over base+injection with full override (objects merge recursively; arrays/scalars from the overlay replace ours).lightbridgeMCP or a required plugin dropped/replaced) istracing::warn!'d and noted on the review's coverage disclosure. The overlay is captured (redacted) in the run-config audit trail.It solves:
docs/adr/0099-operator-opencode-config-overlay.md, merged in docs(adr): ADR-0099 operator OpenCode config overlay for review (file-based base + full override) #460). Operators could not read or extend the reviewer's OpenCode surface (model, sub-agents, permissions) without reading Rust.2. Intent
The intent of this PR is:
3. Scope
In Scope
integrations/opencode/config/review.jsonc(new base) + Rust loader (jsonc comment strip,include_str!), deep-merge helper, floor-diff.opencodeoverlay field on the file/resolved config with tier→flat fallback, and its redaction in the audit trail.{file:*}(was inlined), per ADR-0099.Out of Scope
config.review.opencodein the values schema) — a separate PR in the ai-helm repo; the runner already accepts the field.run_native_agentpath (separate in-flight task; still present inmain).4. Verification
I verified this change by:
Commands run:
Results:
Key new tests: overlay adds a sub-agent → present in the merged config, no breach; overlay flips
permission.bashtoallow→ merged config reflects it AND the floor warning fires; empty/absent overlay → byte-identical to base+injection (no behaviour change); jsonc comment-strip preserves//inside strings ($schemaURL); deep-merge recurses objects and replaces arrays/scalars; an inlined credential in the overlay is redacted in the audit trail.5. Screenshots / Evidence
opencode debug configresolves{env:*}and{file:./review-prompt.md}inagent.review.promptat config load (config-dir-relative), and rejects unknown keys — so the base must be real.jsonc(verified), and inline→{file:*}for the prompt is behaviour-neutral (opencode works from the already-substituted config either way).buildagent, which is why the built-in disables are top-level (load-bearing) and hold under the base.6. Risk Assessment
Risk level:
Potential risks:
{file:*}inagent.review.prompt.Mitigation:
{file:*}prompt resolution proven equivalent to inline against real opencode; the prompt file is co-located with the config so the relative reference always resolves. The base isinclude_str!'d (compile-time), so no new runtime file dependency and no Dockerfile change.7. AI Usage Declaration
AI was used for:
Human verification:
8. Reviewer Focus
Please focus your review on:
services/review-agent/src/opencode/config.rs(full-override semantics; the floor is derived from the base so it can't drift).services/agent-runner/src/bootstrap/config/review.rs(review.opencodereaches both tiers; a per-tier block overrides).