Skip to content

feat: concurrent execution with cancellation reporting#232

Draft
branchseer wants to merge 4 commits intomainfrom
03-11-feat_concurrent_execution
Draft

feat: concurrent execution with cancellation reporting#232
branchseer wants to merge 4 commits intomainfrom
03-11-feat_concurrent_execution

Conversation

@branchseer
Copy link
Member

@branchseer branchseer commented Mar 12, 2026

Summary

  • Add --concurrency flag for parallel task execution (default: 10)
  • Implement fast-fail with explicit cancellation: when a task fails, all in-flight tasks are cancelled via shared CancellationToken instead of being silently dropped
  • Display inline exit status (✗ exit code N) and cancellation (✗ cancelled) for each failed/cancelled task in multi-task mode
  • Track cancelled tasks separately in execution summary

Key changes

  • CancellationToken shared across all nested graph executions via ExecutionContext
  • LeafFinishStatus enum (Spawned/Completed/Error) prevents invalid reporter states
  • Rename StdioSuggestionStdioMode throughout
  • Thread cancel_token through fspy::Command::spawn() and spawn_with_tracking()
  • Drain futures on failure instead of dropping (ensures explicit finish() calls)

Test plan

  • E2E fast-fail test: failure cancels in-flight tasks and skips dependents
  • All existing E2E snapshot tests pass with --concurrency=1 for determinism
  • Plan snapshot tests pass
  • cargo check compiles
  • Cross-platform lints pass (native, Linux, Windows)

🤖 Generated with Claude Code

branchseer and others added 4 commits March 12, 2026 13:45
Add a --concurrency flag to control how many tasks run in parallel within
a multi-node execution graph. Supports absolute values (e.g. --concurrency=4)
and percentage of logical CPUs (e.g. --concurrency=50%). Defaults to the
number of logical CPUs.

Key changes:
- New Concurrency CLI type with FromStr parsing (absolute + percentage)
- Concurrent scheduler using semaphore-based DAG execution with
  dependency tracking via petgraph
- Labeled reporter: buffered output for non-first tasks, streaming for
  the first active task, with atomic flush on completion
- ExecutionGraph struct wrapping AcyclicGraph with resolved concurrency
- Nested vp run inherits parent concurrency unless overridden
- Plan snapshots include concurrency field; E2E tests use --concurrency=1
  for deterministic output ordering
Verifies that when a task fails, in-flight sibling tasks are cancelled
and downstream dependents are never started.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
When a task fails during concurrent execution, in-flight tasks are now
explicitly cancelled via a shared CancellationToken instead of being
silently dropped. Each cancelled/failed task displays inline status
(✗ exit code N or ✗ cancelled) in multi-task mode. The summary also
tracks cancelled tasks separately.

Key changes:
- Add CancellationToken to ExecutionContext, shared across nested graphs
- Drain futures on failure instead of dropping (explicit finish calls)
- Add LeafFinishStatus enum (Spawned/Completed/Error) to reporter trait
- Rename StdioSuggestion → StdioMode throughout
- Thread cancel_token through fspy::Command::spawn() and spawn_with_tracking()
- Render inline exit status and cancellation lines in labeled reporter
- Track cancelled tasks in summary statistics

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Member Author

This stack of pull requests is managed by Graphite. Learn more about stacking.

@branchseer branchseer changed the title feat: add --concurrency flag for parallel task execution feat: concurrent execution with cancellation reporting Mar 12, 2026
@branchseer branchseer marked this pull request as draft March 12, 2026 10:01
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