Skip to content

fix(streaming): chat and lessons return SSE errors instead of servlet 500s#56

Merged
WilliamAGH merged 1 commit into
mainfrom
dev
Jun 10, 2026
Merged

fix(streaming): chat and lessons return SSE errors instead of servlet 500s#56
WilliamAGH merged 1 commit into
mainfrom
dev

Conversation

@WilliamAGH

Copy link
Copy Markdown
Owner

Summary

Chat and guided learning now keep dependency failures inside the SSE contract instead of surfacing servlet HTTP 500s. The dev deployment also keeps LLM gateway traffic on the production tier even when the tier env var is blank.

Changes

Bug Fixes

  • Chat requests no longer crash as servlet 500s when retrieval or reranking fails before the first token: prompt setup now runs inside the returned stream and maps setup/stream failures to structured SSE error events (ChatController.stream).
  • Guided lesson chat no longer crashes as servlet 500s when lesson retrieval or reranking fails before streaming begins: guided prompt setup now runs inside the returned stream and emits structured SSE errors (GuidedLearningController.streamGuidedResponse).
  • Guided lesson pages now stream lesson content through the same SSE parser as chat instead of blocking on JSON: /api/guided/content/stream emits JSON-wrapped text/error events, and the Learn view consumes that stream with abort protection (GuidedLearningController.streamLesson, streamLessonContent, LearnView.svelte).
  • A transient primary-provider backoff no longer hides the only configured LLM gateway provider: provider routing only removes a backed-off primary when an alternate provider is actually configured (OpenAiProviderRoutingService.selectAvailableProviderCandidates).
  • LLM gateway calls no longer risk an empty capacity tier header from blank env config: blank LLM_GATEWAY_TIER resolves to production-z, preserving the higher-capacity queue contract (OpenAIStreamingService.createClient).

Verification

  • frontend/node_modules/.bin/svelte-check --tsconfig ./tsconfig.json
  • frontend/node_modules/.bin/vitest run
  • ./gradlew test
  • ./gradlew build
  • Pre-push hook: frontend build, backend build, full test suite, lint, and frontend check passed.
  • Dogfood on https://dev.javachat.ai at 79ce02319aef3bd33f004c0156aa6e4970a3350e: browser load, main chat stream, guided lesson content stream, and guided lesson chat stream all passed with no console errors and no CustomErrorController 500s in the container logs.

Breaking Changes

None

@coderabbitai

coderabbitai Bot commented Jun 10, 2026

Copy link
Copy Markdown
Contributor

Warning

Review limit reached

@WilliamAGH, we couldn't start this review because you've reached your PR review rate limit.

More reviews will be available in 10 minutes and 27 seconds. Learn how PR review limits work.

Your organization has run out of usage credits. Purchase more in the billing tab.

⌛ How to resolve this issue?

After more reviews become available, a review can be triggered using the @coderabbitai review command as a PR comment. Alternatively, push new commits to this PR.

We recommend that you space out your commits to avoid hitting the rate limit.

🚦 How do rate limits work?

CodeRabbit enforces hourly rate limits for each developer per organization.

Our paid plans include higher PR review limits than trial, open-source, and free plans. In all cases, reviews become available again over time. During sustained high-volume PR review activity, CodeRabbit may temporarily slow when the next review becomes available.

Please see our Fair Usage Limits Policy for further information.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 98de0e67-a88d-4c15-b6a1-29085075858e

📥 Commits

Reviewing files that changed from the base of the PR and between 8a4e1fd and 79ce023.

📒 Files selected for processing (12)
  • frontend/src/lib/components/LearnView.svelte
  • frontend/src/lib/components/LearnView.test.ts
  • frontend/src/lib/services/guided.test.ts
  • frontend/src/lib/services/guided.ts
  • frontend/src/lib/services/sse.ts
  • src/main/java/com/williamcallahan/javachat/service/GuidedLearningService.java
  • src/main/java/com/williamcallahan/javachat/service/OpenAIStreamingService.java
  • src/main/java/com/williamcallahan/javachat/service/OpenAiProviderRoutingService.java
  • src/main/java/com/williamcallahan/javachat/web/ChatController.java
  • src/main/java/com/williamcallahan/javachat/web/GuidedLearningController.java
  • src/test/java/com/williamcallahan/javachat/service/OpenAIStreamingServiceTest.java
  • src/test/java/com/williamcallahan/javachat/web/GuidedSseCitationEventTest.java
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch dev

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

@WilliamAGH WilliamAGH merged commit 59a8173 into main Jun 10, 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.

1 participant