Skip to content

perf(server): selected-file commits probe cherry-pick and revert refs only in reftable repositories - #40334

Open
juliusmarminge wants to merge 2 commits into
mainfrom
factory/issue-40314
Open

juliusmarminge wants to merge 2 commits into
mainfrom
factory/issue-40314

Conversation

@juliusmarminge

Copy link
Copy Markdown
Member

Every commit of selected files started two extra git rev-parse processes that look for reftable-stored cherry-pick and revert refs, even in ordinary files-backend repositories where they cannot exist. That cost about 90-120 ms per partial commit on Windows. The check now runs only when the repository (or worktree) has a reftable directory, which the existing rev-parse --git-path call resolves at no extra process cost. Partial commits during a cherry-pick or revert are still refused in both ref backends.

Fixes #40314

Reproduction on main

Commit c1464d6 (origin/main), Windows Server 2025 pool machine, Git 2.56.1.windows.1, Defender real-time protection on. Seed: git clone -q --local of the t3code checkout (33,228 tracked files, git rev-parse --show-ref-format = files), branch work. A scratch vitest driver (uploaded: https://gh-file-drop-api-prod-mi5fy3sowv63ufte.pinglabs.workers.dev/f/a59a29353255fb59/perf40314.test.ts) builds the real GitVcsDriverCore with a counting ChildProcessSpawner and a span-collecting Tracer. It appends to README.md, package.json and AGENTS.md, then calls driver.commit(repo, msg, '', { stage: { filePaths: ['README.md'] } }) 6 times. Result on main: GitVcsDriver.commit.operationRef ran 2 times on 6 of 6 commits, 108-142 ms per commit (median 123 ms), right after commit.mergeHead (68-125 ms). Git processes per commit: 12-13. driver.commit total: median 1,154 ms (1,118-1,388). Baseline on the same machine with the probes disabled (operationRefs set emptied, then reverted): operationRef 0 times, 10-11 git per commit, driver.commit median 845 ms (782-1,244). Not run: the reporter's full WebSocket client flow; the measurement is at the driver.commit level that runCommitStep calls. The failing test on factory/repro-40314 makes one selected-file commit in a files-backend repo and asserts no --symbolic-full-name spawn; it fails on main on Linux too, and the 4 existing refusal tests (files and reftable cherry-pick/revert) pass.

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/vcs/GitVcsDriverCore.test.ts -t "selected-file|cherry-pick and revert refs" (Linux, Git 2.43): 14 passed, reftable cases skipped (need Git 2.45+)
  • Same command on Windows with the fix (Git 2.56.1): new repro test and all 4 refusal tests (files and reftable, cherry-pick and revert) pass; 2 merge-conflict tests fail
  • Same command on Windows without the fix: 3 failed (the repro test plus the same 2 merge-conflict tests, so those 2 fail before this change too)
  • Triage's perf driver on Windows, before and after: operationRef 2 to 0 per commit, git processes 12-13 to 10-11, driver.commit median 903 ms to 812 ms
  • vp run check:changed: format, lint, knip, graphql, typecheck (3 packages), tests (2 files, 360 passed) all pass

Not in this change

  • Two selected-file merge-conflict tests fail on Windows Server with 'Git command exited with a non-zero status' both before and after this change (GitVcsDriver.review.emptyTree in one case).

Who did the work

  • Written by Claude Opus 5.5, in Claude Code
  • Reviewed by GPT-6.1 Sol, in Codex, and by Claude Opus 5.5, each on its own
  • Proof captured by GPT-6.1 Sol and checked by Claude Opus 5.5

Run by the t3code factory in T3 Code.

juliusmarminge and others added 2 commits November 21, 2026 12:19
…be no operation refs

Reproduces #40314: the partial-commit step runs rev-parse --symbolic-full-name
for CHERRY_PICK_HEAD and REVERT_HEAD even when the repository does not use reftable.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… only in reftable repositories

Fixes #40314

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@github-actions github-actions Bot added vouch:trusted Author is trusted by repo permissions or the VOUCHED list. size:S 10-29 changed lines (additions + deletions). labels Nov 21, 2026
@github-actions

Copy link
Copy Markdown
Contributor

Thread transfer impact

✅ Thread transfer remains within every enforced ceiling.

Provider Metric Main baseline This PR Impact PR ceiling
Codex Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Codex Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Codex Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Codex Live turn WebSocket decoded 21.5 KiB 21.5 KiB 0 B (0.0%) 24.4 KiB ✅
Codex Live turn messages 1 1 0 (0.0%) 8 ✅
Claude Total thread wire 5.0 KiB 5.0 KiB 0 B (0.0%) 6.8 KiB ✅
Claude Thread snapshot wire 3.8 KiB 3.8 KiB 0 B (0.0%) 4.9 KiB ✅
Claude Live turn WebSocket wire 1.2 KiB 1.2 KiB 0 B (0.0%) 2.0 KiB ✅
Claude Live turn WebSocket decoded 21.9 KiB 21.9 KiB 0 B (0.0%) 24.4 KiB ✅
Claude Live turn messages 1 1 0 (0.0%) 8 ✅

Other scenarios

All 64 scenario measurements match main.

All 64 scenario measurements
Provider Scenario Metric Main baseline This PR Impact PR ceiling
Codex short turn resume WebSocket decoded 10.5 KiB 10.5 KiB 0 B (0.0%) 12.7 KiB ✅
Codex short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn running, cold open HTTP decoded 281.7 KiB 281.7 KiB 0 B (0.0%) 302.7 KiB ✅
Codex long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Codex long turn running, history page HTTP decoded 92.4 KiB 92.4 KiB 0 B (0.0%) 107.4 KiB ✅
Codex long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Codex long turn finished, cold open HTTP decoded 381.5 KiB 381.5 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, socket cold open WebSocket decoded 381.6 KiB 381.6 KiB 0 B (0.0%) 410.2 KiB ✅
Codex long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Codex long turn finished, work page HTTP decoded 186.2 KiB 186.2 KiB 0 B (0.0%) 200.2 KiB ✅
Codex long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Codex idle thread resume WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell snapshot HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Codex fleet shell subscribe WebSocket decoded 65 B 65 B 0 B (0.0%) 200 B ✅
Codex fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Codex fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Codex fleet shell resume check rows 0 0 0 0 ✅
Codex stale shell reload HTTP decoded 42.4 KiB 42.4 KiB 0 B (0.0%) 53.7 KiB ✅
Codex stale shell reload rows 27 27 0 (0.0%) 27 ✅
Codex stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Codex stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Codex stale todo list cold open HTTP decoded 72.4 KiB 72.4 KiB 0 B (0.0%) 83.0 KiB ✅
Codex stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Codex stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Codex stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Codex stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅
Claude short turn resume WebSocket decoded 10.6 KiB 10.6 KiB 0 B (0.0%) 12.7 KiB ✅
Claude short turn resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn running, cold open HTTP decoded 283.3 KiB 283.3 KiB 0 B (0.0%) 302.7 KiB ✅
Claude long turn running, cold open rows 75 75 0 (0.0%) 75 ✅
Claude long turn running, history page HTTP decoded 93.4 KiB 93.4 KiB 0 B (0.0%) 107.4 KiB ✅
Claude long turn running, history page rows 75 75 0 (0.0%) 75 ✅
Claude long turn finished, cold open HTTP decoded 384.2 KiB 384.2 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, socket cold open WebSocket decoded 384.3 KiB 384.3 KiB 0 B (0.0%) 410.2 KiB ✅
Claude long turn finished, socket cold open WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude long turn finished, socket cold open rows 151 151 0 (0.0%) 151 ✅
Claude long turn finished, work page HTTP decoded 188.1 KiB 188.1 KiB 0 B (0.0%) 200.2 KiB ✅
Claude long turn finished, work page rows 150 150 0 (0.0%) 150 ✅
Claude idle thread resume WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude idle thread resume WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell snapshot HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude fleet shell snapshot rows 27 27 0 (0.0%) 27 ✅
Claude fleet shell subscribe WebSocket decoded 66 B 66 B 0 B (0.0%) 200 B ✅
Claude fleet shell subscribe WebSocket messages 1 1 0 (0.0%) 1 ✅
Claude fleet shell resume check HTTP decoded 18 B 18 B 0 B (0.0%) 100 B ✅
Claude fleet shell resume check rows 0 0 0 0 ✅
Claude stale shell reload HTTP decoded 43.0 KiB 43.0 KiB 0 B (0.0%) 53.7 KiB ✅
Claude stale shell reload rows 27 27 0 (0.0%) 27 ✅
Claude stale shell resume WebSocket decoded 140 B 140 B 0 B (0.0%) 400 B ✅
Claude stale shell resume WebSocket messages 2 2 0 (0.0%) 2 ✅
Claude stale todo list cold open HTTP decoded 73.4 KiB 73.4 KiB 0 B (0.0%) 83.0 KiB ✅
Claude stale todo list cold open rows 75 75 0 (0.0%) 75 ✅
Claude stale todo list cold open nodes 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open subagents 2 2 0 (0.0%) 4 ✅
Claude stale todo list cold open plans 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open providerTurns 1 1 0 (0.0%) 2 ✅
Claude stale todo list cold open checkpoints 1 1 0 (0.0%) 2 ✅

Baseline: 7ef7ba0 · PR result: 9715f6a · Source CI: success

Scenario and decoded snapshot size

10 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.

  • Codex decoded thread snapshot: 108.5 KiB
  • Claude decoded thread snapshot: 108.8 KiB

Updated in place by a trusted workflow. PR artifacts are strictly validated and never executed.

@coderabbitai

coderabbitai Bot commented Nov 21, 2026

Copy link
Copy Markdown
Contributor

Explain Change →

No actionable comments were generated in the recent review.

Walkthrough

Partial-commit operation detection now checks for a reftable directory when marker files are missing. A regression test verifies that a selected-file commit in a reftable repository succeeds without a Git command using --symbolic-full-name.

Changes: Partial-commit operation detection

Layer / File(s) Summary
Reftable detection and regression test
apps/server/src/vcs/GitVcsDriverCore.ts, apps/server/src/vcs/GitVcsDriverCore.test.ts
The operation check uses reftable presence when evaluating missing CHERRY_PICK_HEAD or REVERT_HEAD files. The regression test checks the commit subject and verifies that no Git command uses --symbolic-full-name.

Estimated code review effort: 2 (Simple) | ~10 minutes

Change: Refactor · Severity of issue fixed: Low

Suggested reviewers: only21mil, amv146

Merge Risk: Minimal · up to 9715f

Partial commits in files-backend repositories skip two unnecessary Git probes, which speeds them up. Refusal during cherry-pick and revert is preserved for both ref backends. No merge-blocking risk was identified.

Pre-merge checks: Passed 4

Check name Status Explanation
Title check Passed The title names the main change: selected-file commits now probe cherry-pick and revert refs only in reftable repositories. The raw summary and objectives match this. The title is long (99 characters)…
Description check Passed The description follows the template's main ideas. It states the problem with timing data, explains the change, and links issue #40314. It gives detailed verification, including Linux and Windows test…
Linked Issues check Passed Issue #40314 is the only active directly linked issue. Its coding objectives are:
1. Zero GitVcsDriver.commit.operationRef calls per selected-file commit in files-backend repositories. Evidence: the P…
Out of Scope Changes check Passed The changes touch apps/server/src/vcs/GitVcsDriverCore.ts (partial-commit operation detection gated on a reftable directory check) and apps/server/src/vcs/GitVcsDriverCore.test.ts (one new selected-fi…
Full details: Title check

Explanation

The title names the main change: selected-file commits now probe cherry-pick and revert refs only in reftable repositories. The raw summary and objectives match this. The title is long (99 characters) but specific and accurate. It uses the conventional commit form the template asks for.

Full details: Description check

Explanation

The description follows the template's main ideas. It states the problem with timing data, explains the change, and links issue #40314. It gives detailed verification, including Linux and Windows test runs and a check run. The Scope section is covered by the linked issue. The Evidence section says it is pending and must be filled in before merge. The template asks for before/after evidence for UI changes, but this PR changes no UI, so the pending section does not block the check. The author also says the full WebSocket client flow was not run. The description is complete enough to pass, though it is long and the Evidence section still needs content.

Full details: Linked Issues check

Explanation

Issue #40314 is the only active directly linked issue. Its coding objectives are:

  1. Zero GitVcsDriver.commit.operationRef calls per selected-file commit in files-backend repositories. Evidence: the PR reports operationRef 2 to 0 per commit on Windows. The new test asserts no --symbolic-full-name spawn for a files-backend selected-file commit. It fails on main and passes with the fix (per PR Tests section). Status: Addressed.
  2. Runcommitstep Git commands at most 15. Evidence: the PR reports Git processes 12-13 to 10-11 per commit. Status: Addressed.
  3. About 80 ms reduction in commit-step time. Evidence: the PR reports median driver.commit 903 ms to 812 ms (about 91 ms), measured at driver level only. Status: Addressed, with the caveat that the WebSocket client flow was not measured.
  4. Keep the mergeHead check and keep refusal during merge, cherry-pick, revert, and sequencer operations in both backends. Evidence: the 4 refusal tests (files and reftable, cherry-pick and revert) pass on Windows with Git 2.56.1. Reftable cases were skipped on Linux (Git 2.43), so reftable refusal evidence comes from Windows only. Status: Addressed.
    The #40248 prepareCommitContext work is excluded by the issue. The two merge-conflict test failures on Windows also occur without the fix, so they are not attributed to this change.
    Limitation: the git diff blobs were unavailable in this checkout. The code-level conclusions rely on the supplied PR description, the raw summary, and the reported test runs, not on a direct read of the changed hunks.
Full details: Out of Scope Changes check

Explanation

The changes touch apps/server/src/vcs/GitVcsDriverCore.ts (partial-commit operation detection gated on a reftable directory check) and apps/server/src/vcs/GitVcsDriverCore.test.ts (one new selected-file commit test). Both map directly to issue #40314. No unrelated files appear in the supplied summary. The #40248 prepareCommitContext work is not included. Limitation: the git diff blobs were unavailable, so the file-level scope relies on the supplied summary and PR description.

Finishing Touches

Generate unit tests (beta)

  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts
Recent review info

Run configuration

Commits

Reviewing files that changed from the base of the PR and between 7ef7ba0 and 9715f6a.

Files selected for processing: 2

  • apps/server/src/vcs/GitVcsDriverCore.test.ts
  • apps/server/src/vcs/GitVcsDriverCore.ts

Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size:S 10-29 changed lines (additions + deletions). vouch:trusted Author is trusted by repo permissions or the VOUCHED list.

Projects

None yet

1 participant