Repository navigation
Improve new worktree startup timing - #4555
Merged
Merged
Conversation
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
Benchmark
Methodology: Electron dev app with isolated
ORCA_DEV_USER_DATA_PATHprofiles, local repo/Users/nwparker/projects/orca, setup skipped, 5 disposable worktrees per side, and a self-contained startup command (node -e "console.log(...)"). The reliable milestone is terminal PTY adoption/visibility, which is the part this PR moves earlier; this does not measure an agent model's first token.Baseline was detached
origin/mainatc9c0418612; PR branch wasaf48b0f07f.origin/mainmedianspawn_startup_terminalstarts in main)Interpretation: this PR does not make
git worktree addfaster. It moves self-contained terminal/agent startup into the backend at the first safe point after worktree registration, so startup can begin before the renderer activation/handoff path; in the no-setup local benchmark that makes the visible terminal only modestly faster because git dominates the total time, but it starts the terminal process ~189ms earlier and records the phase timing needed to optimize the next bottleneck.Validation
pnpm exec vitest run --config config/vitest.config.ts src/main/worktree-create-timing.test.ts src/main/ipc/worktrees.test.ts src/renderer/src/store/slices/worktrees.test.tspnpm run typecheckpnpm exec oxlint --quiet src/main/worktree-create-timing.ts src/main/worktree-create-timing.test.ts src/main/ipc/worktree-remote.ts src/main/ipc/worktrees.test.ts src/main/ipc/pty.ts src/main/runtime/orca-runtime.ts src/renderer/src/hooks/useComposerState.ts src/renderer/src/store/slices/worktrees.ts src/renderer/src/store/slices/worktrees.test.ts src/shared/types.tspnpm run lint:switch-exhaustivenesspnpm run lint(passes; reports existingChecksPanel.tsxreact-hooks warnings)startupTerminal.spawned === true, timing includedspawn_startup_terminal, and renderer state was active on the adopted terminal tab.perf-first-output-bench-*worktrees were force-removed after each sample.Notes
--no-verifybecause lint-staged runsoxlint --config config/oxlint-react-doctor.json --deny-warningson touched files and reports pre-existinguseComposerState.tswarnings unrelated to this change.