fix: pass labels and reviewers through PR creation call chain (#44) (#44)#59
Merged
fix: pass labels and reviewers through PR creation call chain (#44) (#44)#59
Conversation
…viewers Passthrough
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
PR labels and reviewers configured via
config.pullRequest.labelsandconfig.pullRequest.reviewerswere silently dropped when creating a pull request. This fix extends theCreatePullRequestParamsinterface with these fields and threads them through the entire call chain: the phase executor, the GitHub API layer, and the Azure DevOps provider.Closes #44
Changes
src/platform/provider.ts: Added optionallabels?: string[]andreviewers?: string[]fields to theCreatePullRequestParamsinterface.src/executors/pr-composition-phase-executor.ts: UpdatedcreatePullRequest()call to forwardctx.config.pullRequest.labelsandctx.config.pullRequest.reviewers.src/github/api.ts: UpdatedGitHubAPI.createPullRequest()to conditionally includelabelsandreviewersin thecreate_pull_requestMCP tool call arguments (only when non-empty).src/platform/azure-devops-provider.ts: After PR creation, sets labels via the ADOPOST /labelsendpoint and adds reviewers by resolving their identity GUIDs via the VSSPS identities API then callingPUT /reviewers/{id}. Both operations are non-critical — failures are logged as warnings.tests/github-provider-parsing.test.ts: Added tests verifying thatlabelsandreviewersare forwarded to the MCP call, and that omitting them produces no extra keys in the payload.tests/pr-composition-phase-executor.test.ts: Added tests verifying thatlabelsandreviewersfromctx.config.pullRequestare passed tocreatePullRequest().tests/azure-devops-provider.test.ts(new file): Comprehensive unit tests for the ADO provider's PR creation, labels, and reviewers forwarding logic, including failure-tolerance behavior.Implementation Details
The GitHub provider path was the simpler change: the MCP
create_pull_requesttool already supportslabelsandreviewers, so only the parameter plumbing was missing. For Azure DevOps, labels and reviewers require separate REST calls after initial PR creation. Reviewer resolution requires an extra identity lookup against the VSSPS API to convert an email/alias string into the GUID that the ADO reviewers endpoint expects. Failures in these post-creation calls are treated as non-critical warnings to preserve overall PR creation success.Testing
PRCompositionPhaseExecutor,GitHubAPI, andAzureDevOpsProvidercovering labels and reviewers passthrough.Integration Verification
Notes
searchFilter=AccountNameagainst the VSSPS identities API. If a reviewer string is not an exact account name match, the identity lookup will return no results and a warning is logged — the reviewer is skipped rather than failing the PR creation.POST /labelsper label (one call per label), not a batch endpoint, which is consistent with the ADO API design.pullRequest.labelsalready defaults to['cadre-generated']andpullRequest.reviewersalready defaults to[].Cadre Process Challenges
Closes #44