Skip to content

Simplify setting http response after activity processing#398

Merged
heyitsaamir merged 10 commits into
mainfrom
kavin/simplify-activity-response
Dec 9, 2025
Merged

Simplify setting http response after activity processing#398
heyitsaamir merged 10 commits into
mainfrom
kavin/simplify-activity-response

Conversation

@singhk97

Copy link
Copy Markdown
Collaborator

Ensure that HTTP responses are returned directly from handlers, rather than through event-based callbacks.

Activity processing and response flow:

  • The onActivity handler in app.events.ts now returns a Promise<InvokeResponse> and directly returns the result of processing the activity, rather than just awaiting it.
  • The $process function in app.process.ts is refactored to always return an InvokeResponse, handling both normal and error cases, and ensuring response construction is consistent.

HttpPlugin interface and implementation updates:

  • The $onActivity event handler in HttpPlugin is now asynchronous and returns a Promise<InvokeResponse>, aligning with the new app contract.
  • The HTTP request handler in HttpPlugin now awaits the activity response and sends it directly to the client, removing the previous pattern of storing pending responses and using callback events.
  • Old error and activity response event handlers (onError, onActivityResponse) and related state management are removed from HttpPlugin, as response handling is now synchronous with the HTTP request.

Type and import consistency:

  • The InvokeResponse type is imported and used consistently across files to improve type safety and clarity.

@heyitsaamir heyitsaamir left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense to me. Add tests?

@singhk97
singhk97 marked this pull request as ready for review November 18, 2025 22:00
Comment thread packages/apps/src/app.events.ts Outdated
heyitsaamir added a commit to microsoft/teams.py that referenced this pull request Dec 4, 2025
@heyitsaamir
heyitsaamir merged commit c9d27c8 into main Dec 9, 2025
9 checks passed
@heyitsaamir
heyitsaamir deleted the kavin/simplify-activity-response branch December 9, 2025 18:52
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants