Skip to content

Drop signals with the wrong number of arguments - #2021

Open
AyeshaWaseemAhmad wants to merge 1 commit into
temporalio:mainfrom
AyeshaWaseemAhmad:fix/drop-signals-with-wrong-arg-count
Open

AyeshaWaseemAhmad wants to merge 1 commit into
temporalio:mainfrom
AyeshaWaseemAhmad:fix/drop-signals-with-wrong-arg-count

Conversation

@AyeshaWaseemAhmad

Copy link
Copy Markdown

Fixes #355

A signal whose argument count does not match the handler passes payload decoding and then raises a TypeError inside the handler, which fails the workflow task on every retry. _SignalDefinition now records the accepted positional range for named handlers, and _process_signal_job logs and drops a signal outside that range, next to the existing "Failed deserializing signal input" path.

Dynamic handlers and handlers with required keyword-only parameters are not checked. A handler with no parameters still ignores extra arguments, because _convert_payloads passes an empty type hint list. Not covered: updates and queries.

Tested with tests/worker/test_workflow.py (new test_workflow_bad_signal_arg_count and test_positional_arg_count_range, the first fails on the previous code), plus the replayer, interceptor and sandbox tests. ruff, pyright, mypy, basedpyright and pydocstyle are clean. I did not run the full suite or cargo clippy.

A signal whose argument count does not match the handler signature raised a TypeError inside the handler and failed the workflow task on every retry. The count is now checked before the handler runs, and the signal is logged and dropped, as already happens for arguments that fail to decode.
@AyeshaWaseemAhmad
AyeshaWaseemAhmad requested a review from a team as a code owner October 25, 2026 11:49
@CLAassistant

CLAassistant commented Oct 25, 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.

[Feature Request] Log and drop signals that pass the wrong number of arguments

2 participants