Skip to content

fix(workflows): scope wait, timer, and join replay markers to claim epoch (#760) - #780

Merged
rcbevans merged 2 commits into
mainfrom
fix/760-snooze-wait-cursors
Nov 26, 2026
Merged

rcbevans merged 2 commits into
mainfrom
fix/760-snooze-wait-cursors

Conversation

@rcbevans

Copy link
Copy Markdown
Contributor

What changed

Scopes wait, timer, and child-join replay markers to the executing claim_epoch so a node re-claimed at a refunded attempt ordinal (after Snooze or a non-consuming deferral) does not inherit a replay marker written by an earlier execution and re-hold on an already-answered wait, fired timer, or expired join.

  • Claim-scoped replay markers (src/taskq/workflows/api/_ctx_wait.py, _ctx_timer.py, _childflow.py):
    • Added shared read_claim_marker / write_claim_marker helpers storing {epoch, ...} under a new per-attempt key family so rows stamped by older releases read as no marker and older workers never attempt an integer cast on a JSON object.
    • Forward-only epoch write guard prevents a body whose lease lapsed from resetting the active claim's cursor.
    • Refuses non-positive claim_epoch at replay-consuming sites while preserving reassert_hold's standing-hold re-entry contract.
  • Docs & pins: Updated wait/timer/join docstrings, docs/guides/workflows.md, and docs/api-reference/workflows.md W5, and added tests/test_wf_snooze_wait_cursors_pins.py (20 integration tests covering both non-consuming deferral forms across all three sites, direct and fleet execution, loop bodies, and zero-epoch refusals).

Verification

  • .venv/bin/pytest tests/test_wf_snooze_wait_cursors_pins.py -q: 20 passed
  • .venv/bin/pytest tests/test_docs_pins.py -q: 9 passed
  • .venv/bin/ruff check, .venv/bin/ruff format --check, .venv/bin/pyright on changed files: 0 errors, 0 warnings

Closes #760

@rcbevans
rcbevans requested a review from XBeg9 November 26, 2026 00:32
@rcbevans
rcbevans force-pushed the fix/760-snooze-wait-cursors branch from 306b69f to e0fbbb9 Compare November 26, 2026 06:29
@rcbevans
rcbevans merged commit f2a00af into main Nov 26, 2026
54 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

1 participant