Skip to content

[BUG FIX] [MER-5820] Harden DOT GenAI failure handling - #6765

Open
nicocirio wants to merge 3 commits into
masterfrom
MER-5820-harden-genai-failure-paths
Open

[BUG FIX] [MER-5820] Harden DOT GenAI failure handling#6765
nicocirio wants to merge 3 commits into
masterfrom
MER-5820-harden-genai-failure-paths

Conversation

@nicocirio

@nicocirio nicocirio commented Aug 10, 2026

Copy link
Copy Markdown
Contributor

Jira

https://eliterate.atlassian.net/browse/MER-5820

Summary

Fixes DOT failure paths that could leave students on an infinite loading spinner.

  • Reject invalid or undecryptable registered-model credentials before invoking a provider; OpenAI no longer falls back to the global API key.
  • Monitor and cancel dialogue tasks, and translate task crashes, stream failures, invalid tool JSON, and tool failures into the existing generic DOT error.
  • Add a request-scoped watchdog based on configured model timeouts.
  • Correlate dialogue events with an engagement ID so late events from a timed-out request cannot affect the next response.
  • Emit safe, actionable failure logs with model/service context and normalized categories (for example, 429 insufficient_quota), without provider bodies, prompts, tool arguments, or credentials.

Failure mode and fix

A bad encrypted credential previously reached provider execution (or silently used the global OpenAI key), while a stalled task could outlive the UI watchdog. The UI could then re-enable submission and receive stale stream events from the old task. This change fails invalid credentials explicitly, bounds the task lifecycle, and ignores stale events.

Video

Video: DOT tested with an OpenAI API key that has no remaining credits. The request fails gracefully, the chat displays the generic error and correctly re-enables input for another message. At the same time, the server logs the failure safely and actionably as 429 insufficient_quota, without exposing credentials or sensitive content.

Screen.Recording.2026-08-11.at.9.52.36.AM.mov
[warning] GenAI request failed service_config_id=1 registered_model_id=4 provider=open_ai request_type=stream http_status=429 error_category=insufficient_quota

Validation

  • mix format
  • mix compile
  • yarn --cwd assets run format
  • yarn --cwd assets run check-types
  • yarn --cwd assets run deploy
  • mix test test/oli/gen_ai/dialogue/server_test.exs test/oli/gen_ai/execution_test.exs test/oli/gen_ai/completions_test.exs test/oli/gen_ai/completions/open_ai_compliant_provider_test.exs test/oli/encrypted/binary_test.exs test/oli_web/live/dialogue/window_live_test.exs (66 tests, 0 failures)

@github-actions

github-actions Bot commented Aug 10, 2026

Copy link
Copy Markdown
Contributor
Warnings
⚠️ PR is large (892 LOC changed). Consider splitting.

Risk score: 11 → risk/high

Generated by 🚫 dangerJS against a19c2a4

@github-actions

Copy link
Copy Markdown
Contributor

AI Review — ui

No issues found

@github-actions

Copy link
Copy Markdown
Contributor

AI Review — performance

No issues found

@github-actions

Copy link
Copy Markdown
Contributor

AI Review — elixir

No issues found

@github-actions

Copy link
Copy Markdown
Contributor

AI Review — security

No issues found

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.

1 participant