Skip to content

🧷 refactor: Require a Mounted Steer Host Instead of a Module Default - #17164

Merged
berry-13 merged 1 commit into
devfrom
refactor/chat-steer-hostreq
Oct 18, 2026
Merged

berry-13 merged 1 commit into
devfrom
refactor/chat-steer-hostreq

Conversation

@berry-13

Copy link
Copy Markdown
Collaborator

Summary

useSteerHost fell back to a host registered with setDefaultSteerHost, which the app called as an import side effect of Providers/SteerHostContext.tsx. That is a module-level mutable default: a steer hook rendered outside SteerHostProvider silently worked through whatever the last import registered, which is the reach-for-global pattern the package should not extend.

This removes setDefaultSteerHost and its import-time call. useSteerHost now throws a named error when no provider is mounted. Every real render path of the steer hooks is under routes/Root.tsx, which already mounts SteerHostProvider (the share view and the standalone auth routes render none of them), so the app is unaffected. Client specs that render the steer hooks mount the app host through a small SteerHostTestProvider in client/test/steerHost.tsx, and the package's host spec covers the missing-provider error.

Part of the stack that moves the steer hooks into the chat package; base is the previous link.

Type of change

  • Refactor

Testing

Tested environments/configuration:

Local jest and typecheck; no runtime configuration matters for this change.

Automated tests:

  • cd client && npx jest src: the full client suite, 791 suites, 12,048 tests pass.
  • cd packages/chat && npx jest src/react/steer: host spec covers the nearest provider and the missing-provider error.
  • npx tsc --noEmit for client and packages/chat: clean. ESLint, Prettier and import sorting clean on every changed file.

Screenshots / recordings

No user-facing change.

Risk / compatibility

Low. A steer hook rendered outside the provider now fails loudly instead of using a registered default; the full client suite and a grep of render paths found none outside Root.

Checklist

  • I reviewed my own changes
  • Existing relevant tests pass
  • The change does not introduce new warnings or errors

@berry-13
berry-13 marked this pull request as ready for review October 15, 2026 16:15
@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-18T15:45:54.793923Z 5e52d8d New commits
🔒 Security Review ✅ Completed 2026-10-15T16:18:01.301823Z ae8fa8b 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.

@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 added this pull request to stack #17157 October 15, 2026 16:23
@berry-13
berry-13 force-pushed the refactor/chat-steer-hostreq branch from ae8fa8b to 05bf9d0 Compare October 15, 2026 17:30
Copilot AI balanced review requested due to automatic review settings October 15, 2026 17:30

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.

@berry-13
berry-13 force-pushed the refactor/chat-steer-hostreq branch from d1922c9 to 5e52d8d Compare October 18, 2026 15:44
@berry-13
berry-13 merged commit 02b4a41 into dev Oct 18, 2026
43 checks passed
@berry-13
berry-13 deleted the refactor/chat-steer-hostreq branch October 18, 2026 18:28
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