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
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:
1 parent
783c9ccda3
commit
f8d128705f
1 file changed
+13
-4
@@ -252,10 +252,19 @@ jobs:
|
|||||||
"opencode-go": {
|
"opencode-go": {
|
||||||
"options": { "apiKey": "%s" }
|
"options": { "apiKey": "%s" }
|
||||||
}
|
}
|
||||||
|
},
|
||||||
|
"permission": {
|
||||||
|
"edit": "deny",
|
||||||
|
"bash": "deny",
|
||||||
|
"webfetch": "deny"
|
||||||
}
|
}
|
||||||
}' "$OPENCODE_API_KEY" > opencode.json
|
}' "$OPENCODE_API_KEY" > opencode.json
|
||||||
# --print-logs: surface auth/provider errors in the CI log instead
|
# --print-logs: surface auth/provider errors in the CI log instead
|
||||||
# of failing with an opaque exit code
|
# 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 \
|
opencode run \
|
||||||
--print-logs \
|
--print-logs \
|
||||||
--model opencode-go/deepseek-v4-pro#max \
|
--model opencode-go/deepseek-v4-pro#max \
|
||||||
@@ -325,12 +334,12 @@ jobs:
|
|||||||
End your response with a final verdict line, exactly one of:
|
End your response with a final verdict line, exactly one of:
|
||||||
VERDICT: APPROVE (no BLOCKER findings)
|
VERDICT: APPROVE (no BLOCKER findings)
|
||||||
VERDICT: REQUEST_CHANGES (at least one BLOCKER)" \
|
VERDICT: REQUEST_CHANGES (at least one BLOCKER)" \
|
||||||
> /tmp/review.md 2>&1
|
> /tmp/review.md 2>&1 || EXIT_CODE=$?
|
||||||
EXIT_CODE=$?
|
# always show the output - never swallow the error text
|
||||||
cat /tmp/review.md
|
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"
|
echo "::error::opencode review failed (exit ${EXIT_CODE}) - NOT posting this output as a review comment"
|
||||||
exit $EXIT_CODE
|
exit "$EXIT_CODE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
- name: Post review as PR comment
|
- name: Post review as PR comment
|
||||||
|
|||||||
Reference in new issue
Block a user