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

[Bug]: Python SDK can not work in Copilot platform #2326

Open
frankqianms opened this issue Feb 26, 2025 · 3 comments
Open

[Bug]: Python SDK can not work in Copilot platform #2326

frankqianms opened this issue Feb 26, 2025 · 3 comments
Labels
bug Something isn't working Python Change/fix applies to Python. If all three, use the 'JS & dotnet & Python' label

Comments

@frankqianms
Copy link

frankqianms commented Feb 26, 2025

Language

Python

Version

latest

Description

Using SDK to create a basic chat bot and add neccessary scopes in manifest.json to sideload the bot in M365 Copilot. Try to conversation with the bot agent, get the error.

[on_turn_error] unhandled error: 'text'
Traceback (most recent call last):
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\botbuilder\core\bot_adapter.py", line 174, in run_pipeline
    return await self._middleware.receive_activity_with_status(
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\botbuilder\core\middleware_set.py", line 69, in receive_activity_with_status
    return await self.receive_activity_internal(context, callback)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\botbuilder\core\middleware_set.py", line 79, in receive_activity_internal
    return await callback(context)
           ^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\teams\app.py", line 745, in on_turn
    await self._start_long_running_call(context, self._on_turn)
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\teams\app.py", line 903, in _start_long_running_call
    return await func(context)
           ^^^^^^^^^^^^^^^^^^^
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\teams\app.py", line 751, in _on_turn
    self._remove_mentions(context)
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\teams\app.py", line 786, in _remove_mentions
    context.activity.text = context.remove_recipient_mention(context.activity)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\botbuilder\core\turn_context.py", line 392, in remove_recipient_mention
    return TurnContext.remove_mention_text(activity, activity.recipient.id)
           ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "c:\Users\frankqian\TeamsApps\test11\.venv\Lib\site-packages\botbuilder\core\turn_context.py", line 401, in remove_mention_text
    escape(mention.additional_properties["text"]),
           ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^^^^
KeyError: 'text'

Reproduction Steps

repro-noresponse-in-copilot.mp4
1.clone the bot repo from this link.https://github.com/frankqianms/basic-py
2.open the project using Teams Toolkit in vs code.
3.input neccessary api_key, deployment model name, endpoint in .env.local.user 
4.launch debug with “Debug in Teams(Desktop)”
5.in Teams Copilot channel, try to start converstion
6.get the error
...
@frankqianms frankqianms added the bug Something isn't working label Feb 26, 2025
@sayali-MSFT
Copy link

@frankqianms ,
Thank you for your inquiry about your Teams app development issue!
We are checking the issue. We will get back to you shortly.

@lilyydu
Copy link
Collaborator

lilyydu commented Feb 27, 2025

Checking the stack trace pasted - it looks like the bug is being thrown on Botbuilder? Do you have a screenshot/video of the bug? Looks like there's no text associated with the activity from quick glance

@lilyydu lilyydu added the Python Change/fix applies to Python. If all three, use the 'JS & dotnet & Python' label label Feb 27, 2025
@frankqianms
Copy link
Author

frankqianms commented Feb 27, 2025

@lilyydu Added a repro video and linked issue added in botbuilder repo.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working Python Change/fix applies to Python. If all three, use the 'JS & dotnet & Python' label
Projects
None yet
Development

No branches or pull requests

3 participants