Repository navigation
temporal: Support use_existing option for start_workflow - #6
Merged
Merged
Conversation
kstewartfigma
marked this pull request as ready for review
October 30, 2026 23:00
kstewartfigma
requested review from
a team and
kahlstrom-figma
and removed request for
a team
October 30, 2026 23:01
|
Nice. I think we can remove the ignore_already_started_failure start_workflow options now? |
yfang-figma
approved these changes
Nov 2, 2026
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Reviewed by Cursor Bugbot for commit 948c5c1. Configure here.
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.

Written by AI
Description
An ordinary
Temporal.start_workflowcall with a workflow ID that is already running can opt intoworkflow_id_conflict_policy: :use_existing. The call returns that execution's actual run ID. It does not start another execution or deliver the second call's input. Without the option, duplicate starts continue to raiseTemporal::WorkflowExecutionAlreadyStartedFailure.Changes
make proto.:use_existingand explicit:failfor ordinary starts. Keep the closed-runworkflow_id_reuse_policyseparate and reject its incompatible:terminate_if_runningvalue when a conflict policy is specified.schedule_workflow, andTemporal::Testing.local!, where this path cannot honor it.First-party SDK coverage parity
Pinned reference:
temporalio/sdk-rubyat2169e3e0dc2b4f59dbf9cc93205e19c2c01a037e.USE_EXISTINGreturns the current run handle and original resultexamples/spec/integration/start_workflow_spec.rb: same run ID, original start input in history, and result after signaling the original workflow.client_spec.rbchecks the returned server run ID.grpc_spec.rbchecks extraction of the duplicate run ID.:allow_failedwith:use_existing; another case checks:rejectand:allowafter termination.USE_EXISTINGaddition. The fork's existing:terminate_if_runningreuse-policy test remains in place.The first-party Ruby client sets the request field directly and uses the server response's run ID; this path does not delegate conflict handling to Core. Its Update-With-Start handler cases exercise a separate API.
November 17 merge validation
Merged master
cc03140(official-SDK protobuf coexistence) into this branch. The generation pipeline retains both the conflict-policy backport and coexistence guards; the backport also honorsPROTO_OUT.make prototwice exactly reproduces the generated files; a separate output directory matcheslib/genand leaves checked-in files unchanged.USE_EXISTING; only that newly tagged case is excluded from the legacy run. The aggregatetest_examplescheck requires both configurations to pass.Local validation limitation: the legacy matrix ran 92 examples with two search-attribute failures. The same two fail from the already-green SDK #7 branch against that local server; they are not isolated to this merge. The subsequent clean hosted run passed the legacy and modern example jobs, their aggregate check, the unit suite, and the coexistence suite on
948c5c1. The earlier full modern-server run exposed unrelated search-attribute/namespace expectations, so those tests retain their existing legacy-server coverage.Test Plan
Validated on October 19, 2026 against this PR's then-current head,
6140c92efc089265e2c71d29f241be2061063323, and base8dd84b3bf3255b595cbabd93e128d9fe1121c50b, in an authenticated Coder devbox (Linux x86_64, Ruby 3.4.7):examples/spec/integration/start_workflow_spec.rbagainst Temporal Server 1.32.0 (CLI 1.9.1): 6 examples, 0 failures. Verified that a running duplicate with:use_existingreturns the original actual run ID, retains the original start input, and produces the original workflow's signal result. Also verified default duplicate rejection, closed-run reuse policies, and existing:terminate_if_runningbehavior.make protoran twice successfully against pinned submoduleae312b0724003957b96fb966e3fe25a02abaade4. Both runs exactly reproduced the committed generated files, with no generated diff. This Linux validation resolves the earlier macOS tool-execution blocker.git diff --checkpassed and the tracked checkout remained clean.On November 2, the six ordinary-start integration cases passed again against Temporal Server 1.32.0 while validating the Update-With-Start follow-up (#8), stacked on this exact parent revision.
Rerun
With the repository's dependencies and pinned proto submodule installed:
bundle exec rspec spec/unit/lib/temporal/client_spec.rb spec/unit/lib/temporal/grpc_spec.rb spec/unit/lib/temporal/testing/temporal_override_spec.rb make proto make proto git diff --exit-code -- lib/genFor live validation, start a local Temporal dev server on port 17233 and run the example worker and specs from
examples/withTEMPORAL_HOST=127.0.0.1,TEMPORAL_PORT=17233,TEMPORAL_NAMESPACE=default, andTEMPORAL_TASK_QUEUE=sdk-validation-pr6:Limits
The October/November 2 results above were manual validation. The current November 17 revision also has automated unit, official-SDK coexistence, and legacy/conflict-policy integration checks in GitHub Actions, all passing. Live validation covered Server 1.32.0, not production deployment, mixed-version rollout, or every conflict policy. The seven baseline unit failures remain unresolved.
November 17 review follow-up
Clean Linux protobuf generation against current head
948c5c1and the pinned proto submodule passed twice using grpc-tools 1.85.0 (protoc 35.1); both outputs exactly matchlib/gen. The Bugbot regeneration report was not reproducible: RubyString#scanwith a String argument performs literal matching, and this compiler emits the expected escaped descriptor bytes. The thread is resolved without changing the generator.The monorepo's
ignore_already_started_failurewrapper still serves consumers on the older SDK and returns a skipped-run sentinel. AdoptingUSE_EXISTINGchanges that return contract to an actual run ID, so removal belongs with a separately validated caller migration after this SDK is adopted.