[1130] fix: mimo-parallel-tool-call-policy (2/2) - #49
Closed
myk1yt wants to merge 33 commits into
Closed
Conversation
# Conflicts: # src/core/tools/error-interception/StructuralValidator.ts
# Conflicts: # src/core/assistant-message/__tests__/NativeToolCallParser.spec.ts # src/core/assistant-message/__tests__/presentAssistantMessage-parser-dedup.integration.spec.ts # src/core/assistant-message/presentAssistantMessage.ts
# Conflicts: # src/core/assistant-message/__tests__/presentAssistantMessage-parser-dedup.integration.spec.ts
…ception refs from backup
MimoHandler was passing raw tool schemas to the API without the strict mode conversion that all other OpenAI-compatible providers use. This caused tool call errors due to missing required/strict fields. - Call this.convertToolsForOpenAI(tools) instead of raw assignment - Adds strict: true, required properties, additionalProperties: false
An id-less argument-continuation chunk belongs to the most recent id chunk seen at its index. When a provider reuses index 0 with a NEW id (a disguised second parallel call), the new call's id chunk was dropped but its id-less argument fragments were still kept and concatenated into the FIRST call's accumulator, corrupting its JSON. Track dropped indexes in filterToFirstToolCall state and drop subsequent id-less fragments for those indexes. Also rewrite the function docblock, which referenced a non-existent error-interception retry loop.
The parseErrors/parseFailures docblocks claimed presentAssistantMessage routes recorded failures to an INVALID_JSON_ARGUMENTS error-interception pattern. No such routing exists on this codebase; describe the actual lifecycle (consumed via the consume* APIs, cleared on new API request). Comment-only change, no behavior difference.
parseErrors/parseFailures static maps accumulated an entry per malformed tool call and were never cleared in production (the consume* APIs have no production callers), slowly leaking for the extension-host lifetime. Add NativeToolCallParser.clearParseFailures() and call it in Task.recursivelyMakeClineRequests alongside clearAllStreamingToolCalls()/ clearRawChunkState(), where other per-stream state is reset. The consume* APIs keep working for tests.
MiMo sends tools through convertToolsForOpenAI(), which attaches a strict flag to every function tool. An OpenAI-compatible endpoint that doesn't support structured outputs rejects the request with a 400 and the turn fails outright. Mirror the existing parallel_tool_calls fallback: detect schema-rejection errors narrowly (400 status plus a mention of strict/additionalProperties in a tools context, so unrelated 400s like MiMo's missing-reasoning_content rejection are not retried) and retry once with the original schemas and no strict flag.
…d telemetry events
…, and Task policy resolution
…oo-Code-Org#1130) CI failures: 1. Code QA Roo Code run 31229619240: unused 'taskId' binding (lint). 2. E2E Tests (Mocked) run 31229619233: 4 TS errors in mimo-parallel.test.ts: - mimoBaseUrl was a 4-literal union, rejecting the local mock server URL - 'enableToolUse' is not a RooCodeSettings key - 'api_req_failed' is a ClineAsk, not a ClineSay (x2) Fix: - provider-settings.ts: widen mimoBaseUrl to z.string().url() (documented with the 4 common endpoints) so tests can point the handler at a local mock. - mimo-parallel.test.ts: drop unused taskId, remove enableToolUse, compare m.ask === 'api_req_failed' instead of m.say. Runs: https://github.com/Zoo-Code-Org/Zoo-Code/actions/runs/31229619240 https://github.com/Zoo-Code-Org/Zoo-Code/actions/runs/31229619233
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 join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Stack Position
fix/mimo-parallel-tool-call-policyDescription
Full Feature Description
fix/mimo-parallel-tool-call-policymimo.ts,mimo.ts,NativeToolCallParser.ts,ToolCallRetentionPolicy.ts, task policy wiring, andTelemetryService.ts. B05a is shared between this chain and theopenai-compatible-strict-reasoningchain.Why Split Into 17 PRs
Instead of submitting this feature as a single unified PR, it was split into individual PRs because as code size grows, safely reviewing a PR becomes very difficult. The feature was broken into mutually exclusive individual PRs so that each can be reviewed independently.
What This PR Specifically Changes
Adds MiMo capability/request conversion, stream parser, ghost quarantine, malformed call retention, max-one execution guard, and payload-free telemetry. Does not change other provider behavior or cost calculation.
Included Files
packages/types/src/providers/mimo.tspackages/telemetry/src/TelemetryService.tssrc/api/providers/mimo.tssrc/core/assistant-message/NativeToolCallParser.tssrc/core/assistant-message/ToolCallRetentionPolicy.tsExclusion Scope
Summary by CodeRabbit
New Features
Bug Fixes
Privacy
Upstream PR: Zoo-Code-Org#1130