Skip to content

fix: budget-exhausted conversations now get a summary instead of empty response - #8935

Merged
teknium1 merged 1 commit into
mainfrom
fix/budget-exhausted-empty-response
Apr 13, 2026
Merged

fix: budget-exhausted conversations now get a summary instead of empty response#8935
teknium1 merged 1 commit into
mainfrom
fix/budget-exhausted-empty-response

Conversation

@teknium1

Copy link
Copy Markdown
Contributor

When the agent hits max iterations or budget exhaustion, users see an empty/no response. This is a long-standing bug affecting both CLI and gateway.

Root cause: The post-loop grace call mechanism at line 10156 was dead code. It:

  1. Injected a user message asking for a summary
  2. Set _budget_grace_call = True
  3. But could never re-enter the while loop (already exited)
  4. And the flag blocked the fallback _handle_max_iterations from running (condition: not self._budget_grace_call)
  5. Result: final_response = None → empty response to user

Fix: Remove the broken grace block. Let _handle_max_iterations handle budget exhaustion directly — it already injects a summary request and makes one extra toolless API call.

Change: 5 insertions, 19 deletions. Net simpler.

…y response

The post-loop grace call mechanism was broken: it injected a user
message and set _budget_grace_call=True, but could never re-enter the
while loop (already exited).  Worse, the flag blocked the fallback
_handle_max_iterations from running, so final_response stayed None.

Users saw empty/no response when the agent hit max iterations.

Fix: remove the dead grace block and let _handle_max_iterations handle
it directly — it already injects a summary request and makes one extra
toolless API call.
@teknium1
teknium1 merged commit 934318b into main Apr 13, 2026
4 of 6 checks passed
@teknium1
teknium1 deleted the fix/budget-exhausted-empty-response branch April 13, 2026 10:36
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.

1 participant