Skip to content

Fix Studio chat history and attachments with newer assistant-ui#5296

Merged
danielhanchen merged 2 commits into
unslothai:mainfrom
wasimysaid:fix/studio-chat-runtime-adapters
May 6, 2026
Merged

Fix Studio chat history and attachments with newer assistant-ui#5296
danielhanchen merged 2 commits into
unslothai:mainfrom
wasimysaid:fix/studio-chat-runtime-adapters

Conversation

@wasimysaid

@wasimysaid wasimysaid commented May 5, 2026

Copy link
Copy Markdown
Collaborator

Summary

  • pass Studio history/dictation/attachment adapters directly into useLocalRuntime
  • stop relying on assistant-ui remote thread list unstable_Provider ordering for runtime adapters
  • add frontend package-lock.json so npm fallback/fresh installs have deterministic resolution

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

  • cd studio/frontend && bun run typecheck
  • fresh temp frontend without node_modules/dist/bun.lock: npm ci --ignore-scripts --no-fund --no-audit --loglevel=error
  • fresh temp frontend: npm ls @assistant-ui/core @assistant-ui/react --depth=2 (resolved @assistant-ui/react@0.12.28 and @assistant-ui/core@0.1.17 deduped)
  • fresh temp frontend: npm run typecheck
  • fresh temp frontend: npm run build (bundle contains _RuntimeBinder)

solves #5287

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

Comment thread studio/frontend/src/features/chat/runtime-provider.tsx
Comment thread studio/frontend/src/features/chat/runtime-provider.tsx
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)

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 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),

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P1 Badge 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 danielhanchen left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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.

@danielhanchen danielhanchen merged commit 858ba9b into unslothai:main May 6, 2026
1 check passed
github-actions Bot pushed a commit to josephGuo/unsloth that referenced this pull request May 6, 2026
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.
danielhanchen added a commit that referenced this pull request May 6, 2026
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.
rhsCZ pushed a commit to rhsCZ/unsloth that referenced this pull request May 6, 2026
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.
@loopy321

loopy321 commented May 9, 2026

Copy link
Copy Markdown

Studio version 2026.5.2, can use uploaded .png, but pdf is not found.

Describe the pdf

Thought for 0 seconds
Please provide the content of the PDF or a link to it so I can describe it for you. I do not have access to local files on your device.


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.

3 participants