Skip to content

ChannelServiceAdapter create_conversation throws when creating TurnContext #231

@mojenkins

Description

@mojenkins

When ChannelServiceAdapter#create_conversation is called, TypeError("TurnContext must be instantiated with a request parameter of type Activity.") is raised.

More detail:
In libraries/microsoft-agents-hosting-core/microsoft_agents/hosting/core/channel_service_adapter.py#create_conversation, it calls self._create_turn_context without specifying activity.

In _create_turn_context the default value is None for activity, and it uses that to initialize TurnContext

In the TurnContext initializer, it has the following check

        if self.activity is None:
            raise TypeError(
                "TurnContext must be instantiated with a request parameter of type Activity."
            )

My 2 cents:
ChannelServiceAdapter#_create_turn_context should require an Activity rather than having one be optional

The bug was introduced in PR 137 https://github.com/microsoft/Agents-for-python/pull/137/files#diff-935f31e7436a6b94b74346a295724e8c816f07b2eecbd3c6b115a59c2e747391

Metadata

Metadata

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions