fix(ci): deny write tools, never swallow review errors
PR Check / Security scan (Snyk) (pull_request) Skipped
PR Check / ESLint (pull_request) Successful in 34s
PR Check / Typecheck (pull_request) Successful in 37s
PR Check / Secret scan (gitleaks) (pull_request) Successful in 6s
PR Check / Dependency audit (pull_request) Failing after 8s
PR Check / Dockerfile lint (droast) (pull_request) Failing after 4s
PR Check / AI code review (opencode) (pull_request) Successful in 3m9s

- deny edit/bash/webfetch in the generated opencode.json: headless
  permission prompts are the most likely cause of the review agent
  working silently for minutes and then dying; denying write tools
  also makes the reviewer provably read-only
- capture the exit code without triggering 'set -e' ('|| EXIT_CODE=$?')
  so the captured output is always printed before failing - the
  previous version aborted before 'cat' and produced silent failures
This commit is contained in:
Noel Sabia committed 2026-10-18 17:34:17 +02:00
1 parent 783c9ccda3
commit f8d128705f
1 file changed
+13 -4
+13 -4
View File
@@ -252,10 +252,19 @@ jobs:
"opencode-go": {
"options": { "apiKey": "%s" }
}
},
"permission": {
"edit": "deny",
"bash": "deny",
"webfetch": "deny"
}
}' "$OPENCODE_API_KEY" > opencode.json
# --print-logs: surface auth/provider errors in the CI log instead
# of failing with an opaque exit code
# Read-only agent: denying edit/bash/webfetch means no headless
# permission prompts can hang or kill the run, and the reviewer
# physically cannot modify the repo.
EXIT_CODE=0
opencode run \
--print-logs \
--model opencode-go/deepseek-v4-pro#max \
@@ -325,12 +334,12 @@ jobs:
End your response with a final verdict line, exactly one of:
VERDICT: APPROVE (no BLOCKER findings)
VERDICT: REQUEST_CHANGES (at least one BLOCKER)" \
> /tmp/review.md 2>&1
EXIT_CODE=$?
> /tmp/review.md 2>&1 || EXIT_CODE=$?
# always show the output - never swallow the error text
cat /tmp/review.md
if [ $EXIT_CODE -ne 0 ]; then
if [ "$EXIT_CODE" -ne 0 ]; then
echo "::error::opencode review failed (exit ${EXIT_CODE}) - NOT posting this output as a review comment"
exit $EXIT_CODE
exit "$EXIT_CODE"
fi
- name: Post review as PR comment