Files
archived-orca/config
Brennan Bensonandregistered2nd f7cec5ab10 perf(git): start Windows Git on the process worker so launches don't block Electron main (#43471)
* perf(windows): start Git processes on the process worker so a slow launch cannot freeze the window

On Windows, creating a process blocks the calling thread inside CreateProcessW, and endpoint
security can make each launch take seconds. Captured Git commands and streamed native Git
status now start on the shared process worker on Windows, with main's current environment and
execFile's failure text. When the worker cannot run, they start on main as before.

Tracked in #36284

Co-authored-by: registered2nd <39094401+registered2nd@users.noreply.github.com>

* fix(windows): keep tree kill, admission release and spawn-error fields on worker-started Git

Review pass 1: cancel before the worker reports a PID now waits for it and kills the tree; a dead
worker's children release their Git admission; spawn errors keep errno, syscall and path; a stdin
pipe error leaves the result to Git's exit status as on main.

* fix(windows): tree-kill a worker-started Git child whose PID arrives late, and keep the stream's abandonment observer

Review pass 2: a PID reported after the 5 s wait still gets the tree kill, a dead worker ends the wait,
and an earlier child error no longer hides a later worker abandonment from the stream's termination.

* fix(windows): never root-kill a worker-started Git child before its tree kill

Review pass 3: the PID wait now ends without a root kill and clears its timer when the PID arrives,
so the late tree kill cannot be pre-empted by a queued root kill.

* fix(windows): fall back to main for Git when the process worker dies before answering

Council: a worker that starts but cannot load its entry now marks itself unavailable, so later Git
commands start on main instead of failing one after another.

* refactor(git): split streamed Git child selection out of git-stream-stdout; lint and format fixes

* chore(git): move the direct child_process baseline entry with the streamed Git spawn it belongs to

* fix(git): end a Windows Git tree the dead process worker reported before releasing it

A worker that dies can no longer stop its children, so main kills each still-running tree whose PID it knows before admission moves on.

* fix(git): send one tree kill per worker-hosted Git child

A worker that dies while a cancel's taskkill is in flight reuses it instead of walking the PID again.

* fix(git): one taskkill per worker death, and tree kill on Windows output overflow

Trees a dying worker abandons in one turn share a single taskkill launch. A capture past maxBuffer now ends the whole tree, as a cancel does, so a hook holding the pipe can't keep close from arriving.

* fix(git): let worker abandonment wait on a late-PID tree kill

After the PID wait gives up, a late PID's taskkill becomes the child's tree kill, so a worker dying meanwhile doesn't release admission early.

* fix(git): start Windows tree-kill taskkill on the process worker, and let an exited root's pipes close

taskkill now launches off Electron main whenever the worker can run, so cancel, overflow and worker-death cleanup no longer block main under endpoint security. A kill for a child whose root already exited destroys its pipes, as execFile does, so a descendant holding them can't keep close away.

* fix(git): reach an exited root's pipes on kill, and keep tree cleanup alive through worker death

The worker stand-in now forwards kill until close, so an overflow after the root exited retires the pipes a descendant holds. A taskkill whose worker dies before running it restarts from main.

* fix(git): time worker-hosted taskkill from its creation, and rerun it only if it never started

The 2 s wait starts once the worker creates taskkill, with a 30 s launch allowance, so a queued taskkill isn't abandoned for a root-only kill. After a worker death, only a taskkill whose PID never arrived is rerun from main, so a finished one can't walk a reused PID.

* test(git): drop type assertions from the worker taskkill test fixtures

* fix(git): rerun unstarted worker taskkills from main as one batched launch

When a dying worker leaves several taskkills it never started, main reruns them together, so a worker death costs one launch on main.

* perf(git): withdraw a worker launch cancelled before it starts

The worker now starts each queued launch on its own turn, so a cancel that arrives while an earlier CreateProcess blocks the worker drops the queued Git launch instead of starting and then tree-killing it. Requests for a queued launch are replayed once it starts.

* perf(git): keep a stopped Git stream's output on the worker

When a streamed reader stops early, the worker drains the pipes itself instead of copying each later chunk to main while cleanup runs.

* perf(git): keep a finished worker capture's later output on the worker

Once a capture completes (overflow, error), the worker drains any further output itself instead of forwarding it to main while cleanup runs.

* fix(git): wait for a queued worker taskkill instead of root-killing, and keep stopped output on the worker

A taskkill still queued on a live worker is never abandoned for a root-only kill; a dead worker's unstarted taskkill already reruns from main. A child being stopped, and taskkill itself, no longer forward output to main.

* test(git): a taskkill queued on a live worker is awaited past any allowance, never rerun from main

* perf(worker): drop the synchronous worker-entry check; a missing entry retires the host through its own startup error

The worker's error before answering already retires the host, and gated Git launches then fall back to main. Direct spawns after that report the worker unavailable instead of starting it again.

* fix(worker): a worker lost before it was ready fails its queued launches instead of leaving them unproven

The process worker now says when it is ready. If it dies before that it never ran a request, so its children never existed and close as failed launches; an owned-group capture (macOS worktree removal) no longer waits forever when the worker entry is missing. A worker that was ready keeps the rule that only close proves a child ended.

* fix(worker): decide a lost worker's children on its exit, after the messages it already posted

A worker error can be delivered before the ready message the worker posted first; acting on exit, which follows every queued message, keeps a worker that ran requests from having its live children reported as never started.

* perf(worker): any stop of a launch still queued on the worker withdraws it

A plain kill of a child the worker has not started yet now drops the queued launch, as cancel-spawn does, instead of starting the process only to kill it.

* chore(ratchets): shrink the main sync-fs baseline for the worker host

* fix(worker): a child stand-in never receives the host-level ready event

* perf(git): assemble failed Windows capture stderr once

* perf(git): skip capture assembly after a prior error completed it

* perf(git): treat Git's utf-8 capture as utf8 so failures reuse decoded stderr

---------

Co-authored-by: registered2nd <39094401+registered2nd@users.noreply.github.com>
2026-11-18 10:29:31 -08:00
..
2026-11-18 03:28:35 -05:00
2026-11-18 03:28:35 -05:00
2026-11-18 03:28:35 -05:00
2026-11-18 03:28:35 -05:00
2026-11-18 03:28:35 -05:00
2026-11-18 03:28:35 -05:00
2026-11-18 03:28:35 -05:00
2026-11-18 03:28:35 -05:00
2026-11-18 03:28:35 -05:00
2026-11-18 03:28:35 -05:00
2026-11-18 03:28:35 -05:00
2026-11-18 03:28:35 -05:00