Fix effective permissions for inline review submission#35
Conversation
dceoy
left a comment
There was a problem hiding this comment.
Blocking findings:
- The new Bats test only asserts that a literal
review-state/*entry exists. It does not exercise OpenCode's runtime permission evaluation or prove that the orchestrator can now writeinitial.json, which is the behavior that failed silently in #34. Add a focused integration/regression test that runs the relevant OpenCode permission/write path (or an equivalent executable permission-evaluation test), so the test fails when structured payload creation is denied. .opencode/commands/review-pr.mdstill states that the three fixed review-state JSON files are the sole allow-listed external paths. That is no longer accurate after allowing the entire directory wildcard. Update this security-boundary instruction to match the actual configuration while retaining the agent-level edit restriction toinitial.jsonandupdate.json.
CI is green, and I found no issue with the wildcard ordering or the existing agent-level edit constraints. GitHub does not allow requesting changes on one's own PR, so this is submitted as a comment review but should be treated as blocking.
|
I have completed my analysis. Unfortunately, I cannot submit this review through the structured review process (initial.json write is denied by the runtime permission system — the very issue this PR aims to fix). I will present my findings here instead. Review of PR #35: "fix inline review submission"SummaryThe PR correctly identifies the root cause (directory-wildcard access pattern vs. individual file-path allow-listing) and the three documentation/config changes are accurate. However, I found three actionable issues in the new regression test. Finding 1 (critical) —
|
dceoy
left a comment
There was a problem hiding this comment.
PR Review Summary
Important Issues
-
[MEDIUM][Confidence: HIGH][behavioral test coverage] The new executable permission regression currently fails on the reviewed head —
.agents/skills/local-qa/scripts/validate-opencode.bats:139- Impact: The PR’s primary claim is that OpenCode can write the structured review payload while denying unrelated external writes, but the current-head
bats-test / testjob fails in the newly added runtime regression. The intended fix therefore is not verified and the branch does not satisfy its own required validation. - Recommendation: Inspect the failing Bats output, correct the test invocation/configuration or the permission rules as appropriate, and require the runtime regression to pass on OpenCode 1.2.14 before merging.
- Impact: The PR’s primary claim is that OpenCode can write the structured review payload while denying unrelated external writes, but the current-head
Checked
- Effective
external_directoryrules in the global config andreview-pr-orchestratoragent. - The agent-level edit restriction for
initial.jsonandupdate.json. - Updated command and README descriptions of the review-state directory boundary.
- The executable positive and negative permission regression added to
validate-opencode.bats. - Current-head CI for
fb4d03b13e94d4470594ba0e9ce3e88df771a186: shell lint, workflow/security scans, CodeQL, and YAML lint pass;bats-test / testfails. - Existing review discussion; the earlier missing-runtime-test and stale-documentation findings are addressed by the current diff.
Recommended Action
Do not merge until the current-head Bats regression passes and demonstrates the intended structured-review write path.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: b30b675cc8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
The structured review was submitted successfully. The review is now live at #35 (review) as Four inline findings were submitted, covering the three actionable issues found in the new Bats regression test:
|
dceoy
left a comment
There was a problem hiding this comment.
No blocking findings on the current head.
The effective permission chain is now covered at the relevant boundaries: the runtime review-state directory is allowed for external_directory, the orchestrator repeats that allow-list despite its agent-level catch-all deny, and edit remains restricted to initial.json and update.json through both path forms observed on the runner.
The new Bats case executes the actual OpenCode 1.2.14 review-pr-orchestrator write path, verifies initial.json is created, and confirms an unrelated external write remains denied. The current PR workflow also successfully produced inline review comments, providing end-to-end evidence that the structured submission path no longer falls back as described in #34.
The unresolved requests for an additional edit invocation, an update.json case, stronger mktemp handling, and retaining temporary files on assertion failure are not merge blockers. OpenCode's write tool is governed by the edit permission, the issue's failing path is the initial payload, and the remaining items are incremental test-hardening rather than correctness gaps.
Fixes #34.
What changed
$HOME/.config/opencode/review-state/*directory pattern in the global OpenCode config.review-pr-orchestrator, because agent-level permissions override the global rules.$HOMEpath and the worktree-relative path used by the write tool.review-pr-orchestratorwrite path with OpenCode, including a negative assertion for unrelated external files.Root cause
The structured review payload write crossed three permission checks that the previous configuration and tests did not model correctly:
$HOME/.config/opencode/review-state/*, which did not match the previous individual-fileexternal_directoryentries.review-pr-orchestratordeclarespermission."*": deny. Agent rules take precedence over global rules, so the agent-level wildcard deniedexternal_directoryeven after the global directory wildcard was added.editagainst a path relative to the worktree. The existing absolute$HOME/.../initial.jsonandupdate.jsonrules therefore did not match on the Linux Actions runner.As a result,
initial.jsonwas not created,review-pr-submit.sh submit-initialwas never reached, andopencode github runpublished the model output as a top-level comment while the workflow still concluded successfully.Validation
review-pr-orchestratorwrite tool.review-state/initial.json.