[Bug] "You must read" failure slip into tool call window
Description
Previously, the warning/failure of these msg will show up in their own block before tool call adjust
You must read "source/app/components/settings-selector.tsx" before editing it. Call read_file on it first — if the file is over 300 lines, specify start_line and end_line to read its actual content, not just metadata — then retry string_replace with old_str copied exactly from the file.
Now it will be part of the tool call and you have to cancel, manually copy the file, the proceed:
More digging shows the cause is from #1228 (e77289a5). It made validation failures show the approval prompt instead of returning the error to the model.
There are two failure types.
A. Content failure - You must read "
Before #1228: A was blocked by the tool's own re-check at execution, so it never needed the prompt. B was unguarded - MCP didn't re-check - so it did need it.
#1228 fixed B but also caught A, where the prompt adds nothing.
Not sure if this is an intended behavior by @tusharui.
Environment
- OS: (e.g., macOS 14.0, Ubuntu 22.04, Windows 11) Ubuntu
- Node version: (run
node --version) 24 - Nanocoder version: (run
nanocoder --version) Latest commit up to c87bee150272c369229b6b245a28c3af35a60638 but definitely see this before - Provider: (e.g., Ollama, OpenRouter, OpenAI-compatible API) n/a
- Model: (e.g., llama3.2, claude-3.5-sonnet) n/a
Steps to Reproduce
- Ask AI to update a file but not reading it first, this will show
Expected Behavior
Previously it will always fail first, read the file then attempt tool call again
Actual Behavior
Logs/Screenshots
See above
Additional Context
- [x] I have searched existing issues to ensure this is not a duplicate
- [x] I can reproduce this issue consistently
- [x] This issue occurs with the latest version of nanocoder
After reading more through the original PR seems like intentional behavior, but execute this tool seems misleading enough so wonder if this is intended behavior from @tusharui.
Thanks!
Picking this up - a fix will follow shortly.