Report missing activity timeout as BAD_REQUEST inside a Nexus operation handler - #3045
Open
tekkaya wants to merge 1 commit into
Open
Report missing activity timeout as BAD_REQUEST inside a Nexus operation handler#3045tekkaya wants to merge 1 commit into
tekkaya wants to merge 1 commit into
Conversation
tekkaya
marked this pull request as ready for review
August 28, 2026 17:32
…on handler Previously, building StartActivityOptions with neither scheduleToCloseTimeout nor startToCloseTimeout set always threw a plain IllegalArgumentException. When that build() call happens inside a Nexus operation handler, that exception isn't a recognized Nexus error type, so NexusTaskHandlerImpl's catch-all surfaced it as an opaque HandlerException(INTERNAL), which the caller retries until the operation's schedule-to-close timeout expires instead of failing fast. NexusTaskHandlerImpl.convertKnownFailures now maps any IllegalArgumentException raised by handler code to a real HandlerException(BAD_REQUEST), matching the pattern already used for header/operation-token parsing elsewhere in this class and in TemporalOperationHandler/WorkflowRunOperationImpl. This fixes the missing-timeout case without teaching the general-purpose, Nexus-agnostic StartActivityOptions builder about Nexus, and it also covers every other IllegalArgumentException a Nexus operation handler can throw (missing id, empty task queue, negative start delay, etc.) with one change, regardless of whether the handler is built via TemporalOperationHandler or a raw/sync OperationHandler.
tekkaya
force-pushed
the
nexus-missing-timeout-bad-request
branch
from
August 28, 2026 17:46
07289a9 to
b615451
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What was changed
NexusTaskHandlerImpl.convertKnownFailuresnow maps anyIllegalArgumentExceptionthrown byNexus operation handler code to
HandlerException(BAD_REQUEST).Why?
StartActivityOptions.Builder.build()throws a plainIllegalArgumentExceptionwhen neitherscheduleToCloseTimeoutnorstartToCloseTimeoutis set. Thrown from inside a Nexus operationhandler, that isn't a recognized Nexus error type, so it fell through to the generic
HandlerException(INTERNAL)catch-all inNexusTaskHandlerImpl.handle()— the caller thenretries until the operation's schedule-to-close timeout expires, instead of failing fast.
Checklist
Closes: A gap found during Nexus SAA Test Plan execution for Temporal Java SDK
How was this tested:
Added
NexusTaskHandlerImplTest.startTaskHandlerMissingBothActivityTimeoutOptions, which registersa handler that throws
IllegalArgumentException, and asserts the response comes back asHandlerException(BAD_REQUEST).Any docs updates needed?
No.