Threads 7: Rename the thread controller - #261
Conversation
|
Bugbot is not enabled for your account, so this pull request was not reviewed. Enable Bugbot in the Cursor dashboard to get automatic reviews on future PRs. |
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Reviewer's GuideRefactors the thread package to rename the core imperative controller from ThreadChat to Thread, align types and factory functions with the new name, and update useThread’s ownership model and tests/documentation accordingly without changing runtime behavior. File-Level Changes
Tips and commandsInteracting with Sourcery
Customizing Your ExperienceAccess your dashboard to:
Getting Help
|
📝 WalkthroughWalkthroughThe PR renames the thread runtime from ChangesThread API migration
Estimated code review effort: 3 (Moderate) | ~25 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
Greptile SummaryRenames the thread controller API without changing its runtime behavior.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains. Important Files Changed
Reviews (2): Last reviewed commit: "docs(thread): clarify controller identit..." | Re-trigger Greptile |
There was a problem hiding this comment.
Actionable comments posted: 1
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@packages/thread/ARCHITECTURE.md`:
- Around line 113-115: Update the Thread lifetime statement in the useThread
documentation to qualify stability by its identity inputs: the retained instance
remains unchanged only while options.id and any supplied external thread stay
the same. State that changing either input can replace the Thread, including its
tree and active runs.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: a675807d-969a-4145-8ed7-90a8624e79f5
📒 Files selected for processing (11)
packages/thread/ARCHITECTURE.mdpackages/thread/src/ai-sdk-run-chat.tspackages/thread/src/index.tspackages/thread/src/thread.tspackages/thread/src/types.tspackages/thread/src/use-thread.tspackages/thread/test/ai-sdk-run-chat.test.tspackages/thread/test/package-smoke.test.tspackages/thread/test/thread.test.tspackages/thread/test/use-thread-types.tspackages/thread/test/use-thread.test.ts
There was a problem hiding this comment.
All reported issues were addressed across 11 files
Reply with feedback, questions, or to request a fix.
Re-trigger cubic
9dff780 to
9b89d72
Compare
Summary
ThreadChattoThreadcreateThreadChattocreateThreadandThreadChatOptionstoThreadInituseThread({ thread })match the ownership model introduced by the next PRThis is a behavior-free refactor that isolates terminology changes from the external-state architecture.
Summary by Sourcery
Rename the core thread controller and associated React hook interfaces to use the
Threadterminology without changing behavior.Enhancements:
ThreadChattoThreadand adjust exports accordingly.useThreadto accept athreadinstance instead ofchat, aligning the hook ownership model with external thread engines.ThreadChatOptions/createThreadChattoThreadInit/createThreadfor clearer API semantics.Documentation:
Threadinstead ofThreadChat, including ownership and state descriptions.Tests:
Threadterminology and validate the unchanged behavior of the refactored APIs.Summary by cubic
Renamed the thread controller to
Threadand updated the React hook to accept{ thread }. ClarifieduseThreadidentity rules; no behavior changes.Refactors
ThreadChat->Thread,createThreadChat->createThread.ThreadChatOptions->ThreadInit.ThreadChatState->ThreadRunState.Threadis retained; changing the externalthreador a definedidreplaces the controller (including tree and active runs).Migration
new Thread()instead ofnew ThreadChat().createThread(...)instead ofcreateThreadChat(...).useThread({ thread })instead ofuseThread({ chat }).ThreadChatOptionswithThreadInit.Written for commit 9b89d72. Summary will update on new commits.
Summary by CodeRabbit
ThreadChattoThread.createThreadChattocreateThread.ThreadChatOptionstoThreadInit.useThreadto accept athreadinstance (replacingchat), with snapshot/status typings now aligning toThread.Threadconcepts.ThreadAPI.Stack