-
Notifications
You must be signed in to change notification settings - Fork 5.4k
[DRAFT] feat(core): Implement parallel action execution in processActions #6209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: develop
Are you sure you want to change the base?
Conversation
- Execute actions within a single response batch in parallel using Promise.allSettled() - All actions in a batch receive the same initial state snapshot - State accumulates sequentially between response batches - Merge all ActionResult.values after parallel batch completes - Preserve fault tolerance: if one action fails, others still complete - Update prompts to reflect parallel execution model - Update actionStateProvider to clarify 'previous results' refers to prior batches - Update tests to match new behavior This improves performance for multi-action responses while maintaining proper state accumulation for multi-step reasoning workflows.
Introduces AsyncLocalStorage to track action context and prompts during parallel action execution in AgentRuntime. Updates prompt collection and logging to use the new context, ensuring prompts are isolated per action and supporting parallel-safe tracing. Adds comprehensive tests for prompt tracking, isolation, and context logging.
Enhances the browser fallback's context management to properly restore the store for both sync and async callbacks, ensuring correct context in async action handlers. Also refines action plan step updates to better distinguish between failed and successful (including legacy) action results.
Enhances the browser fallback's context management to properly restore the store for both sync and async callbacks, ensuring correct context in async action handlers. Also refines action plan step updates to better distinguish between failed and successful (including legacy) action results. Add parallel-safe prompt tracking with AsyncLocalStorage Introduces AsyncLocalStorage to track action context and prompts during parallel action execution in AgentRuntime. Updates prompt collection and logging to use the new context, ensuring prompts are isolated per action and supporting parallel-safe tracing. Adds comprehensive tests for prompt tracking, isolation, and context logging. fix(core): Make AsyncLocalStorage browser-compatible with fallback
…lizaOS/eliza into feat/parallel-action-execution
Updated tests to track action result status by intercepting createMemory calls instead of log calls. This change ensures verification of action status is based on memory creation, aligning with current runtime behavior.
Increase fetch-depth to 50 for better commit history visibility. Update Claude review prompt to require checking previous comments, reviews, and commits, and to avoid repeating already addressed issues. Add instructions to acknowledge resolved issues and list only new actionable items.
Introduces a browser fallback implementation for AsyncLocalStorage with parallel usage detection and warnings. Enhances AgentRuntime to create error memories when an action is missing a handler or not found. Adds comprehensive tests for these behaviors and the browser fallback context handling.
|
Claude finished @wtfsayo's task —— View job Code Review AnalysisTodo List:
Review Results❌ CRITICAL: Excessive
💡 SUGGESTION: Add timeout protection for parallel actions → Consider: Implementing per-action timeouts
💡 SUGGESTION: Improve AsyncLocalStorage type safety → Consider: Stricter typing for ActionContextStore
Positive Findings✅ Good test coverage - Comprehensive tests for parallel execution and prompt isolation Main IssueThe excessive use of |
Updates the runtime to correctly mark minimal ActionResult objects (e.g., { success: false }) and those with only an error field as 'failed' instead of 'completed'. Adds tests to verify that actions returning minimal failure results are properly handled.
|
Important Review skippedAuto reviews are disabled on this repository. Please check the settings in the CodeRabbit UI or the You can disable this status message by setting the Note Other AI code review bot(s) detectedCodeRabbit has detected other AI code review bot(s) in this pull request and will avoid duplicating their findings in the review comments. This may lead to a less comprehensive review. ✨ Finishing touches🧪 Generate unit tests (beta)
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. Comment |
|
Claude finished @wtfsayo's task —— View job Code Review AnalysisTodo List:
Review Results❌ CRITICAL: Excessive
💡 SUGGESTION: Add timeout protection for parallel actions → Consider: Implementing per-action timeouts
💡 SUGGESTION: Improve AsyncLocalStorage type safety → Consider: Stricter typing for ActionContextStore
Positive Findings✅ Good test coverage - Comprehensive tests for parallel execution and prompt isolation Main IssueThe excessive use of |
Summary
This PR implements parallel action execution within the
processActions()method to improve performance for multi-action responses.Changes
Core Runtime (
packages/core/src/runtime.ts)Promise.allSettled()ActionResult.valuesafter parallel batch completesPrompts (
packages/core/src/prompts.ts)messageHandlerTemplateto reflect parallel execution modelAction State Provider (
packages/plugin-bootstrap/src/providers/actionState.ts)Tests
runtime.test.tsto match new state initialization behaviorprompts.test.tsto match new prompt textKey Data Flow
Testing
Breaking Changes
None - backward compatible. Actions that previously assumed sequential execution within a batch will now run in parallel, but since they all receive the same state snapshot, behavior should be equivalent for independent actions.
Note
Execute actions in a response batch in parallel with a shared state snapshot, accumulate results across batches, and introduce AsyncLocalStorage-based prompt tracking with prompt/provider/test updates.
processActionsper response usingPromise.allSettled(); each batch shares a composed state snapshot; accumulateActionResult.valuesand plan state between batches.{ success:false }(including minimal/error-only) as failed.action_results; update action plan immutably per step.ActionContextStore,getCurrentActionContext, and browser fallbackcreateBrowserFallbackfor prompt collection; include action context inuseModellogs; skip collectingTEXT_EMBEDDINGprompts.messageHandlerTemplatefor parallel execution model and guidance on multi-step dependencies.runtime.test.ts: parallel execution behavior, action result status semantics, prompt collection/isolation via AsyncLocalStorage, browser fallback behavior, exact vs fuzzy action matching.prompts.test.tsfor new execution rules and wording.Written by Cursor Bugbot for commit 55765fc. This will update automatically on new commits. Configure here.