Repository navigation
CAI-8656: Retain Idle state after wrap-up when agent selected it - #755
Conversation
…lected it
Guard the unconditional setCurrentState('0') in refreshTaskList so it only
fires when the agent is already in the default Available state. When a non-
default Idle aux-code is selected, the store retains it and defers to the
backend AGENT_STATE_CHANGE event as the authoritative post-wrap-up source.
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
This pull request is automatically being deployed by Amplify Hosting (learn more). |
|
|
||
| const WELLNESS_NOTIFICATION_ACTIONS = new Set(Object.values(WELLNESS_BREAK_NOTIFICATION_ACTIONS)); | ||
|
|
||
| const DEFAULT_CODE = '0'; // Default aux-code id representing the Available state |
There was a problem hiding this comment.
Now that the PR introduces the module-level DEFAULT_CODE and converts the other call sites, but line 502 still has a bare literal:
this.store.legacyAuxCodeId = payload.auxCodeId?.trim() || this.store.legacyAuxCodeId || '0';
rarajes2
left a comment
There was a problem hiding this comment.
LGTM. Please check what's wrong with the pipeline. Even after adding the validated label, it's failing for that particular reason.
COMPLETES https://jira-eng-sjc12.cisco.com/jira/browse/CAI-8656
This pull request addresses
When an agent selects an Idle state during a call or wrap-up period, the Epic CTI Desktop widget incorrectly forces the agent back to Available once wrap-up completes and the task list empties. Native Agent Desktop retains the Idle selection; this fix corrects the widget regression.
Root Cause:
refreshTaskListinpackages/contact-center/store/src/storeEventsWrapper.tsunconditionally calledsetCurrentState('0')(Available /DEFAULT_CODE) in the empty-task-list branch after wrap-up. This overwrote any agent-selected Idle aux-code, triggeringuseUserStateto react and push an erroneouscc.setAgentState({state: 'Available'...})call to the backend — the forced transition recorded in the ticket. The backendAGENT_STATE_CHANGEevent (handleStateChange) is the authoritative post-wrap-up state source, and the unconditional reset overrode it.by making the following changes
packages/contact-center/store/src/storeEventsWrapper.ts: Introduced module-levelDEFAULT_CODE = '0'constant; guarded thesetCurrentState('0')call inrefreshTaskListto only fire when!this.currentState || this.currentState === DEFAULT_CODE; updatedhandleStateChangeandhandleLoginto reference the shared constant instead of inline literals.packages/contact-center/store/tests/storeEventsWrapper.ts: Added three unit tests to therefreshTaskListsuite — (1) Idle retention when task list empties, (2) Available reset preserved when no Idle was selected, (3) non-empty task list branch unchanged.packages/contact-center/store/ai-docs/store-spec.md: UpdatedSTORE-R-010to reflect the Idle-retention conditional and point to the new test cases.Change Type
The following scenarios were tested
refreshTaskListtests were written first; Test 1 ("retains agent-selected Idle state when task list empties after wrap-up") failed as expected before the fix.refreshTaskListtests pass.refreshTaskList,handleStateChange,handleTaskEnd, and task-rejection patterns all pass after the fix.Vidcast :
https://app.vidcast.io/share/0cdf4504-3e58-4962-85bb-a9cfd567b883
Testing
Vidcast :
https://app.vidcast.io/share/0cdf4504-3e58-4962-85bb-a9cfd567b883
Verification limitations
Acceptance Criteria
External Validation Required
deployment-requiredAGENT_STATE_CHANGEwith the correct Idle aux-code after the task list empties (native Agent Desktop behavior per ticket confirms this). The fix relies on the backend event as the authoritative post-wrap-up state source;cc.setAgentStateis no longer called by the widget in this path.packages/contact-center/store/src/storeEventsWrapper.ts:1078)The GAI Coding Policy And Copyright Annotation Best Practices
Checklist before merging
Make sure to have followed the contributing guidelines before submitting.
Jira: https://jira-eng-sjc12.cisco.com/jira/browse/CAI-8656