Repository navigation
improve: avoid unnecessary Windows startup subprocesses - #149257
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: blocked before merge. Reviewed September 15, 2026, 4:54 PM ET / 20:54 UTC (Revision 6). ClawSweeper reviewWhat this changesReduces Windows startup subprocesses by deferring directory and encoding probes and reading process creation times through the existing native binding, while preserving shell fallbacks. Merge readiness⛔ Blocked before merge - 2 items remain This remains a useful, bounded optimization absent from current main. No actionable patch findings remain, and the prior encoding regression is repaired. The maintainer-owned PR should remain open through the normal CI and landing workflow. Priority: P2 Review scores
Verification
How this fits togetherWindows startup helpers locate system tools, decode subprocess output, and identify processes for lock ownership. Gateway startup and command execution consume these results. flowchart TD
A[Gateway startup and commands] --> B[Windows runtime helpers]
B --> C[Lazy directory discovery]
B --> D[Output encoding detection]
B --> E[Native process identity query]
E --> F[Shell fallback when needed]
C --> G[Tool paths and decoded results]
D --> G
E --> H[Fresh process identity]
F --> H
Before merge
Agent review detailsSecurityNone. PR surfaceSource +92, Tests +298. Total +390 across 9 files. View PR surface stats
Review metrics
Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep discovery lazy within the existing owners while preserving fresh process identities, legacy decoding, and installation-independent sealed helpers. Do we have a high-confidence way to reproduce the issue? Not applicable as a discrete bug report: this is a performance optimization, supported by current-source probe paths and recorded Windows comparisons; no code was executed during this read-only review. Is this the best way to solve the issue? Yes. The patch optimizes existing owners, reuses an installed dependency, and preserves the ordinary runner's encoding snapshot and native-failure fallbacks. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 2a8c98a737a7. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
140896f to
6c6abf0
Compare
|
Merged via squash.
|
Related: #124407
What Problem This Solves
Windows Gateway startup launches subprocesses for Program Files discovery, console-code-page lookup, and process creation-time lookup even when the common path can avoid them.
User Impact
Startup avoids unnecessary Program Files queries, avoids legacy-code-page discovery for UTF-8/BOM output from runExec, and uses a native Windows process-time lookup when available. Existing fallback behavior remains available. There are no new settings, dependencies, state migrations, or operator actions.
In six established-state pairs on Windows using base
38c4aa42, median readiness improved from 6.84 s to 6.50 s (338 ms, 4.9%). The candidate was faster in four of six pairs; the remaining variation matters. This is a measured incremental improvement, and startup remains above five seconds. The rebase preserves the complete patch byte-for-byte; absolute timing on the newer main composition has not yet been measured.Why This Change Was Made
Keep discovery lazy in its existing owners and reuse the installed Koffi binding for a limited-query Windows process handle. Native failures retain the existing shell fallback and total deadline. Sealed updater helpers retain shell lookup without loading native modules from the installation being replaced.
The ordinary command runner and raw-output runner retain their pre-spawn encoding snapshot. Review caught a regression where a child changing the console code page caused legacy output to decode incorrectly; this repair restores that contract while retaining runExec's lazy decoding.
Evidence
test/scripts/vitest-worker-artifacts.test.ts: the compiled TUI provider-hook case and the stale-dist/build-error case. The shared repair is published in fix(test): repair Windows compiled worker fixture setup #149403; its complete Windows file passed 29 tests with the same five skips and unchanged deadlines. That repair merged as027f2082747band is included in current headacf083ac9935. Exact-head CI35052516068 passed, with all 140 jobs successful or skipped and both Windows jobs successful. The previously failing stale-dist case passed in 41.9 seconds under its unchanged 120-second deadline. The entire nine-file PR patch is byte-identical across this refresh. Earlier performance measurements remain bound to their original baseline; current-main combined startup performance is not yet measured. No retries, deadline increases, or weaker assertions were used to hide these failures.Update behavior: stored state and migration flow are unchanged. The standalone managed-service handoff retains its existing shell lookup, with dependency-blocked operation proof. The published-driver activation limitation above is outside this patch; no timeout, integrity check, or installed driver was changed to obtain a passing result.