feat: cherry-pick retry/rebase commands + pre-commit auto-fix + security hardening#1108
feat: cherry-pick retry/rebase commands + pre-commit auto-fix + security hardening#1108myakove wants to merge 11 commits into
Conversation
…ity hardening - Add /cherry-pick-retry command for retrying failed cherry-picks (#1103) - Add /rebase command for rebasing PRs onto base branch (#1103) - Add pre-commit auto-fix after cherry-pick before push (#1089) - Add is_user_valid_to_run_commands guard to all unguarded commands - Verify bot ownership before closing cherry-pick PR on retry - Update welcome message with new commands Closes #1103 Closes #1089
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
Label Management
✅ Merge RequirementsThis PR will be automatically approved when the following conditions are met:
📊 Review ProcessApprovers and ReviewersApprovers:
Reviewers:
Available Labels
AI Features
💡 Tips
For more information, please refer to the project documentation or contact the maintainers. |
…commit abort, DCO signoff - Reject rebase on fork PRs (head repo != base repo) - Restrict non-bot PR rebase to PR owner or maintainers only - Abort cherry-pick when pre-commit fails with unfixable errors - Abort cherry-pick when git add/commit fails after pre-commit fix - Add --signoff to pre-commit auto-fix commit for DCO compliance - Validate single branch name in /cherry-pick-retry
|
Code review by qodo was updated up to the latest commit e3e4e57 |
|
@qodo-code-review[bot] The following review comments were reviewed and a decision was made:
|
- When git diff --name-only fails after pre-commit, report as worktree error - Previously fell into unfixable pre-commit errors branch, misattributing cause
|
Code review by qodo was updated up to the latest commit 86510ca |
Redact secrets in git diff error logging after pre-commit. Reformat long lines for readability.
|
Code review by qodo was updated up to the latest commit eaafc8a |
- Cherry-pick PRs are created by the GitHub App bot, not in auto_verified_and_merged_users - Check user.type == Bot to detect any bot-created PR - Fixes cherry-pick-retry not closing old cherry-pick PRs - Also fixes rebase bot-PR ownership detection
|
Code review by qodo was updated up to the latest commit 9c00066 |
- user.type == Bot is too broad (catches Renovate, Dependabot, etc.) - Now also checks for cherry-pick labels to confirm it is our app PR - Prevents unauthorized force-push rebase on non-cherry-pick bot PRs
|
Code review by qodo was updated up to the latest commit f1d8263 |
…match, simplify bot check - Wrap pull_request.html_url in github_api_call to avoid blocking/stale data - Remove over-restrictive bot-ownership and label filters that prevented matches - Simplify close logic to title prefix + body URL match (sufficient for correctness) - Add debug logging at every step: PR count, title match/skip, body URL match/skip, close/no-match - Update rebase bot-PR detection to use user.type == "Bot" with cherry-pick label check - Update tests to match simplified close logic and bot detection changes
|
Code review by qodo was updated up to the latest commit 141108d |
- Restore Bot type verification before closing cherry-pick PRs on retry - Prevents closing human-created PRs that happen to match title/body pattern - Keep debug logging at every step (title, user type, body URL) - Add test for human-created PR skip (user.type == "User")
|
Code review by qodo was updated up to the latest commit d1c5c71 |
… rebase - Store GitHub App bot login on GithubWebhook during init (github_api.py) - Cherry-pick retry: check PR author login matches app_bot_login instead of user.type - Rebase: check PR author login matches app_bot_login instead of user.type + label heuristic - Prevents false matches on Renovate, Dependabot, or other bot PRs
|
Code review by qodo was updated up to the latest commit 6df198e |
|
@qodo-code-review[bot] The following review comments were reviewed and a decision was made:
|
- Replace blocking github_app_api.get_user().login in __init__ with async github_api_call in process() - Log warning on failure instead of silent empty fallback - Guard with "if not self.app_bot_login" to avoid redundant API calls
|
Code review by qodo was updated up to the latest commit 58a530e |
|
@qodo-code-review[bot] The following review comments were reviewed and a decision was made:
|
…ncelledError, log missing API - Use logger.exception instead of logger.warning to preserve traceback - Add except asyncio.CancelledError: raise before broad except - Log debug message when GitHub App API is not available
|
Code review by qodo was updated up to the latest commit d9292e8 |
PR Summary by Qodo
Add cherry-pick retry + PR rebase commands, pre-commit auto-fix, and command guards
✨ Enhancement🐞 Bug fix🧪 Tests📝 Documentation🕐 40+ MinutesWalkthroughs
User Description
Summary
New commands (#1103)
/cherry-pick-retry <branch>— Retry a failed cherry-pick on merged PRs/rebase— Rebase any open PR onto its base branch (with bot-PR ownership validation)Pre-commit auto-fix (#1089)
Security hardening
is_user_valid_to_run_commandsguard to all 7 previously unguarded commands:/cherry-pick,/assign-reviewer,/assign-reviewers,/check-can-merge,/verified,/wip,/test-oracleCloses #1103
Closes #1089
AI Description
Diagram
graph TD A["Issue comment"] --> B["IssueCommentHandler"] --> C["OwnersFileHandler"] B --> D["RunnerHandler"] --> E["Local git worktree"] --> F{{"GitHub API/remote"}} D --> G["Pre-commit"] --> E B --> H["PullRequestHandler"]High-Level Assessment
The following are alternative approaches to this PR:
1. Use GitHub's built-in 'Update branch' / merge-upstream flow
2. Centralize command authorization via a dispatcher/decorator
3. Run formatting fixes only in CI and comment results (no auto-commit)
Recommendation: The PR’s approach is appropriate for a bot-driven maintenance workflow: rebase and cherry-pick actions need local git to be deterministic, and the added authorization gates materially reduce abuse risk. Consider a follow-up to centralize authorization in the command dispatcher to prevent future unguarded commands and reduce repetition.
File Changes
Enhancement (3)
Tests (2)
Documentation (1)