Skip to content

fix: ignore Task<T> result for activities declared as Task - #999

Open
ahmad-codex wants to merge 2 commits into
temporalio:mainfrom
ahmad-codex:fix/activity-task-result
Open

ahmad-codex wants to merge 2 commits into
temporalio:mainfrom
ahmad-codex:fix/activity-task-result

Conversation

@ahmad-codex

Copy link
Copy Markdown

If an activity is declared as Task but returns a Task<T> at runtime (e.g. forwarding a call without async/await), the worker recorded the inner T as the result. InvokeAsync checked the runtime type of the returned task, not the declared return type, so a large object could land in history or fail with PayloadsTooLarge.

Now an activity declared as non-generic Task always completes with no result. Everything else behaves as before.

Added a test in ActivityDefinitionTests for a Task-declared delegate returning Task.FromResult(...). It fails without the fix.

Fixes #975

@ahmad-codex
ahmad-codex requested a review from a team as a code owner October 28, 2026 19:18
@CLAassistant

CLAassistant commented Oct 28, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

This branch has not been deployed

No deployments
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.

[Bug] Activity declared as Task records the result of the Task it returns

2 participants