Fix Studio chat history and attachments with newer assistant-ui#5296
Conversation
There was a problem hiding this comment.
Code Review
This pull request refactors the chat runtime by replacing the ThreadHistoryProvider component with a useStudioRuntimeAdapters hook, which is now integrated into useRuntimeHook. Feedback highlights a potential issue with useAui() being called outside its expected context and suggests passing threadId explicitly to the adapters to ensure correct scoping and support for multiple threads.
Drops the caret ranges on @assistant-ui/react, @assistant-ui/react-markdown, @assistant-ui/react-streamdown and assistant-stream so future installs cannot silently re-float onto a newer pre-1.0 release. The lockfile alone only fixes resolution for the install that consumes that lockfile -- a future bun add / npm install <other-pkg> rewrites the lockfile and is free to drift carets within their range, which is exactly the path that pulled @assistant-ui/react from 0.12.19 to 0.12.28 and broke 2026.5.1. Pinning in package.json blocks that drift at the manifest layer until assistant-ui leaves 0.x. Pinned to the resolved versions already in the lockfile that this PR's dist was built and verified against: @assistant-ui/react 0.12.28 @assistant-ui/react-markdown 0.12.11 @assistant-ui/react-streamdown 0.1.11 assistant-stream 0.3.12 @assistant-ui/core was already pinned to 0.1.17 exact. Verified: npm install --package-lock-only (lockfile resolutions unchanged) npm install (1083 packages, same as before) npm run typecheck (clean)
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 571eb39596
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| ...createDexieAdapter(modelType, pairId), | ||
| unstable_Provider: ThreadHistoryProvider, | ||
| }, | ||
| adapter: createDexieAdapter(modelType, pairId), |
There was a problem hiding this comment.
Restore the thread-scoped history provider
When a persisted Dexie thread is opened, the history adapter above still derives its key from aui.threadListItem().getState().remoteId / initialize(), but this commit stops installing that adapter through the remote thread list's per-thread unstable_Provider. With the adapter now created from runtimeHook, it is no longer bound to the active thread-list-item context, so existing threads can load with no remoteId and return an empty history (or initialize/write against the wrong item). This regresses the persisted chat flow the provider previously handled.
Useful? React with 👍 / 👎.
danielhanchen
left a comment
There was a problem hiding this comment.
Tested locally: bundle inspection on the freshly-built dist confirms the Studio call site no longer passes unstable_Provider, useLocalRuntime now receives adapters directly, typecheck clean. Pinned the @assistant-ui surface + assistant-stream to exact versions matching the lockfile so future installs cannot re-float.
Matches the release cut from the pip branch that ships PR unslothai#5296: Studio chat history and attachments work again with newer @assistant-ui/react, plus the pinned assistant-ui surface and frontend package-lock.json so future installs cannot drift back onto a broken bundle.
Bumps the unsloth>= install floor in install.sh and install.ps1 from 2026.5.1 to 2026.5.2 so fresh curl/iwr installs pull the just-released PyPI version that ships PR #5296: Studio chat history and image attachments work again with newer @assistant-ui/react.
Cuts a new PyPI release that ships PR unslothai#5296: Studio chat history and attachments work again with newer @assistant-ui/react, plus the pinned assistant-ui surface and frontend package-lock.json so future installs cannot drift back onto a broken bundle.
|
Studio version 2026.5.2, can use uploaded .png, but pdf is not found. |
Summary
Why
Fresh curl/PyPI installs can resolve assistant-ui to the newer _RuntimeBinder path, where useLocalRuntime runs before unstable_Provider. That prevented RuntimeAdapterProvider from supplying Dexie history and attachment adapters, causing previous chats to open blank and web image uploads/drops to fail.
Tests
solves #5287