Skip to content

fix(agent): explain out-of-credits failures and drop the empty streaming row - #67

Merged
Rl0007 merged 3 commits into
mainfrom
fix/agent-low-balance
Oct 6, 2026
Merged

Rl0007 merged 3 commits into
mainfrom
fix/agent-low-balance

Conversation

@Rl0007

@Rl0007 Rl0007 commented Oct 5, 2026 •

Copy link
Copy Markdown
Contributor
  1. When the OpenRouter balance ran out, every assistant turn failed with "The assistant hit an error", and each failure left an empty assistant message in the session.
  2. If the provider refuses a request because of credits, the chat now says so. A failed turn no longer leaves an empty message behind.

You can visit the assistant panel in /wikify to see it.

Fixes #23

Verification
  • Added 2 tests in wikify/tests/test_agent.py (a 402 names the credits cause, leaves no streaming row and writes an Error Log row; a generic failure does the same with the generic text). Both failed on main and pass on this branch. The LLM call is stubbed; the 402 is a litellm.APIError(status_code=402), which is what litellm raises for an OpenRouter 402.
  • API e2e on a devbox: main leaves assistant | streaming | '' before the error row; this branch leaves only the error row.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@Rl0007 Rl0007 changed the title fix(agent): cap max_tokens and explain out-of-credits failures fix(agent): explain out-of-credits failures and drop the empty streaming row Oct 6, 2026

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@greptile-apps greptile-apps Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your trial has ended. Reactivate Greptile to resume code reviews.

@Rl0007
Rl0007 merged commit 6970d67 into main Oct 6, 2026
3 checks passed
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.

The assistant stops working when the API balance runs low

1 participant