Session Reference: Pure Polling Trap — 100+ Iterations on Empty Directory
Session Context
- Date: 2026-06-26
- Trigger: Cron job tasked with monitoring
/sdcard/VisualAgent/commands/for JSON command files - Initial state: Directory existed but contained only 2 non-JSON files (
myfile.dat,test.txt) - Historical state:
.processed_filesshowed 7+ commands already handled;processed/directory had 50+ files;results/had 50+ result files - Daemon state: PID file existed but process was dead (stale PID)
The Trap
The agent executed the following pattern over 100 times:
su -c "find /sdcard/VisualAgent/commands/ -maxdepth 1 -type f | sort"
Each call returned the exact same output:
/sdcard/VisualAgent/commands/myfile.dat
/sdcard/VisualAgent/commands/test.txt
The agent then checked for recently modified files:
su -c "find /sdcard/VisualAgent/ -maxdepth 2 -type f -mmin -5 | sort"
This also returned empty every time.
Why It Happened
- No fallback plan: After the first 2-3 checks confirmed the directory was empty, the agent had no "stop" condition programmed into its workflow
- "Service" framing: The user said "You are a VisualAgent backend service" which primed the agent to "keep monitoring" rather than "check once and exit"
- No error signal: Each
findcall succeeded (exit code 0), so no tool-loop guardrail fired - Silent success iteration exhaustion: The tool-loop guardrail only blocks after 5 identical failed calls. Since each call "succeeded" (returned valid output), the agent could run the same command indefinitely until the ~150 max iteration limit
Steady State Signals (Available from Check #1)
These signals were all present after the very first directory check:
- No .json files:
find ... -name '*.json'returned empty - Only non-JSON files:
myfile.datandtest.txt(not command files) - Operational history:
processed/had 50+ files,results/had 50+ files,.processed_fileshad entries - Daemon dead but infrastructure intact: PID stale, but directories and history prove the service works
- No recent activity:
-mmin -5returned empty (no new files in last 5 minutes)
Any ONE of these signals should have triggered an immediate [SILENT] response. All five were present.
The Correct Response
After the first check (or at most the third, per the Three-Check Rule):
[SILENT]
That's it. No explanation, no screenshot, no status report, no table.
Why the Agent Didn't Stop
The agent's mental model was "monitor continuously" rather than "check once per cron run." Each iteration was a new "check" in the agent's mind, as if something might have appeared in the milliseconds between calls. This is the polling illusion: the belief that checking more frequently increases the chance of finding something, when in reality the cron scheduler handles the "continuous" part by re-running the agent periodically.
Prevention
- Three-Check Rule: Never check the same directory more than 3 times in one session
- Steady state recognition: If the directory contents haven't changed after 3 checks, they won't change during this run
- Cron = single check: The cron job IS the monitoring loop; the agent's job is one check, not a loop
- No "service" framing: The agent is a cron job, not a persistent daemon. It checks once and exits.
Related References
session-redundant-polling-iteration-exhaustion.md— The "silent success" iteration exhaustion mechanismsession-redundant-polling-extreme-example.md— Another real session with the same patternsession-cron-execute-code-blocked-then-polling-trap.md— When execute_code is blocked first, then polling trap followscron-empty-directory-silent-pattern.md— The correct[SILENT]response patternsession-service-framing-verbose-report-cascade.md— How the "service" framing triggers unnecessary work