Skip to content

feat: UI/UX enhancement for model call failures (#1213)#1219

Open
eureka928 wants to merge 14 commits intoeigent-ai:mainfrom
eureka928:feat/model-error-ux
Open

feat: UI/UX enhancement for model call failures (#1213)#1219
eureka928 wants to merge 14 commits intoeigent-ai:mainfrom
eureka928:feat/model-error-ux

Conversation

@eureka928
Copy link
Contributor

@eureka928 eureka928 commented Feb 11, 2026

Related Issue

Closes #1213

Description

Implements UI/UX improvements for model call failures to guide users toward fixing configuration issues, as described in #1213.

Backend:

  • Enrich SSE error events with error_code (invalid_api_key, model_not_found, insufficient_quota) using the existing normalize_error_to_openai_format() classifier
  • Add lightweight PATCH /provider/{id}/invalidate endpoint to mark a provider as invalid without sending full provider data

Frontend:

  • Add model error toast with contextual message and "Model Settings" link (persistent for invalid_api_key, 8s for others)
  • On invalid_api_key errors, automatically call the invalidation endpoint to mark the provider invalid on the server
  • Fix is_valid field mapping — the backend returns is_vaild (legacy typo) but the frontend was reading is_valid, resulting in the green dot always being wrong
  • Fix save payloads to send is_vaild: 2 (the correct field name and enum value)
  • Update status indicators across sidebar, BYOK detail view, and Default Settings dropdown:
    • Green dot → configured AND valid
    • Red dot → configured but invalid
    • No dot → not configured
  • Show inline "API Key Invalid or Expired" warning on the API key input when a provider is invalidated
  • Default Settings dropdown trigger switches from green to warning styling when the default model is invalid

i18n:

  • Add toast message and setting warning keys across all 11 locales

Changes Made

File Change
backend/app/service/chat_service.py Enrich SSE error with error_code
server/app/controller/provider/provider_controller.py Add PATCH /provider/{id}/invalidate
src/api/http.ts Add proxyFetchPatch helper, PATCH method support
src/types/chatbox.d.ts Add error_code to AgentMessage.data
src/components/Toast/modelErrorToast.tsx New — toast with settings link
src/store/chatStore.ts Show toast on error, call invalidation endpoint
src/pages/Setting/Models.tsx Fix is_valid mapping, update status dots, add warnings
src/i18n/locales/*/chat.json New toast message keys (×11)
src/i18n/locales/*/setting.json New warning label keys (×11)

Testing Evidence (REQUIRED)

  • I have included human-verified testing evidence in this PR.
  • This PR includes frontend/UI changes, and I attached screenshot(s) or screen recording(s).
  • No frontend/UI changes in this PR.
image image

What is the purpose of this pull request?

  • Bug fix
  • New Feature
  • Documentation update
  • Other

Contribution Guidelines Acknowledgement

@eureka928
Copy link
Contributor Author

@Wendong-Fan @Pakchoioioi @4pmtong @bytecii would you review my PR?
Thank you for your time

@eureka928 eureka928 force-pushed the feat/model-error-ux branch 2 times, most recently from 83fb9b1 to b0f8259 Compare February 18, 2026 21:37
@eureka928
Copy link
Contributor Author

Hi @Douglasymlai would you review this PR?
Thank you

@Douglasymlai
Copy link
Contributor

Hi @eureka928 , thanks for contributing this PR.

Quick feedback on the UX for this issue: since an invalid model key blocks the user’s task, the error should be handled inside the chat flow (not just as a notification). It would be better to show an inline error message in the chat with an action, so when the model returns an “invalid key” error, the user can directly jump to Model Settings to fix it.

Right now it presents the error information, but adding a clear CTA (for example, Open Model Settings) would make the flow much smoother.

@eureka928
Copy link
Contributor Author

eureka928 commented Feb 21, 2026

Hi @eureka928 , thanks for contributing this PR.

Quick feedback on the UX for this issue: since an invalid model key blocks the user’s task, the error should be handled inside the chat flow (not just as a notification). It would be better to show an inline error message in the chat with an action, so when the model returns an “invalid key” error, the user can directly jump to Model Settings to fix it.

Right now it presents the error information, but adding a clear CTA (for example, Open Model Settings) would make the flow much smoother.

image

Does this work for you?

Looking forward to hearing from you

@eureka928
Copy link
Contributor Author

@Douglasymlai @a7m-1st this is ready as well, please review 😉

@eureka928
Copy link
Contributor Author

@Douglasymlai @4pmtong I think this is also good to merge?

Copy link
Contributor

@Douglasymlai Douglasymlai left a comment

Choose a reason for hiding this comment

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

Everything looks good. @Wendong-Fan @a7m-1st can do the final check for the merging

@eureka928
Copy link
Contributor Author

Everything looks good. @Wendong-Fan @a7m-1st can do the final check for the merging

I'd like to follow up on this

@a7m-1st
Copy link
Collaborator

a7m-1st commented Mar 3, 2026

let me focus on this in a moment !

@eureka928 eureka928 force-pushed the feat/model-error-ux branch from 93a98ea to 92de1c6 Compare March 3, 2026 12:45
@eureka928
Copy link
Contributor Author

let me focus on this in a moment !

I fixed the conflict, would you review and merge?

@Pakchoioioi
Copy link
Contributor

This redirect doesn’t meet the requirements; it should go to the model settings page.

bug.mov

@eureka928 eureka928 force-pushed the feat/model-error-ux branch from 92de1c6 to e81b85e Compare March 5, 2026 00:25
@eureka928
Copy link
Contributor Author

@Pakchoioioi it's updated, that was old version

Screencast.from.2026-03-05.01-31-50.webm

@Pakchoioioi
Copy link
Contributor

Also, it would be helpful to keep the original error message from the model printed out as well.

@eureka928
Copy link
Contributor Author

Also, it would be helpful to keep the original error message from the model printed out as well.

image

like this?

@eureka928
Copy link
Contributor Author

@Pakchoioioi
image
you want like whole error message?

@eureka928
Copy link
Contributor Author

@a7m-1st is this good to merge now?

@eureka928
Copy link
Contributor Author

@4pmtong @a7m-1st would you review and merge this as well?

Comment on lines 50 to +56
"no-reply-received-task-continue": "No reply received, task continue",
"splitting-tasks": "Splitting Tasks",
"start-task": "Start Task",
"message-cannot-be-empty": "Message cannot be empty",
"remove-file": "Remove file",
"drop-files-to-attach": "Drop files to attach",
"expand-input": "Expand input (⌘P)",
"queued-tasks": "Queued Tasks",
"remove-queued-message": "Remove queued message",
"no-agents-added": "No agents added",
"open-in-ide": "Open in IDE",
"open-in-vscode": "Open in VS Code",
"open-in-cursor": "Open in Cursor",
"open-in-file-manager": "Open in File Manager",
"failed-to-open-folder": "Failed to open folder",
"task-completed-card-title": "Task completed",
"task-completed-card-subtitle": "Automate your task with a trigger"
"model-error-go-to-settings": "Model Settings",
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can you add a single commit (to make easy to review) to revert those translation keys?

Image

@4pmtong
Copy link
Collaborator

4pmtong commented Mar 10, 2026

Hi @eureka928 Could you help resolve the conflicts?

eureka928 and others added 13 commits March 10, 2026 07:05
Use normalize_error_to_openai_format() to classify ModelProcessingError
and generic Exception errors, including error_code in SSE payloads so
the frontend can take targeted action (e.g. invalid_api_key,
model_not_found, insufficient_quota).
Lightweight endpoint to mark a provider as invalid without requiring the
full provider payload, used by the frontend when an API key error is
detected during a model call.
Add PATCH method support to proxyFetchRequest and expose proxyFetchPatch.
Add optional error_code field to AgentMessage.data for typed error
handling in the frontend.
Show contextual toast on model call failures with a link to Model
Settings. Persistent (Infinity duration) for invalid_api_key errors,
8s for others.
Capture preferredProviderId during chat start. On SSE error events,
show model error toast and call the invalidation endpoint when
error_code is invalid_api_key.
Fix is_valid field mapping to read is_vaild (legacy typo) from the API
response. Fix save payloads to send is_vaild: 2 (VaildStatus.is_valid).
Update sidebar, BYOK detail, and default model dropdown to show red
indicators for invalid providers and warning styling on the dropdown
trigger. Show inline API key error when provider is invalidated.
Add chat keys for model error toast messages (invalid_api_key,
model_not_found, insufficient_quota) and setting keys for API key
invalid warning and default model unavailable labels across all
11 locales.
- Add Action.error and ActionErrorData to queue system so workforce
  background tasks can push errors to the SSE stream
- Fix "simple answer" error handlers to emit SSE error events instead
  of silently swallowing exceptions
- Add PUT fallback when PATCH /invalidate endpoint is not deployed
- Store preferredProvider reference for invalidation fallback

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Show model errors (invalid API key, model not found, quota exceeded) as
an inline warning card in the chat message list instead of only a toast.
The card includes a contextual description and an "Open Model Settings"
button that navigates to /setting/models.
The "Open Model Settings" button navigated to /setting/models which
redirected to the settings tab. The models page is actually under
the agents tab at /history?tab=agents.
Display the raw error from the model provider below the i18n
description so users have the full context for debugging.
Extract message from SDK .body attribute or parse embedded dict,
and add break-all to prevent long error strings from overflowing.
@eureka928 eureka928 force-pushed the feat/model-error-ux branch from 6afc7b4 to 1957859 Compare March 10, 2026 06:05
@eureka928
Copy link
Contributor Author

Hi @eureka928 Could you help resolve the conflicts?

@4pmtong this is done, if you don't mind, would you review and merge today?
It was approved and opened for a few weeks

@eureka928 eureka928 requested a review from a7m-1st March 10, 2026 06:07
@4pmtong
Copy link
Collaborator

4pmtong commented Mar 11, 2026

Hi @eureka928 I noticed that quite a few configurations seem to be missing in the i18n files — it looks like some entries may have been lost during conflict resolution. Could you take another look at that part and make sure everything is intact? Thanks!

I've attached a few screenshots above for reference, though they don't cover all the missing entries — there may be more affected areas worth checking.
CleanShot 2026-03-11 at 14 19 30@2x
CleanShot 2026-03-11 at 14 19 57@2x
CleanShot 2026-03-11 at 14 20 22@2x
CleanShot 2026-03-11 at 14 20 36@2x

Restores setting.json keys (gpt-5.4-name, help-improve-eigent, etc.)
and chat.json keys (queued-tasks, splitting-tasks, etc.) across all
11 locales that were dropped when resolving merge conflicts.
@eureka928
Copy link
Contributor Author

Good catch @4pmtong — these were lost during rebase conflict resolution. I've restored all missing keys:

  • setting.json (4 keys across all 11 locales): gpt-5.4-name, help-improve-eigent, help-improve-eigent-description, we-only-use-the-essential-data-needed-to-run-your-tasks
  • chat.json (11 keys across all 11 locales): drop-files-to-attach, expand-input, message-cannot-be-empty, no-agents-added, queued-tasks, remove-file, remove-queued-message, splitting-tasks, start-task, task-completed-card-subtitle, task-completed-card-title

Fixed in commit 6baf1b1.

@eureka928
Copy link
Contributor Author

HI @Wendong-Fan @4pmtong @a7m-1st I addressed all comments

@eureka928
Copy link
Contributor Author

@fengju0213 would you merge this PR? I addressed all and got approval

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature Request] UI/UX enhancement for model call failures and BYOK configuration status

6 participants