Skip to content

🧰 refactor: Move useChatHelpers and ChatProvider into the Chat Package - #17446

Merged
berry-13 merged 1 commit into
devfrom
berry-13/chat-helpers-package
Oct 26, 2026
Merged

berry-13 merged 1 commit into
devfrom
berry-13/chat-helpers-package

Conversation

@berry-13

Copy link
Copy Markdown
Collaborator

Pull Request

Summary

Stacked on #17445. useChatHelpers and ChatProvider still lived in client/src/hooks/Chat, wired straight to the app's query cache, pane store, router-backed conversation hooks and abort mutation, so the chat package could not build a pane's contract on its own. This moves useChatHelpers, ChatProvider, the abort cleanup and the message cache id helpers into @librechat/chat/react, with the stop path in its own module.

Everything the hook reached for in the app now arrives through a ChatHost the app supplies with ChatHostProvider, the way the steer hooks take a SteerHost: the pane conversation, new conversation, turn builder (useChatFunctions), latest message, sibling selection, abort transport, message cache (read, write, subscribe, revision and the post-abort refetches) and feedback setting. The app's host lives in client/src/Providers/ChatHostContext.tsx and is mounted in Root beside the steer host. ChatSessionProvider, which also runs the SSE hooks, stays in the client for the next link. The abort and cache specs move into the package and run against a host with no app behind it.

Type of change

  • Refactor

Testing

Tested environments/configuration:

  • Mock e2e harness (in-process fake model), Chromium desktop light/dark and mobile emulation.

Automated tests:

  • npx jest src/hooks src/Providers src/routes src/utils src/components in client: 763 suites, 12157 tests pass.
  • npx jest in packages/chat: 457 tests pass, including the stop spec against a substitute host.
  • npx tsc --noEmit for client and packages/chat; ESLint on every touched file.
  • E2E scenarios: send and reply, the added pane streaming beside the main reply, stop, reload resume, queue owners, compaction controls, and the useChat host-transport and live-attachment scenarios.

Screenshots / recordings

No user-facing change.

Risk / compatibility

A tree that renders ChatProvider or ChatSessionProvider now needs a ChatHostProvider above it, which Root supplies for every route that renders a chat.

Checklist

  • I reviewed my own changes
  • Relevant tests have been added or updated
  • Existing relevant tests pass
  • The change does not introduce new warnings or errors

@codegraph-librechat codegraph-librechat Bot added the 🗺️ Chat Experience codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9) label Oct 26, 2026
@berry-13
berry-13 marked this pull request as ready for review October 26, 2026 09:08
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 26, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review 🔄 Running since 2026-10-26T21:47:13.483835Z c550fbe New commits
🔒 Security Review ✅ Completed 2026-10-26T09:12:25.749459Z 381ffea Draft marked ready
ℹ️ 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@berry-13

Copy link
Copy Markdown
Collaborator Author

@codex review

Please review the current PR head 381ffea. State the exact reviewed commit and ignore findings that apply only to earlier heads.

Purpose supplied by the requester: Codex code review on 381ffea stuck running since 09:08Z (resolved failed); security review on the same head was clean. Rerun approved by the owner.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Didn't find any major issues. Bravo.

Reviewed commit: 381ffea0e4

ℹ️ 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".

Base automatically changed from berry-13/chat-facade-package to dev October 26, 2026 21:46
…eact

useChatHelpers now builds the pane contract from a ChatHost the app supplies:
its pane store, message query cache, turn builder, thread selection, abort
transport and settings. The stop path lives in its own module, its spec runs
in the package against a host with no app behind it, and the app mounts its
host in Root beside the steer host.
@berry-13
berry-13 force-pushed the berry-13/chat-helpers-package branch from 381ffea to c550fbe Compare October 26, 2026 21:47
Copilot AI balanced review requested due to automatic review settings October 26, 2026 21:47

Copilot AI 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.

Copilot was unable to review this pull request because the user who requested the review has insufficient remaining quota.

@berry-13
berry-13 merged commit 7e56534 into dev Oct 26, 2026
15 checks passed
@berry-13
berry-13 deleted the berry-13/chat-helpers-package branch October 26, 2026 21:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🗺️ Chat Experience codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9)

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants