Skip to content

feat: parallel dispatch - #48

Merged
bobrykov merged 2 commits into
masterfrom
feat/parallel-dispatch
Jul 13, 2026
Merged

feat: parallel dispatch#48
bobrykov merged 2 commits into
masterfrom
feat/parallel-dispatch

Conversation

@bobrykov

Copy link
Copy Markdown
Contributor

No description provided.

@coderabbitai

coderabbitai Bot commented Jul 13, 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: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: b62bb37a-02ba-49de-a193-087cf1248ce3

📥 Commits

Reviewing files that changed from the base of the PR and between 3fc6b3a and 0cdbfd1.

📒 Files selected for processing (1)
  • src/engine/bare/dispatch.rs
🚧 Files skipped from review as they are similar to previous changes (1)
  • src/engine/bare/dispatch.rs

📝 Walkthrough

Walkthrough

Adds opt-in parallel tool dispatch with configurable concurrency, resource-key conflict serialization, cancellation-aware recovery, ordered results, and expanded tests. Configuration, tool APIs, mock tooling, documentation, and changelog entries are updated.

Changes

Parallel tool dispatch

Layer / File(s) Summary
Dispatch configuration and resource contracts
src/config.rs, src/tool.rs, src/tool/registry.rs, examples/chat.rs
Adds parallel dispatch configuration and validation, integrates it into LoopConfig, and adds per-call resource-key extraction for Tool and FnTool.
Parallel execution and cancellation
src/engine/bare/dispatch.rs
Implements sequential and parallel dispatch paths with dependency waves, bounded concurrency, ordered results, hook handling, health recording, and cancellation-aware recovery.
Dispatch fixtures and validation
src/testing.rs, src/engine/bare/dispatch.rs, CHANGELOG.md
Adds delayed MockTool execution, dispatch and cancellation tests, documentation adjustments, and changelog entries.

Sequence Diagram(s)

sequenceDiagram
  participant BareLoop
  participant ToolRegistry
  participant ToolDependencyGraph
  participant ParallelDispatch
  participant Tool
  BareLoop->>ToolRegistry: Resolve ToolCall tools
  ParallelDispatch->>ToolDependencyGraph: Plan waves using safety and resource_key
  ParallelDispatch->>Tool: Execute eligible calls with bounded concurrency
  Tool-->>ParallelDispatch: Return per-call results
  ParallelDispatch-->>BareLoop: Preserve input order and finish post-processing
Loading

Possibly related PRs

🚥 Pre-merge checks | ✅ 4
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly and concisely summarizes the main change: adding parallel dispatch.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 50.00%.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch feat/parallel-dispatch

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.

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🧹 Nitpick comments (1)
src/engine/bare/dispatch.rs (1)

1398-1401: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Wall-clock timing assertion can be flaky under CI load.

Asserting elapsed < 250ms for 3×100ms overlapping calls leaves only ~150ms of scheduling headroom; a loaded runner can breach it and produce spurious failures. Consider a wider margin (e.g. < 290ms) or a paused/virtual-time clock so the test asserts overlap without depending on real wall-clock slack.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@src/engine/bare/dispatch.rs` around lines 1398 - 1401, Relax the elapsed-time
threshold in the parallel overlap assertion within the relevant dispatch test to
provide substantially more CI scheduling headroom, such as checking for less
than 290ms. Preserve the test’s intent of rejecting serialized 3×100ms execution
without introducing unrelated changes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/engine/bare/dispatch.rs`:
- Around line 407-418: Update the task closure in dispatch_tools_parallel to
invoke dispatch_tool_with_recovery instead of dispatch_tool, passing the same
tool call, context, timing, cancellation, and turn inputs so
reflector/backoff/correction retries match sequential dispatch. Preserve permit
release and cancellation behavior.

---

Nitpick comments:
In `@src/engine/bare/dispatch.rs`:
- Around line 1398-1401: Relax the elapsed-time threshold in the parallel
overlap assertion within the relevant dispatch test to provide substantially
more CI scheduling headroom, such as checking for less than 290ms. Preserve the
test’s intent of rejecting serialized 3×100ms execution without introducing
unrelated changes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: f009a1d6-74f7-46a9-94e8-250e8e9c8438

📥 Commits

Reviewing files that changed from the base of the PR and between 050469d and 3fc6b3a.

📒 Files selected for processing (7)
  • CHANGELOG.md
  • examples/chat.rs
  • src/config.rs
  • src/engine/bare/dispatch.rs
  • src/testing.rs
  • src/tool.rs
  • src/tool/registry.rs

Comment thread src/engine/bare/dispatch.rs
@bobrykov

Copy link
Copy Markdown
Contributor Author

@CodeRabbit review

@coderabbitai

coderabbitai Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor
✅ Action performed

Review finished.

Note: CodeRabbit is an incremental review system and does not re-review already reviewed commits. This command is applicable only when automatic reviews are paused.

@bobrykov
bobrykov merged commit fe32acc into master Jul 13, 2026
7 checks passed
@coderabbitai coderabbitai Bot mentioned this pull request Jul 27, 2026
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