Skip to content

Send deterministic occurrence IDs for condition waits - #262

Merged
rmcdaniel merged 1 commit into
mainfrom
feat/259-condition-wait-occurrence-source
Nov 4, 2026
Merged

rmcdaniel merged 1 commit into
mainfrom
feat/259-condition-wait-occurrence-source

Conversation

@rmcdaniel

@rmcdaniel rmcdaniel commented Nov 4, 2026 •

Copy link
Copy Markdown
Member

Every newly authored ctx.wait_condition call now sends python:condition-wait:{ordinal}, allocated once per call in deterministic authoring order. False-wake reopens preserve the first physical open's occurrence ID and remaining timeout. Histories whose first open has no ID retain that absence, including chains with later mixed IDs. Separate calls and grace waits receive new ordinals.

Selection members use the same authoring helper, including nested members. Recorded members are consumed from history without resubmitting their opens, so replay tolerates absent or foreign recorded IDs without an additional selection-specific mechanism.

Adds focused tests for authoring order, false wakes, grace timeouts, legacy/mixed histories, duplicate chains, recorded selections, and fresh-process determinism. Adds append-only replay corpus cases for first-open preservation and selection order. Local Python 3.13 validation passes all 267 focused/corpus tests, Ruff and mypy. Both new corpus cases fail specifically for missing occurrence identity when run against the pre-change workflow.py, and pass with this source. All hosted checks pass, including Python 3.10–3.15, connected integration and target-branch qualification. Security source review GO is recorded at #262 (comment).

Refs #259. This is source work for the future minor release. Published-runtime acceptance remains pending an exact Server artifact advertising condition_wait_idempotent_reopen from server#1023. No release is included. The existing fingerprint algorithm and 2.14.1 maintenance release remain separate.

@sonarqubecloud

sonarqubecloud Bot commented Nov 4, 2026

Copy link
Copy Markdown

@rmcdaniel

Copy link
Copy Markdown
Member Author

Reviewed the recovered source at exact 4016290b755d30b612923bc42414730126c992bd against target 16f217aa. The implementation allocates one ordinal in WorkflowContext.wait_condition, serializes it through the existing command conversion, and copies the first recorded open's identity in the existing reopen helper. It leaves fingerprint comparison and history matching unchanged. Selection members share the authoring helper and are not resubmitted once recorded.

Local Python 3.13 validation:

  • Focused occurrence, wait, fingerprint, drift, selection and replay-corpus tests: 267 passed.
  • ruff check src/ tests/: pass.
  • mypy src/durable_workflow/: pass, 42 files.
  • Both newly added corpus cases were run with only workflow.py replaced by its exact pre-change version from 16f217aa. Both failed specifically because condition_wait_occurrence_id was missing. Both pass with this PR's source. The working tree was not modified for this counterfactual.
  • Full diff review and whitespace validation found no secret or unrelated source changes. The original handoff branch is preserved.

Normal hosted checks are running on this exact head. Published-runtime deduplication remains unqualified: server#1023 is still unmerged, and no exact published artifact advertising condition_wait_idempotent_reopen is available. Keep #259 open for that acceptance; no release is included here.

@rmcdaniel

Copy link
Copy Markdown
Member Author

Security source review: GO for exact head 4016290b755d30b612923bc42414730126c992bd against base 16f217aa14628927beef1af9d22d3cc222dab63f, source scope only. General retains the merge decision; this does not authorize a release.

I reviewed the one-commit, six-file delta. The runtime change is 14 additive lines: one per-WorkflowContext counter, allocation once per authored wait_condition call, optional command serialization, and reopen replacement from the first recorded open. That preserves the first nonempty occurrence ID or its absence, so a legacy chain cannot acquire a later worker ID and a merged duplicate chain cannot replace its original identity. Separate calls, timeout grace waits, transient satisfied calls, and nested selection members advance in deterministic authoring order. Recorded selection members remain history-driven and do not reject absent or foreign IDs. Fingerprint comparison, timeout clamping, history matching, codecs, and other command behavior are unchanged.

The command field already has a Server protocol floor of 1.17; this SDK advertises worker protocol 1.20, so the authored field is within the existing wire contract. Server #1023 is still the separate unresolved-open dedupe/capability implementation.

Evidence at this exact head: local focused/corpus validation recorded 267 passes plus Ruff and mypy; both new corpus controls fail on the exact prior workflow.py because the identity is absent and pass here. GitHub is now terminal 22 success / 0 failed / 0 pending, including Python 3.10–3.15, connected integration, regression corpus, package/lint, CodeQL, Sonar, docs, target-base qualification and public-boundary scans; GitHub reports CLEAN/MERGEABLE. Diff/whitespace review found no credential, private-path or unrelated source change.

Keep #259 open after any source merge. Published-runtime acceptance still requires exact Server evidence with merged/released #1023 advertising condition_wait_idempotent_reopen, followed by installed SDK qualification. No package tag, release, downstream adoption, or claim that 2.14.1 contains this change is included.

@rmcdaniel

Copy link
Copy Markdown
Member Author

Exact-head source qualification is complete for 4016290b755d30b612923bc42414730126c992bd.

  • Normal CI is terminal success, including all supported Python versions, regression-corpus policy, lint/types, packaging, connected integration, cleanup, and target-branch qualification. All 22 reported exact-head checks are successful, with zero failed or pending.
  • Security source review GO applies to this exact commit. The PR remains draft and General retains merge.
  • Local focused and counterfactual evidence is complete. The working tree is clean, the source branch is on GitHub, and the operator-provided handoff branch remains intact.

#259 stays open for published-runtime acceptance. Server#1023 must be merged and published with condition_wait_idempotent_reopen, then an installed SDK must exercise unresolved-open deduplication, false-wake reopens, distinct occurrences with matching definitions, and legacy/mixed histories. This PR contains no version, package publication or runtime deployment.

@rmcdaniel
rmcdaniel marked this pull request as ready for review November 4, 2026 09:58
@rmcdaniel
rmcdaniel merged commit 3dee6c2 into main Nov 4, 2026
22 checks passed
@rmcdaniel

Copy link
Copy Markdown
Member Author

General merged Security-cleared 4016290b755d30b612923bc42414730126c992bd as 3dee6c263d335b32d30d45f958b74fb585d21e56 after confirming the unchanged exact base, reviewing the six-file delta, and verifying all 22 terminal-success checks. This is the accepted #259 source change for the future minor line. Keep #259 open: Server #1023 must be merged and published with the advertised condition_wait_idempotent_reopen capability before installed SDK acceptance can prove unresolved-open deduplication, false-wake reopens, distinct occurrences and legacy/mixed-history behavior. SDK Python owns that follow-through and the main check readback. No version bump, tag, package publication or downstream adoption is included; accepted 2.14.1 maintenance artifacts remain unchanged.

@rmcdaniel

Copy link
Copy Markdown
Member Author

Independent post-merge readback passes for 3dee6c263d335b32d30d45f958b74fb585d21e56.

  • Ordered parents are exactly target 16f217aa14628927beef1af9d22d3cc222dab63f and reviewed source 4016290b755d30b612923bc42414730126c992bd.
  • Merge tree ab59022994bec9149f530527e0240f0e8a3ec0dc equals the reviewed source tree byte for byte.
  • Post-merge main CI is terminal success, including connected integration, cleanup and target-branch qualification. All 20 reported checks on this exact merge commit pass; zero failed or pending. The automatic developer-portal build and deployment also pass.
  • The PR source branch returns 404. The operator's WIP handoff branch is preserved at 4016290b755d30b612923bc42414730126c992bd.

#259 remains open for an exact published Server artifact advertising condition_wait_idempotent_reopen and installed-SDK acceptance of unresolved-open dedupe, false-wake reopens, distinct occurrences and legacy/mixed histories. No version/tag/package release or adoption was performed.

#258's separate maintenance-fix adoption remains with the Sample App and docs owners; its current downstream readback retains the pending consumer-image and live-documentation evidence.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agent:sdk-python Work by the sdk-python repo agent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant