perf(worktree): fix the prepared-checkout hit rate and make misses visible (#17863)

This commit is contained in:
Neil
2026-09-01 20:26:00 -07:00
committed by GitHub
parent 7a69357856
commit 6c8eea5ebe
22 changed files with 1644 additions and 274 deletions
@@ -185,7 +185,7 @@ export async function createRuntimeLocalGitWorktree(args: {
)) ?? {})
let addResult: AddWorktreeResult
try {
const preparedResult =
const preparedAttempt =
sparseDirectories.length === 0 && !args.checkoutExistingBranch
? await consumePreparedWorktreeCreate({
repoPath: args.repo.path,
@@ -197,8 +197,9 @@ export async function createRuntimeLocalGitWorktree(args: {
...(preparedWorktreeOptions ? { options: preparedWorktreeOptions } : {})
})
: null
if (preparedResult) {
addResult = preparedResult
// This path has no create-span recorder, so the miss reason is only observable on the IPC path.
if (preparedAttempt?.status === 'hit') {
addResult = preparedAttempt.result
} else if (sparseDirectories.length > 0) {
addResult =
(await (addOptions