Skip to content

fix(task-refactor): bug bash fixes#692

Open
akulakum wants to merge 1 commit into
webex:task-refactorfrom
akulakum:NEW_BUGS_TASK_REFACTOR
Open

fix(task-refactor): bug bash fixes#692
akulakum wants to merge 1 commit into
webex:task-refactorfrom
akulakum:NEW_BUGS_TASK_REFACTOR

Conversation

@akulakum
Copy link
Copy Markdown
Contributor

@akulakum akulakum commented Jun 2, 2026

COMPLETES #< INSERT LINK TO ISSUE >

This pull request addresses

Contact Center Call Control regressions in the task-refactor build around hold state, consult timers, and conference participant list visibility during multi-party flows.

Hold & consult timer issues

  • Agent 2 (consulted side): main CAD “On Hold” chip and timer were wrong or reset after refresh in consult flows (agent-name, EP/DN, conference nested consult).
  • Agent 1 (initiator side): during EP/DN consult, switching from consult back to main showed “Consulting” with the wrong timer instead of “Consult on Hold” when the consult leg was parked.
  • Hold timestamps from the backend could arrive in seconds or milliseconds, causing incorrect elapsed times.

Conference participant list issues

  • During conference, when Agent 1 consults a third agent, the “+N Participant” list disappeared on Agent 1’s side after the consult was accepted.
  • The consulted agent (Agent 3) incorrectly saw the conference participant list even though they are not on the conference mainCall leg.
  • Plain conference (Agent 1 + Agent 2 + customer) participant list needed to remain stable before and during nested consult.

by making the following changes

Hold logic (main CAD chip + timer)

  • Extracted hold derivation into main-cad-hold.util.ts (deriveMainCadHoldState) with rules for EP/DN consulted agent, agent-name consulted agent, nested consult, and plain conference hold.
  • Added resolveMainCadHoldTimestampMs and sessionStorage hold anchors in task-util.ts / useHoldTimer.ts so hold timers survive page refresh when backend timestamps lag.
  • Added normalizeHoldTimestampMs to normalize second vs millisecond hold timestamps.

Consult leg timer (Agent 1 initiator CAD)

  • Updated calculateConsultTimerData in timer-utils.ts to treat consult on hold from consultMedia.isHold without requiring holdTimestamp > 0.
  • Prefer fresher snapshot interaction for initiator on leg switch; fallback when activeLeg === 'main' and consult controls are visible during media lag.
  • Added consult hold session anchor via resolveConsultHoldTimestampMs and anchor read/write in helper.ts.

Conference participant list

  • Fixed getConferenceParticipants in store/task-utils.ts to resolve mainCall media explicitly during nested consult (when interactionId points at the consult leg).
  • Return empty participants for consult-only agents not present on mainCall media; always exclude EP/DN secondary consult child tasks.
  • Updated CallControlCAD visibility to treat interaction.state === 'conference' as active conference (not only exitConference.isVisible), while still requiring non-empty participant data and excluding consult-only agents.

Quality

  • Added/updated unit tests for hold, consult timer, and participant list scenarios.
  • Removed any from new utils code; fixed failing helper tests and lint (test:cc-widgets, test:styles passing).

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

  • The testing is done with the amplify link
    < 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

Checklist before merging

  • I have not skipped any automated checks
  • All existing and new tests passed
  • I have updated the testing document
  • I have tested the functionality with amplify link

Make sure to have followed the contributing guidelines before submitting.

@akulakum akulakum requested a review from a team as a code owner June 2, 2026 11:35
@akulakum akulakum added the validated Indicates that the PR is ready for actions label Jun 2, 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: 3dee3c13ca

ℹ️ 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 on lines +103 to +104
const heldEntries = consultEntries.filter((media) => media.isHold === true);
const candidates = heldEntries.length > 0 ? heldEntries : consultEntries;
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 Stop preferring stale held consult legs

When a previous consult leg remains in interaction.media with isHold: true and the agent starts a new consult whose newer consult media is not held, this filter discards the newer leg before the recency comparison runs. In that re-consult scenario calculateConsultTimerData will keep using the stale held media and show Consult on Hold with the old timestamp even though the current consult is active; compare recency across all consult entries first, then derive hold state from the selected current leg.

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-692.d1b38q61t1z947.amplifyapp.com

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

Labels

validated Indicates that the PR is ready for actions

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant