Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Merged
merged 6 commits into from
May 19, 2023

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
@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