Repository navigation
Conversation
📝 WalkthroughWalkthroughThe change adds shared streaming Priority: ➖ Normal Merge Risk: 🟡 Moderate · up to Windows test runs can time out, and stale workspace scans can continue consuming process and RPC resources for up to two minutes. These issues should be fixed before merging. 🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
Full details: Description checkExplanation The description explains the implementation and testing results, but it does not follow the required template. It omits the ELI5, What Changed, Why, Linked Issue, Visual Proof, Review, Agent skill upstream boundary, Notes, and Checklist sections. Resolution Update the description to include all required template sections. Add the linked issue after “Fixes #”, provide “N/A” with a reason for Visual Proof if there is no UI change, document testing and platforms, complete the required checkboxes, and address security, cross-platform, SSH, mobile, compatibility, and performance considerations.
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 |
8e291bd to
2a8745f
Compare
|
@Jinwoo-H When you have capacity, could you review this focused workspace scan streaming PR? Its current head is mergeable and CodeRabbit is green. |
fba27cb to
53772a9
Compare
|
Rebased onto latest |
|
@coderabbitai review |
✅ Action performedReview finished.
|
|
@coderabbitai review\n\nPlease review the current head after the clean current-main merge. |
|
@coderabbitai review Please review current head f2b75e9 after the clean current-main merge. |
|
✅ Action performedReview finished.
|
|
✅ Action performedReview finished.
|
f2b75e9 to
38b7903
Compare
|
Rebased onto latest |
60badd2 to
a56f058
Compare
Greptile SummaryThis PR replaces buffered
Confidence Score: 5/5Safe to merge; the streaming conversion, budget guard, and renderer-abort hook are all exercised by new tests and the 120 s du deadline is preserved. The most significant behavioural change is serialising directory listing before spawning du, where they previously ran concurrently. This is a non-blocking performance trade-off rather than a correctness issue. All error paths (ENOENT fallback, timeout, capacity exceeded, cancellation) are covered by new tests. The multiplexer timeout-disable change is well-guarded and tested. No data-loss or auth-boundary concerns are introduced. Files Needing Attention: src/main/workspace-space-analysis.ts and src/relay/workspace-space-scan.ts both dropped the concurrent Promise.all([opendir, du]) in favour of sequential awaits; worth confirming the latency trade-off is acceptable for wide directories.
|
| Filename | Overview |
|---|---|
| src/main/workspace-space-analysis.ts | Replaces execFile with spawn for streaming du output; adds WorkspaceSpaceDuTimeoutError and per-entry budget tracking; serialises directory listing and du where they previously ran concurrently |
| src/relay/workspace-space-scan.ts | Mirrors main-side streaming du change with relay-specific error types; same sequential listing to du ordering change and same budget-based capacity guard |
| src/main/ssh/ssh-channel-multiplexer.ts | Allows timeoutMs: null to disable per-request timeout while preserving AbortSignal cancellation; timer field in PendingRequest becomes nullable, cleanup() correctly clears it via closure |
| src/main/ipc/workspace-space.ts | Adds owner destroyed listener to abort the in-flight scan when the owning renderer is destroyed, preventing a later renderer from inheriting a stale pending request |
| src/main/workspace-space-analysis-du-timeout.test.ts | Replaces execFile-based du mock with spawn-based EventEmitter child; adds tests for streaming output, multibyte path splits, timeout, budget exceeded, and Node fallback |
| src/relay/workspace-space-scan-du.test.ts | New test file covering relay-side streaming du: streamed output, multibyte path splits, timeout-while-preserving-cancellation, and Node fallback on ENOENT |
| src/relay/workspace-space-scan-fallback-concurrency.test.ts | New test file verifying relay-side portable fallback concurrency and that no deep child-tree state is retained |
| src/main/workspace-space-analysis-fallback-concurrency.test.ts | New test file verifying that the portable Node fallback scans directory entries concurrently without retaining the full child tree |
| src/relay/workspace-space-scan-du-capacity.test.ts | Updated to split du and listing budget limits into separate mock state; adds test that du is killed and fails closed when streamed rows exceed the retained budget |
| src/main/ssh/ssh-channel-multiplexer.test.ts | Adds test verifying that timeoutMs: null disables the request timeout while AbortSignal cancellation still sends rpc.cancel and rejects with AbortError |
| src/main/ipc/workspace-space.test.ts | Upgrades createEvent() to use an EventEmitter-backed sender so destroyed can be emitted; adds test that a destroyed renderer aborts the in-flight scan and allows a fresh scan to start |
| src/main/providers/ssh-filesystem-provider.ts | Minor: numeric literal 130000 to 130_000 formatting; WORKSPACE_SPACE_SCAN_TIMEOUT_MS constant moved to its own line |
| src/main/providers/ssh-filesystem-provider.test.ts | Trivial: test assertion updated to use 130_000 numeric separator to match the updated source literal |
Sequence Diagram
sequenceDiagram
participant R as Renderer
participant IPC as workspace-space.ts
participant Analysis as analyzeWorkspaceSpace
participant DU as spawn('du')
participant Relay as relay/workspace-space-scan
participant SSH as SshChannelMultiplexer
R->>IPC: workspaceSpace:analyze
IPC->>IPC: register owner 'destroyed' listener
IPC->>Analysis: "analyzeWorkspaceSpace(store, {signal})"
alt Local worktree (non-Windows)
Analysis->>Analysis: opendir + collectEntries
Analysis->>DU: spawn('du', ['-k','-d','1', path])
DU-->>Analysis: stdout data chunks (streaming)
Analysis->>Analysis: consumeDuOutputChunk() + budget check
DU-->>Analysis: close(0)
Analysis-->>Analysis: resolve sizes Map
else Remote worktree (SSH)
Analysis->>SSH: "mux.request('fs.workspaceSpaceScan', {signal, timeoutMs: null})"
SSH->>Relay: JSON-RPC request
Relay->>DU: spawn('du', [...])
DU-->>Relay: stdout streaming
Relay-->>SSH: JSON-RPC response
SSH-->>Analysis: result
end
alt Owner renderer destroyed mid-scan
R->>IPC: emit 'destroyed'
IPC->>Analysis: controller.abort()
Analysis->>DU: child.kill()
end
Analysis-->>IPC: WorkspaceSpaceAnalysis
IPC-->>R: WorkspaceSpaceAnalyzeResult
Reviews (2): Last reviewed commit: "fix(space): bound streamed workspace sca..." | Re-trigger Greptile
|
Want your agent to iterate on Greptile's feedback? Try greploops. |
06dff82 to
e377983
Compare
e377983 to
de5c171
Compare
|
Note The previously reviewed commits are no longer reachable (likely due to a force-push or rebase), so CodeRabbit is performing a full review instead of an incremental one. This review may take a little longer. |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
src/main/workspace-space-analysis-du-timeout.test.ts (1)
53-60: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚖️ Poor tradeoffKey the mocked capacity limit to the budget purpose.
scanLocalWorktreeWithDucreates the directory-listing budget beforereadWorkspaceSpaceDuDepthOnecreates the budget for streameddurows. The mock selects the latter withbudgetState.created === 2, so a future budget insertion or reorder can applyduMaxEntriesto another budget and stop this test from covering the streamed-row capacity path. Pass an explicit purpose marker tocreateWorkspaceSpaceScanBudget, or use separate listing anddubudget factories.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: 86d96781-ffd9-4fbc-92dc-41303c99c701
📥 Commits
Reviewing files that changed from the base of the PR and between 12f2c6b and de5c17159fe6bae69460dd6bbab25b2a044508f5.
📒 Files selected for processing (17)
src/main/ipc/workspace-space.test.tssrc/main/ipc/workspace-space.tssrc/main/providers/ssh-filesystem-provider.test.tssrc/main/providers/ssh-filesystem-provider.tssrc/main/ssh/ssh-channel-multiplexer.test.tssrc/main/ssh/ssh-channel-multiplexer.tssrc/main/workspace-space-analysis-du-timeout.test.tssrc/main/workspace-space-analysis-fallback-concurrency.test.tssrc/main/workspace-space-analysis.tssrc/main/workspace-space-local-scan.tssrc/main/workspace-space-scan-control.test.tssrc/main/workspace-space-scan-control.tssrc/relay/workspace-space-scan-du-capacity.test.tssrc/relay/workspace-space-scan-du.test.tssrc/relay/workspace-space-scan-fallback-concurrency.test.tssrc/relay/workspace-space-scan.tssrc/shared/workspace-space-du-stream.ts
🚧 Files skipped from review as they are similar to previous changes (5)
- src/main/ssh/ssh-channel-multiplexer.test.ts
- src/main/workspace-space-analysis-fallback-concurrency.test.ts
- src/relay/workspace-space-scan.ts
- src/main/ssh/ssh-channel-multiplexer.ts
- src/relay/workspace-space-scan-fallback-concurrency.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 0 remain after this review.
Stream native du output under the shared scan budget and fail closed on timeout or overflow so large or stalled folders cannot buffer unbounded output or inherit a destroyed renderer's in-flight scan. Co-authored-by: Cursor <[email protected]>
e9da2f5 to
19b802e
Compare
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to GitHub limitations.
🟡 Minor · Cancel du when the relay request becomes stale. · workspace-space-du-stream.ts:75-196
src/shared/workspace-space-du-stream.ts:75-196
🩺 Stability & Availability | 🟡 Minor | ⚡ Quick winCancel
duwhen the relay request becomes stale.fs.workspaceSpaceScanpassesRequestContext.isStaletoreadWorkspaceSpaceDuDepthOne, but the helper checks that callback only before spawning and whenstdoutemits data. If the request becomes stale afterdustarts andduemits no further stdout, the child and RPC remain active untilduexits or the 120-second deadline kills it. Make staleness cancellation observable independently of stdout and terminate the child promptly.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Repository UI
Review profile: CHILL
Plan: Advanced
Run ID: aac28d76-c637-45d1-919b-4d78e004dc2b
📥 Commits
Reviewing files that changed from the base of the PR and between e9da2f56e4e5eb8ff334aeafc84e992a80592aaf and 19b802e.
📒 Files selected for processing (5)
src/main/providers/ssh-filesystem-provider.test.tssrc/main/providers/ssh-filesystem-provider.tssrc/main/workspace-space-analysis-du-timeout.test.tssrc/relay/workspace-space-scan-du-capacity.test.tssrc/relay/workspace-space-scan-du.test.ts
🚧 Files skipped from review as they are similar to previous changes (2)
- src/main/providers/ssh-filesystem-provider.ts
- src/main/providers/ssh-filesystem-provider.test.ts
Included review availability: Your plan provides up to 10 included reviews per hour; 4 remain after this review.
| expect(spawnMock).not.toHaveBeenCalled() | ||
| }) | ||
|
|
||
| it('kills du and fails closed when streamed rows exceed the retained budget', async () => { |
There was a problem hiding this comment.
🎯 Functional Correctness | 🟠 Major | ⚡ Quick win
Skip this native du test on Windows.
scanWorkspaceSpaceDirectory uses the Node walker on Windows. It does not call spawn. The wait at Line 105 therefore times out on Windows.
Use it.skipIf(process.platform === 'win32'), as the other relay native-du tests do.
Review follow-up (e9da2f56)
Observe request staleness on every du stdout chunk and use the existing abort cleanup. The new signal-free relay regression proves one child kill and cancellation; 14 tests across 5 files, allCLI/Node/Web non-composite TypeScript and changed-file hygiene passed. No prior assertions were weakened. Silent children retain the existing abort-signal/deadline behavior. Full suite/build and live SSH/native-host smoke were not repeated. Independent Cursor review passed for this exact commit.
Previously verified rebase
Summary
Workspace Space scans now parse native
dustdout as it arrives, replacing the fixed 16 MiBexecFilebuffer. Retained entries use the existing 100,000-entry / 64 MiB budget; stderr is capped separately. The scan lists top-level entries before startingdu, cancels when its owning renderer is destroyed, and stops without a second traversal whendureaches its deadline or the retained-entry budget.The 120-second
dudeadline and 130-second SSH scan request deadline remain. SSH multiplex requests can optionally disable their local timer withtimeoutMs: nullwhile retaining explicit abort cancellation; Space scans themselves still use 130 seconds. Missingduretains the portable walker fallback, and Windows continues using that walker. Main and relay share the streamed parser; folder workspaces use the same scan path.Existing timeout tests intentionally stop expecting a second portable traversal after a wedged
du: timeout and capacity overflow now make the worktree unavailable. Tests also cover UTF-8 chunk boundaries, cancellation, retained-row overflow, owner destruction and portable fallback concurrency. No RPC method or binary stream opcode is added.Testing and review
At
de5c17159fe6bae69460dd6bbab25b2a044508f5, independent verification passed 145 tests across 14 files, with no failures or skips. CLI, Node and Web TypeScript (--composite false), changed-file lint/format, diff whitespace and native preflight/postflight passed. Independent Cursor review passed on this exact commit.Full repository tests, packaging and live Electron/SSH/mixed-version or Windows/Linux smoke were not run. Automated checks ran on macOS.
AI disclosure
Cursor ported and independently reviewed the change; Codex checked the original requirements, source and verification results.