fix: route bash apply_patch through dedicated tool and improve path/prompt handling#885
Open
Barryshen1 wants to merge 2 commits into
Open
fix: route bash apply_patch through dedicated tool and improve path/prompt handling#885Barryshen1 wants to merge 2 commits into
Barryshen1 wants to merge 2 commits into
Conversation
…rompt handling Route bash apply_patch heredocs through ApplyPatchTool for approval and safety, normalize Windows memory paths for reconcile, and strip CRLF from CLI prompts.
…ting Extract normalizePromptText for unit testing, verify CLI --prompt normalization in the TUI thread path, and assert bash apply_patch heredocs route through ApplyPatchTool.
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.
This PR adds three small reliability improvements:
Route bash
apply_patchinvocations through the dedicated tool — Models often runapply_patch <<'PATCH'...via the bash tool instead of callingapply_patchdirectly, which bypasses diff preview, write permissions, and LSP post-checks. MiMo-Code already hadPatch.maybeParseApplyPatch()but it was never wired intoBashTool. This PR addsmaybeParseApplyPatchFromCommand()and delegates matching commands toApplyPatchTool.Fix Windows memory path parsing (windows环境memory.reconcile路径正则只认正斜杠,反斜杠全部匹配失败 #861) —
parsePath()andparseCcPath()used forward-slash-only regexes, causing memory reconcile to skip all files on Windows. Paths are now normalized before matching.Normalize CRLF in CLI
--promptinput — MiMo-Code already normalized line endings for TUI paste events, but not for--prompt/ piped stdin, which could garble the first message on Windows.Test plan
bun test test/memory/paths.test.ts— Windows backslash path casesbun test test/patch/patch.test.ts—maybeParseApplyPatchFromCommandcasesbun test test/cli/prompt-text.test.ts— CRLF normalization unit testsbun test test/cli/tui/thread.test.ts—--promptCRLF normalized before TUI startbun test test/tool/bash.test.ts— bashapply_patchheredoc routes throughApplyPatchTooland requestseditpermissionturbo typecheckpasses across all packagesRelated issues