Require request ID and a completion callback when attaching callbacks on StartActivityExecution conflict#10679
Open
tekkaya wants to merge 1 commit into
Open
Conversation
8f8441f to
5f35af6
Compare
98198c4 to
a232e01
Compare
a232e01 to
0e2fa54
Compare
0e2fa54 to
95c8fd0
Compare
95c8fd0 to
c9a8ad9
Compare
bergundy
reviewed
Jun 12, 2026
| // attach_links and attach_request_id remain independently valid. | ||
| func validateOnConflictOptions(req *workflowservice.StartActivityExecutionRequest) error { | ||
| onConflictOptions := req.GetOnConflictOptions() | ||
| if onConflictOptions == nil || !onConflictOptions.GetAttachCompletionCallbacks() { |
Member
There was a problem hiding this comment.
This condition isn't right. It's also invalid to only attach a request ID.
Contributor
Author
There was a problem hiding this comment.
Is attaching a requestID and links without completion callbacks a valid scenario?
c9a8ad9 to
e93a551
Compare
On the USE_EXISTING path, on_conflict_options must be internally consistent: - attach_completion_callbacks requires attach_request_id (a completion callback is recorded against the request ID; see addCompletionCallbacks). - attach_request_id requires at least one completion callback or link, since attaching a request ID is only meaningful alongside something to attach. attach_links is independent and may be set on its own. Invalid combinations now fail with InvalidArgument instead of being silently accepted. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
e93a551 to
38acef8
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 changed?
StartActivityExecutionnow validateson_conflict_options(chasm/lib/activity/validator.go, called fromvalidateAndPopulateStartRequestinchasm/lib/activity/frontend.go):attach_completion_callbacksis set, the request must also setattach_request_idand include at least onecompletion_callbacksentry; otherwise the request fails withInvalidArgument.attach_linksandattach_request_idremain independently valid.Added unit tests in
chasm/lib/activity/validator_test.go(nil, request-id+callbacks+callback, links-only, request-id-only → ok; callbacks-without-request-id, callbacks-flag-without-callbacks → error).Why?
On the
USE_EXISTINGconflict path,on_conflict_optionscan attach completion callbacks to the already-running activity. A completion callback is keyed to the request ID, but the request ID is only recorded on the existing execution whenattach_request_idis set — so attaching callbacks without the request ID orphans the callback, andattach_completion_callbackswith no callbacks provided is a no-op (the handler gates onattach_completion_callbacks && len(callbacks) > 0). Per review feedback, the server should reject these invalid combinations instead of silently accepting them.How did you test it?
Ran
go test ./chasm/lib/activity/and the standalone-activity functional tests locally:TestStandaloneActivityTestSuite/TestStart(coversAttachLinksOnConflictUnionsLinksand theOnConflictOptionssubtest) and.../TestCallbacksDisabledboth pass. All CI functional tests pass.Potential risks
InvalidArgument. These did nothing useful before, but any caller relying on the silent no-op behavior would now get an error.attach_links-only stays valid. An earlier stricter version rejected everything except{request_id + callbacks}and brokeAttachLinksOnConflictUnionsLinks. If links should also be restricted, that's a follow-up that changes those existing tests.AttachRequestIdis currently a no-op on the activity conflict path (no references to it inchasm/lib/activity/; the conflict block only attaches callbacks/links). With this validation in place, the handler should also record the request ID on the existing execution whenAttachRequestIdis set, mirroring the workflow path'sAddWorkflowExecutionOptionsUpdatedEvent(..., requestID, completionCallbacks, ...). Can be folded in here or as a follow-up.