Skip to content

Refactor error handling and display stream errors in thread UI - #263

Merged
i-subham23 merged 7 commits into
thesysdev:mainfrom
i-subham23:feature/refactor-error-handling-and-formatting
Mar 12, 2026
Merged

Refactor error handling and display stream errors in thread UI#263
i-subham23 merged 7 commits into
thesysdev:mainfrom
i-subham23:feature/refactor-error-handling-and-formatting

Conversation

@i-subham23

@i-subham23 i-subham23 commented Mar 5, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Stream error detection: Updated both OpenAI stream adapters (openai-completions and openai-readable-stream) to detect error objects in streamed JSON responses and yield RUN_ERROR events instead of silently ignoring them.
  • Error propagation: Changed processStreamedMessage to throw on RUN_ERROR events (instead of just console-logging), so errors properly propagate to the chat store's error handling.
  • Empty response guard: Added a check in createChatStore that detects when streaming completes without producing any new messages and throws a user-friendly error.
  • Thread error UI: Introduced a ThreadError component in the Shell thread that uses the Callout component to display threadError to users when something goes wrong.
  • SCSS cleanup: Collapsed multi-line var() declarations in cssUtils.scss into single lines for consistency.

Test plan

  • Verify that backend stream errors (e.g. invalid API key, rate limit) are displayed in the thread UI via the Callout component
  • Confirm that normal chat streaming still works without regressions
  • Check that an empty response (no messages produced) shows the appropriate error message
  • Validate mobile layout of the error callout

- Detect and surface error objects in OpenAI stream adapters by yielding
  RUN_ERROR events instead of silently ignoring them
- Propagate RUN_ERROR as thrown exceptions in processStreamedMessage so
  they reach the chat store's error handling
- Add empty-response detection in createChatStore to catch cases where
  streaming completes without producing any messages
- Introduce ThreadError component with Callout to display threadError
  in the Shell thread UI
- Clean up SCSS formatting in cssUtils.scss (collapse multi-line var
  declarations)

Made-with: Cursor
@vercel

vercel Bot commented Mar 5, 2026

Copy link
Copy Markdown

@i-subham23 is attempting to deploy a commit to the thesys-devs Team on Vercel.

A member of the Team first needs to authorize it.

i-subham23 and others added 4 commits March 9, 2026 12:25
- Remove redundant error checks in openAIAdapter and openAIReadableStreamAdapter.
- Directly parse JSON data and access choices, improving code clarity and maintainability.
@i-subham23
i-subham23 merged commit d355a42 into thesysdev:main Mar 12, 2026
1 of 2 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.

2 participants