Skip to content

A duplicate start() takes the holder's handle from DBOS - #319

Merged
czpython merged 1 commit into
mainfrom
commonzenpython/eng-875-start-hands-back-the-live-run-via-return-existing
Aug 24, 2026
Merged

A duplicate start() takes the holder's handle from DBOS#319
czpython merged 1 commit into
mainfrom
commonzenpython/eng-875-start-hands-back-the-live-run-via-return-existing

Conversation

@czpython

Copy link
Copy Markdown
Owner

Workflow.start() claims a subject's run slot with DBOS queue deduplication. The collision arm hand-rolled what DBOS 2.30 now does natively: it caught DBOSQueueDeduplicatedError, looked the holder up through private API (_get_dbos_instance()._sys_db.get_deduplicated_workflow), and recursed into start() when the holder reached terminal between the rejection and the lookup.

With duplication_policy="return-existing" on the enqueue, a held slot returns the holder's handle instead of raising, and DBOS retries the terminal race internally (_core.py, the init_workflow loop). A fresh enqueue is handle.workflow_id == workflow_id — the minted id — and keeps its row creation and SCHEDULED event; a duplicate returns the holder's id bare, same as before.

Net: the private _sys_db reach, the exception import, and the recursion are gone; behavior is unchanged and the existing dedup tests (test_duplicate_start_returns_the_live_run, test_duplicate_start_shares_the_run_across_accounts, test_failed_enqueue_claims_no_slot) pin it end to end.

The dedup collision arm caught DBOSQueueDeduplicatedError, looked the
holder up through private API, and recursed when the holder reached
terminal between the rejection and the lookup. DBOS 2.30's
return-existing duplication policy does all three natively: on a held
slot the enqueue returns the holder's handle, with the terminal race
retried inside DBOS.
@czpython
czpython merged commit 8932006 into main Aug 24, 2026
1 check passed
@czpython
czpython deleted the commonzenpython/eng-875-start-hands-back-the-live-run-via-return-existing branch August 24, 2026 10:26
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.

1 participant