Skip to content

🧱 refactor: Read Message Content Siblings Through the Parts Host - #17171

Merged
berry-13 merged 1 commit into
devfrom
refactor/chat-parts-siblings
Oct 16, 2026
Merged

berry-13 merged 1 commit into
devfrom
refactor/chat-parts-siblings

Conversation

@berry-13

Copy link
Copy Markdown
Collaborator

Summary

The message part components read the app only through MessagePartsHost, but their siblings in components/Chat/Messages/Content still reached for Recoil, ~/store, useMessageContext and useToastContext directly: 16 of 115 files. A sibling that reads app state that way cannot move into @librechat/chat with the parts, and it ignores whatever host the view supplied.

This routes nine of them through the host. MarkdownComponents, SiblingHeader, MessageContent, Markdown, BackgroundTaskCard and hydration read the message, user, toast, user-text preferences and LaTeX setting from useMessagePartsHost(). For that, MessagePartMessage gains the optional conversationId and partIndex the app's message context already carries, MessagePartsUser gains id, and the host gains useLaTeXParsing. ApprovalContext reads the ephemeral agent from ChatSettings, which already exposes the same Recoil reader. The two benches only swap their inline RecoilRoot for an AppStores wrapper in client/test/harness.tsx; that is a harness-only change.

The remaining siblings follow in two stacked PRs, and ActivityPhaseGroup waits for #17138.

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/components/Chat/Messages src/components/Chat/Input src/hooks/Input src/components/Chat/Subagents src/components/Share src/Providers: 201 suites, 3,729 tests pass.
  • cd packages/chat && npx jest: 36 suites, 388 tests pass; every host fixture carries the new member.
  • Both benches run explicitly (npx jest --runInBand --coverage=false --testMatch '**/ContentParts.bench.tsx', and the same for MarkdownBlocks.bench.tsx): 2 and 3 cases pass.
  • npx tsc --noEmit for client and packages/chat, and the package build, are clean. ESLint, Prettier and import sorting are clean on every changed file.
  • The audit's parts-context.sh over Messages/Content reports 7 of 115 files (from 16), and 0 of 44 under Parts.

Screenshots / recordings

No user-facing change.

Risk / compatibility

Low. Each new read is the same store or context the component read before, through the app's host. useResumeSubmit now takes getEphemeralAgent from ChatSettings, which every caller has above it under routes/Root.tsx.

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

Copilot AI balanced review requested due to automatic review settings October 15, 2026 17:53

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 marked this pull request as ready for review October 15, 2026 17:54
@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-15T17:58:03.997716Z 6fcd281 Draft marked ready
🔒 Security Review ✅ Completed 2026-10-15T17:58:23.961134Z 6fcd281 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 🗺️ Client UI Foundation 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 #17183 October 16, 2026 13:03
@berry-13
berry-13 merged commit 6194cb8 into dev Oct 16, 2026
66 of 70 checks passed
@berry-13
berry-13 deleted the refactor/chat-parts-siblings branch October 16, 2026 20:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🗺️ Client UI Foundation 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