Skip to content

perf(worktree): remove redundant creation and terminal startup work - #18793

Merged
nwparker merged 15 commits into
mainfrom
nwparker/worktree-create-technical
Sep 5, 2026
Merged

nwparker merged 15 commits into
mainfrom
nwparker/worktree-create-technical

Conversation

@nwparker

@nwparker nwparker commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Worktree creation repeats Git checks and terminal setup before the workspace becomes usable. This removes redundant work while preserving the existing creation trigger, branch selection, hooks, profiles, and startup policy.

  • Reuse resolved base commits and overlap independent finalization reads; preserve branch-adoption conflict checks.
  • Resolve WSL workspace roots asynchronously once per creation and refresh catalog ownership before startup.
  • Preserve terminal incarnation/snapshot metadata during reattachment and initialize ligatures before the first WebGL atlas.
  • Load Codex preflight directly, with an explicit packaging entry, instead of loading unrelated agent-hook controls.

This is the independent technical foundation for #18876. It adds no speculative workspace, shell, hook, or agent startup. It respects the user's Git checkout-worker configuration.

Evidence:

  • Codex preflight packaged-runtime sample: median 125.55 → 109.7 ms. A targeted test verifies one initial WebGL atlas instead of two. These are overhead improvements, not a claim of instantaneous cold checkout.
  • Integrated product revision aad6d64f1d6 includes main 1924c8f5b1e. Full typecheck passed. The previous integration passed 260 focused tests (17 environment-gated skips); subsequent lifecycle and main-integration checks passed 56 and 26 tests respectively.
  • A fresh test build passed all five Docker SSH relay restarts, including shell-generated output, replacement PTY, exact lease ownership, and teardown (52.7 s total). The resolved test combines main's recovery helper with the replacement-PTY and lease checks.
  • Independent review/fix and elegance passes found no outstanding proven defect. Mobile-backcompat and Windows/Linux skill reviews found no proven compatibility issue. Live coverage on every supported topology remains incomplete.
  • Previous full CI passed unit/static/typecheck/Git compatibility/packaging and the broad SSH job, but the changed-spec job failed its frozen-host input assertion. The original local reproduction passed; its CI cause remains unproven.
  • Current head 9df55c82346 adds test-only evidence: shell-executed pre-freeze readiness and bounded terminal/authority observations, with the post-recovery observation after the single write. The original 60-second output assertion remains. The final local test passed in 57.8 seconds. Current CI: https://github.com/stablyai/orca/actions/runs/33993416795 — unit/static/typecheck/compatibility/packaging and changed E2E passed (15 passed, 1 skipped; frozen-host input recovery 51.3 s). The broader SSH suite also passed; the full run completed successfully.
  • Combined macOS/Windows trial: https://github.com/stablyai/orca-adhoc/releases/tag/v1.4.198-adhoc.20260905211711. Built from bebc3d9277ef (A + Keep creation drafts responsive without early workspace shells #18876 + main 1924c8f5b1e); subsequent commits change only two E2E test files. ARM installer checksum, app signature/notarization, bundled source, and actual creation/Send/reload behavior verified. Windows checksum verified; Windows UI untested.

Merged as d7767fb1960507a7ae3fc47d5858b06f8887bd6b after exact-head full CI passed. Assessed merge risk: low; the earlier frozen-host failure remains unexplained, but the corrected test and broad SSH suite pass. Snapshot replay and catalog invalidation are reliability changes, so this is not a pure performance refactor.

Remaining user-facing negative trade-off:

  • The fresh workspace-catalog scan can add work in large repositories.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

A performance pass that removes redundant subprocess and renderer work from worktree creation and terminal startup, split as PR A of a two-part change. Reviewed in full: the parallel-checkout config and its Git-version boundary, the base-OID reuse and read overlap in prepared-checkout finalization, the adoption-first branch conflict probe, the remote/username probe short-circuits, the async WSL workspace-root resolution and catalog invalidation ordering, and the terminal replay reconciliation plus ligatures-before-WebGL change.

  • checkout.workers=4 on native macOS — worktreeCheckoutGitArgs gates on darwin with no wslDistro, so WSL/Windows/Linux/SSH keep existing settings; documented Git 2.25–2.31 fallback is verified by a real-binary contract.
  • Reuse resolved base OIDs and overlap independent reads — resolveWorktreeAddBaseContext returns effectiveBaseOid only when no refresh/suggestion can move the ref; finalizePreparedWorktree settles both reads via Promise.allSettled before failure cleanup.
  • Skip unnecessary probes — probeLocalBranchRef uses rev-parse --verify --quiet to distinguish proven absence (no WSL login-shell retry), and explicit existing-branch adoption is deferred behind getBranchConflictKind's allowLocalBranch callback; empty-remote and no-separator bases short-circuit without spawning Git.
  • Resolve WSL workspace root once, asynchronously — createLocalWorktree awaits computeWorkspaceRootAsync and threads the single root through computeWorktreePath for every name candidate.
  • Invalidate the catalog before startup — invalidateWorktreeCatalog(repo.id) runs before spawnLocalStartupAndSetupTerminals so the just-created id resolves against a fresh cache.
  • Paint snapshot-covered startup output once — the daemon-snapshot reattach path now arms the restored-snapshot baseline and records the renderer ordered seq; unsequenced and blank snapshots clear the baseline and retain bytes. PTY reattach also preserves incarnationId.
  • Ligatures before the first WebGL atlas — openTerminal attaches ligatures ahead of attachWebgl, avoiding an immediate atlas rebuild; toggling still rebuilds.

The test coverage is thorough and the assertions are exact rather than loose: the adoption tests pin subprocess call counts, the OID-reuse tests assert the reused vs re-read OIDs, and the replay tests distinguish covered/legacy/blank snapshot cases. No correctness, security, or cross-platform (SSH/WSL/folder-workspace) concerns identified.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 5, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

Note

Reviews paused

It looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the reviews.auto_review.auto_pause_after_reviewed_commits setting.

Use the following commands to manage reviews:

  • @coderabbitai resume to resume automatic reviews.
  • @coderabbitai review to trigger a single review.

Use the checkboxes below for quick actions:

  • ▶️ Resume reviews
  • 🔍 Trigger review

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 98e36704-daaf-4466-b370-b2946b573919

📥 Commits

Reviewing files that changed from the base of the PR and between 5e2e2e1 and 9a84a57.

📒 Files selected for processing (2)
  • src/cli/handlers/agent-hooks.test.ts
  • src/cli/handlers/agent-hooks.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The changes add Git branch adoption probes, effective base OID reuse, asynchronous workspace-root resolution, prepared worktree finalization, and worktree catalog invalidation. They preserve PTY incarnation and snapshot metadata during reattachment, record renderer snapshot baselines, and add terminal ligature initialization during pane creation. Reliability gate, compatibility, integration, and regression tests cover the updated flows.

Merge Risk: 🔵 Low · up to 9a84a

Worktree creation and remote-base validation are being optimized, but a malformed remote-base value containing an internal double separator may still yield an invalid branch component. This is a bounded invalid-input handling risk that should be addressed or explicitly accepted before broader reliance on that path.

🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (2 warnings)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 37.50% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 24 functions across 44 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Description check ⚠️ Warning The description explains the technical changes, rationale, testing evidence, risks, and remaining trade-offs. However, it does not follow the required template structure and omits several required sec… Rewrite the description using all template headings. Add a brief ELI5 summary, explicit What Changed and Why sections, a valid Fixes #18876`` issue reference, Visual Proof or N/A with a reason, AI Disclosure details or the permitted omiss…
✅ Passed checks (3 passed)
Check name Status Explanation
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Title check ✅ Passed The title clearly identifies the primary change: removing redundant worktree creation and terminal startup work.
Full details: Description check

Explanation

The description explains the technical changes, rationale, testing evidence, risks, and remaining trade-offs. However, it does not follow the required template structure and omits several required sections, including ELI5, What Changed, Why, Linked Issue with a Fixes #... entry, Visual Proof or N/A, AI Disclosure, Review, Agent skill upstream boundary, Notes, and Checklist items.

Resolution

Rewrite the description using all template headings. Add a brief ELI5 summary, explicit What Changed and Why sections, a valid Fixes #18876`` issue reference, Visual Proof or N/A with a reason, AI Disclosure details or the permitted omission, Review and Agent skill upstream boundary sections, Notes covering the listed compatibility areas, and completed or explained Testing and Checklist items.

  • Fix all pre-merge checks with AI
✨ Finishing Touches 💡 1
📝 Generate docstrings 💡
  • Create stacked PR
  • Commit on current branch

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 9a7750cf-8010-41f6-a6cf-75e62f437756

📥 Commits

Reviewing files that changed from the base of the PR and between 436ef82 and f2d3d0f.

📒 Files selected for processing (40)
  • config/reliability-gates.jsonc
  • docs/reference/git-compatibility.md
  • src/main/git/git-username.ts
  • src/main/git/repo-branch-conflict.test.ts
  • src/main/git/repo-branch-conflict.ts
  • src/main/git/repo-username.test.ts
  • src/main/git/runner-wsl-direct-read.test.ts
  • src/main/git/worktree-add-creation-config.test.ts
  • src/main/git/worktree-add-local-base-refresh.test.ts
  • src/main/git/worktree-add-local-base-suggestion.test.ts
  • src/main/git/worktree-add.ts
  • src/main/git/worktree-create-preparation-real-wsl.test.ts
  • src/main/git/worktree-create-preparation.ts
  • src/main/git/worktree-preparation-base-oid.test.ts
  • src/main/ipc/worktree-logic-wsl.test.ts
  • src/main/ipc/worktree-logic.ts
  • src/main/ipc/worktree-remote.ts
  • src/main/ipc/worktrees-local-create-flow.test.ts
  • src/main/ipc/worktrees-test-module-mocks.ts
  • src/main/ipc/worktrees-test-runtime-stub.ts
  • src/main/providers/local-pty-provider-spawn-session.test.ts
  • src/main/providers/local-pty-spawn-state.ts
  • src/main/runtime/fetch-remote-cache.test.ts
  • src/main/runtime/orca-runtime-refresh-repo-worktree-scan.ts
  • src/main/runtime/runtime-local-worktree-create-candidate.ts
  • src/main/runtime/runtime-remote-fetch-controller.ts
  • src/main/runtime/worktree-scan-admin-fingerprint-gate.test.ts
  • src/renderer/src/components/terminal-pane/ipc-pty-connect-result.ts
  • src/renderer/src/components/terminal-pane/pty-connection-deferred-reattach-live-output.test.ts
  • src/renderer/src/components/terminal-pane/pty-connection/apply-reattach-payload.ts
  • src/renderer/src/components/terminal-pane/pty-transport-connect-spawn.test.ts
  • src/renderer/src/components/terminal-pane/terminal-pane-manager-options.ts
  • src/renderer/src/lib/pane-manager/pane-lifecycle.test.ts
  • src/renderer/src/lib/pane-manager/pane-lifecycle.ts
  • src/renderer/src/lib/pane-manager/pane-manager-pane-creation.ts
  • src/renderer/src/lib/pane-manager/pane-manager-types.ts
  • src/renderer/src/lib/pane-manager/pane-split-close.ts
  • src/shared/git-binary-compatibility.test.ts
  • src/shared/worktree-checkout-config.test.ts
  • src/shared/worktree-checkout-config.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

Preserve explicit branch adoption, WSL callback routing and sparse cleanup expectations.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

The new commit is test-only, pinning the optimized creation call signatures introduced in the prior commit so the assertions match production behavior.

  • Sparse-checkout rollback assertion — add-sparse-worktree.test.ts now expects git -c checkout.workers=4 worktree add … during the sparse-setup failure rollback, matching performAddWorktree after the worktreeCheckoutGitArgs change (platform is mocked to darwin in beforeEach, so the config is applied).
  • Adoption-callback call signature — local-worktree-creation.spec.ts and local-worktree-creation-part-02.spec.ts pin getBranchConflictKind's new 4th/5th args: the localWorktreeGitOptions object and the undefined adoption callback when a branch override prefers existing-branch adoption.
  • WSL adoption routing — worktree-removal-and-reconciliation.spec.ts drives the lazy adoption callback and asserts it re-probes the local ref through WSL (rev-parse --verify --quiet refs/heads/runtime-wsl^{commit} with wslDistro: 'Ubuntu').

Verified locally: add-sparse-worktree.test.ts 5/5 passing; the orca-runtime.test.ts aggregator (which imports the changed .spec.ts files) 1251 passing, 1 skipped.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai

coderabbitai Bot commented Sep 5, 2026

Copy link
Copy Markdown
Contributor

Note

GitHub couldn't provide a complete incremental comparison for this pull request, so CodeRabbit is performing a full review instead. This review may take a little longer.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

The delta since the prior Pullfrog review is a clean rollback of the parallel-checkout optimization, followed by a merge of main.

  • Removed the checkout.workers=4 parallel checkout — 9d88718 deletes src/shared/worktree-checkout-config.ts and its test, drops the -c checkout.workers=4 args from performAddWorktree and both reset --hard sites, removes the "Parallel checkout configuration" doc section and the real-binary contract, and reverts the affected test assertions. The removal is complete (no dangling worktreeCheckoutGitArgs/checkout.workers references remain), and it resolves the exact tradeoff the PR body had flagged: overriding a user's per-command checkout tuning.
  • Merged main — 08ae314 brings the branch current. The base-OID reuse, adoption-first probe, async WSL workspace-root resolution, catalog invalidation, snapshot-baseline replay, and ligatures-before-atlas changes all remain intact.

One housekeeping note: the PR description still advertises the parallel-checkout behavior ("Use command-local checkout.workers=4 on native macOS") and lists its CPU/I/O and tuning-override tradeoff under merge risk, neither of which the code ships anymore — worth updating so the description matches the merged changes.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Team

Run ID: 0ba8967a-e9c6-4064-93e4-c9aea69e78bc

📥 Commits

Reviewing files that changed from the base of the PR and between 9d88718 and 5e2e2e1.

📒 Files selected for processing (2)
  • src/main/runtime/fetch-remote-cache.test.ts
  • src/main/runtime/runtime-remote-fetch-controller.ts

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

: baseBranch
// A remote-tracking base needs both a configured remote and a branch component.
if (!shortBaseBranch.includes('/')) {
if (shortBaseBranch.indexOf('/') <= 0 || shortBaseBranch.endsWith('/')) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

🔎 Supported by static analysis

🏁 Script executed:

#!/bin/bash
set -euo pipefail

if git check-ref-format 'refs/heads//main'; then
  echo "Git unexpectedly accepted an empty ref component"
  exit 1
fi

rg -n "origin//main|refs/remotes/origin//main" \
  src/main/runtime/fetch-remote-cache.test.ts

Repository: stablyai/orca

Length of output: 151


🤖 get_repo_knowledge executed:

get_repo_knowledge stablyai/orca /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/learnings /tmp/coderabbit-repo-knowledge/stablyai-orca-89dc44e4/conventions

Length of output: 28681


🏁 Script executed:

#!/bin/bash
set -euo pipefail

printf '%s\n' '--- changed hunk ---'
git diff -- src/main/runtime/runtime-remote-fetch-controller.ts

printf '%s\n' '--- controller context ---'
sed -n '180,275p' src/main/runtime/runtime-remote-fetch-controller.ts

printf '%s\n' '--- relevant symbols and tests ---'
rg -n -C 4 \
  'shortBaseBranch|RemoteTrackingBase|refs/remotes|fetch-remote-cache|fetchRemote|refresh' \
  src/main/runtime/runtime-remote-fetch-controller.ts \
  src/main/runtime/fetch-remote-cache.test.ts

Repository: stablyai/orca

Length of output: 33502


Reject internal empty path components.

The guard accepts origin//main and refs/remotes/origin//main. The resolver returns branch: '/main', so refresh can construct refs/heads//main. Reject empty slash-separated components while preserving nested branches such as foo/bar/main. Add both cases to the local and WSL table.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

The delta since the prior Pullfrog review (9d88718) is a single hardening commit that tightens the remote-tracking base probe in resolveRemoteTrackingBase.

  • Skip malformed remote base probes — the separator check now rejects slash-less, leading-slash, and trailing-slash bases (shortBaseBranch.indexOf('/') <= 0 || shortBaseBranch.endsWith('/')), so origin/, /main, refs/remotes/origin/, and refs/remotes//main short-circuit before spawning git remote.
  • Expanded test matrix — fetch-remote-cache.test.ts covers the four new malformed shapes (plus the WSL-distro path) and renames the case to match the broader contract.

The new check is a strict superset of the previous one: valid remote-tracking bases (remote/branch, including nested remote names like foo/bar/main) still pass, and the newly rejected shapes cannot name a real remote/branch pair. No regressions identified.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

The delta since the prior Pullfrog review (5e2e2e1) is a single CLI module-loading optimization that keeps the Codex shell preflight off the heavier all-agent hook-controls module.

  • Import prepareManagedCodexHomeBeforeShellLaunch from its own module — the static import now resolves directly from src/main/codex/managed-home-shell-preflight instead of managed-agent-hook-controls, so agent hooks prepare-codex no longer loads the full managed-hook registry (installers, presence detection, script refreshers).
  • Lazy-load the all-agent hook controls — applyAgentStatusHooksEnabled and getManagedAgentHookStatuses are pulled via await import('...managed-agent-hook-controls.js') only inside the on/off and status handlers, matching the repo's existing .js dynamic-import convention.
  • Split the test mocks — agent-hooks.test.ts now mocks the preflight from its new module and the remaining hook controls from managed-agent-hook-controls, matching the new import graph.

No behavior change: the handlers call the same functions with the same arguments, managed-home-shell-preflight has no dependency back on the controls module (no cycle), and the .js-extension dynamic imports resolve to the same module under Vitest — the offline on/off tests exercise that path.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

The delta since the prior Pullfrog review (9a84a57) is a single build fix that declares the Codex preflight module as a main electron-vite entry.

  • Declared codex/managed-home-shell-preflight as a main rollup input — electron.vite.config.ts now maps codex/managed-home-shell-preflight → src/main/codex/managed-home-shell-preflight.ts, so the packaged CLI's require('../../main/codex/managed-home-shell-preflight') (introduced in 9a84a57) survives electron-vite's out/main clean and resolves from the emitted out/main/codex/managed-home-shell-preflight.js. This mirrors the existing agent-hooks/managed-agent-hook-controls and claude-accounts/keychain entries; config/tsconfig.cli.json already lists the source file.

The entry name matches the CLI's relative resolution path, the module's graph is electron-free (node builtins + cross-platform-path + codex/hook-service, and it is re-exported by the guarded agent-hooks/managed-agent-hook-controls entry), and the change has no runtime behavior beyond unblocking the packaged CLI build that the packaging CI caught.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

The delta since the prior Pullfrog review (a9f00a0) is a single E2E-only commit that closes a race in the repeated relay-restart lease test.

  • Waited for the replacement PTY before lease-recovery input — in ssh-docker-transport-drop-recovery.spec.ts's "keeps one reattachable lease per pane across repeated relay restarts" loop, each generation now captures previousPtyId first and polls (waitForActivePanePtyId(...).catch(() => previousPtyId), asserted .not.toBe(previousPtyId)) until the pane's PTY binding actually changes after killDockerSshRelayDaemon, before running the LEASE_GEN_n marker. Previously the marker could target the still-superseded binding, which skewed the reattachable-lease count the test exists to pin at exactly one.

The new poll mirrors the identical pattern already in the "replaces the pane only when the host proves the session is gone" test (same .catch fallback and .not.toBe assertion), so the fix is consistent with the file's established idiom. No production code changed, and no correctness or cross-platform concerns.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@greptile-apps

greptile-apps Bot commented Sep 5, 2026

Copy link
Copy Markdown

Too many files changed for review (209 files, 100 file limit).

Bypass the limit by tagging @greptile-apps to review.

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ℹ️ No critical issues — the deferred-startup and retained-creation machinery fails closed and stays owner-fenced; one minor suggestion inline.

Reviewed changes

Since the prior Pullfrog review (148ee48), this branch merged in the retained-composer-drafts stack (previously stacked PR #18794) plus one E2E test commit.

  • Added a daemon/runtime deferred-startup protocol — a held composer command is written to its terminal exactly once, on an explicit releaseStartupCommand, gated behind daemon protocol v37/v38 and triple-checked (operation + incarnation + owner) at every layer.
  • Added retained/standby worktree preparation — a single-slot standby owner and a preparation-pool hold/claim keep one warm checkout for the active composer target, with the renderer retaining a frozen request snapshot until submit.
  • Extracted hook-trust inspection — inspectHooksTrust checks script trust non-interactively without opening the composer's modal.
  • Refactored child-process spawn resolution — resolveSpawn moved to a pure module; hasExitedPosixProcessGroup skips the termination grace when the drained root's group is already gone.

ℹ️ Scope expanded past the title and description

The branch now ships the full retained-composer-drafts + deferred-startup feature (the diff grew from ~43 to 209 files vs main), but the title and "What Changed" section still describe only the technical creation work and claim the composer work is "isolated in stacked PR #18794". Worth reconciling so a reviewer reading the description understands what this PR actually ships — and so the two PRs don't merge the same code twice if #18794 also lands.

ℹ️ Nitpicks

  • completePreparationClaim only runs on the finalize-success path in consumePreparedWorktreeCreate, so a failed finalize leaves the standby slot cold — the standby owner is never notified to re-prepare until the composer target changes.
  • createRetainedWorktreeCreation.retire() is never called in production (retired is only set inside take's mismatch branch).

Note: 1 inline comment(s) dropped because they did not anchor to lines inside the PR diff:

  • src/main/worktree-create-preparation-pool.ts:159 (RIGHT) — file not in PR diff

Pullfrog  | Fix it ➔ | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

The branch was rewritten since the prior review: the retained-composer-drafts stack that had been merged in is now split back out into stacked PR #18842, so this PR is again the technical portion only (the prior scope-expansion note and inline nitpicks no longer apply). The remaining new commits are test-only.

  • Reaped orphaned macOS Crashpad reporters on teardown — a new cleanupE2ECrashpad helper, invoked from cleanupE2EDaemons, enumerates ps on macOS and SIGTERMs only the reporter whose --database points at the exact temporary profile, re-checking ownership with a second ps -p before signaling to close the enumeration→kill race.
  • Tightened the SSH lease assertion — the five-restart loop now asserts the reattachable lease settles at the exact active PTY (toRelaySshPtyId(targetId, ptyId)) rather than a bare count of one, and waits for the pane's PTY binding to change before sending the generation marker.

The crashpad cleanup is appropriately defensive: it re-verifies the PID still owns the profile database before SIGTERM, is a no-op off darwin, and treats both enumeration and kill failures as best-effort. The unit test pins the ownership recheck (a PID whose command changed after enumeration is not signaled) and the platform gate.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

The delta since the prior Pullfrog review (0575b264) is a merge of current main into the branch — two merge commits that bring the PR current without touching its own code.

  • Merged main 79350f455 into the branch — b36d2783 (merge origin/main) followed by 18df2f2f (merge origin/nwparker/worktree-create-technical). The four main commits pulled in (79350f455 e2e sidebar helpers, a3c1d329 cloud relay-ops latency bar, 9c3d957a automations collation reuse, 062db771 tab minimum width) share no file paths with PR-A's 46 files, so the merge is clean.
  • PR-A technical content is unchanged — the base-OID reuse and read overlap, adoption-first branch probe, async WSL workspace-root resolution, catalog invalidation ordering, snapshot-baseline replay, and ligatures-before-atlas changes all remain exactly as previously reviewed and approved.

One incidental, non-blocking note: the merge surfaces a package.json diff that removes a duplicate bench:terminal-partial-escape-tail key (--disable-warning=MODULE_TYPELESS_PACKAGE_JSON variant) that main's #18764 left behind. No behavioral impact — the later no-flag entry already wins on main.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Since the prior Pullfrog review (18df2f2), a single test-only commit de-flakes the real-child self-exit assertion in the Claude stream-json connection suite.

  • De-flaked the self-exit tree verdict — claude-stream-json-connection.test.ts no longer pins close() to false and the tree to unverifiable, because a real child's stderr-triggered descendant snapshot can now win or lose the race with its own exit. The test still pins the first-hand root verdict (root: 'exited'), accepts only exited/unverifiable for the tree, and asserts close() agrees with the observed tree verdict (closed === (tree === 'exited')).

The loosened assertion is genuinely racy rather than loose: proveClaudeChildExitWithReaper returns exited && tree.treeVerdict === 'exited', so given root: 'exited' the new consistency check is an exact invariant on the ladder's return expression and still fails on a regression. Deterministic coverage is preserved elsewhere — the adjacent natural-exit test pins tree: 'exited', and claude-agent-sdk-exit-proof.test.ts / claude-agent-sdk-root-kill-fallback.test.ts pin tree: 'unverifiable' with mocked deps.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Since the prior Pullfrog review (1b7386f), a merge of current main brought three main commits into the branch, with a single conflict in the SSH transport-drop spec.

  • Merged main 1924c8f5b1 — aad6d64 pulls in 1924c8f5b1 (sort-comparator perf-lint contracts), d8c4c830 (E2E SSH recovery fencing + the recoverDockerSshRelayAfterFault helper), and 61ebffa86 (terminal-wait blocked-prompt bound). None of them touch PR-A production code.
  • Resolved the lease-test conflict correctly — the five-restart loop in ssh-docker-transport-drop-recovery.spec.ts now drives main's recoverDockerSshRelayAfterFault helper while preserving both PR-A guarantees intact: the wait-for-replacement-PTY poll (.poll(...).catch(() => previousPtyId).not.toBe(previousPtyId)) and the exact-PTY assertion (.toEqual([toRelaySshPtyId(remote.targetId, ptyId)])). The electron-process-shutdown.ts overlap auto-merged cleanly, keeping both the cleanupE2ECrashpad hook and main's releaseExitedProcessPipes.

The earlier package.json duplicate-bench:terminal-partial-escape-tail note is now moot — main resolved that key itself, so the PR diff no longer carries it.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@pullfrog pullfrog Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ No new issues found.

Reviewed changes

Since the prior Pullfrog review (aad6d64), a single test-only commit adds diagnostic evidence capture around the frozen-host input-recovery test.

  • Added an SSH recovery input-observation helper — attachSshRecoveryInputObservation runs a page.evaluate that snapshots the store's SSH connection authority (sshConnectionStates.get(targetId)), the active worktree, each pane manager's pane bindings (ptyId, active leaf), and a terminal.list result raced against a 1s timeout, then attaches the result as ssh-input-<label>.json.
  • Wrapped the frozen-host recovery test with evidence capture — the accepts input again after a frozen host resumes test now records before-freeze, after-write, and failure-before-cleanup observations, so a flake or failure leaves the recovery state (authority, pane bindings, terminal list) attached to the report instead of vanishing with the torn-down user-data dir.

The helper mirrors the repo's established E2E introspection idioms (window.__store?.getState(), window.__paneManagers, the sshConnectionStates.get(targetId) pattern from ssh-codex-reconnect-replay-driver.ts), is best-effort by design (the failure-path capture is .catch(() => undefined)), and the 1s timeout race keeps a hung terminal.list from stalling the observation. No production code changed.

Pullfrog  | View workflow run | Using DeepSeek Pro (free via Pullfrog for OSS) | 𝕏

@nwparker
nwparker merged commit d7767fb into main Sep 5, 2026
37 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…tablyai#18793)

* perf(worktree): remove redundant creation and terminal startup work

* test(worktree): cover optimized creation call signatures

Preserve explicit branch adoption, WSL callback routing and sparse cleanup expectations.

* perf: preserve user Git checkout worker settings

* perf(git): skip malformed remote base probes

* perf(cli): avoid loading other agent hooks for Codex preflight

* fix(build): retain Codex preflight entry for packaged CLI

* test(ssh): wait for replacement PTY before lease recovery input

* test(ssh): verify recovered shell execution and lease ownership

* test(electron): reap isolated macOS crash reporters on teardown

* test: allow either observed self-exit snapshot ordering

* test: capture frozen-host input recovery evidence
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant