Skip to content

feat(cli): parallel --rain fetch with bounded worker pool (PR D) - #28

Open
bschellenberger2600 wants to merge 12 commits into
cursor/network-failfast-env-971dfrom
cursor/parallel-rain-workers-971d
Open

bschellenberger2600 wants to merge 12 commits into
cursor/network-failfast-env-971dfrom
cursor/parallel-rain-workers-971d

Conversation

@bschellenberger2600

Copy link
Copy Markdown
Member

Stacked stall-review fix 4/6. Base: cursor/network-failfast-env-971d (PR C). PR E stacks on this branch.

Summary

After the --rain picker confirms, selected repos run through the same bounded fetch_workers pool as the default streaming CLI (runRainReposParallel), using RunNetworkGit timeouts and run-level cancellation.

Tests

  • TestRunRainOnRepos_ParallelStallDoesNotBlockHealthy

Verification

Open in Web Open in Cursor 

cursoragent and others added 2 commits October 11, 2026 11:02
Run post-picker repos through the same fetch_workers pool as the default
streaming path so one stalled remote cannot block later repos.

Co-authored-by: Ben Schellenberger <bschellenberger2600@users.noreply.github.com>
Co-authored-by: Ben Schellenberger <bschellenberger2600@users.noreply.github.com>
@coderabbitai

coderabbitai Bot commented Oct 11, 2026 •

Copy link
Copy Markdown

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

⚙️ Run configuration
  • Configuration used: defaults
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 84838e55-c124-464c-8ad5-fd7949c172ec

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Use the checkbox below for a quick retry:

  • 🔍 Trigger review
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

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.

cursoragent and others added 7 commits October 11, 2026 12:25
…' into cursor/parallel-rain-workers-971d

Co-authored-by: Ben Schellenberger <bschellenberger2600@users.noreply.github.com>
Co-authored-by: Ben Schellenberger <bschellenberger2600@users.noreply.github.com>
…ers-971d

Co-authored-by: Ben Schellenberger <bschellenberger2600@users.noreply.github.com>
…ers-971d

Co-authored-by: Ben Schellenberger <bschellenberger2600@users.noreply.github.com>
Co-authored-by: Ben Schellenberger <bschellenberger2600@users.noreply.github.com>
…nRepos

Co-authored-by: Ben Schellenberger <bschellenberger2600@users.noreply.github.com>
…ers-971d

Co-authored-by: Ben Schellenberger <bschellenberger2600@users.noreply.github.com>

@cursor cursor Bot left a comment •

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Cursor Bugbot has reviewed your changes and found 1 potential issue.

Fix All in Cursor

Bugbot Autofix prepared a fix for the issue found in the latest run.

  • ✅ Fixed: Rain indexes ignore selection order
    • Indexes are now taken from confirmed selection slice position via rainRepoJob, so [n/total] and --json index stay stable under parallel workers.

Create PR

Or push these changes by commenting:

@cursor push 89638c54e9
Preview (89638c54e9)
diff --git a/cmd/rain_workers.go b/cmd/rain_workers.go
--- a/cmd/rain_workers.go
+++ b/cmd/rain_workers.go
@@ -11,6 +11,11 @@
 	"github.com/git-rain/git-rain/internal/registry"
 )
 
+type rainRepoJob struct {
+	repo  git.Repository
+	index int
+}
+
 // runRainReposParallel runs fetch/rain for repos using the same bounded worker
 // pool as the default streaming CLI path.
 func runRainReposParallel(reg *registry.Registry, repos []git.Repository, rainOpts git.RainOptions, fullSync bool, fetchWorkers int) (rainTotals, []jsonRepoResult) {
@@ -19,9 +24,9 @@
 	}
 
 	workers := fetchWorkerCount(fetchWorkers)
-	repoChan := make(chan git.Repository, len(repos))
-	for _, repo := range repos {
-		repoChan <- repo
+	repoChan := make(chan rainRepoJob, len(repos))
+	for i, repo := range repos {
+		repoChan <- rainRepoJob{repo: repo, index: i + 1}
 	}
 	close(repoChan)
 
@@ -31,9 +36,8 @@
 		skipped int64
 		frozen  int64
 		failed  int64
-		seq     int64
 	)
-	total := int64(len(repos))
+	total := len(repos)
 	var jsonReports []jsonRepoResult
 	var jsonReportsMu sync.Mutex
 
@@ -43,13 +47,12 @@
 		workersWG.Add(1)
 		go func() {
 			defer workersWG.Done()
-			for repo := range repoChan {
+			for job := range repoChan {
 				if runCtx != nil && runCtx.Err() != nil {
 					continue
 				}
-				current := int(atomic.AddInt64(&seq, 1))
 				var buf strings.Builder
-				delta, report := runRainOnRepo(reg, repo, rainOpts, fullSync, current, int(total), &buf, !rainJSON)
+				delta, report := runRainOnRepo(reg, job.repo, rainOpts, fullSync, job.index, total, &buf, !rainJSON)
 
 				printMu.Lock()
 				if !rainJSON {

You can send follow-ups to the cloud agent here.

Reviewed by Cursor Bugbot for commit e00bcd3. Configure here.

Comment thread cmd/rain_workers.go Outdated
cursoragent and others added 3 commits October 13, 2026 19:00
Co-authored-by: Ben Schellenberger <bschellenberger2600@users.noreply.github.com>
…ers-971d

Co-authored-by: Ben Schellenberger <bschellenberger2600@users.noreply.github.com>
…heck S1030)

Co-authored-by: Ben Schellenberger <bschellenberger2600@users.noreply.github.com>
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.

2 participants