Skip to content

feat(core): enable parallel tool call execution#2000

Draft
yiliang114 wants to merge 42 commits intosplit/tool-scheduler-refactorfrom
split/tool-scheduler-parallel
Draft

feat(core): enable parallel tool call execution#2000
yiliang114 wants to merge 42 commits intosplit/tool-scheduler-refactorfrom
split/tool-scheduler-parallel

Conversation

@yiliang114
Copy link
Collaborator

Summary

Closes #1998

This PR enables parallel execution of independent tool calls within the same batch. Built on top of #1998 (refactor), it switches from sequential to concurrent execution using Promise.allSettled.

Changes

  • Replaced for...of loop with Promise.allSettled for parallel execution
  • Maintained thread safety for state management and event emission
  • Updated test cases to verify concurrent semantics

Depends On

Stack

yiliang114 and others added 10 commits February 11, 2026 14:52
Changed sub-agent tool calls from sequential to parallel execution
using Promise.allSettled() to significantly improve performance when
the model returns multiple tool calls in a single response.

Key changes:
- Use Promise.allSettled() for parallel tool call execution
- Extract executeSingleToolCall() method for better code organization
- Maintain existing state management and error handling
- Add parallel execution timing tests

Parallelism is safe because LLM tool call protocol guarantees that
tool calls in the same response cannot reference each other's outputs.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
…d prioritize project-level settings

- SubAgentScope now automatically appends global memory (including QWEN.md and output-language.md) to its system prompt, ensuring subagents respect project conventions and language preferences.
- The CLI config loader now checks for `.qwen/output-language.md` in the project directory before falling back to the global `~/.qwen/output-language.md`, allowing project-specific language settings.

Made-with: Cursor
…1305

- Add error code 1305 to RATE_LIMIT_ERROR_CODES for DashScope/IdealTalk internal rate limit detection (issue #1918)
- Add test case for 1305 error code detection
- Update existing test cases to use 9999 as custom error code to avoid conflict
- Remove unused sdk-java/.gitignore file

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
@github-actions
Copy link
Contributor

📋 Review Summary

This PR enables parallel execution of independent tool calls within the same batch using Promise.allSettled, replacing the previous sequential execution. The change improves performance by allowing multiple tool calls to run concurrently while maintaining thread safety for state management. The implementation appears solid with comprehensive test coverage verifying parallel execution semantics.

🔍 General Feedback

  • The change from sequential to parallel execution is well-implemented using Promise.allSettled which properly handles mixed success/failure scenarios
  • The tests comprehensively cover various parallel execution scenarios including success, failure, cancellation, and mixed outcomes
  • Good documentation added explaining why parallel execution is safe for LLM tool calls
  • The refactoring extracts the single tool call execution into a separate method, improving code organization

🎯 Specific Feedback

🟡 High

  • File: packages/core/src/core/coreToolScheduler.ts:1091-1104 - The comment explains that Node.js single-threaded event loop ensures synchronous state mutations don't race, but it might be beneficial to add more robust synchronization mechanisms for critical sections if the codebase grows more complex. Consider adding more explicit locking if shared state access becomes more complex in the future.

🟢 Medium

  • File: packages/core/src/core/coreToolScheduler.test.ts:1893-1920 - The test helper functions createMockConfig and createMockToolRegistry improve test readability and reduce duplication. Consider extracting these to a shared test utilities module if they're used across multiple test files.
  • File: packages/core/src/core/coreToolScheduler.test.ts:1923-1970 - The parallel execution test could benefit from a small tolerance margin in timing assertions to account for CI environment variations. The current 90ms threshold for a 50ms expected parallel execution is reasonable but could be documented with a comment explaining the rationale.

🔵 Low

  • File: packages/core/src/core/coreToolScheduler.ts:1107-1110 - The JSDoc for executeSingleToolCall mentions it was extracted to support parallel execution, which is good documentation. Consider adding examples of when this method might be called independently in the future.

✅ Highlights

  • Excellent test coverage for parallel execution scenarios including edge cases like mixed success/failure and cancellation
  • Proper use of Promise.allSettled to handle all promises regardless of success/failure status
  • Well-documented implementation with clear comments explaining the safety of parallel execution for LLM tool calls
  • Performance improvement without compromising correctness or reliability

沐目 and others added 5 commits February 28, 2026 13:25
…guage path priority

- Add 3 tests for SubAgentScope.buildChatSystemPrompt appending userMemory
- Add 3 tests for project-level output-language.md path resolution priority

Made-with: Cursor
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Add AuthDisplayType enum and helper for Coding Plan detection
- Remove formatAuthType/titleizeAuthType functions
- Update tests for new auth types

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Add i18n keys for modality types and status labels
- Update ModelDialog to use t() for user-facing strings

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Update error messages for unsupported image/PDF inputs with clearer guidance
- Add `modalities` setting to override auto-detected input modalities
- Document `modalities` config in model-providers.md and settings.md
- Update converter tests to match new error message format

This provides users with actionable alternatives when their selected model doesn't support certain input types, and allows manual modality overrides for models not recognized by auto-detection.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
tanzhenxin and others added 13 commits February 28, 2026 16:35
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

- Add 5MB limit for image files to prevent API errors

- Add 10MB limit for PDF files based on provider constraints

- Return FILE_TOO_LARGE error with clear message when limits exceeded

- Add tests for both image and PDF size limit enforcement

This prevents errors when attempting to process large binary files that exceed provider API limits.
Add AGENT_CONTEXT_FILENAME constant and include AGENTS.md in default
context file search alongside QWEN.md. This enables out-of-the-box
support for the AGENTS.md standard (https://agents.md/) without
requiring manual configuration.

Changes:
- Add AGENT_CONTEXT_FILENAME = 'AGENTS.md' constant
- Update currentGeminiMdFilename default to include both AGENTS.md and QWEN.md
- AGENTS.md takes precedence (first in array) for the de facto standard

Closes #2006
- Add weighted tip system to make certain tips appear more frequently
- Set /insight tip to weight 3 (3x more likely than regular tips)
- Add i18n translations for the new tip across all supported languages
- Add comprehensive unit tests for weighted tip selection

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
feat(cli): Increase /insight feature exposure via weighted tips
- Removed exact match assertion for help text that changed in UI
- Test now only verifies the dialog title renders correctly

The help text changed from 'Enter to select · Esc to close' to
'Enter to select, ↑↓ to navigate, Esc to close', causing the test
to fail unnecessarily.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
…heck

- Reduce general file size limit from 20MB to 10MB (using 9.9MB threshold)
- Remove per-type size limits (5MB images, 10MB PDFs)
- Add base64 encoding size check for PDFs to prevent data URI limit errors
- Update all tests to reflect new 10MB limit

This fixes issue #1880 where large PDFs could exceed API data URI limits
after base64 encoding, causing errors. The 9.9MB threshold provides
margin for encoding overhead.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

Replace generic skill suggestion with specific guidance to install

the document-skills extension for PDF processing.
Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Keep QWEN.md as the first element in the default context filenames array
to maintain backward compatibility with /init command and save_memory tool.
Both QWEN.md and AGENTS.md will still be searched and loaded, but QWEN.md
takes precedence for file creation operations.
…logs

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
feat: support AGENTS.md as default context file
fix(subagent): append output-language.md to subagent system prompt and prioritize project-level settings
Mingholy and others added 14 commits March 2, 2026 17:22
Add missing 'modes' and 'configOptions' fields to NewSessionResponse
to enable mode switching (plan/yolo/auto-edit) in Zed ACP client.

- Update schema.ts: add configOptionSchema and extend newSessionResponseSchema
- Update acpAgent.ts: add buildModesData() and buildConfigOptions() helpers

Fixes ACP mode control issue where Zed couldn't switch approval modes.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Update session/list response to match Claude Agent's format:
- Change 'items' to 'sessions' array
- Add 'title' field (mapped from prompt)
- Add 'updatedAt' field (ISO format from mtime)
- Remove 'hasMore' and 'nextCursor' fields

This fixes session list display in Zed ACP client.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Add sessionCapabilities with fork, list, and resume capabilities
to initialize response to match Claude Agent's format.

This enables Zed ACP client to discover session management features.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- Make cwd optional in listSessionsRequestSchema (defaults to process.cwd())
- Remove fork from sessionCapabilities (not supported)

Fixes -32602 error when Zed calls session/list without cwd param.

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
fix(core/rateLimit): add support for rate limit error code 1305 and custom retry error codes
fix(logging): reduce excessive streaming output in session history logs
docs: update installation instructions
fix: add modality defaults to prevent API errors when reading PDFs and other media
Fix ACP protocol compatibility issues with Zed editor
* feat: add Ctrl+Y shortcut to retry failed requests

- Add Ctrl+Y keyboard shortcut for retrying the last failed request
- Add isNetworkError() to detect transient network failures (ECONNREFUSED, ETIMEDOUT, etc.)
- Add DashScope 1305 error code to rate limit detection
- Add error hint \"Press Ctrl+Y to retry\" in error messages
- Support user-defined error codes for retry via config
- Add retryLastPrompt() hook in useGeminiStream
- Update keyboard shortcuts documentation

* feat: improve Ctrl+Y retry feature with tests, docs, and rate limit config

- Add comprehensive tests for Ctrl+Y retry shortcut in InputPrompt
- Add unit tests for retryLastPrompt in useGeminiStream hook
- Add detailed JSDoc comments for retryLastPrompt function and Ctrl+Y shortcut
- Extend isRateLimitError to support custom error codes via retryErrorCodes config
- Fix rate limit retry log variable reference (RATE_LIMIT_RETRY_OPTIONS → maxRateLimitRetries)
- Add Eclipse IDE files to .gitignore

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* refactor(ui): consolidate retry countdown as inline hint in error messages

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* feat(cli): enhance error handling with improved retry mechanism

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

- Modify ErrorMessage component to remove dim color from hint text

- Update useGeminiStream hook to improve retry countdown behavior with option to preserve or clear hints

- Adjust tests to match new error handling implementation

* feat: add Ctrl+Y shortcut to retry the last failed request

When a request errors out, the error message shows an inline hint
"(Press Ctrl+Y to retry.)" in secondary color. Pressing Ctrl+Y
re-submits the same prompt, commits the error text to history
(without the hint), and clears the hint from the UI.

- Add retryLastPrompt action wired to Ctrl+Y via keyBindings and InputPrompt
- Track last submitted prompt and error state in useGeminiStream refs
- Show retry hint inline with error text in ErrorMessage component,
  wrapping naturally on narrow terminals while preserving hint color
- Expose retryLastPrompt through UIActionsContext
- Add keyboard shortcut entry in KeyboardShortcuts display
- Add i18n strings for hint and no-retry-available message
- Document Ctrl+Y in keyboard-shortcuts.md

* docs(configuration): Update model provider configuration document

* chore: remove YOLO mode code from core

* fix: prevent Ctrl+Y hint from overriding auto-retry countdown

When an auto-retry countdown is active (retryCountdownTimerRef is set),
handleErrorEvent should not overwrite it with the Ctrl+Y hint. The auto-retry
hint ("retrying in Xs...") and manual retry hint ("Press Ctrl+Y to retry.")
are mutually exclusive:

- Auto-retry errors (e.g., rate limits): show countdown hint
- Other errors: show Ctrl+Y hint

Also removed retryErrorCodes from ContentGeneratorConfig as it's not part
of the minimal Ctrl+Y feature scope.

* simplify: remove complex options from clearRetryCountdown

Revert clearRetryCountdown to simplest form without options parameter.
The function now just clears the timer and pending item without any
automatic history commit logic.

* fix: restore pendingRetryCountdownItem as separate state from pendingRetryErrorItem

Auto-retry countdown and manual retry hint are now independent:
- pendingRetryErrorItem: displays error message with optional hint
- pendingRetryCountdownItem: displays separate countdown line for auto-retry

This ensures both can be shown simultaneously without overriding each other.

* fix: restore RetryCountdownMessage rendering in HistoryItemDisplay

The retry_countdown type should be rendered as a separate message,
not inline in ErrorMessage. This allows auto-retry countdown and
manual retry hint to coexist properly.

* fix(cli): properly commit retry error item to history before clearing

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* fix(cli): remove trailing period from retry hint translations

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

Remove unnecessary period from 'Press Ctrl+Y to retry' translation strings in both en.js and zh.js locales. Also update the corresponding usage in useGeminiStream hook.

* chore(sdk-java): add Eclipse project configuration files

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

Add .project configuration files for client and qwencode modules to support Eclipse IDE development environment.

* feat(cli): add retry countdown hint to error message

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>

* Revert "chore(sdk-java): add Eclipse project configuration files"

This reverts commit da83b5e.

---------

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
refactor(core): extract single tool-call execution path
…ential execution guidelines

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.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.

5 participants