Skip to content

🔑 refactor: Read Stream Auth and Deployment Config Through ChatSettings - #17141

Open
berry-13 wants to merge 1 commit into
refactor/chat-run-atomsfrom
refactor/chat-sse-settings
Open

berry-13 wants to merge 1 commit into
refactor/chat-run-atomsfrom
refactor/chat-sse-settings

Conversation

@berry-13

Copy link
Copy Markdown
Collaborator

Pull Request

Before submitting, please review the Contributing Guide.

Documentation changes belong in the LibreChat documentation repository.

Summary

The stream hooks still reached into the app for two globals: useResumableSSE, useSSE and the abort handlers read the bearer token and sign-in state from useAuthContext, and useResumableSSE, useSSE and useResumeOnLoad read the balance toggle, the retention mode and whether the startup config has arrived from useGetStartupConfig. That ties the chat hooks to the app shell instead of the host-supplied ChatSettings the rest of the chat already reads.

This adds token and isAuthenticated to ChatAuth, and loaded and balanceEnabled to ChatConfig, fills them in ChatSettingsProvider from the same queries, and switches the four hooks to useChatSettings(). The new fields are optional: a host that does not set loaded has no config to wait for, matching the default settings used in isolated renders. No behavior changes: the provider wraps every route that mounts these hooks. Stacked on #17138.

Type of change

  • Refactor

Testing

Tested environments/configuration:

Not applicable: the hooks receive the same values through the settings context instead of reading them directly.

Automated tests:

  • ChatSettings.spec.tsx covers the new fields: loaded and balanceEnabled are false until the deployment answers and follow it after, and the signed-in token reaches auth.
  • useResumeOnLoad.spec.tsx drives the retention mode and the "config not yet loaded" wait through the settings context; transport.spec.tsx and useResumableSSE.spec.ts supply the token through it instead of mocking useAuthContext.
  • In client: hooks/SSE, hooks/Chat, routes and components/Chat: 250 suites, 4,741 tests pass.
  • npx tsc --noEmit in client, eslint, prettier and sort-imports on the changed files: clean.

Screenshots / recordings

No user-facing change.

Risk / compatibility

None for users. A host that renders the chat hooks outside ChatSettingsProvider would now stream without a token; the app mounts them only under Root, which supplies it.

Checklist

  • I reviewed my own changes
  • Relevant tests have been added or updated

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 15, 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 ✅ Completed 2026-10-16T19:40:15.728294Z 907b2a0 New commits
🔒 Security Review ✅ Completed 2026-10-15T07:57:21.333559Z a4795a6 PR opened
ℹ️ 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
berry-13 force-pushed the refactor/chat-sse-settings branch from a4795a6 to 515930f Compare October 15, 2026 07:56
@codegraph-librechat codegraph-librechat Bot added the 🗺️ Chat State codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9) label Oct 15, 2026
@berry-13
berry-13 force-pushed the refactor/chat-sse-settings branch from 515930f to 9f37183 Compare October 15, 2026 16:03
@berry-13
berry-13 added this pull request to stack #17153 October 15, 2026 16:13
@berry-13
berry-13 force-pushed the refactor/chat-sse-settings branch from 9f37183 to 907b2a0 Compare October 16, 2026 19:38
Copilot AI balanced review requested due to automatic review settings October 16, 2026 19:38

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 reached their quota limit.

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🗺️ Chat State 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