Skip to content

fix: report workflow and update compensation independently - #394

Open
jw-ond wants to merge 1 commit into
temporalio:mainfrom
jw-ond:codex/fix-workflow-compensation-state
Open

jw-ond wants to merge 1 commit into
temporalio:mainfrom
jw-ond:codex/fix-workflow-compensation-state

Conversation

@jw-ond

@jw-ond jw-ond commented Oct 15, 2026

Copy link
Copy Markdown

What was changed

Remove the update-compensation flag assignment from workflow_compensation().
run() already sets the workflow-compensation flag after that activity finishes;
the update flag should only change after update compensation.

Add workflow-only and update-only compensation regressions, and compare the
query flags with the compensation activities scheduled/completed in the real
Temporal history. The existing both/neither paths use the same assertions.

Why?

Cancelling this sample before sending any update reports
update_compensation_done() == True, even though the server history contains no
update-compensation activity. The existing tests did not distinguish this from
the case where both compensations actually ran.

This is a one-line sample state fix, not a change to activity execution,
compensation ordering, retries or the SDK.

How was this tested?

  • On unchanged source, the new native-server regression fails with the incorrect
    update flag: 1 failed, 4 passed.
  • With the fix, all 5 compensation tests pass against the real local Temporal
    server; repeating this group three times yields 15 passes.
  • The related native message-passing and selected hello sample run passes 20
    tests. This is not a claim that every sample/integration in the repository ran.
  • Scoped Ruff import checks, Ruff formatting, mypy and git diff --check pass.
uv sync --locked --python 3.11
uv run pytest -q tests/message_passing/waiting_for_handlers_and_compensation --workflow-environment local

Tested with Python 3.11.15, Temporal Python SDK 1.33.0 and the local server version
selected by this repository's test fixture. No external Temporal service or
application side effects were used. No documentation/API change is needed.

AI assistance was used to trace the issue, write the tests/fix, execute checks,
and prepare this description. The complete patch and reproduction are provided
for review; no claim of prior human review or upstream acceptance is made.

@jw-ond
jw-ond requested a review from a team as a code owner October 15, 2026 23:59
@CLAassistant

CLAassistant commented Oct 15, 2026 •

Copy link
Copy Markdown

CLA assistant check
All committers have signed the CLA.

@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you sign our Contributor License Agreement before we can accept your contribution.
You have signed the CLA already but the status is still pending? Let us recheck it.

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.

2 participants