This repository was archived by the owner on May 15, 2026. It is now read-only.
fix: combine tool call sync fix with GLM model detection for issue #11071 - #11096
Draft
ghost wants to merge 2 commits into
Draft
fix: combine tool call sync fix with GLM model detection for issue #11071#11096ghost wants to merge 2 commits into
ghost wants to merge 2 commits into
Conversation
…1071 This PR combines: 1. PR #11093 fix: NativeToolCallParser processFinishReason hasStarted check 2. GLM model detection utility for LM Studio and OpenAI-compatible providers 3. mergeToolResultText optimization for GLM models 4. Disable parallel_tool_calls for GLM models 5. GLM-4.7 thinking parameter support 6. Diagnostic logging for GLM detection Closes #11071
Author
Review complete. No issues found. The PR correctly addresses the reported issue by:
The latest commit (9e96578) adds GLM detection to The changes are well-tested with 39 new test cases. Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
|
@roomote tested with OpenAI-compatible endpoint and GLM-4.5-UD-Q8_K_XL-00001-of-00008.gguf as the model. I didnt see any logging about model detection in the console. |
This commit adds GLM model detection and related optimizations to the
OpenAI Compatible provider (OpenAiHandler), which handles the "OpenAI
Compatible" option in the UI when users set a custom base URL.
Changes:
- Import GLM detection utilities and Z.ai format converter
- Add glmConfig property to track GLM model configuration
- Detect GLM model on construction when model ID is available
- Re-detect GLM model in createMessage if model ID changes
- For GLM models:
- Use convertToZAiFormat with mergeToolResultText to prevent
conversation flow disruption
- Disable parallel_tool_calls as GLM models may not support it
- Add thinking parameter for GLM-4.7 models
- Add console logging for detection results and applied optimizations
This addresses the feedback in issue #11071 where the user clarified
they are using the "OpenAI Compatible" provider, not the "OpenAI"
provider. The previous changes in this PR only affected the
base-openai-compatible-provider.ts (used by Z.ai, Groq, etc.) and
lm-studio.ts, but not openai.ts which handles OpenAI Compatible.
7 tasks
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related GitHub Issue
Closes: #11071
Roo Code Task Context (Optional)
N/A
Description
This PR attempts to address Issue #11071 by combining the fix from PR #11093 with GLM-related improvements (points 1-5 from the discussion), excluding point 6 (path-based repetition detection).
Changes included:
PR fix: prevent tool_call_end events for unstarted tool calls #11093 Fix - Tool Call Sync: Fixed
NativeToolCallParser.processFinishReason()to only emittool_call_endevents for tool calls that have actually started (i.e., wheretool_call_startwas emitted). This preventsfinalizeStreamingToolCallfrom receiving IDs that were never registered, which was causing tool results to be silently dropped and triggering infinite retry loops.GLM Model Detection (
glm-model-detection.ts): New utility that detects GLM models (GLM-4.5, GLM-4.6, GLM-4.7 and their variants) from model IDs, supporting various formats from LM Studio and OpenAI-compatible endpoints.mergeToolResultText Optimization: For detected GLM models, the providers now use
convertToZAiFormatwithmergeToolResultText: trueto prevent conversation flow disruption and reasoning_content loss.Disable parallel_tool_calls: GLM models have
parallel_tool_callsdisabled as they may not support it properly.GLM-4.7 Thinking Parameters: For GLM-4.7+ models, the providers send the
thinking: { type: "enabled" | "disabled" }parameter based on user settings.Diagnostic Logging: Console logging shows GLM detection results including version, variant, and applied optimizations.
Test Procedure
NativeToolCallParser.spec.tscovering the processFinishReason fixglm-model-detection.spec.tscovering GLM detectionRun tests:
All 51 tests pass.
Pre-Submission Checklist
Screenshots / Videos
N/A - Backend fix, no UI changes.
Documentation Updates
Additional Notes
This PR combines solutions from prior PRs (#11093, #11092) as requested by @mark-ucalgary in the issue discussion. Feedback and guidance are welcome!
Important
Fix tool call sync issue and enhance GLM model detection, adding support for GLM-4.5, 4.6, 4.7 models and optimizing message handling.
processFinishReason()inNativeToolCallParserto emittool_call_endonly for started tool calls, preventing unregistered IDs from causing issues.glm-model-detection.tsto detect GLM models (GLM-4.5, GLM-4.6, GLM-4.7) and handle various ID formats.mergeToolResultTextfor GLM models to prevent conversation flow disruption.parallel_tool_callsfor GLM models.thinkingparameter for GLM-4.7 models based on user settings.NativeToolCallParser.spec.tsforprocessFinishReasonfix.glm-model-detection.spec.tsfor GLM detection.This description was created by
for 9e96578. You can customize this summary. It will automatically update as commits are pushed.