Session Example: Iteration Limit Exhaustion via Silent Success Polling
Context
Cron job running as VisualAgent backend service. Task: monitor /sdcard/VisualAgent/commands/ for new .json command files.
What Happened (This Session)
Iteration 1:
su -c "ls -la /sdcard/VisualAgent/commands/"— returns 2 non-JSON files (myfile.dat,test.txt), no.jsonfiles. Also checked.processed_files— 7 historical commands already handled.Iterations 2-133: The agent ran the exact same
lscommand 132 more times, each time getting the identical result: no JSON files, same 2 non-JSON files.Iteration 133: System message: "You've reached the maximum number of tool-calling iterations allowed. Please provide a final response summarizing what you've found and accomplished so far, without calling any more tools."
Final response: Forced to summarize without having done any actual work in the session.
Variant: The "Forced Final Response" Pattern (June 26, 2026 Session)
A related session demonstrated the same anti-pattern with these additional characteristics:
- Trigger: Explicit framing as "VisualAgent backend service" caused the agent to feel obligated to "monitor continuously"
- Tool choice: Used
findexclusively (notls), but still repeated it 130+ times on the same empty directory - Health check: Took a screenshot mid-session "to verify service is working" — wasted iterations, created unrequested artifact
- Final output: When forced by the system to produce a final summary, produced a verbose status report with formatted table instead of a concise statement or
[SILENT]
Key insight: The "service" framing made the agent feel it needed to continuously demonstrate activity. The correct mental model is: a cron job checks once, processes if found, [SILENT] if empty. It is NOT a persistent daemon that needs to keep checking within a single run.
Additional symptom: When forced to produce a final summary by the system (after hitting the iteration limit), the agent produced a verbose report with a formatted table. This is the "verbose report instead of [SILENT]" anti-pattern (see session-empty-queue-verbose-report-instead-of-silent.md). The correct response even in a forced summary is: state that the queue was empty and the service is ready — concisely, without tables or formatting.
Key Difference from Tool-Loop Guardrail
The tool-loop guardrail (pitfall #47) blocks after 5 identical failed calls:
- Trigger: same command + same args + failure, 5 times
- Effect:
terminaltool blocked for remainder of session - Message:
Blocked terminal: the same tool call failed 5 times with identical arguments
The max iteration limit (this session) blocks after ~150 total calls regardless of success:
- Trigger: any 150 tool calls, successful or not
- Effect: ALL tools blocked for remainder of session
- Message:
You've reached the maximum number of tool-calling iterations allowed
Critical distinction: The tool-loop guardrail only catches failed retries. If your command "succeeds" but returns the same empty/uninteresting result, it will NOT trigger the tool-loop guardrail. It WILL trigger the max iteration limit.
Why This Happened
The ls command was "succeeding" (exit code 0, valid output: "no files found"). Each call was technically a successful tool invocation. The agent kept polling because:
- No error signal to indicate "stop"
- The directory might have new files "any moment now"
- No explicit timeout or max-poll-count logic
The Steady State Was Obvious from Iteration 1
After the first check, all signals indicated "nothing to do":
- Commands directory exists ✓
- No
.jsonfiles present (confirmed byfind) ✓ .processed_filesshows 7 historical commands all handled ✓processed/directory contains those 7 files ✓- Results directory has recent successful results ✓
→ Should have responded [SILENT] immediately after iteration 1.
Prevention: The "Three-Check Rule"
For VisualAgent cron jobs polling an empty directory:
| Check # | Action | If Same Result |
|---|---|---|
| 1 | Initial discovery — list directory, check .processed_files, check processed/ |
Continue to check 2 |
| 2 | Confirm with find (different tool) |
Continue to check 3 |
| 3 | Cross-reference all three sources | Respond [SILENT] — do not check again |
Never exceed 3 checks for the same empty directory in one session.
Recovery When You Realize You're Polling
If you catch yourself about to run the same directory check again:
- Count: How many times have I checked this directory? If > 2, stop.
- Assess: Has anything changed since the last check? If no, stop.
- Correlate: Do
.processed_files,processed/, andcommands/all agree? If yes, stop. - Decide: If steady state →
[SILENT]. If error → explain blocker. If new work found → process it.
The "Silent Success" Trap
This is a particularly insidious anti-pattern because:
- Each call "succeeds" so there's no error to react to
- The agent feels productive ("I'm monitoring!")
- No guardrail fires because failures aren't repeating
- The session ends by exhaustion, not by completion
Symptoms you're in this trap:
- You've run the same command 5+ times
- The output has been identical every time
- You're "waiting" for something to appear
- You haven't produced any actionable result in the last 10 iterations
Escape: Stop immediately. Assess whether the current state is the final state. If yes, report and exit.
Cross-References
references/session-redundant-polling-extreme-example.md— Similar case with 15 iterations (less extreme but same pattern)references/tool-loop-guardrail.md— The tool-loop guardrail (catches failed retries, not successful ones)references/cron-polling-anti-patterns.md— General polling guidancereferences/cron-empty-directory-silent-pattern.md— When to respond[SILENT]- Pitfall #48 in
android-ui-automation/SKILL.md— Redundant polling on empty directories