Skip to content

fix(5k webinar):prevent LLM connection from being permanently killed#4878

Open
mickelr wants to merge 2 commits intowebex:nextfrom
mickelr:fix/llm-lost
Open

fix(5k webinar):prevent LLM connection from being permanently killed#4878
mickelr wants to merge 2 commits intowebex:nextfrom
mickelr:fix/llm-lost

Conversation

@mickelr
Copy link
Copy Markdown
Contributor

@mickelr mickelr commented Apr 20, 2026

COMPLETES #< INSERT LINK TO ISSUE >

This pull request addresses

updateLLMConnection() disconnects the shared LLM singleton (code 3050, permanent) before validating whether reconnection is feasible. This causes permanent LLM loss in two scenarios:

Unjoined meeting triggers disconnect - An incoming CALL creates a new meeting object that calls updateLLMConnection(). Since isJoined() is false on the new meeting, it disconnects the webinar LLM but never reconnects.

datachannelUrl cleared by locus.difference - A locus delta clears datachannelUrl. The method disconnects the LLM, then registerAndConnect() silently bails out because datachannelUrl is null.

by making the following changes

Add a guard before cleanupLLMConneciton() that validates reconnection is feasible (isJoined, url, and dataChannelUrl must all be truthy). If reconnection is not possible, the existing LLM connection is preserved.

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.

@mickelr mickelr requested review from a team as code owners April 20, 2026 02:55
@mickelr mickelr added the validated If the pull request is validated for automation. label Apr 20, 2026
@mickelr mickelr changed the title Fix/llm lost fix(5k webinar):prevent LLM connection from being permanently killed Apr 20, 2026
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 8ff06e9c65

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// This prevents permanently killing the LLM when:
// 1. An unjoined meeting (e.g. incoming CALL) triggers updateLLMConnection
// 2. datachannelUrl becomes null/undefined due to a locus.difference event
if (!isJoined || !url || !dataChannelUrl) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Disconnect LLM when joined state drops to false

The new !isJoined early-return prevents cleanupLLMConneciton() from running even when this meeting already owns an active LLM connection. updateLLMConnection() is called from the SELF_UNADMITTED_GUEST flow, so when a user transitions from JOINED to unadmitted/lobby, this branch now leaves the socket plus relay/locus listeners active instead of tearing them down. In that state, the meeting can continue receiving/processing LLM events for an unjoined participant until some later explicit cleanup path runs.

Useful? React with 👍 / 👎.

@aws-amplify-us-east-2
Copy link
Copy Markdown

This pull request is automatically being deployed by Amplify Hosting (learn more).

Access this pull request here: https://pr-4878.d3m3l2kee0btzx.amplifyapp.com

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c78bed7541

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

// Guard 1: Don't disconnect if this meeting doesn't own the LLM connection.
// This prevents an unjoined meeting (e.g. incoming CALL) from killing another
// meeting's active LLM connection.
if (!isJoined && llmLocusUrl && llmLocusUrl !== url) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Avoid URL-only ownership check before skipping disconnect

This guard treats llmLocusUrl !== url as proof that another meeting owns the LLM connection, but the same meeting can legitimately change locus URL during locus replacement flows (locus.replaces handling updates the meeting’s locus URL). In that case, if updateLLMConnection() runs while isJoined is false (for example from the SELF_UNADMITTED_GUEST path), this branch returns early and skips cleanupLLMConneciton(), leaving stale LLM socket/listener state active even though the participant is no longer joined.

Useful? React with 👍 / 👎.

@mickelr mickelr force-pushed the fix/llm-lost branch 2 times, most recently from ef464c6 to 34307ab Compare April 20, 2026 09:54
Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 34307ab105

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +6466 to +6471
if (!isJoined && llmLocusUrl && llmLocusUrl !== url) {
LoggerProxy.logger.info(
'Meeting:index#updateLLMConnection --> Not disconnecting LLM: owned by different meeting'
);

return undefined;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Handle locus replacement before skipping unjoined disconnect

The new !isJoined && llmLocusUrl !== url guard can misclassify ownership after locus replacement: setUpLocusUrlListener updates the meeting’s locus URL, but the active LLM connection may still carry the previous locus until a successful reconnect, so when SELF_UNADMITTED_GUEST calls updateLLMConnection() this branch can return early for the same meeting and skip cleanupLLMConneciton(), leaving LLM socket/listener state active while the user is no longer joined. Fresh evidence in this revision is the added unit test that enforces this early-return behavior for unjoined meetings without covering the same-meeting locus-replacement case.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

@chatgpt-codex-connector chatgpt-codex-connector bot left a comment

Choose a reason for hiding this comment

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

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: e834899784

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

handleDataChannelUrlChange(datachannelUrl) {
// @ts-ignore - config coming from registerPlugin
if (datachannelUrl && this.config.enableAutomaticLLM) {
if (datachannelUrl && this.config.enableAutomaticLLM && this.isJoined()) {
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P1 Badge Keep practice-session cleanup outside joined-state guard

Placing this.isJoined() in the outer handleDataChannelUrlChange guard now blocks this.webinar.updatePSDataChannel() whenever the meeting transitions to a non-joined state (for example lobby/unadmitted). That is a regression because updatePSDataChannel() is also the cleanup path: it explicitly calls cleanupPSDataChannel() when meeting.isJoined() is false, so skipping this call can leave the practice-session LLM channel/listeners active for an unjoined participant until a later full meeting cleanup.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown
Contributor Author

@mickelr mickelr Apr 20, 2026

Choose a reason for hiding this comment

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

I don't think unjoined participant has chance to connect PS data channel

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

Labels

validated If the pull request is validated for automation.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant