DeepTutor icon indicating copy to clipboard operation
DeepTutor copied to clipboard

[Bug]: Chat page crashes for non-admin accounts in v1.7.3 (supported_reasoning_efforts is null)

Open NoxsMedia opened this issue 2 weeks ago • 1 comments

Do you need to file an issue?

  • [x] I have searched the existing issues and this bug is not already filed.
  • [x] I believe this is a legitimate bug, not just a question or feature request.

Describe the bug

In v1.7.3 the chat page crashes for any non-admin account. The whole page is replaced by "This page couldn't load". Admin accounts are not affected.

The new composer reasoning-effort selector (#2564) calls supportedReasoningEffortValues(option) in web/lib/reasoning-effort.ts. It only falls back to the provider/model tables when supported_reasoning_efforts is undefined:

option.supported_reasoning_efforts !== undefined
  ? reasoningEffortOptionsFromSupportedLevels(option.supported_reasoning_efforts) // values.map(...)
  : reasoningEffortOptions(...)

The value is null for non-admin accounts:

  • redacted_model_access() (deeptutor/multi_user/model_access.py:114) sets it to model.get("codex_supported_reasoning_levels"), which is None for most models.
  • allowed_llm_options() (line 158) passes it through.

So GET /api/settings/llm-options returns "supported_reasoning_efforts": null. Then null.map throws inside useMemo and trips the error boundary.

The admin path (list_llm_options in services/model_selection/llm.py) only sets the field when it is a list. That is why admins never see the crash.

Steps to reproduce

  1. Run v1.7.3 with multi-user auth enabled.
  2. As admin, grant a learner account an LLM model whose catalog entry has no codex_supported_reasoning_levels (for example a DeepSeek or Gemini model).
  3. Log in as the learner and open /chat.
  4. The page shows "This page couldn't load".

Expected Behavior

The chat page loads. A null value is treated like a missing one: either the frontend falls back to the provider/model tables, or the backend omits the field (or sends a list) the same way the admin path does.

Related Module

Frontend/Web

Configuration Used

Multi-user auth. A learner account with two granted LLM models (DeepSeek deepseek-flash, Gemini models/gemini-3.8-flash). Neither model has codex_supported_reasoning_levels.

Logs and screenshots

Browser console:

Uncaught TypeError: Cannot read properties of null (reading 'map')
    at m (/_next/static/chunks/2554-….js)     // reasoningEffortOptionsFromSupportedLevels
    at f (/_next/static/chunks/2554-….js)     // supportedReasoningEffortValues
    at …/9563-….js                            // ReasoningEffortSelector useMemo

Learner response from /api/settings/llm-options (abridged):

{"options":[{"provider":"deepseek","model":"deepseek-flash","supported_reasoning_efforts":null,"declared_reasoning":true}, …]}

No backend error is logged.

Additional Information

  • DeepTutor Version: v1.7.3 (PyPI wheels). dev at 4c1e000 has the same code. v1.7.2 was not affected because the composer selector did not exist yet.
  • Operating System: Ubuntu (server); Windows and Linux Chrome (clients)
  • Python Version: 3.11
  • Node.js Version: n/a (prebuilt web bundle)
  • Browser (if applicable): Chrome
  • Related Issues: #2564 (introduced the selector), #641

NoxsMedia avatar Nov 16 '26 08:11 NoxsMedia

I'd like to take this one.

Verified against dev at 4c1e000d8: the crash is reachable exactly as described. In web/lib/reasoning-effort.ts, supportedReasoningEffortValues guards with option.supported_reasoning_efforts !== undefined, so a null value passes the check and reaches reasoningEffortOptionsFromSupportedLevels, where values.map(...) throws. The non-admin path (redacted_model_access in deeptutor/multi_user/model_access.py) sets the field from codex_supported_reasoning_levels, which is None for most models, while the admin path only sets it when it is a list — hence admins are unaffected.

Planning a narrow frontend fix: treat a null/non-array value like a missing one (Array.isArray guard) so it falls back to the provider/model tables, matching the admin path's semantics, plus a regression test for the null case. Will open a PR against dev shortly.

ZQR1101 avatar Nov 16 '26 09:11 ZQR1101