Commit graph

1 commit

Author SHA1 Message Date
Kel
4ab251d458
fix(assistant): prevent the Notebook AI tab from crashing on open (#8204)
Opening the Notebook's AI tab crashed the reader with "Cannot set
properties of undefined (setting '_getInitializePromise')".
@assistant-ui/react 0.11.58 calls the thread runtime's
__internal_setGetInitializePromise without its object. Patch the pinned
release with the upstream fix (assistant-ui/assistant-ui#3096), in the
shipped dist file and its source.

With the crash gone, New Chat (or any saved chat with no messages) left
the AI panel blank, with no message box, because Thread hid its empty
state for every active conversation. Hide it only for a chat with stored
messages to restore or with history still loading, so reopening a saved
chat doesn't flash it and leaving an empty chat keeps the loading
overlay.

Tests that fail without the change:
- local-runtime-initialization.test.tsx, on main's unpatched package:
  "TypeError: Cannot set properties of undefined (setting
  '_getInitializePromise')".
- AIAssistant.test.tsx "shows the message box for a saved conversation
  with no messages yet": "Unable to find an element with the text: Get
  answers based on the book content". The flash test fails ("expected
  true to be false") if the guard is dropped from Thread instead, and
  "keeps the empty state hidden while another saved chat loads" fails
  without the loading condition ("expected <p> to be null").

Verified in the Linux CEF dev app with an OpenAI-compatible provider
(local Ollama). On main's package the tab shows the crash screen. With
this change it indexes and answers, New Chat works, and a saved chat
restores after a reload with no empty-state frame and answers a
follow-up. pnpm lint, pnpm format:check and 13 related suites (90 tests) pass; CI
is green at the merged head.

Reported by Romaricoco on GitHub.

Co-Authored-By: Codex (GPT-6) <noreply@openai.com>
Co-Authored-By: Claude Code (Claude Opus 5.5) <noreply@anthropic.com>
2026-12-02 18:49:42 +08:00