Skip to content

feat(cc-store): add AI summary lifecycle - #748

Open
rsarika wants to merge 10 commits into
webex:nextfrom
rsarika:codex/ai-summary-store
Open

rsarika wants to merge 10 commits into
webex:nextfrom
rsarika:codex/ai-summary-store

Conversation

@rsarika

@rsarika rsarika commented Oct 9, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds AI summary state, SDK event handling, feedback and response flows to the existing Contact Center store for consult/transfer, receiving-agent and post-call summaries.

  • Stores SDK AISummary in entry.content and SDK AISummaryResponse in entry.response, grouped by interaction and summary role. Requests, receiver events and edit/copy/feedback actions access the record directly and replace it inside runInAction; senders forward it without a response composer or duplicate counter/feedback fields. Result handling, logging and status notification live in the owning flow. Empty responses supply the required SDK fields when no summary has arrived.
  • Matches Agent Desktop by sending only edited structured sections, preserving cleared values, removing reverted edits and using SDK summary text for receiver feedback. Incoming SDK metadata and optional display fields are retained.
  • Checks task.aiSummaryCapabilities directly for summary requests and responses, matching suggested responses without an additional media-type restriction. task:featureEnablement refreshes the current task after the SDK updates those flags, including late enablement and later disabling. The store keeps no separate capability map or enablement helper.
  • Guards overlapping requests, pairs task listener cleanup and requires the original task when submitting a response after wrap-up.
  • Keeps the lifecycle selector and its tests in the existing store event files. Includes typed fixtures, regression tests, store documentation and a lockfile that supports immutable installs.

Stack

This is PR 1 of 3. This cleanup is scoped to store PR #748.
Component PR #749 and widget integration PR #750 need to consume the SDK fields in entry.content and entry.response, including entry.response.feedback and the SDK copy/edit counts. Widget enablement checks should read task.aiSummaryCapabilities directly in place of the removed isAISummaryEnabled helper. Their presentation and UI lifecycle props remain in those PRs; SDK-backed fixtures include conversationId.

Verification

  • Repository pre-commit checks under Node 24: yarn test:unit passed (91 suites, 1,834 tests passed, 7 skipped) and yarn test:styles passed with 6 existing warnings.
  • yarn install --immutable
  • yarn build:dev (all widget packages)
  • yarn workspace samples-cc-react-app build (sample TypeScript check)
  • yarn workspace @webex/cc-store test:unit --runInBand: 330 passed, 3 skipped.
  • Changed store, sample and fixture source files pass lint; git diff --check is clean.

SDK dependency

Uses published @webex/contact-center 3.12.0-next.148 for the store, React sample and the sample's transitive Webex SDK. The vendored SDK archive is removed. Three scoped resolutions map unavailable transitive versions to their published predecessors: Device next.55 to next.54, Metrics next.56 to next.55, and Mercury next.62 to next.61. Remove these resolutions once the referenced versions are published. The React sample uses the SDK-supported User requested logout reason on page unload.

@rsarika
rsarika requested a review from a team as a code owner October 9, 2026 05:29
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 9, 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 ⚠️ Failed 2026-10-09T14:38:05.212836Z f3f75bb New commits
ℹ️ 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.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: ff0880bccc

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread yarn.lock Outdated
resolution: "@webex/contact-center@file:./vendor/contact-center-cc-summaries.tgz#./vendor/contact-center-cc-summaries.tgz::hash=66e859&locator=webex-widgets%40workspace%3A."
dependencies:
"@types/platform": "npm:1.3.4"
"@webex/calling": "npm:3.12.0-next.98"

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 Regenerate the vendored SDK's transitive lock entries

The new tarball stanza names @webex/calling@3.12.0-next.98 and six exact plugin versions, but yarn.lock contains no package records for any of those descriptors; local Yarn 4.5.1 already reports that the calling package is absent. In the checked .github/workflows/pull-request.yml Install Dependencies step, bare yarn runs on CI, and yarn install --help says --immutable “defaults to true on CI” and aborts if the lockfile would be modified, so a clean PR/deploy checkout cannot reach the build or tests. Regenerate and commit the complete lockfile for the vendored package.

AGENTS.md reference: AGENTS.md:L80-L81

Useful? React with 👍 / 👎.

Comment thread package.json Outdated
"@momentum-design/components": "0.133.23",
"@momentum-design/icons": "0.17.0"
"@momentum-design/icons": "0.17.0",
"@webex/contact-center": "file:./vendor/contact-center-cc-summaries.tgz"

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 Depend on a published SDK with the summary surface

This root-only resolution makes the private monorepo build against 3.12.0-cc-summaries.15f3da706d84, but the checked .github/workflows/deploy.yml publishes the workspace's own manifest, where @webex/cc-store still depends on @webex/contact-center@3.12.0-next.133. The added store spec explicitly says release requires a published SDK containing these APIs, so external TypeScript consumers receive declarations importing missing AISummary* exports and the supported host-supplied Webex path receives task objects without the new methods/events. Update the workspace dependency to a compatible published SDK, or block publishing this package until one exists.

AGENTS.md reference: AGENTS.md:L55-L57

Useful? React with 👍 / 👎.

/** Sends the final post-call response once; it is never retried. */
sendPostCallSummaryResponse = async (
response: AISummaryResponse,
task: ITask = this.currentTask

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Retain the summarized task for post-call submission

When a consumer follows the documented flow of freezing the response before wrap-up and sending it afterward, handleTaskRemove has already cleared or promoted currentTask; omitting the optional task argument here therefore either dereferences null (reported as response-failed) or sends the frozen response through a different task whose SDK context targets another interaction. Retain the original task/context with the response or make that task required so the default public path cannot lose or misroute the post-call result.

Useful? React with 👍 / 👎.

this.logAISummaryFailure('request', error);
result = 'failed';
}
if (this.getAISummaryEntry(role, task)?.status === 'loading') {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Tokenize overlapping AI summary requests

When requests A and B overlap and A rejects after B has set this shared entry to loading (the vendored SDK's requestAndWaitForRtd can still reject from A's send acknowledgement after its RTD waiter was replaced), this status-only check treats A's failure as current and changes B's entry to error; any later B settlement is then discarded because the status is no longer loading. The existing latest-request test only rejects A after B is already ready, so track and compare a per-request generation/token here instead.

AGENTS.md reference: AGENTS.md:L102-L102

Useful? React with 👍 / 👎.

Use SDK summary types directly and send only changed structured sections. Guard superseded request results, pair task listener cleanup, and require the original task for post-call submission. Repair the lockfile for immutable installs.
@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-748.d1b38q61t1z947.amplifyapp.com

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c8a3b2944b

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

this.store.realTimeAssist = next;
});
}
if (taskId && this.store.aiSummaries[taskId]) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Clean up summaries for ended background tasks

When two interactions are active and the non-current task ends, its TASK_END handler only schedules refreshTaskList; since the current task is still present, that method takes its setCurrentTask branch and never calls handleTaskRemove for the ended task. Consequently this deletion (and the listener teardown just above it) never runs, so aiSummaries[taskId] and aiSummaryReceivedListeners[taskId] survive until logout and retain stale summary state and task listeners for the whole agent session. Prune summary entries and listeners for every ID removed from the refreshed task list, not only the current task.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Failed to sample tokens
ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c75883b7c5

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

const {sections, summaryText} = entry?.content ?? {};
let summary: AISummaryResponse['summary'] = summaryText ?? '';
// Receivers report SDK text. Editable summaries report only changed sections, like Desktop.
if (role !== 'receiver' && sections) {

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Preserve text edits for mixed summary payloads

When an SDK payload contains both sections and summaryText (the new typedSections and structured fixtures do), the public editAISummary(..., 'summaryText', ...) succeeds and marks the entry edited, but this branch unconditionally replaces the outgoing summary with section deltas; if no section changed it sends {} while numberOfTimesEdited is 1. A component choosing the text field therefore silently drops the agent's edited content, so composition must follow the edited/displayed representation or the mutation API must reject that edit.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Failed to sample tokens
ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 79b8573d80

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread package.json Outdated
"@momentum-design/components": "0.133.23",
"@momentum-design/icons": "0.17.0"
"@momentum-design/icons": "0.17.0",
"@webex/contact-center": "file:./vendor/contact-center-cc-summaries.tgz"

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 Rebuild the vendored SDK before resolving it

When a receiving-agent summary carries the original conversation ID while the receiving task has its own interaction ID (the consult/transfer lineage covered by the SDK's included tests), this resolution loads the archive's main (dist/webex.js), whose dist/services/task/TaskManager.js still looks up only taskCollection[conversationId] and later flushes by task.data.interactionId; the archive's newer src/services/task/TaskManager.ts routes by interaction.mainInteractionId, but that source was not compiled into dist. Consequently TASK_MID_CALL_SUMMARY_RECEIVED is never emitted for those tasks, so the new store listener cannot populate the receiver summary. Rebuild and repack the archive from its included source before making it workspace-wide.

AGENTS.md reference: AGENTS.md:L56-L57

Useful? React with 👍 / 👎.

@chatgpt-codex-connector chatgpt-codex-connector Bot 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.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 199f875fd0

ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread package.json Outdated
"@momentum-design/components": "0.133.23",
"@momentum-design/icons": "0.17.0"
"@momentum-design/icons": "0.17.0",
"@webex/contact-center": "file:./vendor/contact-center-cc-summaries.tgz"

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 Redact summaries from the vendored SDK log

When a submitted mid/post-call summary contains customer details, this resolution executes an archive whose dist/services/task/Task.js puts response.summary in eventMetaData, while dist/services/ApiAiAssistant.js logs that whole object through LoggerProxy.info('Sending event', ...) and LoggerProxy JSON-serializes it. ai-docs/SECURITY.md:30-35 classifies transcript/customer text as PII that must never be logged, so every such submission leaks generated or edited summary text to configured SDK logs; redact the metadata before using this archive.

AGENTS.md reference: AGENTS.md:L67-L67

Useful? React with 👍 / 👎.


let result: AISummary | undefined;
try {
result = await (action ? task.requestMidCallSummary(action) : task.requestPostCallSummary());

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Settle superseded summary requests

When requests A and B of the same kind/conversation overlap, A's HTTP acknowledgement fails after B replaces it, and B's acknowledgement succeeds, this generation guard cannot make B finish: in the vendored runtime's dist/services/ApiAiAssistant.js, A's rejection calls removeRtdRequest by key, deleting B's waiter and clearing B's timeout. B's RTD response then has no waiter, so this await and the public promise remain pending and the entry stays loading indefinitely. Fresh evidence beyond the earlier status-race report is that the actual vendored runtime removes the new SDK waiter; cancel/settle superseded requests or serialize these calls.

AGENTS.md reference: AGENTS.md:L55-L57

Useful? React with 👍 / 👎.

Comment on lines +539 to +540
state: 'DEFAULT',
numberOfTimesViewed: 1,

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Record unavailable summaries as not viewed

When the SDK returns an AISummary with areTranscriptsAvailable: false, getAISummarySurface and the status notification classify it as unavailable, but this response is still initialized as DEFAULT with one view. If the agent then continues the consult/transfer or wrap-up flow, the send methods forward that record and report a summary that was hidden as successfully viewed, corrupting summary outcome metrics; initialize transcript-unavailable results with zero views and the appropriate non-received state.

Useful? React with 👍 / 👎.

@chatgpt-codex-connector

Copy link
Copy Markdown

Codex Review: Something went wrong. Try again later by commenting “@codex review”.

Failed to sample tokens
ℹ️ 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".

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

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

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

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant