Repository navigation
fix(azure-devops): az repos pr create links the new pull request to the thread - #36292
juliusmarminge wants to merge 1 commit into
Conversation
…he thread An agent that opened a pull request with `az repos pr create` left its thread without a link: the Azure DevOps definition named no create command, and the reactor only reads a URL on a line of its own, while `az` prints the pull request as JSON with its REST address. The definition now names the create command and reads the web URL out of that JSON. Every `az repos pr` subcommand prints an existing pull request in the same form, so one beside the create (`show`, `list`, `update`) leaves nothing linked. Printed URLs are now counted against each host's own create commands, so an Azure create cannot vouch for a second GitHub URL. Fixes #31166 Co-Authored-By: Claude Fable 5.2 <[email protected]>
ApprovabilityVerdict: Approved at Macroscope's review found this PR approvable — Azure DevOps pull requests created by an agent are now linked to the conversation using parsed CLI output. The change reuses existing linking and refresh behavior, with guards against treating existing pull requests as newly created. You can add or adjust custom eligibility rules. Learn more. |
Thread transfer impact✅ Thread transfer remains within every enforced ceiling.
Other scenariosAll 64 scenario measurements match All 64 scenario measurements
Baseline: Scenario and decoded snapshot size10 historical turns, 5 command tools per turn, 878.9 KiB retained MCP result per historical turn, and a 1.05 MiB retained result in the measured turn.
Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed. |
|
The automated pipeline stopped on this pull request and will not merge it: the fix is written and reviewed, but proving it needs something no worker has:
It stays open for a person to finish or close. |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Rebuilt from origin/main as one commit; the first attempt's branch was not used as a base, only its diff was read. Cause: the Azure DevOps definition set no
changeRequestCreateCommand, andchangeRequestsCreatedByin PullRequestSyncReactor only reads a URL on a line of its own, whileaz repos pr createprints indented JSON whoseurlis the REST address. Fix: the definition now sets the create command and a new optionalchangeRequestCreateOutputUrls, which reads each top-level JSON object in the output and builds the web URL with the existingazureDevOpsPullRequestWebUrl(moved unchanged from server/ to shared/pullRequestUrls.ts so the definition can use it). The reviewers' open finding (az repos pr show --id "$PR_ID" && az repos pr create --title test --output nonelinking existing PR 42) is settled by a new optionalchangeRequestPrintCommand: Azure sets it to anyaz repos prsubcommand,az devops invokeoraz rest, and when one runs beside the create nothing of that host is linked, since all of them print an existing pull request in the same JSON form. That is broader than the first attempt's list-only guard and is covered by a test row that fails without it. Printed URLs are also counted per host against that host's own create commands instead of against the total, so an Azure create cannot vouch for a second GitHub URL; that is a small tightening for mixed-host scripts that main did not have. Limit: an indented JSON pull request printed by a non-azcommand (for examplecat saved.json) beside a create would still be read, the same class of gap GitHub has withcat urls.txt. docs/user/source-control.md now namesaz repos pr createamong the commands that link automatically. No UI change.Fixes #31166
Supersedes #31191. The change is @juliusmarminge's; their commits are kept.
Reproduction on main
In T3 Code, open a project backed by an Azure DevOps Services repository with an authenticated Azure CLI. Push a feature branch and ask an agent in a thread to run
az repos pr create --source-branch feature --target-branch main --title "Linking reproduction", retaining default JSON output and without calling link_pull_request. Inspect the thread's linked pull requests: main leaves the new PR unlinked; this change should add it automatically. These steps were derived from the issue and diff, not executed.Evidence
Being captured: before and after in the real app. This section is filled in before the pull request can merge.
Tests
vp test run src/orchestration-v2/PullRequestSyncReactor.test.ts -t "links what the command created"in apps/server: 22 passed, including 3 new table rows (Azure create after a push links PR 42;az repos pr showbeside a silent create links nothing; an existing GitHub URL beside GitHub and Azure creates links nothing). Verified failing-first: with the source changes stashed the Azure create row fails; with onlychangeRequestPrintCommanddisabled theshowrow fails.vp run check:changed: format, lint, knip, graphql, typecheck (19 packages) and tests (4 files, 110 tests) all pass. The pre-commit hook (fmt, lint, knip) passed.Not in this change
azureDevOpsPrintedPullRequestUrlsin the package; the reactor table rows exercise it end to end at the one layer that failed on main.az repos pr create --output jsonpiped throughjq -c,--output tsv,--query) is not read, so those creates stay unlinked rather than guessed at.az repos pr listbeside a create and for a GitHub create after an Azure list were not carried over; theshowrow covers the same guard, and the Azure list case is unchanged existing behaviour.Who did the work
Run by the t3code factory in T3 Code.