fix(agent): make budget exhaustion visibly incomplete - #49309
fix(agent): make budget exhaustion visibly incomplete#49309spiky02plateau wants to merge 1 commit into
Conversation
|
Thanks @spiky02plateau. The core data-loss in #8049 is now fixed on main via #50009 (merge commit 9f67ba1): the unguarded cleanup chain in This PR goes considerably further than the reported bug — ~670 lines reworking completion semantics ( Closing against #8049 since the data-loss is resolved. If you want to pursue the "visibly incomplete budget" behavior, please open a focused PR scoped to just that and we'll review it on its own merits — thanks for the thorough write-up. |
Summary
Budget-exhausted turns now surface as visibly incomplete instead of letting a fluent model summary pass as a verified final answer. Both
max_iterationsand sharedIterationBudgetexhaustion returncompleted=falsewith structured budget metadata, and the final visible response is wrapped in runtime-owned wording that says the task is not verified complete and can be resumed withcontinue.This keeps downstream behavior honest without introducing startup-context optimization or a new resume system: gateway resume markers stay uncleared, cron treats the run as failed, and final-send suppression no longer hides the deterministic incomplete-state warning after streamed/interim content.
Design notes
budget_exhausted=true,failure_reason="budget_exhausted",budget_used, andbudget_maxare emitted on every finalizer result.Tests
python -m pytest tests/agent/test_turn_finalizer_budget_exhaustion.py tests/run_agent/test_turn_completion_explainer.py tests/gateway/test_restart_resume_pending.py tests/cron/test_scheduler.py -q -o 'addopts='python -m py_compile agent/turn_finalizer.py agent/chat_completion_helpers.py gateway/run.py run_agent.py tests/agent/test_turn_finalizer_budget_exhaustion.py tests/run_agent/test_turn_completion_explainer.py tests/gateway/test_restart_resume_pending.py tests/cron/test_scheduler.pyPost-Deploy Monitoring & Validation
budget_exhausted=true,completed=false, and user-visible text starting withIteration budget exhausted; cron runs with exhausted budgets record failure rather thanok.iteration_budget_exhausted,max_iterations_reached,budget_exhausted, andSuppressing normal final sendaround exhausted turns.completed=true, cron jobs marked successful after exhausted turns, or chat users receiving only interim/tool-progress text without the deterministic warning.