Repository navigation
perf: read GC worktree discovery asynchronously - #3802
Conversation
janicduplessis
left a comment
There was a problem hiding this comment.
Independent correctness review of a712995 against b2541a2: clear, with no actionable findings.
Checked the full diff, issue #3799, candidate sorting/deduplication, source and bare checkout refusals, canonical containment, inventory failure handling, and the unchanged removal-time ownership and HEAD rechecks. The async selector uses the same parser and source decision function; inventory failure remains a refusal and does not yield unlisted candidates. SIGKILL is confined to the spawned inventory/read child at the existing timeout, with no ownership expansion.
Independently ran the new real-child discovery/measurement/timeout probes and the worktree parser/source-selection suite: 59 passed across two files in 7.16 seconds. These cover the changed inventory paths, not completion of all report cancellation or remaining synchronous probes. The PR description states that remaining scope accurately. No new user-facing flags or destructive decisions require guidance changes. No human-review trigger applies to this diff.
Description
GC still blocks on Git worktree discovery while collecting candidates and measuring build state. These reads prevent a responsive in-process report for Desktop.
Fixes #3799. Other blocking probes and cancellation remain under #3546.
Solution
Use the existing bounded async Git inventory and source-checkout selector for report paths. Preserve sorting, source-checkout refusals and containment checks. Inventory timeouts kill only the probe child; the non-measuring maintenance policy keeps its synchronous discovery.
Test plan
Four regressions fail against the original collector and pass here. Real Git behind delayed child processes verifies responsiveness during candidate discovery, classification, build-state measurement and unlisted-directory inspection. A child ignoring SIGTERM is terminated at the existing deadline without producing unlisted deletion candidates. Existing worktree and maintenance cases check removal guards and reported sizes.