fix(ci): restore fork filter for pull_request_review_comment events#1426
fix(ci): restore fork filter for pull_request_review_comment events#1426worktrunk-bot wants to merge 1 commit intomainfrom
Conversation
PR #1421 removed the fork filter based on the incorrect assumption that pull_request_review_comment has secret access for fork PRs. It does not — run 22914840420 failed at checkout with an empty token. Restore the fork filter and document fork PR secret availability for all event types. Closes #1424 Co-authored-by: Claude <noreply@anthropic.com>
## Summary - Add `github.event.issue.user.login != 'worktrunk-bot'` to the `issues` trigger in `claude-mention.yaml` - Document the new filter in `.github/CLAUDE.md` "Does not trigger" list ## Problem The hourly review workflow creates issues (like #1424) that incidentally mention `@worktrunk-bot` in body text — e.g., "comment contained `@worktrunk-bot`". This triggers `claude-mention` on the `issues` event, which then duplicates the hourly review's work, including creating a second fix PR (#1425 vs #1426 for the same issue). ## Fix Add an author check to skip issues created by `worktrunk-bot` itself, consistent with the existing `comment.user.login != 'worktrunk-bot'` loop-prevention checks on `issue_comment` and `pull_request_review_comment` events. Closes #1428 ## Test plan - [ ] Verify the `if:` condition syntax is valid (CI should pass) - [ ] Confirm the next hourly review run doesn't trigger a claude-mention run on its issues 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com> Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
|
I don't understand — we don't have access to the secrets from can you really research this? we just want something that runs on any interaction, including comments on fork PRs... |
|
Good question — I dug into this properly. Why the difference: It's a GitHub platform distinction based on which repo context the event runs in:
Run 22914840420 confirmed this: the Options for making inline review comments work on fork PRs:
Given that fork PRs are relatively rare and conversation tab comments work fine for them, option 2 seems like the right trade-off — but happy to build the |
|
this seems like a strong claim and so needs stronger evidence — find primary sources + issues discussing this |
|
didn't the bot respond here, for example: #1408 (comment) (though later there stops responding!) |
|
Good catch — and this is exactly the kind of thing I should have traced before claiming it. I dug into the actual workflow runs for PR #1408 to answer both questions. The bot's response at discussion_r2906398164 was NOT triggered by Every "Later there stops responding" — exactly right. The later comments (2910069729, 2911871360) were pure review comments on the Files tab. These only trigger Primary sources on fork PR secret accessThe GitHub docs on events state that for fork PRs, secrets are not passed to the runner (except a read-only
There is no So the current state is actually working correctly for fork PRs — conversation tab comments ( Given this, the PR as-is is the right fix — restore the fork filter and document the limitation. Want me to update the PR description to clarify this mechanism? |
|
but this seems to suggest that the events are sent, no? https://docs.github.com/en/actions/reference/workflows-and-actions/events-that-trigger-workflows#pull-request-events-for-forked-repositories-2
|
|
You're right that the events are sent to the base repo — that quote is about event delivery (where the webhook goes), not about secret access. All five events fire on the base repo, but only some of them get secrets. The primary source is the docs page you linked. Each event type has its own section, and the ones subject to fork restrictions have a "Workflows in forked repositories" subsection. Specifically:
The empirical evidence matches: run 22914840420 logs show So the table is: |
|
OK, that does look reasonable. Do lots of people complain about this? It seems like one very annoying hole in the approach, such that only in this tiny corner (inline comments on a forked PR) can a bot not be triggered by secrets? Search for places where people have raised this issue and what others do about it. |
|
Yes, it's a well-known pain point. There are several community discussions about the missing
What other bots do: Most accept the gap. AI review bots (CodeRabbit, Presubmit, claude-code-action) use The So the approach in this PR (filter fork PRs, document the limitation) matches what everyone else does. The gap only affects inline review comments on fork PRs specifically — a small enough corner that projects live with it. |
## Summary
- Rewrite the hourly reviewer's Step 7 ("Report findings") to prefer
creating PRs over issues
- PRs are now the default for any fixable problem (skill edits, workflow
tweaks, CLAUDE.md updates)
- Issues are only for problems too large or ambiguous to fix directly
- PR descriptions carry the full analysis (run ID, log excerpts, root
cause) — replacing what would have been the issue body
- Instructs the bot to keep findings cohesive (grouped PRs, not many
small patches)
This eliminates the duplication problem from #1425/#1426, where the
hourly reviewer created an issue and the triage bot raced to also fix
it. With the reviewer going straight to PR, there's no issue for triage
to pick up.
Requested by @max-sixty in
#1425 (comment).
## Test plan
- [ ] Workflow YAML passes validation (CI lint check)
- [ ] Next hourly run creates PRs instead of issues for small fixes
🤖 Generated with [Claude Code](https://claude.com/claude-code)
---------
Co-authored-by: worktrunk-bot <254187624+worktrunk-bot@users.noreply.github.com>
Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
Co-authored-by: Maximilian Roos <5635139+max-sixty@users.noreply.github.com>
Problem
PR #1421 removed the fork filter (
head.repo.full_name == github.repository) from thepull_request_review_commenttrigger, based on the assumption that this event type has secret access for fork PRs likepull_request_targetandissue_commentdo.This assumption was wrong — run 22914840420 failed at checkout with
Input required and not supplied: token, confirming thatpull_request_review_commentdoes not have secret access for fork PRs.Solution
github.event.pull_request.head.repo.full_name == github.repository) in theif:condition.github/CLAUDE.mddocumenting which event types have secrets for fork PRs, to prevent this mistake from recurringTesting
Workflow-only change — no code tests to run. The fix reverts the logic to the pre-#1421 state which was working correctly.
Closes #1424 — automated triage