Skip to content

Bound concurrent repo scans and trace renderer breadcrumbs - #5608

Merged
AmethystLiang merged 1 commit into
mainfrom
invesigate-quit
Jun 17, 2026
Merged

AmethystLiang merged 1 commit into
mainfrom
invesigate-quit

Conversation

@AmethystLiang

@AmethystLiang AmethystLiang commented Jun 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Bounds concurrent repository scans during startup/hydration to a limit of 5, avoiding CPU and process spikes. In addition, renderer-side crash breadcrumbs are now traced via durable trace spans in the main process to provide context for native crash analysis.

Screenshots

No visual change

Testing

  • pnpm lint
  • pnpm typecheck
  • pnpm test
  • pnpm build
  • Added or updated high-quality tests that would catch regressions, or explained why tests were not needed

Unit tests were added in worktrees.test.ts to assert concurrent repo scans are capped at a maximum of 5, and in crash-reporting.test.ts to verify tracing spans are successfully started and ended on renderer breadcrumbs.

AI Review Report

  • Concurrency Throttling: Restricts concurrent git operations, which improves stability on macOS, Linux, and Windows by avoiding process/file descriptor exhaustion.
  • IPC/Cross-Platform: Tested and verified that the IPC and tracing methods are platform-independent.

Security Audit

  • Sanitization: Added main-process sanitization via sanitizeCrashReportDetails for renderer breadcrumb data to safeguard against prototype pollution and invalid types.
  • Input limits: Re-verified tracing inputs are sanitized using sanitizeCrashReportString.

Notes

None


Open in Stage

- Limit worktree refresh concurrency to 5 parallel workers to prevent launching too many concurrent git scans during startup and activation.
- Record renderer breadcrumbs as tracer spans to provide durable pre-crash context for native main-process crashes.
- Log a breadcrumb when activating a worktree from the sidebar.
@ghost

ghost commented Jun 17, 2026

Copy link
Copy Markdown

Ready to review this PR? Stage has broken it down into 3 individual chapters for you:

Title
1 Limit concurrent repository scans during hydration
2 Trace renderer breadcrumbs via main process spans
3 Record breadcrumbs for sidebar worktree activation
Open in Stage

Chapters generated by Stage for commit d2cdcce on Jun 17, 2026 6:08pm UTC.

@coderabbitai

coderabbitai Bot commented Jun 17, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository UI

Review profile: CHILL

Plan: Pro

Run ID: 1a87fd33-e90f-4b05-8a65-7a731f86e59a

📥 Commits

Reviewing files that changed from the base of the PR and between 5429e65 and d2cdcce.

📒 Files selected for processing (5)
  • src/main/ipc/crash-reporting.test.ts
  • src/main/ipc/crash-reporting.ts
  • src/renderer/src/components/sidebar/WorktreeCard.tsx
  • src/renderer/src/store/slices/worktrees.test.ts
  • src/renderer/src/store/slices/worktrees.ts

📝 Walkthrough

Walkthrough

The pull request contains two independent changes. The first adds observability tracing to the renderer breadcrumb IPC path: sanitizeRendererBreadcrumbData is refactored to delegate to sanitizeCrashReportDetails, a new recordRendererBreadcrumbTrace helper emits a renderer.breadcrumb span via startSpan and immediately ends it, and the crashReports:recordBreadcrumb IPC handler now calls both the existing crash breadcrumb recorder and the new trace helper. WorktreeCard also gains a recordRendererCrashBreadcrumb call on sidebar activation. The second change introduces WORKTREE_REFRESH_CONCURRENCY and a mapReposForWorktreeRefresh pool helper in the worktrees slice, replacing unbounded Promise.all fan-outs in fetchAllWorktrees for both the hydration-time probe and steady-state paths. Tests cover both span emission and peak-concurrency bounds.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title accurately summarizes the two main changes: bounding concurrent repo scans and tracing renderer breadcrumbs, matching the core modifications across all affected files.
Description check ✅ Passed The description covers the summary, testing approach with specific test files, AI review report addressing cross-platform concerns, and security audit with sanitization details as required by the template.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch

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.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@AmethystLiang
AmethystLiang merged commit f230c2d into main Jun 17, 2026
2 checks passed
enrick-dev pushed a commit to enrick-dev/orca that referenced this pull request Oct 15, 2026
…5608)

- Limit worktree refresh concurrency to 5 parallel workers to prevent launching too many concurrent git scans during startup and activation.
- Record renderer breadcrumbs as tracer spans to provide durable pre-crash context for native main-process crashes.
- Log a breadcrumb when activating a worktree from the sidebar.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant