Problem
Gemini can repeatedly execute the same tool with the same arguments against unchanged state without an orchestration guard. Its constructor defaults both max_turns and timeout_seconds to None, and the loop treats that as unlimited. Every iteration makes another model request and appends another tool exchange to history.
This leaves the Gemini path exposed to the wasteful behavior addressed for Anthropic in #152 / #153.
Evidence and reproduction
Audited main at 7289751459ceace471ac771f3a0ec39b972d1949. Area: AI provider orchestration. Findings come from source inspection and isolated Python execution of the relevant source functions with mocked CAD/model boundaries; no paid model requests or live CAD mutations were made.
An isolated run of the actual Gemini child function used a fake stream returning 65 identical read-tool calls with unchanged arguments, results, and CAD context. VibeCAD executed all 65 and issued 66 model requests. It stopped only because the mock returned final text on request 66. No guard or deadline ended the sequence.
The test is deliberately finite; unlimited continuation is established by the loop condition, not by running an infinite test.
Proposed fix
Add Gemini progress tracking using tool/argument/result and meaningful document/job-state fingerprints. Detect repeated failed or unchanged calls and return an actionable blocker or a bounded recovery outcome. Add configurable request/turn limits while retaining an explicit unlimited option and compatibility for callers that need it.
Do not apply a small blanket limit to productive modeling. Polling a running job must be distinguished from a failed repeated operation, including legitimate waits that return the same running status.
Acceptance tests
- Repeated identical failed and read calls stop within the configured no-progress allowance.
- Unknown-tool loops also terminate usefully.
- Changed document revisions and productive operations continue.
- Legitimate background-job polling and eventual completion remain supported.
- Cancellation stops further requests promptly.
- Existing tool IDs, thought signatures, and transition behavior remain intact.
- Report actual model-request counts in regression tests.
Suggested priority: high. This is a Gemini follow-up, not a duplicate of the completed Anthropic fix.
Problem
Gemini can repeatedly execute the same tool with the same arguments against unchanged state without an orchestration guard. Its constructor defaults both
max_turnsandtimeout_secondstoNone, and the loop treats that as unlimited. Every iteration makes another model request and appends another tool exchange to history.This leaves the Gemini path exposed to the wasteful behavior addressed for Anthropic in #152 / #153.
Evidence and reproduction
Audited
mainat7289751459ceace471ac771f3a0ec39b972d1949. Area: AI provider orchestration. Findings come from source inspection and isolated Python execution of the relevant source functions with mocked CAD/model boundaries; no paid model requests or live CAD mutations were made.An isolated run of the actual Gemini child function used a fake stream returning 65 identical read-tool calls with unchanged arguments, results, and CAD context. VibeCAD executed all 65 and issued 66 model requests. It stopped only because the mock returned final text on request 66. No guard or deadline ended the sequence.
The test is deliberately finite; unlimited continuation is established by the loop condition, not by running an infinite test.
Proposed fix
Add Gemini progress tracking using tool/argument/result and meaningful document/job-state fingerprints. Detect repeated failed or unchanged calls and return an actionable blocker or a bounded recovery outcome. Add configurable request/turn limits while retaining an explicit unlimited option and compatibility for callers that need it.
Do not apply a small blanket limit to productive modeling. Polling a running job must be distinguished from a failed repeated operation, including legitimate waits that return the same running status.
Acceptance tests
Suggested priority: high. This is a Gemini follow-up, not a duplicate of the completed Anthropic fix.