Skip to content

fix(ambiance-agent): prevent LLM request floods (250+ req/session) - #811

Open
hackolite with Copilot wants to merge 2 commits into
mainfrom
copilot/limpression-envoyer-plein-requetes
Open

fix(ambiance-agent): prevent LLM request floods (250+ req/session)#811
hackolite with Copilot wants to merge 2 commits into
mainfrom
copilot/limpression-envoyer-plein-requetes

Conversation

Copilot AI commented Aug 9, 2026

Copy link
Copy Markdown

The AmbianceAgent called the LLM on every UI frame while Execute was checked and state was READY. Errors returned the agent to READY instantly with no backoff, creating unbounded request loops.

Changes

  • Error cooldown: LLM errors now enter COOLDOWN (15 s) instead of transitioning directly to READY, preventing tight retry loops on repeated failures
  • Input deduplication: MD5 hash of prompt + aggregated_inputs is stored on each dispatch; if inputs haven't changed the LLM call is skipped entirely
  • One-shot execute: The "Execute Agent" checkbox is automatically unchecked once a request is dispatched — re-enabling requires explicit user action
  • Cooldown duration hygiene: _cooldown_s is reset to the success default (30 s) on every READY transition, so a preceding error cooldown cannot bleed into subsequent runs
# Before — on error:
self._state = 'READY'   # triggers a new call next frame

# After — on error:
self._state = 'COOLDOWN'
self._cooldown_start = time.time()
self._cooldown_s = self._error_cooldown_s  # 15 s

Copilot AI and others added 2 commits August 9, 2026 23:32
…-shot

Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Co-authored-by: hackolite <826027+hackolite@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants