Skip to content

Keep flag 2 out of runs that use flag 4 - #2194

Merged
VegetarianOrc merged 2 commits into
amazzeo/workflow-wait-condition-cancellationfrom
alexmazzeo/sdk-606-flag-4-keep-flag-2-out-of-runs-whose
Dec 3, 2026
Merged

VegetarianOrc merged 2 commits into
amazzeo/workflow-wait-condition-cancellationfrom
alexmazzeo/sdk-606-flag-4-keep-flag-2-out-of-runs-whose

Conversation

@VegetarianOrc

@VegetarianOrc VegetarianOrc commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

What was changed

_activate now checks flag 4 first, unless history holds flag 2, and checks flag 2 last:

  • A run whose history holds flag 4 never records flag 2, even on a worker with flag 2 as a default.
  • A new run on a worker with both flags as defaults records flag 4.
  • A run whose history holds flag 2 keeps flag 2 and never records flag 4.

Why?

Before, the worker checked flag 2 first. A worker with flag 2 as a default recorded flag 2 on a run whose history held flag 4, and the run changed to flag 2 behavior. Replay stayed deterministic, and only the private test hook can make flag 2 a default today, so this change is defensive.

Checklist

  1. Refs SDK-606. Stacked on Add activation batching flag with task-local cancellation #2149.

  2. How was this tested:

    • A review checked all 32 combinations of history flags, worker defaults and replay. Every replay chooses the same behavior as before.
    • test_workflow_logic_flag_kept_after_worker_flags_change (renamed in Add missing flag 4 tests #2195): the first task records flag 4 or flag 2, and later tasks run on a worker with both flags. With the old order, the flag 4 case returns the wrong result and records both flags.
    • test_workflow_shielded_wait_condition_after_cancel now compares the full set of recorded flags.
    • poe lint passed.
  3. Any docs updates needed? No. Users cannot see the change in this release.

🤖 Generated with Claude Code

@VegetarianOrc
VegetarianOrc added this pull request to stack #2196 December 2, 2026 23:39
@VegetarianOrc VegetarianOrc changed the title alexmazzeo/sdk 606 flag 4 keep flag 2 out of runs whose Keep flag 2 out of runs that use flag 4 Dec 2, 2026
@VegetarianOrc
VegetarianOrc force-pushed the alexmazzeo/sdk-606-flag-4-keep-flag-2-out-of-runs-whose branch 2 times, most recently from 6027b7f to 99546d5 Compare December 3, 2026 00:13
@VegetarianOrc
VegetarianOrc removed this pull request from stack #2196 December 3, 2026 00:18
@VegetarianOrc
VegetarianOrc added this pull request to stack #2197 December 3, 2026 00:18
VegetarianOrc and others added 2 commits December 2, 2026 16:20
The worker checked flag 2 before flag 4. A worker with flag 2 as a
default then recorded flag 2 on a run whose history holds flag 4, and
the run changed to flag 2 behavior. Check flag 4 first when history
does not hold flag 2, and check flag 2 last. A new run on a worker
with both flags as defaults now records flag 4.

Refs SDK-606.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Address review findings on the flag precedence tests:
- Start the handler wait on the second worker, so the result shows
  which flag the run uses.
- Compare the full set of recorded flags.
- Set both flags explicitly on each worker.
- Remove cases that run the same code path.

Refs SDK-606.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@VegetarianOrc
VegetarianOrc force-pushed the alexmazzeo/sdk-606-flag-4-keep-flag-2-out-of-runs-whose branch from 99546d5 to bfae0e5 Compare December 3, 2026 00:22
Base automatically changed from alexmazzeo/sdk-605-flag-4-add-the-missing-behavior-changes to main December 3, 2026 00:37
@VegetarianOrc
VegetarianOrc removed this pull request from stack #2197 December 3, 2026 00:37
@VegetarianOrc
VegetarianOrc changed the base branch from main to amazzeo/workflow-wait-condition-cancellation December 3, 2026 00:37
@VegetarianOrc
VegetarianOrc added this pull request to stack #2199 December 3, 2026 00:37
@VegetarianOrc
VegetarianOrc merged commit bfae0e5 into main Dec 3, 2026
20 of 21 checks passed
@VegetarianOrc
VegetarianOrc deleted the alexmazzeo/sdk-606-flag-4-keep-flag-2-out-of-runs-whose branch December 3, 2026 00:47
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