Repository navigation
ADFA-6836 | Let create_file take empty content - #156
Merged
Merged
Conversation
The required-argument check read content="" as missing, so "add a file with an empty class" failed with "Missing required argument(s): content" before reaching the approval dialog. For create_file, content now counts as missing only when it is absent. An omitted content is still rejected. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Vh2DAaJxvRXKRYkgiDqwGQ
Daniel-ADFA
approved these changes
Oct 29, 2026
hal-eisen-adfa
approved these changes
Oct 29, 2026
Contributor
Author
Independent review (
|
| ID | Finding | Checked | Conclusion |
|---|---|---|---|
| F06 | update_file still rejects content = "", though UpdateFileHandler would write it |
True: only create_file/content is in EMPTY_ALLOWED_ARGS. If an empty update_file reached the handler it would truncate an existing file to zero length, after the approval step, and report "Updated file: X (0 characters)" |
Left as it is: this PR is about create_file, and blanking a file is riskier than creating one. Whether to allow it is a decision for the owner |
| F07 | Three places now say when an empty string is legal (EMPTY_ALLOWED_ARGS, VERBATIM_TEXT_ARGS, a comment in requiredArgsForTool) |
True | A design point, not a defect |
| F08 | The schema still marks content required while the handler has ?: "" |
The two agree: the key must be present and "" is a valid value. The handler fallback is unreachable through the Executor |
Not a defect. Nothing tells the model that empty is allowed |
| F09 | Tests cover only "" and an absent key |
True. Whitespace-only content is now accepted and untested. A JSON null arrives as JSONObject.NULL, whose toString() is "null", so it passes and a file would contain null |
The null behaviour is not new. Tests could be added |
| F10 | A non-string content (a number, boolean or object) is stringified and passes the check |
True | Not new: the old check let these through too |
Not device-verified.
Posted by Claude Code for David Schachter.
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.
Summary
ADFA-6836.
create_filewithcontent=""(an empty file) was rejected by the executor's required-argument check as "Missing required argument(s): content", before the approval dialog. A small on-device model asked to "add a file Util.kt with an empty class Util" sends exactly that, then answers "I can't assist with that request" and stops.For
create_file,contentnow counts as missing only when it is absent. An empty string goes through to the approval dialog; an omittedcontentis still rejected.update_file,edit_fileand every other tool keep the old check. The change is anEMPTY_ALLOWED_ARGSset inplugins/AI-Core/.../tool/Executor.kt, keyed on the registered tool name and argument, plus two tests inExecutorTest.Measured on a Pixel 6 Pro (Android 17)
qwen2.5-coder-1.5b-instruct-q4_k_m, "Build Apps Anywhere" test project, a fresh chat, prompt "Add a file Util.kt with an empty class Util", approval declined.
create_file(…/Util.kt, content="")→ "Missing required argument(s): content"; next turn "I can't assist with that request."; no dialogcreate_file(…/Util.kt, content="")reaches the approval dialogReview
An independent read-only review found no blocking problems. Empty content passes every later step it checked (alias normalisation,
CreateFileHandler.execute, the path guard, the approval text), an omittedcontentis still rejected, and only the new empty-content test fails without the change. It noted one existing hazard, not caused by this diff: a text-parsed call with JSON"content": nullbecomes the string"null", which the old check also accepted, so such a call would write a file containingnull. Not changed here.Not verified
executewrites"").mainplus this change, with the AI-Agent-Local build from ADFA-6805 | Teach the local model to read files with read_file, not search #155 installed; this change does not touch AI-Agent-Local.ChatViewModelCompactionTest, which this change does not touch; it passed on the next two full runs. I treat it as a flake and have not filed it.Test plan
testDebugUnitTest(1,257 tests; passes on a rerun after the one flake above)addons checkexits 0🤖 Generated with Claude Code
https://claude.ai/code/session_01Vh2DAaJxvRXKRYkgiDqwGQ