Skip to content

fix(ci): restore fork filter for pull_request_review_comment events - #1425

Closed
worktrunk-bot wants to merge 1 commit into
mainfrom
hourly/fix-fork-review-comment-secrets
Closed

worktrunk-bot wants to merge 1 commit into
mainfrom
hourly/fix-fork-review-comment-secrets

Conversation

@worktrunk-bot

Copy link
Copy Markdown
Collaborator

Summary

  • Restore the fork filter (head.repo.full_name == github.repository) for pull_request_review_comment events in claude-mention.yaml
  • Update .github/CLAUDE.md to document that fork PR inline review comments are filtered and why
  • PR fix(ci): allow bot responses on fork PR inline review comments #1421 removed this filter based on the incorrect assumption that pull_request_review_comment has secret access for fork PRs — run 22914840420 proved otherwise (checkout failed: Input required and not supplied: token)

The correct event behavior:

Event Fork PR secret access
pull_request No
pull_request_target Yes
pull_request_review_comment No
issue_comment Yes

Fork PR users should use conversation-tab @worktrunk-bot mentions (which go through issue_comment) instead of inline review comments.

Closes #1424

Test plan

  • Verify the workflow passes validation (no syntax errors)
  • Confirm inline review comments on non-fork PRs still trigger the bot
  • Confirm fork PR inline review comments are skipped (no checkout failure)

🤖 Generated with Claude Code

PR #1421 removed the fork filter based on the incorrect assumption that
`pull_request_review_comment` events have access to secrets for fork PRs.
Run 22914840420 proved this wrong — checkout failed with
"Input required and not supplied: token" because WORKTRUNK_BOT_TOKEN was
empty.

`pull_request_review_comment` runs in the fork context (like
`pull_request`), NOT in the base repo context (like `pull_request_target`
or `issue_comment`). Fork PRs should use conversation-tab @worktrunk-bot
mentions instead, which go through `issue_comment` and always have
secret access.

Closes #1424

Co-Authored-By: Claude Opus 4.6 <[email protected]>
max-sixty pushed a commit that referenced this pull request Mar 10, 2026
## 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 <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
@max-sixty

Copy link
Copy Markdown
Owner

to the hourly reviewer — why did we get two PRs here — this and #1426 ?

@max-sixty max-sixty closed this Mar 10, 2026
@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

Two separate automated workflows picked up issue #1424 near-simultaneously:

They raced — both saw the same open issue and independently created a fix. Neither workflow checks whether the other has already opened a PR for the same issue.

#1425 is already closed, so #1426 is the one to review. Happy to add deduplication logic (e.g., checking for existing PRs referencing the same issue before creating a new one) if you'd like.

@max-sixty

Copy link
Copy Markdown
Owner

ah!

I think probably the hourly reviewer should not open issues when it can open PRs. I find them a bit noisy. Can you draft a PR that would open PRs for small changes. If it finds big persistent issues that it doesn't know how to fix, it should open an issue. In return, it should put the detail in the PR.

Is that viable?

Ensure that the changes are cohesive — not lots of patches — rewrite from scratch if necessary.

worktrunk-bot added a commit that referenced this pull request Mar 10, 2026
Rewrite Step 7 of the hourly reviewer prompt so it defaults to creating
PRs (with thorough descriptions) instead of issues. Issues are now only
for problems too large or ambiguous to fix directly. Also instructs the
bot to keep findings cohesive rather than creating many small patches.

Requested in #1425.

Co-Authored-By: Claude Opus 4.6 <[email protected]>
@worktrunk-bot

Copy link
Copy Markdown
Collaborator Author

Done — #1432 rewrites the hourly reviewer's Step 7 so it defaults to creating PRs for fixable problems (with the full analysis in the PR description) and only falls back to issues for things too large or ambiguous to fix directly. CI is green across all platforms.

This also addresses the duplication with triage: if the reviewer goes straight to PR, there's no issue for the triage bot to race on.

max-sixty added a commit that referenced this pull request Mar 10, 2026
## 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 <[email protected]>
Co-authored-by: Claude Opus 4.6 <[email protected]>
Co-authored-by: Maximilian Roos <[email protected]>
@max-sixty
max-sixty deleted the hourly/fix-fork-review-comment-secrets branch June 18, 2026 06:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

claude-mention: pull_request_review_comment events lack secrets for fork PRs (regression from #1421)

2 participants