Skip to content

fix: track parallel tasks by index to handle duplicate task names#112

Merged
rileyhilliard merged 1 commit intomainfrom
release/fix-duplicate-task-tracking
Jan 14, 2026
Merged

fix: track parallel tasks by index to handle duplicate task names#112
rileyhilliard merged 1 commit intomainfrom
release/fix-duplicate-task-tracking

Conversation

@rileyhilliard
Copy link
Copy Markdown
Owner

@rileyhilliard rileyhilliard commented Jan 14, 2026

Summary

  • Fix for duplicate task name collision in parallel execution
  • Tasks with the same name (e.g., running test-opendata 3x for flaky test detection) now tracked separately by index

Changes

  • Add Index field to TaskInfo and TaskResult structs
  • Create unique task IDs like task#0, task#1 for state tracking
  • Update OutputManager and ParallelProgress to track by task ID
  • Log files now named <taskname>_<index>.log to prevent overwrites
  • Add regression tests for duplicate task names

Test plan

  • All existing tests pass
  • New regression tests verify duplicate name handling

🤖 Generated with Claude Code

Summary by CodeRabbit

Release Notes

  • Bug Fixes
    • Fixed handling of tasks with identical names in parallel execution—each task instance is now properly tracked, logged, and displayed separately.
    • Log files for duplicate-named tasks are now indexed (e.g., task_0.log, task_1.log) to prevent conflicts and data loss.
    • Task status and progress indicators now correctly distinguish between multiple instances of the same task.

✏️ Tip: You can customize this high-level summary in your review settings.

When running the same task multiple times in parallel (e.g., for flaky
test detection), tasks were keyed by name alone causing state confusion.
Only the first task's running state got updated, and log files
overwrote each other.

Changes:
- Add Index field to TaskInfo and TaskResult structs
- Add ID() method creating unique IDs like "task#0", "task#1"
- Update OutputManager to track by task ID instead of name
- Update ParallelProgress to find tasks by index
- Log files now named <taskname>_<index>.log
- Add regression tests for duplicate task names

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
@rileyhilliard rileyhilliard merged commit 6798dff into main Jan 14, 2026
3 of 4 checks passed
@rileyhilliard rileyhilliard deleted the release/fix-duplicate-task-tracking branch January 14, 2026 06:09
@coderabbitai
Copy link
Copy Markdown

coderabbitai bot commented Jan 14, 2026

Caution

Review failed

The pull request is closed.

Walkthrough

Introduces per-task indexing throughout the parallel execution system to support duplicate task names. Each task gets an Index field; all components (output manager, progress UI, log writer, workers) now accept and use taskIndex alongside taskName for identification, enabling separate tracking and logging for task instances with identical names.

Changes

Cohort / File(s) Summary
Type definitions
internal/parallel/types.go
Added TaskIndex field to TaskResult and Index field to TaskInfo; introduced ID() methods on both types to generate composite identifiers for index-based lookups.
Log writer
internal/parallel/logs/writer.go
Updated WriteTask signature to accept taskIndex parameter; changed log filename pattern from <taskname>.log to <taskname>_<index>.log using new taskLogFilename helper; updated WriteSummary to derive indexed filenames.
Output manager
internal/parallel/output.go, internal/parallel/output_test.go
Reworked all public methods (InitTasks, TaskSyncing, TaskExecuting, TaskStarted, TaskOutput, TaskCompleted, GetTaskStatus) to accept taskIndex parameter and use composite key (name+index) for internal tracking; added test for duplicate task name scenarios.
Workers
internal/parallel/worker.go
Updated all calls to output manager methods to pass task.Index; changed notifyComplete to receive only TaskResult (extracts taskName/index from result); updated TaskResult initialization to populate TaskIndex.
Progress UI
internal/ui/parallel_progress.go, internal/ui/parallel_progress_test.go
Introduced TaskInit type with Name and Index fields; updated all task lifecycle methods (TaskSyncing, TaskExecuting, TaskStarted, TaskCompleted) to accept and use index for identification; added test for duplicate task name tracking.
Orchestration
internal/parallel/orchestrator.go, internal/cli/parallel.go
Modified to pass TaskInfo objects (with Index) to InitTasks instead of task name strings; updated task enumeration to populate and assign Index during parallel execution setup.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

✨ Finishing touches
  • 📝 Generate docstrings


📜 Recent review details

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b5f8e5a and 93d9cca.

📒 Files selected for processing (9)
  • internal/cli/parallel.go
  • internal/parallel/logs/writer.go
  • internal/parallel/orchestrator.go
  • internal/parallel/output.go
  • internal/parallel/output_test.go
  • internal/parallel/types.go
  • internal/parallel/worker.go
  • internal/ui/parallel_progress.go
  • internal/ui/parallel_progress_test.go

✏️ Tip: You can disable this entire section by setting review_details to false in your review settings.


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

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