fix(pr-reviewer): fetch PR author before allowlist skip
User description
Summary
- Add a GitHub REST fallback for pr-reviewer author resolution when Relayfile
meta.authorand webhook payload author are empty orunknown. - Use the fallback before applying
REVIEW_AUTHORS, so a newly fired reviewer does not fail-close while the Relayfile PR mount is still syncing. - Keep the existing fail-closed behavior if no token is available or the API lookup fails.
Root-cause evidence
A live worker-tail capture from cloud PR #1803 (AgentWorkforce/cloud, author khaliqgant) showed the pr-reviewer pipeline fired end-to-end: webhook -> match -> sandbox -> clone -> runner.started. It then skipped immediately with:
pr-reviewer skipped
reason: REVIEW_AUTHORS is set but the PR author could not be resolved
runner.handler.ok durationMs: 1
durationMs: 1 means author resolution happened before the Relayfile mount finished syncing pulls/{n}/meta.json (the mount had just logged Mirror started ... Sync interval 5s). The integration-watch payload also had no usable pull_request.user.login, so resolveAuthorLogin(meta, pr) returned unknown and the allowlist fail-closed.
The fix asks GitHub directly (GET /repos/{owner}/{repo}/pulls/{number} -> .user.login) when meta/payload author resolution is empty/unknown and a GitHub token is available.
Tests
npm run test:reviewnpm run typechecknpm test
Note
Cloud should still populate the PR author in Relayfile meta.json/the integration-watch event as secondary hardening, but the persona should not race the mount sync for an allowlist decision.
Summary by cubic
Fetch the PR author from the GitHub REST API when Relayfile meta/payload lack it, and do this before checking the REVIEW_AUTHORS allowlist. Prevents false skips during early mount sync while keeping fail-closed behavior if lookup fails.
- Bug Fixes
- Added API fallback to resolve author (
GET /repos/{owner}/{repo}/pulls/{number} -> user.login) before the allowlist check. - Recognizes multiple tokens for the lookup:
GITHUB_TOKEN,GH_TOKEN,GITHUB_API_TOKEN,GITHUB_PR_WORKSPACE_TOKEN. - Preserves fail-closed when no token or the API call fails; tests cover success, workspace token, and failure paths.
- Added API fallback to resolve author (
CodeAnt-AI Description
Avoid skipping reviews when the PR author is temporarily unavailable
What Changed
- When the PR author cannot be read from synced PR data, the reviewer now checks GitHub directly before deciding to skip for
REVIEW_AUTHORS - If GitHub returns the author, allowlisted PRs continue normally instead of being skipped early
- If the author still cannot be confirmed, the reviewer keeps the same fail-closed skip behavior
- Added tests for both the fallback path and the failure case
Impact
✅ Fewer false review skips
✅ More reliable allowlist checks for new PRs
✅ Clearer behavior during PR sync delays
💡 Usage Guide
Checking Your Pull Request
Every time you make a pull request, our system automatically looks through it. We check for security issues, mistakes in how you're setting up your infrastructure, and common code problems. We do this to make sure your changes are solid and won't cause any trouble later.
Talking to CodeAnt AI
Got a question or need a hand with something in your pull request? You can easily get in touch with CodeAnt AI right here. Just type the following in a comment on your pull request, and replace "Your question here" with whatever you want to ask:
@codeant-ai ask: Your question here
This lets you have a chat with CodeAnt AI about your pull request, making it easier to understand and improve your code.
Example
@codeant-ai ask: Can you suggest a safer alternative to storing this secret?
Preserve Org Learnings with CodeAnt
You can record team preferences so CodeAnt AI applies them in future reviews. Reply directly to the specific CodeAnt AI suggestion (in the same thread) and replace "Your feedback here" with your input:
@codeant-ai: Your feedback here
This helps CodeAnt AI learn and adapt to your team's coding style and standards.
Example
@codeant-ai: Do not flag unused imports.
Retrigger review
Ask CodeAnt AI to review the PR again, by typing:
@codeant-ai: review
Check Your Repository Health
To analyze the health of your code repository, visit our dashboard at https://app.codeant.ai. This tool helps you identify potential issues and areas for improvement in your codebase, ensuring your repository maintains high standards of code health.