Repository navigation
perf: cap shared-path scans and synchronize Windows PTY access - #23194
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. Note Reviews pausedIt 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 Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Repository UI Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 7 remain after this review. 📝 WalkthroughWalkthroughThe changes update the node-pty patch, including Windows ConPTY job tracking and cleanup, and add Windows stress and regression coverage. Worktree symlink filtering now uses a bounded scan for eligible queries and limits. Focused Playwright workflow commands no longer include a standalone Priority: ➖ Normal Merge Risk: ⚪ Minimal · up to No identified issue currently blocks merging; complete the normal final-head checks. Security Architecture ReviewSecurity architecture risk: 🔵 Low · up to The Windows terminal change adds controls for process ownership and coordinated cleanup. No new security exposure was confirmed, but concurrent teardown and some Windows runtime modes remain insufficiently verified. Retained concerns Security review detailsSecurity Blast Radius
Trust Boundaries and Controls
Resilience and Maintainability Implications
Hardening Proposals
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches 💡 1📝 Generate docstrings 💡
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. Comment |
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Early-exit suggestion scan —
getWorktreeSymlinkPathFilterStatenow collects matches in a bounded loop that stops oncemaxSuggestionsresults are found, instead of filtering the whole list and slicing. Only entries needed to fill the visible list have theirnameread. - Compatibility fallback preserved — empty queries and non-integer/negative/
NaN/±Infinitylimits still take the originalfilter().slice()expression, so slice semantics are untouched for unusual caller-supplied bounds. - New scan-budget tests — pins the bounded name-read count and differentially compares against the original expression across limits, sparse arrays, and the exact-match-after-limit case.
Behavior is output-preserving: I ran the 11 scoped tests (all pass) and a separate 20,000-case differential fuzz over random arrays (including holes) and the full unusual-limit set — zero divergences in output, order, element identity, hole handling, or showLiteralItem. The new tests genuinely fail against the pre-change code (the maxSuggestions: 0 getter case would throw under filter()), so they are not tautological. No native, IPC, wire, or filesystem surface changes; the helper is renderer-local and only used by WorktreeSymlinksSection.tsx.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
ca67e5c to
326ca5b
Compare
|
Reviewed the CodeRabbit docstring-coverage warning. This repository explicitly requires concise comments limited to non-obvious reasoning (AGENTS.md), so I am declining the generic 80% docstring suggestion. The existing ownership/behavior comments and focused regression tests cover the decisions in this change. No code change is warranted for that style-only warning. |
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 92d9662b-daa4-4784-9fa0-3ac6dd29a616
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (11)
config/patches/[email protected]config/scripts/windows-pty-table-stress.cjssrc/main/pty/node-pty-self-exit-pseudoconsole-close.test.tssrc/main/windows/windows-msys-job.win32.test.tssrc/main/windows/windows-pty-job.win32.test.tssrc/renderer/src/i18n/locales/en.jsonsrc/renderer/src/i18n/locales/es.jsonsrc/renderer/src/i18n/locales/fr.jsonsrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.jsonsrc/renderer/src/i18n/locales/zh.json
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 0 remain after this review.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
- Full ConPTY table synchronization —
conpty.ccnow holdsptyJobMutexfor everyptyHandles/pty_batonaccess that was still unprotected:PtyStartProcessinsertion (now via a local handle instead ofptyHandles.back()),PtyConnect's lookup andhShell/shellPid/hJobstore, andPtyResize/PtyClear, which also gained aconsoleClosedguard.get_pty_baton/remove_pty_batonare renamed_lockedto mark the contract. - Kill path unchanged in shape, now on the renamed helper —
PtyKillstill resolves the conpty DLL before touching state and closes the pseudoconsole outside the lock, so the lock is not held across the draining call. - Native regression coverage — new
windows-pty-table-stress.cjsdrives kill/resize/clear concurrently with fresh spawns; a new.win32test runs it and asserts the survivor keeps its job; the MSYS job test now reports exit/job/output diagnostics on timeout. - i18n catalog entries — the three
DiffCommentPopoverkeys added to six locales match the fallbacks inDiffCommentDraftCard.tsx.
I audited the synchronization for remaining gaps: ptyHandles is only touched by the two _locked helpers and the locked emplace_back; the outside-lock reads (allowJobBreakaway, hpc, handle values) are immutable after publish; the exit watcher releases the mutex before its blocking BlockingCall; and holding the mutex across ResizePseudoConsole/ClearPseudoConsole is the deliberate inverse of PtyKill's placement — it is what keeps hpc valid for the call — with conout draining on its own worker, so it does not gate those calls. No lock-ordering cycle found.
ℹ️ Native scope still travels under a renderer-perf title
The PR presents as the shared-path suggestion optimization, but the delta now also carries a Windows ConPTY table-lifetime synchronization fix and its stress fixture. Worth making the merge record and any future revert match the change set.
Technical details
# Scope vs. title
## Affected sites
- `config/patches/[email protected]` — `ptyJobMutex` now covers `PtyStartProcess`, `PtyConnect`, `PtyResize`, `PtyClear`
- `config/scripts/windows-pty-table-stress.cjs` — new stress fixture
- `src/main/windows/windows-pty-job.win32.test.ts` — new integration test
## Required outcome
- The title/description should make clear that a native Windows teardown change rides along, so the merge record and any revert match the change set.
## Open questions for the human
- Is the native synchronization intended to ship in this PR, or should it be split from the renderer perf change?DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
Actionable comments posted: 1
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 0a35c73d-62c7-4505-9ee3-800d2987e22b
⛔ Files ignored due to path filters (1)
pnpm-lock.yamlis excluded by!**/pnpm-lock.yaml
📒 Files selected for processing (7)
.github/workflows/golden-e2e-experiment.yml.github/workflows/terminal-ime-e2e.ymlconfig/scripts/playwright-focused-workflow-selection.test.mjsconfig/scripts/run-terminal-ibus-hangul-e2e.mjsconfig/scripts/terminal-ime-e2e-workflow.test.mjssrc/renderer/src/i18n/locales/ja.jsonsrc/renderer/src/i18n/locales/ko.json
💤 Files with no reviewable changes (1)
- config/scripts/run-terminal-ibus-hangul-e2e.mjs
🚧 Files skipped from review as they are similar to previous changes (2)
- src/renderer/src/i18n/locales/ko.json
- src/renderer/src/i18n/locales/ja.json
Included review availability: This review used your included allowance. Your plan provides up to 10 included reviews per hour; 1 remain after this review.
Assert each golden platform step and its focused arguments before deduplicating Playwright discovery probes.
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The delta since the prior pullfrog review is the focused-Playwright CI fix, its regression test, and a historical-version test pin; the native ConPTY synchronization and i18n entries are unchanged.
- Focused file selection restored —
golden-e2e-experiment.yml,terminal-ime-e2e.yml, andrun-terminal-ibus-hangul-e2e.mjsno longer pass a literal--before their spec paths, matching thepnpm run test:e2e "${TEST_FILES[@]}"formchanged-e2ealready uses; theterminal-ime-e2e-workflow.test.mjsregex follows. - Selection pinned by test — new
playwright-focused-workflow-selection.test.mjsextracts the four focused commands and runs the installed Playwright 1.63.0 CLI--listover a temp fixture, asserting each resolves only its requested files and checking the golden commands per platform. - Historical hourly fixture pinned —
hourly-build-version.test.mjsnow mocksreadFileSyncto return its1.4.201package fixture, so a newer realpackage.jsonversion can no longer break the expected1.4.203build identity.
I ran the new and changed config tests (23/23 pass) and reproduced the mechanism: with the locked Playwright 1.63.0, -- <file> selects every spec while <file> selects only the named one, and pnpm 12 forwards the literal -- to the script.
ℹ️ The -- fix leaves 28 reliability-gate commands on the broken form
config/reliability-gates.jsonc still carries 28 pnpm run test:e2e -- tests/e2e/<spec> commands. These traverse the same pnpm run → npx playwright test path, so the literal -- reaches Playwright and the file filter is dropped — the exact failure this PR fixes. changed-e2e already uses the correct no--- form (pinned at pr-e2e-gate-contract.test.mjs:177), so the manifest is now the outlier. Worth aligning in the same sweep if the reliability harness runs these commands verbatim; it does not block this PR.
Technical details
# Reliability-gate e2e commands still pass a literal `--`
## Affected sites
- `config/reliability-gates.jsonc` — 28 `"pnpm run test:e2e -- tests/e2e/<spec>"` commands (e.g. lines 13443-13445, 13970, 15030-15031).
## Evidence
- Probe with the locked Playwright 1.63.0: `playwright test --list --reporter=json -- <file>` lists the named file AND an unrelated spec; without `--` it lists only `<file>`.
- Probe with pnpm 12.0.0: `pnpm run <script> -- a --workers=1` echoes the script invocation with the literal `--` forwarded.
- The new `playwright-focused-workflow-selection.test.mjs` asserts the positive (no-`--`) case only; it does not scan `reliability-gates.jsonc`.
## Required outcome
- The 28 commands select their named specs (drop `--`), matching `changed-e2e`.
## Open questions for the human
- Does the external reliability harness execute these strings through `pnpm run` verbatim? If it strips `--` itself, no change is needed — but the inconsistency remains.DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
There was a problem hiding this comment.
✅ No new issues found.
Reviewed changes
The delta since the prior pullfrog review (d6a9934) is two commits: PTY stress-probe failure handling and an hourly build-identity test seam. Native production code and the renderer suggestion helper are unchanged.
- Stress probe keeps the first failure —
windows-pty-table-stress.cjsnow stores the try-block failure and, if the exit drain also times out, logsdrain-errorand keeps the original error instead of overwriting it, so the first failure surfaces. - Ready shells assert job membership —
waitForReadyassertslistJobProcessIdsincludes each ready shell's pid, and the required host-job precondition is reported before its assertion. - Hourly identity takes an explicit package version —
getHourlyBuildIdentityaccepts an optionalpackageVersionthat overrides thepackage.jsonread; the historical-identity test injects1.4.201directly instead of module-mockingnode:fs. The CLI caller passes no override, so default resolution is unchanged.
The test seam and probe assertions are test-only and do not touch the shipped version-resolution or renderer paths.
DeepSeek Flash (free via Pullfrog for OSS) | 𝕏
|
I checked the manifest on the current head. The 28 text occurrences consist of 14 configured gate commands and 14 historical evidence-run command records across seven gates. This PR does not change that manifest; the repository’s manifest consumer validates it rather than executing the strings. I agree that an external runner which executes those configured strings verbatim can encounter the same forwarded- I am keeping that existing manifest migration outside this PR, as your review explicitly marks it nonblocking. A blanket replacement would rewrite historical evidence, and the validator currently requires recorded evidence commands to match a configured command. A correction needs to preserve the commands actually recorded for old runs while updating future invocation semantics and their validation. No manifest correction or new evidence run is claimed here, and no GitHub issue was opened. The focused workflows in this PR now omit the separator, and their test requires each platform’s command before deduplicating the actual discovery probes. This note does not change the native PTY risk verdict or substitute for final-head CI. |

ELI5
Typing in Worktree Shared Paths stops checking names once it has filled the 50 suggestions it can show.
What Changed
Collect matching entries in order and stop at the limit instead of filtering the entire list first. Empty searches, sparse arrays and unusual limits retain the existing results. With 50,000 matching entries, name reads fall from 50,050 to 100, including the final exact-match check.
Why
Stopping when the result is full avoids extra work without another cache or invalidation rule.
Linked Issue
N/A — PR only, as requested.
Visual Proof
N/A — identical suggestion results and interaction behavior; no UI markup changed.
Testing
Eleven suggestion tests pass, with original/candidate differential and work-count coverage. The changed-code quality checks and dedicated anti-slop lint pass. All 46 checks completed successfully or were correctly skipped on merged head
32983f5e4c0879bc7ed1ae9cc5216cc8250917ae.The new Windows installer-probe fixture repair is tracked in #23209. This PR was merged by another contributor after its same-head Windows rerun passed, before that fixture correction reached its branch. The later branch commit containing the fixture correction is not part of this merge.
Review
Suggestion behavior was independently reviewed against 1,680 input combinations. Queries with too few matches still scan the full list. The helper adds no filesystem, provider, credential or wire operation.
The earlier native race repair is already on main via #23257. Neither those passing native tests nor the module-path experiment establish the cause of the historical worker exit or 20-second probe timeout.
Agent skill upstream boundary
Notes
Folder and SSH behavior is unchanged. The suggestion work-count reduction is measured; end-to-end latency is not. No GitHub issue was created.
Checklist