Skip to content

Removed sessionId usage - #5092

Draft
shnaaz wants to merge 17 commits into
llmrefactorfrom
shnaaz/feat/SPARK-831620
Draft

Removed sessionId usage#5092
shnaaz wants to merge 17 commits into
llmrefactorfrom
shnaaz/feat/SPARK-831620

Conversation

@shnaaz

@shnaaz shnaaz commented Jul 10, 2026

Copy link
Copy Markdown
Contributor

COMPLETES #< INSERT LINK TO ISSUE >

This pull request addresses

< DESCRIBE THE CONTEXT OF THE ISSUE >
Before refactor:
Main Session:
Uses webex.internal.llm singleton with session ID 'llm-default-session'
URL from [locusInfo.info.datachannelUrl]
Events: ['event:relay.event'] ['locus.llm'], 'online'

Practice Session:
Uses same webex.internal.llm singleton with session ID 'llm-practice-session'
URL from [locusInfo.info.practiceSessionDatachannelUrl]
Events: ['event:relay.event:llm-practice-session'], ['locus.llm:llm-practice-session']
Waits for main session 'online' before connecting

Voicea:
Single [webex.internal.voicea] singleton shared by both sessions
[announce()] / [turnOnCaptions()]operates on whichever session is active
Caption state isCaptionBoxOn is global

Refactor:
Main Session:

[meeting.llmChannel]= dedicated [LLMChannel] instance owned by meeting
[meeting.voiceaChannel]= dedicated [VoiceaChannel] instance bound to [llmChannel]
Events emitted directly on the channel instance (no suffix)

Practice Session:
[webinar.practiceSessionLLMChannel] = dedicated [LLMChannel] instance owned by webinar
[webinar.practiceSessionVoiceaChannel]= dedicated [VoiceaChannel] instance bound to PS channel
Still waits for main session 'online' before connecting

In both architectures, when Practice Session is active:

  • Main session channel stays connected
  • Practice session channel connects after main session is online
  • Both receive relay events, routed by binding in event header
  • Services like annotation switch to PS channel during practice session

Channel Ownership Summary

Regular Meeting:
meeting.llmChannel
meeting.voiceaChannel → listens to meeting.llmChannel

Webinar (main session only):
meeting.llmChannel
meeting.voiceaChannel → listens to meeting.llmChannel

Webinar (practice session active):
meeting.llmChannel - main session (stays connected)
webinar.practiceSessionLLMChannel - practice session (ADDITIONAL)
meeting.voiceaChannel → SWITCHES to practiceSessionLLMChannel
(preserves caption state, re-announces)

On practice session exit:
meeting.voiceaChannel.switchLLMChannel(meeting.llmChannel) → switches back
webinar.practiceSessionLLMChannel → disconnected & cleaned up

by making the following changes

< DESCRIBE YOUR CHANGES >

Change Type

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to change)
  • Documentation update
  • Tooling change
  • Internal code refactor

The following scenarios were tested

< ENUMERATE TESTS PERFORMED, WHETHER MANUAL OR AUTOMATED >

The GAI Coding Policy And Copyright Annotation Best Practices

  • GAI was not used (or, no additional notation is required)
  • Code was generated entirely by GAI
  • GAI was used to create a draft that was subsequently customized or modified
  • Coder created a draft manually that was non-substantively modified by GAI (e.g., refactoring was performed by GAI on manually written code)
  • Tool used for AI assistance (GitHub Copilot / Other - specify)
    • Github Copilot
    • Other - Please Specify
  • This PR is related to
    • Feature
    • Defect fix
    • Tech Debt
    • Automation

I certified that

  • I have read and followed contributing guidelines
  • I discussed changes with code owners prior to submitting this pull request
  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the documentation accordingly

Make sure to have followed the contributing guidelines before submitting.

@shnaaz shnaaz changed the title Shnaaz/feat/spark 831620 Removed sessionId usage Jul 10, 2026
Comment thread packages/@webex/internal-plugin-llm/src/llm-plugin.ts Outdated
Comment thread packages/@webex/internal-plugin-llm/src/llm-plugin.ts Outdated
Comment thread packages/@webex/internal-plugin-llm/src/llm.ts Outdated
Comment thread packages/@webex/internal-plugin-llm/src/llm.types.ts
Comment thread packages/@webex/internal-plugin-voicea/test/unit/spec/voicea.js Outdated
Comment thread packages/@webex/plugin-meetings/src/annotation/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/annotation/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/breakouts/index.ts
Comment thread packages/@webex/plugin-meetings/src/interceptors/dataChannelAuthToken.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/interceptors/dataChannelAuthToken.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/meeting/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/meeting/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/meeting/index.ts Outdated
/**
* Pending practice session datachannel token, passed to webinar for its LLM channel.
*/
private _pendingPracticeSessionDatachannelToken?: string;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it make more sense to keep this inside Webinar class?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I see you moved it, but it's now public and name starting with "_" - probably best to make it private and add a public setter

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see the setter added, but the prop is still public

Comment thread packages/@webex/internal-plugin-llm/src/llm-plugin.ts
*
* @returns {LLMChannel} A new LLM connection instance
*/
public createConnection(): LLMChannel {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the function is called "createConnection" but it returns an LLMChannel - it would be better to settle on one name and use it consistently everywhere - either "connection" or "channel"

note that there are more places that use "connection" like getConnectionByDatachannelUrl, getAllConnections, etc

Comment thread packages/@webex/internal-plugin-llm/src/llm.ts Outdated
Comment thread packages/@webex/internal-plugin-voicea/src/voicea-plugin.ts Outdated
Comment thread packages/@webex/internal-plugin-voicea/src/voicea.ts Outdated
Comment thread packages/@webex/internal-plugin-voicea/src/voicea.ts Outdated
Comment thread packages/@webex/internal-plugin-voicea/src/voicea.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/annotation/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/breakouts/index.ts
Comment thread packages/@webex/plugin-meetings/src/webinar/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/webinar/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/webinar/index.ts
Comment thread packages/@webex/plugin-meetings/src/webinar/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/interceptors/dataChannelAuthToken.ts Outdated
/**
* The Voicea channel for transcription/captions, bound to this meeting's LLM channel.
*/
voiceaChannel?: VoiceaChannel;

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this maybe be private?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see this is now private, but I also see it's being accessed in lots of places by the web app in the web app PR, so feels like this shouldn't be private after all? or we need some public getter

Comment thread packages/@webex/plugin-meetings/src/meeting/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/meeting/index.ts
Comment thread packages/@webex/plugin-meetings/src/meeting/index.ts Outdated
Comment thread packages/@webex/plugin-meetings/src/webinar/index.ts Outdated
const channel = new LLMChannel({parent: this.webex});

this.channels.add(channel);
channel.onDisconnect = () => this.channels.delete(channel);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not great. As onDisconnect is public anyone else can overwrite it and the LLM plugin's one won't get called. We should do this properly via an event registration and emit


// Re-announce and re-enable captions if they were on
if (captionsWereOn) {
await this.turnOnCaptions(spokenLanguage);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

question: just wondering if maybe we need to do something with currentCaptionLanguage too?

this.annotation.registerChannel(this.llmChannel);
// Register annotation channel only if not in practice session
// (practice session manages its own annotation channel via updatePSDataChannel)
if (!this.webinar?.isPracticeSessionLLMChannelConnected()) {

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

shouldn't this be only checking if we're in practice session no matter if the PS LLM channel is connected or not? I mean there can be a case of being in PS but with disconnected LLM channel and in that case we still want annotation to stay on the PS LLM channel and not use the main one, right?

@marcin-bazyl marcin-bazyl left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approving, so that you're not blocked when I'm on PTO, but there are 6 open comment threads right now, so please either address them by replying in this PR if no code change is needed or do the code change in another PR and reply here with just the PR link

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants