Skip to content

fix(cli): gracefully handle model API errors instead of crashing#42

Open
c001estb0y wants to merge 1 commit into
MagicCube:mainfrom
c001estb0y:fix/graceful-model-error
Open

fix(cli): gracefully handle model API errors instead of crashing#42
c001estb0y wants to merge 1 commit into
MagicCube:mainfrom
c001estb0y:fix/graceful-model-error

Conversation

@c001estb0y
Copy link
Copy Markdown

Summary

  • When model provider returns 503/429/5xx, the error was re-thrown from the agent loop, crashing the Ink process
  • Now displays the error as an assistant message so the user can retry without restarting

Reproduce

  1. Configure a model that returns 503 (e.g. DeepSeek during peak hours)
  2. Send any message
  3. Before: process exits with unhandled error
  4. After: shows "Error: ..." message, user can continue

Change

src/cli/tui/hooks/use-agent-loop.ts — 1 line removed, 6 lines added

When the model provider returns 503/429/5xx, the error was re-thrown
from the agent loop hook, causing the Ink process to crash and exit.

Now the error is caught and displayed as an assistant message so the
user can retry without restarting the session.
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