fix: review action no longer fails on opencode session-share push denial (#129)#190
Conversation
…ial (#129) opencode's built-in 'share session' step runs `git add && git commit && git push` to the PR branch after the agent finishes. When the workflow declares `contents: read` (the documented read-only mode for review), the push fails with 403, causing the entire job to exit 1 even though the review comment was already posted successfully via the API. This was the issue reported in #129: the action advertises read-only operation but the job fails when the runner scope matches that contract. The wrapper now detects the specific push-denied markers in the captured log ("Write access to repository not granted", "Command failed with code 128: git push", or "fatal: unable to access ... error: 403") and converts the non-zero exit to 0 with a ::warning::. This is consistent with the existing cleanup-error-comments logic, which already auto-deletes the error comment that opencode posts in this scenario. Also: the fake opencode fixture gains FAKE_OPENCODE_PUSH_DENIED_MODELS so the test suite can exercise the new path.
|
最终决策:可合并 / CAN MERGE 无阻塞项,所有 reviewer 建议均为非阻塞改进。以下为去重整合后的问题。 阻塞项:无 建议项:
📋 各 Reviewer 详细审查结果quality可合并 / CAN MERGE 该 PR 正确实现了对 opencode session-share 阻塞项:无 建议项:
security存在风险 / AT RISK 该 PR 本身目的明确——在 opencode session-share 的 详细分析已确认无风险项
关注项阻塞项:无 建议项:
performance性能有疑虑 / CONCERNS 本次 PR 新增了 其他变更(模块级编译的正则匹配、 阻塞项:无 建议项:
architecture架构有疑虑 / CONCERNS 此 PR 的功能意图(push-denied 时不报错退出)是合理的,修改范围也相对集中,但存在如下问题: 阻塞项:无 虽然 建议项:
|
Fixes #129.
Problem
The
reviewaction advertisescontents: readas its documented permission, but the job still exits 1 when opencode's built-in 'share session'git pushstep is denied by the runner's token scope. The review comment itself was already posted via the API before the push attempt, so the failure is non-fatal — it just shouldn't be propagated.Fix
run-github-opencode.pynow detects the specific push-denied markers in the captured log and converts the non-zero exit to 0 with a::warning:::Write access to repository not grantedCommand failed with code 128: git pushfatal: unable to access '...': The requested URL returned error: 403This is consistent with the existing
cleanup-error-commentslogic, which already auto-deletes the error comment that opencode posts in this scenario — the wrapper was already acknowledging this class of failure as expected, it just wasn't reflecting that in its exit code.Tests
test_push_denied_treated_as_success: 403 push in single-model path → exit 0test_push_denied_with_fallback_skips_fallback: 403 push in primary → exit 0, fallback not consultedtest_unrelated_error_not_treated_as_push_denied: a genuine non-push error (e.g.deadline exceeded) still propagatesThe fake opencode fixture gained
FAKE_OPENCODE_PUSH_DENIED_MODELSto exercise the new path.Files
github-run-opencode/run-github-opencode.py— detection + exit 0 logictests/fixtures/fake-installer.sh—FAKE_OPENCODE_PUSH_DENIED_MODELStests/test_all.py— 3 new testsCHANGELOG.md— entry under[Unreleased]