This is an automated email from the ASF dual-hosted git repository.

zclll pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/doris.git


The following commit(s) were added to refs/heads/master by this push:
     new 0ceacf6c2e3 [fix](ci) Add error handling and PR notification for 
OpenCode review failures (#61334)
0ceacf6c2e3 is described below

commit 0ceacf6c2e385decb7d4b5bf9197febb905939b5
Author: zclllyybb <[email protected]>
AuthorDate: Mon Mar 16 10:07:29 2026 +0800

    [fix](ci) Add error handling and PR notification for OpenCode review 
failures (#61334)
    
    before it may silently fail. now try it best to return the status if
    failed.
---
 .claude/skills/code-review/SKILL.md   |  3 ++-
 .github/workflows/opencode-review.yml | 51 ++++++++++++++++++++++++++++++++++-
 2 files changed, 52 insertions(+), 2 deletions(-)

diff --git a/.claude/skills/code-review/SKILL.md 
b/.claude/skills/code-review/SKILL.md
index 2a3fd54e716..fcff7368bfc 100644
--- a/.claude/skills/code-review/SKILL.md
+++ b/.claude/skills/code-review/SKILL.md
@@ -34,10 +34,11 @@ Always focus on the following core invariants during review:
 ### 1.2 Review Principles
 
 - **Follow Context**: Match adjacent code's error handling, interface usage, 
and lock patterns unless a clearly better approach exists
-- **Reuse First**: Search for existing implementations before adding new ones; 
ensure good abstraction afterward
+- **Reuse First**: Search for existing implementations before adding new ones; 
ensure good abstraction afterward. For example, in the implementation of SQL 
functions in BE, we prefer to use an existing base template rather than 
implementing everything from scratch. The same principle applies to the 
implementation of other features. Common parts should be abstracted as much as 
possible.
 - **Code Over Docs**: When this skill conflicts with actual code, defer to 
code and note the mismatch
 - **Performance First**: All obviously redundant operations should be 
optimized away, all obvious performance optimizations must be applied, and 
obvious anti-patterns must be eliminated.
 - **Evidence Speaks**: All issues with code itself (not memory or environment) 
must be clearly identified as either having problems or not. For any erroneous 
situation, if it cannot be confirmed locally, you must provide the specific 
path or logic where the error occurs. That is, if you believe that if A then B, 
you must specify a clear scenario where A occurs.
+- **Review Holistically**: For any new feature or modification, you must 
analyze its upstream and downstream code to understand the real invocation 
chain. Identify all implicit assumptions and constraints throughout the flow, 
then verify carefully that the current change works correctly within the entire 
end-to-end process. Also determine whether a seemingly problematic local 
pattern is actually safe due to strong guarantees from upstream or downstream, 
or whether a conventional local im [...]
 
 ### 1.3 Critical Checkpoints (Self-Review and Review Priority)
 
diff --git a/.github/workflows/opencode-review.yml 
b/.github/workflows/opencode-review.yml
index 303228df82f..12db3ee067f 100644
--- a/.github/workflows/opencode-review.yml
+++ b/.github/workflows/opencode-review.yml
@@ -108,8 +108,57 @@ jobs:
           BASE_SHA: ${{ steps.pr.outputs.base_sha }}
 
       - name: Run automated code review
+        id: review
+        continue-on-error: true
         env:
           GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
         run: |
           PROMPT=$(cat /tmp/review_prompt.txt)
-          opencode run "$PROMPT" -m "github-copilot/claude-opus-4.6"
+
+          set +e
+          opencode run "$PROMPT" -m "github-copilot/claude-opus-4.6" 2>&1 | 
tee /tmp/opencode-review.log
+          status=${PIPESTATUS[0]}
+          set -e
+
+          last_log_line=$(awk 'NF { line = $0 } END { print line }' 
/tmp/opencode-review.log)
+
+          failure_reason=""
+          if printf '%s\n' "$last_log_line" | rg -q -i '^Error:|SSE read timed 
out'; then
+            failure_reason="$last_log_line"
+          elif [ "$status" -ne 0 ]; then
+            failure_reason="OpenCode exited with status $status"
+          fi
+
+          if [ -n "$failure_reason" ]; then
+            {
+              echo "failure_reason<<EOF"
+              printf '%s\n' "$failure_reason"
+              echo "EOF"
+            } >> "$GITHUB_OUTPUT"
+            exit 1
+          fi
+
+      - name: Comment PR on review failure
+        if: ${{ steps.review.outcome == 'failure' }}
+        env:
+          GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
+          FAILURE_REASON: ${{ steps.review.outputs.failure_reason }}
+          RUN_URL: ${{ github.server_url }}/${{ github.repository 
}}/actions/runs/${{ github.run_id }}
+        run: |
+          gh pr comment "${{ github.event.issue.number }}" --body "$(cat <<EOF
+          OpenCode automated review failed and did not complete.
+
+          Error: ${FAILURE_REASON}
+          Workflow run: ${RUN_URL}
+
+          Please inspect the workflow logs and rerun the review after the 
underlying issue is resolved.
+          EOF
+          )"
+
+      - name: Fail workflow if review failed
+        if: ${{ steps.review.outcome == 'failure' }}
+        env:
+          FAILURE_REASON: ${{ steps.review.outputs.failure_reason }}
+        run: |
+          echo "OpenCode automated review failed: ${FAILURE_REASON}"
+          exit 1


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to