Repository navigation
perf(azure-devops): pull request Code tab shows its first files in about 5 s - #5
Conversation
…out 5 s The Code tab spent two `az` reads per changed file, then diffed them in process. It now reads one page of up to 50 files with their diff blocks from Azure's `pullRequestFilesDiff` preview in a single `az devops invoke` call, and builds each file's patch from the blocks. - Pages are requested from page-aligned offsets, because Azure orders each page itself, and one page is held so slices that stop inside it do not refetch. - A file whose blocks cannot be trusted (binary, elided text, a hidden final-newline change, oversize) is read the old way. - A first page Azure cannot give falls back to the iteration changes; a later page too large to read is skipped and the slice marked truncated. - Cursors record which file list they index so a walk resumes in the same order. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…walk holds The held files diff page is shared by every walk. A walk that read its page to the end released whatever page was held, so a concurrent walk on another pull request lost its page and had to read it again. Release the held page only when it is the one this request read. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
…replaces it Releasing the held page once a walk read it to its end freed memory only for the last page of a fully read pull request, since a walk left inside a page kept it anyway, and it let one walk evict a page another walk held. Hold the last page until the next files diff page replaces it, and drop the release and its race. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
@coderabbitai full review |
Action performed
|
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
|
Verified the substantive full review of d85ae85: no actionable comments; minimal merge risk. I checked the retained architecture concerns against rebuildSides and openDiff. They accurately describe the original implementation's accepted limits, not new defects from this port: Azure's equal blocks are whitespace-insensitive, and concurrent iteration/page reads cannot prove snapshot identity. Both are explicitly documented in this PR and the upstream review; extra sequential az reads would defeat the approved latency trade-off. This bounded port preserves those choices rather than redesigning the API/transport. The page-size question remains unverified against a live Azure service; focused tests verify exact 50-file slices, aligned offsets, held-page reuse, and truncation. No claim of a fresh live benchmark is made. Integrated peer PR #4 from origin/main in d41a75b without changing Azure source. Awaiting fresh hosted validation and automatic review coverage of that head before merge. No duplicate initial review trigger. |
Use one response-projection input for files diffs and status checks, with exact CLI argument coverage for both. Preserve newest-source-SHA and escaped item-path regressions. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Exercise the files-diff preview in all location-seeding entry-point cases and preserve the original per-file fallback in the cache-recency cases. Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Problem
Azure DevOps' Code tab starts two Azure CLI reads per changed file, delaying the first diff slice and timing out on larger pull requests. This restores the focused performance change from pingdotgg#29818 after its earlier combined fork integration was explicitly reverted.
Change
Reapply feature commits
349e1bf791,43d732e729, anddfef056583in order, preserving Alex Vallone's authorship and Copilot trailers; exclude the upstream-sync merge.Use
pullRequestFilesDiffwith API version7.2-previewand one response projection,--query "to_string(@)", protecting non-ASCII Windows output. Fetch page-aligned batches of 50 files, retain the last page across slices, and reconstruct unified patches from Azure's blocks. Unrepresentable files keep the existing per-file fallback. Cursors retain source/iteration provenance; unavailable initial pages fall back, while unreadable later pages and changed iterations report truncation.Preserve the fork's newest-source-SHA handling, escaped item-path queries, and location caching. Additional assertions cover the exact 50-file bound, retaining a completed page, and resuming a held iteration after a push before truncating at the next unheld page. The checks port landed separately in #3 and is now integrated: both files diffs and status checks use the one
queryhelper input, and exact CLI-argument assertions verify each projection and API version without duplicate--queryhandling. The location-cache port landed separately in #2 and is also integrated; its entry-point cases now exercise files-diff preview while preserving fallback/cache-recency coverage.Accepted upstream trade-offs remain unchanged: Azure's blocks are whitespace-insensitive; binary/unrepresentable entries still incur file reads; pages over the 16 MiB output cap can be skipped with truncation. Held pages intentionally finish the cursor's iteration without another CLI call. The documented race between concurrent latest-iteration and files-diff reads remains; the upstream author and reviewer accepted this latency trade-off. No new transport, authentication path, contracts, client code, settings, or workflows.
Scope and approval
Upstream: pingdotgg#29818 (original head
d8dc58e3bb5240d60a653bb5c74f7e5349d19740), addressing pingdotgg#27329.The fork owner explicitly approved this bounded port in the originating T3 Code request: "Own the port of pingdotgg#29818 ... into amv146/t3code" and "You may create, fix, push and merge YOUR fork PR to amv146/t3code main when latest-head checks/reviews meet readiness." This is approval for this fork only, not a claim of upstream maintainer approval. Upstream PRs and source branches are untouched.
Only
packages/source-control-azure-devopschanges. Web, desktop, mobile, remote connections, and agent entry points consume the existing provider API unchanged.Verification
git diff --check- passed.vp test run packages\source-control-azure-devops\src\server\AzureDevOpsPullRequestCli.test.ts packages\source-control-azure-devops\src\server\AzureDevOpsPullRequestProvider.test.ts packages\source-control-azure-devops\src\server\azureDevOpsDiff.test.ts packages\source-control-azure-devops\src\server\azureDevOpsPullRequestJson.test.ts- could not start locally: missing project-localvite-plus.vp install --frozen-lockfile- failed: corporate registryhttps://packagefeedproxy.microsoft.io/npm/@alchemy.run%2Ftestreturns HTTP 404 during supply-chain verification. No policy or lockfile changes.vp run check:changed origin/main- could not start locally after that install failure: missing project-localvite-plus.vp fmt --check packages\source-control-azure-devops\src\server\AzureDevOpsPullRequestCli.test.ts packages\source-control-azure-devops\src\server\AzureDevOpsPullRequestCli.ts packages\source-control-azure-devops\src\server\AzureDevOpsPullRequestProvider.test.ts packages\source-control-azure-devops\src\server\AzureDevOpsPullRequestProvider.ts packages\source-control-azure-devops\src\server\azureDevOpsDiff.test.ts packages\source-control-azure-devops\src\server\azureDevOpsDiff.ts packages\source-control-azure-devops\src\server\azureDevOpsPullRequestJson.test.ts packages\source-control-azure-devops\src\server\azureDevOpsPullRequestJson.ts- could not load config locally: missing project-localvite-plus.Hosted Fork PR validation passed on
d85ae8591e0690e7476358051e8853af0974b574, including shared checkout fix852618b095. The exact commandvp run check:changed "$BASE"usedBASE=852618b095a70cf480d99831708eb40f18f4c240: format, lint, both knip passes, typecheck of 11 affected/dependent packages, and 127 tests across 5 files all passed. Chromium installation also passed. Existing Blacksmith jobs remain queued and are not disabled or bypassed.Peer PRs #4 and #3 were merged from
origin/main; the checks/files-diff conflict resolution preserves both features with one projection helper. Fork PR validation passed onc0aa9e39f96751b2b5811f5ad42ec0a7b3b1d098. The exact commandvp run check:changed "$BASE"usedBASE=a54dea3e75f1ab5025e5516039bc79998b5708d3: format, lint, both knip passes, typecheck of 11 packages, and 140 tests across 5 files passed, including the combined Azure projection, head-SHA, and path-escaping coverage.vp run check:changed origin/mainwas attempted again locally on this integrated head and still could not start because the corporate-registry failure leftvite-plusunavailable.CodeRabbit's substantive review explicitly covers
c0aa9e39f96751b2b5811f5ad42ec0a7b3b1d098(kind: reviewed), with no actionable comments and minimal merge risk. There are no unresolved review threads. Retained whitespace/snapshot architecture concerns were verified as the original documented trade-offs described above, not new port defects.The head-pinned merge attempt was rejected when peer #2 landed concurrently; this PR was not merged.
origin/mainwas then merged again, preserving the location cache and adapting its tests to the preview API. Current headae6024fafd69add5e5e3472cc43baee33f9e002dhas passed hosted Fork PR validation:vp run check:changed "$BASE"withBASE=b445f5ae88f863645a32eef79a9172c8dd2ac60dpassed format, lint, both knip passes, typecheck of 11 packages, and 145 tests across 5 files. CodeRabbit's substantive review explicitly covers this same head (kind: reviewed), with no actionable comments and minimal merge risk. The retained architecture concerns remain the verified, documented upstream trade-offs.vp run check:changed origin/mainwas attempted on this final-peer integration too and remains blocked locally by missingvite-plus. Optional Blacksmith jobs are not a configured requirement; no check or policy was disabled or bypassed.The coordinator lifted the serialization hold after composer PR #1 merged as
5cb8de196102a53f209b6b5bbb403fa4b6c8ddc3. Composer-integrated head92b16a144655b2f1e9f3d4b75ac7a4644606ef9fpassed hosted validation:vp run check:changed "$BASE"withBASE=5cb8de196102a53f209b6b5bbb403fa4b6c8ddc3passed format, lint, both knip passes, 11-package typecheck, and 145 tests across 5 files. CodeRabbit explicitly skipped its automatic incremental review because no selected files had new reviewable changes from the substantively reviewedae6024fafd, not because of allowance.Fork-maintenance PR #6 subsequently landed on main. It was merged normally into this branch, yielding
58098ae53c73ec961101bd157161c94001fdf802;git diff ae6024fafd HEAD -- packages/source-control-azure-devopsis empty. This merge-only head awaits fresh hosted validation and automatic review evidence. No additional manual review triggers or paid reviews are authorized; a review allowance blocker will be reported rather than bypassed. Macroscope remains suspended.Head
58098ae53c73ec961101bd157161c94001fdf802subsequently passed Fork PR validation at 2026-11-08 23:05:59 UTC:vp run check:changed "$BASE"withBASE=28fee9478de4c278f0196a4261eb95688f595cddpassed format, lint, both knip passes, 11-package typecheck, and 145 tests in 5 files. CodeRabbit again reported no new reviewable changes. The optional Blacksmith fingerprint job remaining queued was not a merge requirement; the PR should have advanced when hosted validation finished.The newest fork nightly
1d4e3ffb82has been merged normally into this branch. Final head9eef98f9cfafefb237037972cd37de9c2dd51a5bstill has no Azure source or test changes relative to the substantive reviewed headae6024fafd. CodeRabbit's automatic incremental review explicitly skipped this exact head because there were no new reviewable changes, not because of allowance.Final-head Fork PR validation passed:
vp run check:changed "$BASE"withBASE=origin/mainresolving to1d4e3ffb82d9c1d51ee11a88cbe7117b8a463a72passed format, lint, both knip passes, typecheck of 11 packages, and 145 tests in 5 files. This fresh dispatch replaced the pull-request-triggered run and its retry, which failed with GitHub internal-server errors before creating any jobs. No workflows, checks, policies, billing settings, or review triggers were changed to obtain this evidence. Main is integrated and the fork has no configured branch-protection/ruleset requirements.Upstream's approximately five-second timings and previous combined-port results are reference evidence, not a fresh benchmark of this standalone fork head. No live dev server or private Azure repository was used for this port.
Port and integration: GPT-6.1 Sol (
gpt-6.1-sol) in T3 Code through the acpRegistry harness (GitHub Copilot). Original implementation: Alex Vallone with Claude Sonnet 5.5 and Claude Opus 5.5 through GitHub Copilot CLI over ACP.