Summary
Nanobot currently guards repeated external lookups (for example web_fetch and web_search) but does not guard repeated identical local tool calls in the same turn.
In practice, this can produce loops where the model reissues the same local call with unchanged arguments until cancellation or max_iterations.
Reproduction Pattern
Examples of repeated identical local calls:
read_file(path=...)
list_dir(path=...)
glob(pattern=...)
grep(pattern=...)
The same (tool_name, args) signature can repeat many times with no new signal.
Expected Behavior
Nanobot should short-circuit repeated identical local calls in a single turn after a small retry budget.
Proposed Scope
Initial guarded tools:
read_file
list_dir
glob
grep
Behavior:
- Normalize a signature from
tool_name + normalized args
- Count repeats within one turn
- Allow a small retry budget (for example 2-3)
- After threshold, return synthetic tool error:
Error: repeated identical tool call blocked. Use the prior result or choose a different tool.
- Emit warning log with tool, abbreviated signature, attempt count
Suggested Implementation Area
nanobot/agent/runner.py
- optionally shared helper in
nanobot/utils/runtime.py
Test Expectations
- Repeated identical
read_file is blocked after threshold
- Repeated identical
glob is blocked after threshold
- Repeated identical
grep is blocked after threshold
- Different arguments remain allowed
- Existing external lookup guard behavior remains unchanged
Notes
This issue is intended as a general core safety fix, not workflow-specific behavior.
Summary
Nanobot currently guards repeated external lookups (for example
web_fetchandweb_search) but does not guard repeated identical local tool calls in the same turn.In practice, this can produce loops where the model reissues the same local call with unchanged arguments until cancellation or
max_iterations.Reproduction Pattern
Examples of repeated identical local calls:
read_file(path=...)list_dir(path=...)glob(pattern=...)grep(pattern=...)The same
(tool_name, args)signature can repeat many times with no new signal.Expected Behavior
Nanobot should short-circuit repeated identical local calls in a single turn after a small retry budget.
Proposed Scope
Initial guarded tools:
read_filelist_dirglobgrepBehavior:
tool_name + normalized argsError: repeated identical tool call blocked. Use the prior result or choose a different tool.Suggested Implementation Area
nanobot/agent/runner.pynanobot/utils/runtime.pyTest Expectations
read_fileis blocked after thresholdglobis blocked after thresholdgrepis blocked after thresholdNotes
This issue is intended as a general core safety fix, not workflow-specific behavior.