fix(enrichment): circuit-break exhausted quota calls - #229
Conversation
|
Follow-up validation: reproduced and fixed a probe-state bug where a non-quota failure after cooldown could leave the circuit permanently blocking requests. Added regression coverage for probe recovery, classifier request suppression, summarizer request suppression, and non-quota behavior. Verified with compileall, Black, focused Flake8, and direct classifier/circuit assertions. Full pytest collection remains blocked locally by the unrelated installed |
|
Docker verification completed: |
Summary
Closes #222.
When the enrichment LLM returns a definitive quota exhaustion error, repeated stores previously retried summarization and classification independently. This adds a shared, fail-soft cooldown circuit across both enrichment paths.
Changes
insufficient_quota/quota errors for a configurableENRICHMENT_CIRCUIT_COOLDOWN_SECONDSperiod (default 300 seconds).The default remains backward compatible for successful requests and non-quota transient failures. The change only suppresses further enrichment requests after a quota-related failure; stores remain fail-soft.
Verification
python -m compileall -q automem app.py— passed.python -m black --check app.py automem tests/test_enrichment_circuit.py— passed.python -m flake8 app.py automem --count --select=E9,F63,F7,F82 --show-source --statistics— passed.python -m pytest -q tests/test_enrichment_circuit.py— not runnable in this environment: pytest collection resolves an unrelated installedtestspackage (D:\project\tscodex\connectonion-pr\tests) and cannot import this checkout'stests.support; no test assertion was executed.make testand Docker integration tests were not run because the focused pytest collection issue must be resolved before they can provide meaningful results.