Skip to content

fix(apollo-react): give each chat service its own internal event bus - #1295

Open
BenGSchulz wants to merge 1 commit into
refactor/chat-headless-movefrom
fix/chat-service-instance-isolation
Open

BenGSchulz wants to merge 1 commit into
refactor/chat-headless-movefrom
fix/chat-service-instance-isolation

Conversation

@BenGSchulz

@BenGSchulz BenGSchulz commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Isolates chat service instances and removes the _eventBus casts (story MST-16175).

  • Per-instance internal events: AutopilotChatInternalService was a page-wide singleton, so two AutopilotChatService instances saw each other's theme, locale, history/settings toggle and local-history events. Each service now creates its own. The static Instantiate() / Instance stay for compatibility, marked deprecated (nothing in the repo used them).
  • chatService.publish(event, data): a public method that replaces all six (chatService as any)._eventBus casts (attachments, scroll load-more, custom header action, message actions, history load-more and search).
  • Rename: attachements-provider → attachments-provider.
  • Tests for AutopilotChatService (instantiate caching, instance isolation, publish, intercept), EventBus (subscribe, intercept, hijack, clear) and ContentPartBuilder (none existed).

Notes for reviewers

  • This also fixes a leak the ticket did not list: LocalHistoryService subscribes to each service's internal events, so one instance enabling useLocalHistory used to enable it for every instance on the page.
  • theme-provider already exposed only theme and isDark; no change.
  • The scroll-provider split ("keep only ConversationLoadMore and the autoscroll toggle") is not in this PR: where the remaining scroll state should live depends on the renderer split.

Verification

  • Isolation tests fail with the singleton restored and pass with the fix
  • apollo-react tests: 3863 pass; tsc and lint clean
  • Storybook: sending a message logs the request and shows the loading state

Stack

Merge in order; each PR is based on the previous one.

  1. feat(apollo-react): wire the @uipath/apollo-react/chat subpath #1293 subpath wiring (MST-16174)
  2. refactor(apollo-react): move chat service and headless layer to src/chat #1294 move to src/chat (MST-16175)
  3. fix(apollo-react): give each chat service its own internal event bus #1295 instance isolation and publish (MST-16175) ← this PR
  4. feat(apollo-react): add ChatRoot, renderer registry and renderer/density config #1296 ChatRoot and renderer registry (MST-16175)
  5. feat(apollo-react): resolve chat message renderers per chat renderer #1297 message renderers (MST-16175)
  6. feat(apollo-react): run ApChat on ChatRoot with a Material renderer #1298 Material renderer on ChatRoot (MST-16176)

Plan: https://uipath.atlassian.net/wiki/spaces/CLD/pages/91226013878

🤖 Generated with Claude Code

@github-actions

github-actions Bot commented Oct 7, 2026

Copy link
Copy Markdown
Contributor

Dependency License Review

  • ✅ 1937 package(s) scanned
  • ✅ No license issues found
  • ⚠️ 2 package(s) excluded (see details below)
License distribution
License Packages
MIT 1708
ISC 88
Apache-2.0 55
BSD-3-Clause 27
BSD-2-Clause 23
BlueOak-1.0.0 8
MPL-2.0 4
MIT-0 3
CC0-1.0 3
MIT OR Apache-2.0 2
(MIT OR Apache-2.0) 2
Unlicense 2
LGPL-3.0-or-later 1
Python-2.0 1
CC-BY-4.0 1
(MPL-2.0 OR Apache-2.0) 1
Unknown 1
Artistic-2.0 1
(WTFPL OR MIT) 1
(BSD-2-Clause OR MIT OR Apache-2.0) 1
CC-BY-3.0 1
0BSD 1
(MIT OR CC0-1.0) 1
MIT AND ISC 1
Excluded packages
Package Version License Reason
@img/sharp-libvips-linux-x64 1.3.3 LGPL-3.0-or-later LGPL pre-built binary, not linked
khroma 2.1.0 Unknown MIT per GitHub repo, missing license field in package.json

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

📊 Coverage + size by package

Per-package coverage and bundle size on this PR. New-line coverage = of the source lines this PR adds or changes, the % hit by tests.

Package Coverage New-line coverage Packed (gzip) Unpacked vs main
@uipath/apollo-core — — 42.02 MB 50.17 MB ±0
@uipath/apollo-react 49.0% 46.9% (30/64) 7.93 MB 31.14 MB +41.1 KB
@uipath/apollo-ui-icons — — 2.86 MB 6.97 MB ±0
@uipath/apollo-wind — — 678.6 KB 3.98 MB +18 B
@uipath/ap-chat 85.8% — 43.93 MB 56.80 MB +6.0 KB

"Coverage" is each package's own coverage.include scope (e.g. apollo-core instruments only scripts/). "Packed"/"Unpacked" come from npm pack --dry-run and only cover built packages — "—" means not measured this run (package not affected / not built). "vs main" is the packed (gzipped) delta against the last successful main build (the package-sizes artifact from the Release workflow); "—" there means no main baseline was available this run. The baseline is main's latest build, not this PR's exact merge-base, so it includes any drift since the branch diverged. Packages with no vitest config are omitted.

AutopilotChatInternalService was a page-wide singleton, so two chat
instances saw each other's theme, locale, toggle and local-history
events. Each AutopilotChatService now creates its own; the static
Instantiate/Instance accessors stay for compatibility, deprecated.

Adds AutopilotChatService.publish and uses it in place of the six
`(chatService as any)._eventBus` casts, renames attachements-provider
to attachments-provider, and adds tests for ChatService, EventBus and
ContentPartBuilder.

MST-16175

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 7, 2026 17:09
@BenGSchulz
BenGSchulz force-pushed the fix/chat-service-instance-isolation branch from ae358c8 to 813b641 Compare October 7, 2026 17:09

Copilot AI left a comment

Copy link
Copy Markdown

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.

@github-actions

github-actions Bot commented Oct 7, 2026 •

Copy link
Copy Markdown
Contributor

Apollo Coded App preview deployments are ready.

Project Status Preview Updated (PT)
apollo-design Ready Preview · Logs Oct 07, 2026, 10:20:20 AM
apollo-docs Ready Preview · Logs Oct 07, 2026, 10:20:20 AM
apollo-landing Ready Preview · Logs Oct 07, 2026, 10:20:20 AM
apollo-vertex Ready Preview · Logs Oct 07, 2026, 10:20:20 AM

@github-actions github-actions Bot added the size:L 100-499 changed lines. label Oct 7, 2026

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

pkg:apollo-react size:L 100-499 changed lines.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants