Skip to content

🪡 refactor: Split useResumableSSE Into Thin Host Bindings - #17133

Open
berry-13 wants to merge 1 commit into
refactor/chat-resumable-mountfrom
refactor/chat-resumable-bindings
Open

berry-13 wants to merge 1 commit into
refactor/chat-resumable-mountfrom
refactor/chat-resumable-bindings

Conversation

@berry-13

@berry-13 berry-13 commented Oct 15, 2026 •

Copy link
Copy Markdown
Collaborator

Pull Request

Before submitting, please review the Contributing Guide.

Documentation changes belong in the LibreChat documentation repository.

Summary

With the resumable run in @librechat/chat core, useResumableSSE was left as one long hook that built everything the run needs from the app: the steer-chip adapter, the query cache adapter, the pane controls and queue-drain markers, and the event and usage handlers. Those are four separate concerns that each read different app state.

This splits it by responsibility into thin bindings in client/src/hooks/SSE/: useResumableSteers (adapts the steer state from useSteerState() in hooks/SSE/steer.ts to the run's steer host, adding queue restore and recovery bookkeeping), useResumableCache (the cache, active jobs and the new chat's optimistic records), useResumablePane (controls, generation epochs, run end and the detached-run markers) and useResumableEvents (the event and usage handlers and the error cards). Each returns one group of the ResumableHost; useResumableSSE composes them and calls mountSubmission, and is now 142 lines (from 4,964 before this stack). No behavior changes. Stacked on #17132.

Type of change

  • Refactor

Testing

Tested environments/configuration:

Not applicable: the bindings are moved, not changed.

Automated tests:

  • useResumableSSE.spec.ts imports selectLocalSteersForQueue and ABORT_SWEEP_STATUSES from their new home; nothing else in the specs changed.
  • In client, the hooks/SSE and hooks/Chat specs plus data-provider/SSE: 1148 pass.
  • npx tsc --noEmit in client, eslint, prettier and sort-imports on the changed files: clean.

Screenshots / recordings

No user-facing change.

Risk / compatibility

The host groups are memoized per hook, so a render that changes one handler rebuilds only its group; the host a subscription captured still comes from the render that attached it.

Checklist

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

@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:41:42.544502Z d63d52d New commits
🔒 Security Review ✅ Completed 2026-10-15T07:08:29.207930Z 97c89cf 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.

@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 #17153 October 15, 2026 13:49
Copilot AI balanced review requested due to automatic review settings October 15, 2026 15:42
@berry-13
berry-13 force-pushed the refactor/chat-resumable-bindings branch from 97c89cf to f4d8d97 Compare October 15, 2026 15:42

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.

@codegraph-librechat codegraph-librechat Bot added the 🗺️ Async Run Streaming codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9) label Oct 15, 2026
@berry-13
berry-13 force-pushed the refactor/chat-resumable-bindings branch from f4d8d97 to d63d52d Compare October 16, 2026 19:38

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

🗺️ Async Run Streaming codegraph: the taxonomy area this belongs to (classifier, confidence ≥ 0.9) 🗺️ 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