fix(skill): Detect stacked PR context from branch#5223
Conversation
Update the create-java-pr skill to infer standalone vs stacked PR mode\nfrom git branch and existing PR relationships.\n\nWhen running on main/master, default to standalone PR mode and only\nenter stack mode when explicitly requested by the user.\n\nCo-Authored-By: Claude <noreply@anthropic.com>
Semver Impact of This PR🟢 Patch (bug fixes) 📋 Changelog PreviewThis is how your changes will appear in the changelog. This PR will not appear in the changelog. 🤖 This preview updates automatically when you update the PR. |
Sentry Build Distribution
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes and found 2 potential issues.
Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
| ```bash | ||
| gh pr list --base "$(git branch --show-current)" --json number,headRefName,title | ||
| ``` | ||
| If there are downstream PRs, treat this as a stack base context. |
There was a problem hiding this comment.
Collection branch misclassified as standalone PR context
Medium Severity
The decision tree classifies any branch whose PR targets main/master as standalone, then only checks for downstream PRs when no PR exists for the current branch. A stacked-PR collection branch has a PR targeting main and has downstream stack PRs — but the downstream check is never reached, so the collection branch is incorrectly treated as standalone. The downstream-PR check needs to also run when a PR exists with baseRefName equal to main/master to correctly detect a stack base.
| ```bash | ||
| gh pr list --base "$(git branch --show-current)" --json number,headRefName,title | ||
| ``` | ||
| If there are downstream PRs, treat this as a stack base context. |
There was a problem hiding this comment.
Undefined "stack base context" PR type mapping
Low Severity
The downstream-PR check concludes with "treat this as a stack base context," but the three defined PR types below (standalone, first PR of new stack, next PR in existing stack) don't include a "stack base context" option. The classification result doesn't map to any actionable PR workflow, leaving behavior ambiguous.


📜 Description
Improve the local
create-java-prskill so it determines whether to run in standalone or stacked PR mode from git context.The skill now checks the current branch and existing PR relationships to infer stack context, instead of relying on manual prompting.
💡 Motivation and Context
When the workflow starts on
main, it should default to a normal PR againstmainand not accidentally assume stacked PR behavior.This change makes that default explicit and still allows stacked mode when the user asks for it.
💚 How did you test it?
./gradlew spotlessApply apiDumpsuccessfully (using JDK 17 locally)📝 Checklist
sendDefaultPIIis enabled.🔮 Next steps
#skip-changelog