fix: require explicit Write content#874
Open
yaojinrun wants to merge 1 commit into
Open
Conversation
Collaborator
|
Write工具当前设计是为了提高落盘成功率;0.2.8版本可将配置文件ai.write_tool_mode设置为"inline_content"来启用旧版Write工具 |
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.
Problem
The previous
Writetool contract only exposedfile_pathto the model. The runtime then launched a secondary AI request to generate the file content and injected that generated text into the tool arguments before execution.This created an unsafe failure mode: if the secondary content-generation request returned tool transcript text, thinking text, error output, or UI-rendered conversation fragments instead of raw file content, the fallback extraction path could treat that text as file content and write it to disk.
Observed bad outputs included fragments like tool-call logs,
[Input],[Error],[Thinking], and previous conversation text being written into source files.Summary
Writecalls to provide explicitfile_pathandcontent.RoundExecutor.<bitfun_contents>extraction/sanitization fallback logic.contentschema and missing-content validation.Approach
The fix makes
Writecontent flow explicit and single-pass:file_pathandcontentas required fields.validate_inputrejects calls that omitcontent.RoundExecutorno longer performs a hidden second model call to generate file content.Writestill creates new files only, while identical-content retries remain idempotent.