Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 22 additions & 2 deletions .github/workflows/grok-code-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@
# 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 (empty input; the action adds --effort only when set),
# max_turns 50. Do not set effort low.
# 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,
# and synchronize follow-ups cancel each other.
name: Grok code review

on:
Expand All @@ -20,7 +30,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:
Expand All @@ -33,6 +43,10 @@ jobs:
timeout-minutes: 30
env:
XAI_API_KEY: ${{ secrets.XAI_API_KEY }}
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.' || '' }}
steps:
- name: Checkout PR head
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
Expand Down Expand Up @@ -69,7 +83,10 @@ jobs:
grok_auth_json: "{}"
github_token: ${{ github.token }}
pr_number: ${{ github.event.pull_request.number || github.event.inputs.pr_number }}

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🐞 [bug] First-pass path supplies empty effort to the review action

When the first-pass branch executes, the step writes an empty value for effort and the action invocation interpolates it as "effort: ". The stated behavior for first-pass events is to use the action default effort. An explicitly provided empty value is not guaranteed to be treated as an omitted input by the composite action.

Suggestion: Omit the effort input entirely for the first-pass path, or emit a documented sentinel that the action maps to its default.

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not a bug on the pinned action. 0xr3ngar/grok-build-review-action@eded30018cdee4e83dfca14d18f292b860c30cdd documents effort as Empty = CLI default (default: ""). The composite only adds --effort when the value is non-empty:

[ -n "$EFFORT" ] && EXTRA_ARGS+=(--effort "$EFFORT")

First pass therefore leaves effort empty on purpose so grok-4.6 uses the CLI default and does not get --effort low. One job cannot omit a with: key on only one path; empty is the action’s documented omit. Leaving this thread open for that reason. We are not changing the first-pass effort input.

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"
Expand All @@ -82,6 +99,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 }}\` |"
Expand Down
Loading