fix: use get_app().slug for app_bot_login instead of get_user().login#1114
fix: use get_app().slug for app_bot_login instead of get_user().login#1114rnetser wants to merge 6 commits into
Conversation
get_user() always returns 403 for GitHub App installation tokens —
it's a platform limitation, not a permissions issue. get_app() is
the correct endpoint for app tokens and returns app metadata
including slug. Bot login format is always {slug}[bot].
Closes #1113
Signed-off-by: rnetser <rnetser@redhat.com>
Generated-by: Claude <noreply@anthropic.com>
Code Review by Qodo
Context used 1.
|
|
Report bugs in Issues Welcome! 🎉This pull request will be automatically processed with the following features: 🔄 Automatic Actions
📋 Available CommandsPR Status Management
Review & Approval
Testing & Validation
Container Operations
Cherry-pick Operations
Branch Management
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
Security Checks
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
PR Summary by QodoFix app bot login detection using GitHub App slug (avoid get_user() 403) WalkthroughsDescription• Fix app_bot_login initialization for GitHub App installation tokens (avoid 403 from get_user()).
• Derive bot login from get_app().slug using the stable {slug}[bot] format.
• Restore reliable bot-owned PR detection for webhook-driven operations (rebase/cherry-pick retry).
Diagramgraph TD
A["Webhook processor"] --> B["GitHub App API client"] --> C{{"GitHub REST API"}} --> D["App metadata (slug)"] --> E["app_bot_login: {slug}[bot]"]
High-Level AssessmentThe following are alternative approaches to this PR: 1. Make bot login configurable (env/setting)
2. Attempt get_user() then fall back to get_app()
Recommendation: Keep the PR’s approach: using get_app() is the correct endpoint for GitHub App installation tokens, and deriving File ChangesBug fix (1)
|
|
@qodo-code-review[bot] The following review comments were reviewed and a decision was made:
|
Moves .slug property access inside the github_api_call lambda to keep it off the event loop and get retry protection, per AGENTS.md guidelines. Signed-off-by: rnetser <rnetser@redhat.com> Assisted-by: Claude <noreply@anthropic.com>
|
Code review by qodo was updated up to the latest commit a5fb576 |
|
/build-and-push-container |
|
New container for ghcr.io/myk-org/github-webhook-server:pr-1114 published |
get_app() requires AppAuth (JWT), not AppInstallationAuth. Added get_github_app_slug() helper that creates its own GithubIntegration with proper AppAuth to call get_app().slug. Removed the intermediate _github_app_api variable since we no longer need the installation token for bot login detection. Signed-off-by: rnetser <rnetser@redhat.com> Assisted-by: Claude <noreply@anthropic.com>
|
Code review by qodo was updated up to the latest commit a203182 |
|
@qodo-code-review[bot] The following review comments were reviewed and a decision was made:
|
Removed try/except from get_github_app_slug() so exceptions propagate through github_api_call() for retry/backoff on transient failures. The outer try/except in process() handles permanent failures. Signed-off-by: rnetser <rnetser@redhat.com> Assisted-by: Claude <noreply@anthropic.com>
|
Code review by qodo was updated up to the latest commit 0a38fb1 |
Signed-off-by: rnetser <rnetser@redhat.com> Assisted-by: Claude <noreply@anthropic.com>
|
Code review by qodo was updated up to the latest commit 6e2bd74 |
|
@qodo-code-review[bot] The following review comments were reviewed and a decision was made:
|
Slug is immutable — no need to read PEM + call GET /app on every webhook event. First call fetches and caches, subsequent calls return cached value. Assisted-by: Claude <noreply@anthropic.com> Signed-off-by: rnetser <rnetser@redhat.com>
|
Code review by qodo was updated up to the latest commit 170ddd7 |
|
@qodo-code-review[bot] The following review comments were reviewed and a decision was made:
|
|
@qodo-code-review[bot] The following review comments were reviewed and a decision was made:
|
|
/build-and-push-container |
|
New container for ghcr.io/myk-org/github-webhook-server:pr-1114 published |
|
/verified |
|
@qodo-code-review re-review |
Problem
app_bot_logininitialization fails on every webhook with a 403 error:get_user()always returns 403 for GitHub App installation tokens — this is a GitHub platform limitation, not a permissions issue.Impact
Without
app_bot_login, the server cannot identify its own PRs:Fix
Replace
get_user().loginwithget_app()+f"{slug}[bot]". Theget_app()endpoint is designed for app tokens and returns app metadata includingslug. The bot login format is always{slug}[bot].Closes #1113
Generated-by: Claude noreply@anthropic.com