Skip to content

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

Closed
yiliang114 wants to merge 304 commits intosplit/tool-scheduler-refactorfrom
split/tool-scheduler-parallel
Closed

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

Conversation

@yiliang114
Copy link
Copy Markdown
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

@github-actions
Copy link
Copy Markdown
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

DennisYu07 and others added 7 commits February 27, 2026 23:29
- 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>
…l, Dev Container)

- Detect cloud IDE environments via environment variables
- Use host.docker.internal for IDE server connection in containers
- Add DNS lookup with timeout and fallback to 127.0.0.1
- Improve error messages and troubleshooting guidance for cloud IDEs
- Update /ide status, /ide install, and /ide enable commands with cloud-specific info

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 21 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.
- 为 ActionSelectionStep.test.tsx 和 ExtensionListStep.test.tsx 添加 KeypressProvider 包裹
- 修复 KeypressContext 导入路径
- 更新测试快照
- 重构 ExtensionsManagerDialog:提取 enable/disable 公共逻辑到 handleToggleExtensionState
- 添加错误消息状态和用户友好的错误提示
When LLM streaming output exceeds token limits, JSON arguments for tool calls
can be truncated mid-stream. This causes validation errors or silent data
corruption when the truncated JSON passes validation but writes incomplete files.

The fix adds truncation detection at the streaming parser level and overrides
misleading finish_reason values from providers (e.g., DashScope/Qwen reporting
'stop' instead of 'length'). This ensures downstream code correctly identifies
truncated responses and provides clear guidance to the LLM for retrying with
split content.

Changes:
- turn.ts: Add wasOutputTruncated flag to ToolCallRequestInfo
- coreToolScheduler.ts: Reject truncated edit tool calls, append guidance for write_file
- converter.ts: Override finish_reason when streaming parser detects incomplete JSON
- streamingToolCallParser.ts: Add hasIncompleteToolCalls() method
- Tests: Add comprehensive test coverage for truncation detection scenarios

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
- 更新 extensionsCommand.test.ts 以匹配新的命令结构
- 移除对已删除子命令(update, uninstall, disable, enable, detail)的测试
- 简化 listAction 函数,始终返回 extensions_manage 对话框
- 移除未使用的 showMessageIfNoExtensions 函数
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>
- Replace nested API-KEY submenu with flat three-option layout
- Add descriptive labels for each authentication method:
  - Qwen OAuth: Free, up to 1,000 requests/day
  - Alibaba Cloud Coding Plan: Paid, multiple model providers
  - API Key: Bring your own API key
- Simplify region selection for Coding Plan (China vs Global)
- Use DescriptiveRadioButtonSelect for better visual hierarchy
- Add itemGap prop to BaseSelectionList for spacing
- Update i18n strings in en.js, zh.js, and ru.js
- Simplify custom API key configuration info view
- Clean up unused region-specific strings

Closes #2016

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
Update error handling to display user-friendly quota exceeded messages with links to Alibaba Cloud Coding Plan upgrade options.

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.
DennisYu07 and others added 27 commits March 9, 2026 20:38
chore(release): bump version to 0.12.1
fix: clean up MCP server display and add CONCAT merge strategy for mcp allowed/excluded lists
fix(hooks): Fix failing hook integration tests by updating hook scripts to create hook_invoke_count.txt
improve readability of context compression description
feat(cli): change temporary filename prefix to qwen-edit-
…Session

The /export commands (html, md, json, jsonl) were incorrectly using
loadLastSession() which loads the last modified session from disk,
rather than the currently active session.

This fix uses config.getSessionId() to get the current session ID
and loads the correct session with loadSession(sessionId).

Fixes #2267

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

Adopt Claude Code's approach for webview view registration:
- Use mutual-exclusive sidebar/secondary sidebar with `when` conditions
- Detect secondary sidebar support via VS Code version >= 1.106
- Share single ChatWebviewViewProvider instance across both view IDs
- Only set context key when secondary sidebar is NOT supported
- Pass supportsSecondarySidebar as closure variable to commands

Additional fixes:
- Fix WebViewContent.generate() to accept both Webview and WebviewPanel
- Fix permission handler leak (cancel old promise before new)
- Fix double diff command execution in resolve callback
- Add initializationPromise dedup for auth-restore races
- Add attachToView() for sidebar/secondary sidebar hosting
- Add missing AskUserQuestionResponseMessage import

Co-authored-by: buaoyezz <buaoyezz@users.noreply.github.com>
…ext-aware new chat

- Adjust thinking message timestamp to sort above assistant response
- Add context-aware new chat: sidebar resets in-place, editor tab opens new tab

Co-authored-by: Qwen-Coder <qwen-coder@alibabacloud.com>
feat(vscode-ide-companion): add sidebar view and multi-position chat layout
…opening (#2221)

* fix(core): skip openDiff in YOLO mode to prevent VS Code editor from opening

* test: add shouldConfirmExecute tests for AUTO_EDIT and YOLO in edit and write-file

* Update packages/core/src/tools/edit.ts

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>

* Update packages/core/src/tools/write-file.ts

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>

---------

Co-authored-by: Shaojin Wen <shaojin.wensj@alibaba-inc.com>
Add global uncaught exception handler to suppress known race condition
in @lydell/node-pty where a deferred resize fires after the pty process
has already exited on Windows.

Tracking bug: microsoft/node-pty#827

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

- Add error handling in readTextFile to catch and map file system errors
- Convert ENOENT errors to RequestError with RESOURCE_NOT_FOUND code
- Add unit tests for the error mapping logic

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

fix(cli): suppress Windows pty resize race condition
fix(vscode-ide-companion): map ENOENT errors to ACP RESOURCE_NOT_FOUND in readTextFile
fix: export command should use current session ID instead of loadLastSession
Resolved conflict in coreToolScheduler.test.ts by:
1. Keeping the Parallel Execution test suite from this branch
2. Removing the Sequential Execution test suite from main (tests old behavior)
3. Keeping all other test suites from main branch

The current branch implements parallel execution for tool calls (issue #1998),
so the Sequential Execution tests that test the old serial behavior are no longer
applicable.
Add @yiliang114 as the code owner for the following packages:
- packages/vscode-ide-companion/
- packages/webui/
chore: add yiliang114 as code owner for vscode-ide-companion and webui
@yiliang114 yiliang114 closed this Mar 17, 2026
@yiliang114
Copy link
Copy Markdown
Collaborator Author

Included by #2434.

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.