Skip to content

Commit 51b5c73

Browse files
authored
Let "effort=max" in an @claude comment or new issue opt into max effort (#24275)
## What is wrong today Claude runs at max effort only when a comment starts with `@claude /pr-review`. Every other request, such as a question, an investigation or a code change, runs at the default effort, and there is no way to ask for more. ## What this change does A comment that contains `effort=max`, or a new issue whose body contains it, now also runs at max effort, the same opt-in pytorch/pytorch uses: ``` @claude why does this test fail on Windows? # default effort @claude why does this test fail on Windows? effort=max # max effort ``` What this does and does not change: - **Reviews: nothing new.** Every review request already goes through the `/pr-review` skill, so `@claude review effort=max` runs the same as `@claude /pr-review`. - **Other requests: the real change.** Questions, investigations and code changes can now run at max effort. Their run time at max effort has not been measured yet. - **Matching.** `effort=max` counts anywhere in the comment, also in a quoted reply. No other level, such as `effort=high`, is recognized. A comment in the workflow file says this. - **New issues.** The issue body is read only on issue events. On a comment it holds the issue or PR description, so a description that mentions `effort=max` would otherwise raise every comment there to max effort. Max effort stays opt-in because it is slow. In recent runs on this repository, max effort reviews took 14 to 58 minutes, against 4 to 8 minutes at the default. The job is stopped after one hour, when its credentials expire, and a run stopped there loses any answer it has not posted yet. ## Tests This workflow runs from the main branch for comment and issue events, so no check on this pull request runs the new condition. - `actionlint` 1.7.12 reports no problems in the workflow file. - A Python copy of the condition, following GitHub's expression rules (case-insensitive `contains` and `startsWith`, missing fields read as empty strings), gives the expected effort for these sample events: | Event | Comment | Issue or PR body | Effort | |---|---|---|---| | comment | `@claude review` | mentions `effort=max` | default | | comment | `@claude review effort=max` | plain | max | | comment | `@claude /pr-review` | plain | max | | comment | `@claude why is this slow? effort=max` | plain | max | | comment | `@claude explain` | empty | default | | new issue | none | `@claude investigate this crash effort=max` | max | | new issue | none | `@claude investigate this crash` | default | - After merge: in the "Run Claude Code" step's log, `--effort max` should appear in the Claude arguments for an `@claude ... effort=max` comment and for a new issue whose body has `@claude ... effort=max`. It should not appear for a plain `@claude` comment on this pull request, whose description mentions `effort=max`.
1 parent ea0f88f commit 51b5c73

1 file changed

Lines changed: 3 additions & 1 deletion

File tree

‎.github/workflows/claude-code.yml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ jobs:
1010
claude-code:
1111
uses: pytorch/test-infra/.github/workflows/_claude-code.yml@main
1212
with:
13-
additional_claude_args: --allowedTools Skill ${{ startsWith(github.event.comment.body, '@claude /pr-review') && '--effort max' || '' }}
13+
# No other effort level is recognized. The issue body is read only on issue
14+
# events, because on a comment it holds the issue or PR description.
15+
additional_claude_args: --allowedTools Skill ${{ (startsWith(github.event.comment.body, '@claude /pr-review') || contains(github.event.comment.body, 'effort=max') || (github.event_name == 'issues' && contains(github.event.issue.body, 'effort=max'))) && '--effort max' || '' }}
1416
append_system_prompt: |
1517
When asked to review a PR, always use the /pr-review skill first.
1618
Put the detailed review inside a GitHub collapsible section and a

0 commit comments

Comments
 (0)