Skip to content

Fix for CopilotChat error: "Unable to load chats. Details: interaction_in_progress: Interaction is currently in progress." #1084

Merged
hathind-ms merged 6 commits intomicrosoft:mainfrom
gitri-ms:interaction-in-progress
May 19, 2023
Merged

Fix for CopilotChat error: "Unable to load chats. Details: interaction_in_progress: Interaction is currently in progress." #1084
hathind-ms merged 6 commits intomicrosoft:mainfrom
gitri-ms:interaction-in-progress

Conversation

@gitri-ms
Copy link
Contributor

Motivation and Context

Issue Banner on Co-pilot start up: "Unable to load chats. Details: interaction_in_progress: Interaction is currently in progress."

This error occurs when another MSAL interactive API call is currently in progress -- e.g., we are requesting a token before the previous token request has completed. Per the MSAL React documentation, the solution is to check if another interaction is in progress and wait until it's done. We already do this when acquiring tokens for skills (in TokenHelper.ts), so we should use the same code to acquire the token for the SKaaS backend.

Description

  • Pipe MSAL's inProgress indicator into all calls to AuthHelper.getSKaaSAccessToken()
  • Change AuthHelper.getSKaaSAccessToken() to call TokenHelper.getAccessTokenUsingMsal(), which already handles the interaction_in_progress error

Contribution Checklist

@gitri-ms gitri-ms added bug Something isn't working PR: ready for review All feedback addressed, ready for reviews typescript labels May 18, 2023
@gitri-ms gitri-ms requested a review from teresaqhoang May 18, 2023 23:23
@hathind-ms hathind-ms enabled auto-merge (squash) May 19, 2023 00:10
@hathind-ms hathind-ms merged commit 7d48ed3 into microsoft:main May 19, 2023
@gitri-ms gitri-ms deleted the interaction-in-progress branch May 19, 2023 00:42
shawncal pushed a commit to johnoliver/semantic-kernel that referenced this pull request May 19, 2023
…n_in_progress: Interaction is currently in progress." (microsoft#1084)

### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
Issue Banner on Co-pilot start up: "Unable to load chats. Details:
interaction_in_progress: Interaction is currently in progress."

This error occurs when another MSAL interactive API call is currently in
progress -- e.g., we are requesting a token before the previous token
request has completed. Per the [MSAL React
documentation](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/errors.md#interaction_in_progress),
the solution is to check if another interaction is in progress and wait
until it's done. We already do this when acquiring tokens for skills (in
`TokenHelper.ts`), so we should use the same code to acquire the token
for the SKaaS backend.

### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
- Pipe MSAL's `inProgress` indicator into all calls to
`AuthHelper.getSKaaSAccessToken()`
- Change `AuthHelper.getSKaaSAccessToken()` to call
`TokenHelper.getAccessTokenUsingMsal()`, which already handles the
`interaction_in_progress` error

### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows SK Contribution Guidelines
(https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
- [ ] The code follows the .NET coding conventions
(https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions)
verified with `dotnet format`
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄

---------

Co-authored-by: Teresa Hoang <125500434+teresaqhoang@users.noreply.github.com>
golden-aries pushed a commit to golden-aries/semantic-kernel that referenced this pull request Oct 10, 2023
…n_in_progress: Interaction is currently in progress." (microsoft#1084)

### Motivation and Context
<!-- Thank you for your contribution to the semantic-kernel repo!
Please help reviewers and future users, providing the following
information:
  1. Why is this change required?
  2. What problem does it solve?
  3. What scenario does it contribute to?
  4. If it fixes an open issue, please link to the issue here.
-->
Issue Banner on Co-pilot start up: "Unable to load chats. Details:
interaction_in_progress: Interaction is currently in progress."

This error occurs when another MSAL interactive API call is currently in
progress -- e.g., we are requesting a token before the previous token
request has completed. Per the [MSAL React
documentation](https://github.com/AzureAD/microsoft-authentication-library-for-js/blob/dev/lib/msal-react/docs/errors.md#interaction_in_progress),
the solution is to check if another interaction is in progress and wait
until it's done. We already do this when acquiring tokens for skills (in
`TokenHelper.ts`), so we should use the same code to acquire the token
for the SKaaS backend.

### Description
<!-- Describe your changes, the overall approach, the underlying design.
These notes will help understanding how your code works. Thanks! -->
- Pipe MSAL's `inProgress` indicator into all calls to
`AuthHelper.getSKaaSAccessToken()`
- Change `AuthHelper.getSKaaSAccessToken()` to call
`TokenHelper.getAccessTokenUsingMsal()`, which already handles the
`interaction_in_progress` error

### Contribution Checklist
<!-- Before submitting this PR, please make sure: -->
- [ ] The code builds clean without any errors or warnings
- [ ] The PR follows SK Contribution Guidelines
(https://github.com/microsoft/semantic-kernel/blob/main/CONTRIBUTING.md)
- [ ] The code follows the .NET coding conventions
(https://learn.microsoft.com/dotnet/csharp/fundamentals/coding-style/coding-conventions)
verified with `dotnet format`
- [ ] All unit tests pass, and I have added new tests where possible
- [ ] I didn't break anyone 😄

---------

Co-authored-by: Teresa Hoang <125500434+teresaqhoang@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working PR: ready for review All feedback addressed, ready for reviews

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants