Skip to content

fix: map Nexus start_activity validation failures to BAD_REQUEST - #1795

Closed
tekkaya wants to merge 1 commit into
mainfrom
nexus-saa-gap-fixes
Closed

fix: map Nexus start_activity validation failures to BAD_REQUEST#1795
tekkaya wants to merge 1 commit into
mainfrom
nexus-saa-gap-fixes

Conversation

@tekkaya

@tekkaya tekkaya commented Aug 28, 2026

Copy link
Copy Markdown

What was changed

start_activity's preconditions (missing timeout, negative start_delay) now raise a dedicated _StartActivityInputError. worker/_nexus.py's _exception_to_handler_error recognizes this type and converts it to a non-retryable nexusrpc.HandlerError (BAD_REQUEST).

Why?

Inside a Nexus operation handler starting an activity when both timeout are missing or a negative start_delay is given in start activity options, the raised ValueError was falling through to the generic, retryable HandlerErrorType.INTERNAL branch, discarding the real message and causing the server to redeliver the deterministically-failing request until schedule_to_close_timeout elapsed.

Checklist

  1. Closes Argument validation gap in Nexus + SAA

  2. How was this tested:

  • New unit tests added.
  • Existing test passing.
  • End-to-end against a real server via a separate SAA test harness exercising both validations through a Nexus operation.
  1. Any docs updates needed?
    No public API changes; _StartActivityInputError is private.

@CLAassistant

CLAassistant commented Aug 28, 2026

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@tekkaya
tekkaya force-pushed the nexus-saa-gap-fixes branch from 7a57af2 to 74d57b9 Compare August 31, 2026 18:23
start_activity's preconditions (missing timeout, negative start_delay)
raised a bare ValueError. Inside a Nexus operation handler this fell
through _exception_to_handler_error to a retryable HandlerErrorType
INTERNAL, causing needless redelivery until schedule_to_close_timeout
and discarding the real message.

Raise a dedicated _StartActivityInputError instead so the Nexus worker
can classify it as a non-retryable BAD_REQUEST. It also inherits from
TemporalError so it's catchable alongside the rest of the SDK's
exception hierarchy; ValueError catchability for existing callers is
unaffected.

Adds unit tests covering both preconditions and the
_exception_to_handler_error classification (tests/nexus/, alongside
the other worker._nexus unit tests), plus a CHANGELOG entry.

Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
@tekkaya
tekkaya force-pushed the nexus-saa-gap-fixes branch from 74d57b9 to 4cc3016 Compare August 31, 2026 18:32
@tekkaya
tekkaya marked this pull request as ready for review August 31, 2026 19:51
@tekkaya
tekkaya requested a review from a team as a code owner August 31, 2026 19:51
@tekkaya

tekkaya commented Aug 31, 2026

Copy link
Copy Markdown
Author

This is an intended behaviour, closing this

@tekkaya tekkaya closed this Aug 31, 2026
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