From a6078426b08558908913533fb93c83a3533eb5a9 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 20 Aug 2026 16:16:40 +0000 Subject: [PATCH 1/5] Split Grok reviews into first-pass grok-4.6 and follow-up grok-build-0.1 First pass (opened, reopened, ready_for_review, workflow_dispatch) stays on grok-4.6 with default effort and max_turns 50. Synchronize follow-ups use grok-build-0.1, effort low, and 15 turns, and are told to review only the latest commit without re-litigating posted findings. Register both models in config.toml with quoted table keys so TOML does not nest dotted ids. Auth remains org XAI_API_KEY only. Co-authored-by: Fly Over Coder --- .github/workflows/grok-code-review.yml | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/.github/workflows/grok-code-review.yml b/.github/workflows/grok-code-review.yml index e5175ce..75e2e96 100644 --- a/.github/workflows/grok-code-review.yml +++ b/.github/workflows/grok-code-review.yml @@ -2,6 +2,11 @@ # Enforced via org ruleset "Require Grok code review" pointing at this file. # Auth: org-level XAI_API_KEY only (CLI env_key + https://api.x.ai/v1). # No SuperGrok session fallback. +# +# First pass (opened, reopened, ready_for_review, workflow_dispatch): grok-4.6, +# default effort, action-default max_turns (50). Do not set effort low. +# Follow-up (synchronize): grok-build-0.1, effort low, max_turns 15. The action +# still embeds the full PR diff; cheaper model + fewer turns is the control. name: Grok code review on: @@ -33,6 +38,10 @@ jobs: timeout-minutes: 30 env: XAI_API_KEY: ${{ secrets.XAI_API_KEY }} + GROK_MODEL: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && 'grok-build-0.1' || 'grok-4.6' }} + GROK_EFFORT: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && 'low' || '' }} + GROK_MAX_TURNS: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && '15' || '50' }} + GROK_CUSTOM_INSTRUCTIONS: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && 'Review only the latest commit. Do not re-litigate already-posted findings.' || '' }} steps: - name: Checkout PR head uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -56,6 +65,10 @@ jobs: model = "grok-4.6" base_url = "https://api.x.ai/v1" env_key = "XAI_API_KEY" + [model."grok-build-0.1"] + model = "grok-build-0.1" + base_url = "https://api.x.ai/v1" + env_key = "XAI_API_KEY" [models] default = "grok-4.6" EOF @@ -69,7 +82,10 @@ jobs: grok_auth_json: "{}" github_token: ${{ github.token }} pr_number: ${{ github.event.pull_request.number || github.event.inputs.pr_number }} - model: grok-4.6 + model: ${{ env.GROK_MODEL }} + effort: ${{ env.GROK_EFFORT }} + max_turns: ${{ env.GROK_MAX_TURNS }} + custom_instructions: ${{ env.GROK_CUSTOM_INSTRUCTIONS }} roast_level: professional fail_on: never status_comments: "true" @@ -82,6 +98,9 @@ jobs: echo "" echo "| Field | Value |" echo "| --- | --- |" + echo "| Model | \`${{ env.GROK_MODEL }}\` |" + echo "| Effort | \`${{ env.GROK_EFFORT }}\` |" + echo "| Max turns | \`${{ env.GROK_MAX_TURNS }}\` |" echo "| Verdict | \`${{ steps.grok.outputs.verdict }}\` |" echo "| Issues | \`${{ steps.grok.outputs.issue_count }}\` |" echo "| Bugs | \`${{ steps.grok.outputs.bug_count }}\` |" From 21dabc18cc184236e8b80a483e36dbcac927d28f Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 20 Aug 2026 16:26:56 +0000 Subject: [PATCH 2/5] Keep first-pass grok-4.6 when synchronize cancels an unfinished review A push during an in-flight opened/reopened/ready_for_review job aborted grok-4.6 and started grok-build-0.1 under instructions that assume findings were already posted. Cheap follow-up now requires both synchronize and a completed Grok status comment or review on the PR. Otherwise the replacement stays grok-4.6, default effort, and max_turns 50. cancel-in-progress is unchanged. Co-authored-by: Fly Over Coder --- .github/workflows/grok-code-review.yml | 59 ++++++++++++++++++++------ 1 file changed, 46 insertions(+), 13 deletions(-) diff --git a/.github/workflows/grok-code-review.yml b/.github/workflows/grok-code-review.yml index 75e2e96..02c16a0 100644 --- a/.github/workflows/grok-code-review.yml +++ b/.github/workflows/grok-code-review.yml @@ -5,8 +5,11 @@ # # First pass (opened, reopened, ready_for_review, workflow_dispatch): grok-4.6, # default effort, action-default max_turns (50). Do not set effort low. -# Follow-up (synchronize): grok-build-0.1, effort low, max_turns 15. The action -# still embeds the full PR diff; cheaper model + fewer turns is the control. +# Follow-up (synchronize, and only if a prior Grok review already completed): +# grok-build-0.1, effort low, max_turns 15. The action still embeds the full +# PR diff; cheaper model + fewer turns is the control. +# A synchronize that cancels an in-flight first pass stays on grok-4.6 unless +# a completed Grok status comment or review already exists on the PR. name: Grok code review on: @@ -38,10 +41,6 @@ jobs: timeout-minutes: 30 env: XAI_API_KEY: ${{ secrets.XAI_API_KEY }} - GROK_MODEL: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && 'grok-build-0.1' || 'grok-4.6' }} - GROK_EFFORT: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && 'low' || '' }} - GROK_MAX_TURNS: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && '15' || '50' }} - GROK_CUSTOM_INSTRUCTIONS: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && 'Review only the latest commit. Do not re-litigate already-posted findings.' || '' }} steps: - name: Checkout PR head uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -56,6 +55,40 @@ jobs: exit 1 fi + - name: Choose review pass + id: pass + env: + GH_TOKEN: ${{ github.token }} + PR_NUMBER: ${{ github.event.pull_request.number || github.event.inputs.pr_number }} + IS_SYNC: ${{ github.event_name == 'pull_request' && github.event.action == 'synchronize' }} + run: | + follow_up=false + if [ "$IS_SYNC" = "true" ]; then + comments="$(gh api --paginate "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" \ + --jq '.[] | select(.body != null) | select(.body | contains("")) | select((.body | contains("no issues")) or (.body | test("issue[s]? found"))) | .id' \ + || true)" + reviews="$(gh api --paginate "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/reviews" \ + --jq '.[] | select(.body != null) | select(.body | contains("Grok Build Review")) | select(.state == "COMMENTED" or .state == "APPROVED" or .state == "CHANGES_REQUESTED") | .id' \ + || true)" + if [ -n "$comments" ] || [ -n "$reviews" ]; then + follow_up=true + fi + fi + + if [ "$follow_up" = "true" ]; then + echo "Follow-up path: prior Grok review exists; synchronize uses grok-build-0.1." + echo "model=grok-build-0.1" >> "$GITHUB_OUTPUT" + echo "effort=low" >> "$GITHUB_OUTPUT" + echo "max_turns=15" >> "$GITHUB_OUTPUT" + echo "custom_instructions=Review only the latest commit. Do not re-litigate already-posted findings." >> "$GITHUB_OUTPUT" + else + echo "First-pass path: grok-4.6 (event is not synchronize, or no completed Grok review yet)." + echo "model=grok-4.6" >> "$GITHUB_OUTPUT" + echo "effort=" >> "$GITHUB_OUTPUT" + echo "max_turns=50" >> "$GITHUB_OUTPUT" + echo "custom_instructions=" >> "$GITHUB_OUTPUT" + fi + - name: Write Grok API key config if: ${{ env.XAI_API_KEY != '' }} run: | @@ -82,10 +115,10 @@ jobs: grok_auth_json: "{}" github_token: ${{ github.token }} pr_number: ${{ github.event.pull_request.number || github.event.inputs.pr_number }} - model: ${{ env.GROK_MODEL }} - effort: ${{ env.GROK_EFFORT }} - max_turns: ${{ env.GROK_MAX_TURNS }} - custom_instructions: ${{ env.GROK_CUSTOM_INSTRUCTIONS }} + model: ${{ steps.pass.outputs.model }} + effort: ${{ steps.pass.outputs.effort }} + max_turns: ${{ steps.pass.outputs.max_turns }} + custom_instructions: ${{ steps.pass.outputs.custom_instructions }} roast_level: professional fail_on: never status_comments: "true" @@ -98,9 +131,9 @@ jobs: echo "" echo "| Field | Value |" echo "| --- | --- |" - echo "| Model | \`${{ env.GROK_MODEL }}\` |" - echo "| Effort | \`${{ env.GROK_EFFORT }}\` |" - echo "| Max turns | \`${{ env.GROK_MAX_TURNS }}\` |" + echo "| Model | \`${{ steps.pass.outputs.model }}\` |" + echo "| Effort | \`${{ steps.pass.outputs.effort }}\` |" + echo "| Max turns | \`${{ steps.pass.outputs.max_turns }}\` |" echo "| Verdict | \`${{ steps.grok.outputs.verdict }}\` |" echo "| Issues | \`${{ steps.grok.outputs.issue_count }}\` |" echo "| Bugs | \`${{ steps.grok.outputs.bug_count }}\` |" From 89b2a7cfce9eadfa37e60ad27c8e7a211cd4e9f7 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 20 Aug 2026 16:28:13 +0000 Subject: [PATCH 3/5] Split Grok review concurrency so synchronize cannot cancel first pass First-pass events (opened, reopened, ready_for_review, workflow_dispatch) share one cancel-in-progress group. Synchronize follow-ups share a separate group, so a push during an in-flight grok-4.6 review no longer aborts it and then assumes findings were posted. Follow-up runs still cancel each other. Co-authored-by: Fly Over Coder --- .github/workflows/grok-code-review.yml | 65 +++++++------------------- 1 file changed, 18 insertions(+), 47 deletions(-) diff --git a/.github/workflows/grok-code-review.yml b/.github/workflows/grok-code-review.yml index 02c16a0..a72fe16 100644 --- a/.github/workflows/grok-code-review.yml +++ b/.github/workflows/grok-code-review.yml @@ -5,11 +5,12 @@ # # First pass (opened, reopened, ready_for_review, workflow_dispatch): grok-4.6, # default effort, action-default max_turns (50). Do not set effort low. -# Follow-up (synchronize, and only if a prior Grok review already completed): -# grok-build-0.1, effort low, max_turns 15. The action still embeds the full -# PR diff; cheaper model + fewer turns is the control. -# A synchronize that cancels an in-flight first pass stays on grok-4.6 unless -# a completed Grok status comment or review already exists on the PR. +# Follow-up (synchronize): grok-build-0.1, effort low, max_turns 15. The action +# still embeds the full PR diff; cheaper model + fewer turns is the control. +# +# Concurrency is split by pass type so synchronize does not cancel an in-flight +# first pass. cancel-in-progress stays on: first-pass events cancel each other, +# and synchronize follow-ups cancel each other. name: Grok code review on: @@ -28,7 +29,7 @@ permissions: pull-requests: write concurrency: - group: grok-code-review-${{ github.repository }}-${{ github.event.pull_request.number || github.event.inputs.pr_number }} + group: grok-code-review-${{ github.repository }}-${{ github.event.pull_request.number || github.event.inputs.pr_number }}-${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && 'follow-up' || 'first-pass' }} cancel-in-progress: true jobs: @@ -41,6 +42,10 @@ jobs: timeout-minutes: 30 env: XAI_API_KEY: ${{ secrets.XAI_API_KEY }} + GROK_MODEL: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && 'grok-build-0.1' || 'grok-4.6' }} + GROK_EFFORT: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && 'low' || '' }} + GROK_MAX_TURNS: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && '15' || '50' }} + GROK_CUSTOM_INSTRUCTIONS: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && 'Review only the latest commit. Do not re-litigate already-posted findings.' || '' }} steps: - name: Checkout PR head uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 @@ -55,40 +60,6 @@ jobs: exit 1 fi - - name: Choose review pass - id: pass - env: - GH_TOKEN: ${{ github.token }} - PR_NUMBER: ${{ github.event.pull_request.number || github.event.inputs.pr_number }} - IS_SYNC: ${{ github.event_name == 'pull_request' && github.event.action == 'synchronize' }} - run: | - follow_up=false - if [ "$IS_SYNC" = "true" ]; then - comments="$(gh api --paginate "repos/${GITHUB_REPOSITORY}/issues/${PR_NUMBER}/comments" \ - --jq '.[] | select(.body != null) | select(.body | contains("")) | select((.body | contains("no issues")) or (.body | test("issue[s]? found"))) | .id' \ - || true)" - reviews="$(gh api --paginate "repos/${GITHUB_REPOSITORY}/pulls/${PR_NUMBER}/reviews" \ - --jq '.[] | select(.body != null) | select(.body | contains("Grok Build Review")) | select(.state == "COMMENTED" or .state == "APPROVED" or .state == "CHANGES_REQUESTED") | .id' \ - || true)" - if [ -n "$comments" ] || [ -n "$reviews" ]; then - follow_up=true - fi - fi - - if [ "$follow_up" = "true" ]; then - echo "Follow-up path: prior Grok review exists; synchronize uses grok-build-0.1." - echo "model=grok-build-0.1" >> "$GITHUB_OUTPUT" - echo "effort=low" >> "$GITHUB_OUTPUT" - echo "max_turns=15" >> "$GITHUB_OUTPUT" - echo "custom_instructions=Review only the latest commit. Do not re-litigate already-posted findings." >> "$GITHUB_OUTPUT" - else - echo "First-pass path: grok-4.6 (event is not synchronize, or no completed Grok review yet)." - echo "model=grok-4.6" >> "$GITHUB_OUTPUT" - echo "effort=" >> "$GITHUB_OUTPUT" - echo "max_turns=50" >> "$GITHUB_OUTPUT" - echo "custom_instructions=" >> "$GITHUB_OUTPUT" - fi - - name: Write Grok API key config if: ${{ env.XAI_API_KEY != '' }} run: | @@ -115,10 +86,10 @@ jobs: grok_auth_json: "{}" github_token: ${{ github.token }} pr_number: ${{ github.event.pull_request.number || github.event.inputs.pr_number }} - model: ${{ steps.pass.outputs.model }} - effort: ${{ steps.pass.outputs.effort }} - max_turns: ${{ steps.pass.outputs.max_turns }} - custom_instructions: ${{ steps.pass.outputs.custom_instructions }} + model: ${{ env.GROK_MODEL }} + effort: ${{ env.GROK_EFFORT }} + max_turns: ${{ env.GROK_MAX_TURNS }} + custom_instructions: ${{ env.GROK_CUSTOM_INSTRUCTIONS }} roast_level: professional fail_on: never status_comments: "true" @@ -131,9 +102,9 @@ jobs: echo "" echo "| Field | Value |" echo "| --- | --- |" - echo "| Model | \`${{ steps.pass.outputs.model }}\` |" - echo "| Effort | \`${{ steps.pass.outputs.effort }}\` |" - echo "| Max turns | \`${{ steps.pass.outputs.max_turns }}\` |" + echo "| Model | \`${{ env.GROK_MODEL }}\` |" + echo "| Effort | \`${{ env.GROK_EFFORT }}\` |" + echo "| Max turns | \`${{ env.GROK_MAX_TURNS }}\` |" echo "| Verdict | \`${{ steps.grok.outputs.verdict }}\` |" echo "| Issues | \`${{ steps.grok.outputs.issue_count }}\` |" echo "| Bugs | \`${{ steps.grok.outputs.bug_count }}\` |" From b1e26cb0e7f0c71dfab84a987b953d60abf03844 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 20 Aug 2026 16:38:26 +0000 Subject: [PATCH 4/5] Clarify first-pass max_turns is set to 50, not left to the action default The header said first pass used the action-default max_turns. The workflow always passes 50 on that path (the same number as the action default). Co-authored-by: Fly Over Coder --- .github/workflows/grok-code-review.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/grok-code-review.yml b/.github/workflows/grok-code-review.yml index a72fe16..511a75e 100644 --- a/.github/workflows/grok-code-review.yml +++ b/.github/workflows/grok-code-review.yml @@ -4,7 +4,8 @@ # No SuperGrok session fallback. # # First pass (opened, reopened, ready_for_review, workflow_dispatch): grok-4.6, -# default effort, action-default max_turns (50). Do not set effort low. +# default effort (empty input; the action adds --effort only when set), +# max_turns 50. Do not set effort low. # Follow-up (synchronize): grok-build-0.1, effort low, max_turns 15. The action # still embeds the full PR diff; cheaper model + fewer turns is the control. # From cc208fbff52442db683d3b6cd6eb4c3f5cff4088 Mon Sep 17 00:00:00 2001 From: Cursor Agent Date: Thu, 20 Aug 2026 16:45:04 +0000 Subject: [PATCH 5/5] Hold grok-build-0.1; both review passes stay on grok-4.6 Pro #178 showed grok-build-0.1 plus dummy auth.json exits 1 with no JSON and the action blames SuperGrok session expiry. Do not register that model. Follow-up synchronize stays grok-4.6 on api.x.ai with effort low and max_turns 15. First pass stays grok-4.6 with default effort and 50 turns. Concurrency split is unchanged. Co-authored-by: Fly Over Coder --- .github/workflows/grok-code-review.yml | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/.github/workflows/grok-code-review.yml b/.github/workflows/grok-code-review.yml index 511a75e..567399c 100644 --- a/.github/workflows/grok-code-review.yml +++ b/.github/workflows/grok-code-review.yml @@ -6,8 +6,8 @@ # First pass (opened, reopened, ready_for_review, workflow_dispatch): grok-4.6, # default effort (empty input; the action adds --effort only when set), # max_turns 50. Do not set effort low. -# Follow-up (synchronize): grok-build-0.1, effort low, max_turns 15. The action -# still embeds the full PR diff; cheaper model + fewer turns is the control. +# Follow-up (synchronize): grok-4.6, effort low, max_turns 15. The action +# still embeds the full PR diff; lower effort + fewer turns is the control. # # Concurrency is split by pass type so synchronize does not cancel an in-flight # first pass. cancel-in-progress stays on: first-pass events cancel each other, @@ -43,7 +43,7 @@ jobs: timeout-minutes: 30 env: XAI_API_KEY: ${{ secrets.XAI_API_KEY }} - GROK_MODEL: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && 'grok-build-0.1' || 'grok-4.6' }} + GROK_MODEL: grok-4.6 GROK_EFFORT: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && 'low' || '' }} GROK_MAX_TURNS: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && '15' || '50' }} GROK_CUSTOM_INSTRUCTIONS: ${{ (github.event_name == 'pull_request' && github.event.action == 'synchronize') && 'Review only the latest commit. Do not re-litigate already-posted findings.' || '' }} @@ -70,10 +70,6 @@ jobs: model = "grok-4.6" base_url = "https://api.x.ai/v1" env_key = "XAI_API_KEY" - [model."grok-build-0.1"] - model = "grok-build-0.1" - base_url = "https://api.x.ai/v1" - env_key = "XAI_API_KEY" [models] default = "grok-4.6" EOF