refactor(wfutils): one body behind Execute and ExecuteWithLowPrioQueue - #451
Merged
KillerX merged 1 commit intoAug 14, 2026
Merged
Conversation
KillerX
force-pushed
the
refactor/execute-shared-body
branch
from
August 13, 2026 08:48
971252a to
e72258d
Compare
KillerX
force-pushed
the
refactor/execute-shared-body
branch
from
August 13, 2026 13:26
e72258d to
726653a
Compare
KillerX
force-pushed
the
refactor/execute-shared-body
branch
from
August 14, 2026 06:37
726653a to
61e0540
Compare
KillerX
force-pushed
the
refactor/execute-shared-body
branch
from
August 14, 2026 07:15
61e0540 to
8f1630d
Compare
KillerX
force-pushed
the
refactor/execute-shared-body
branch
from
August 14, 2026 08:16
8f1630d to
a05aed2
Compare
KillerX
force-pushed
the
refactor/execute-shared-body
branch
from
August 14, 2026 08:38
a05aed2 to
9339b07
Compare
KillerX
force-pushed
the
refactor/execute-shared-body
branch
from
August 14, 2026 08:54
9339b07 to
9307192
Compare
KillerX
force-pushed
the
refactor/execute-shared-body
branch
from
August 14, 2026 09:18
9307192 to
2129bc8
Compare
KillerX
force-pushed
the
refactor/execute-shared-body
branch
from
August 14, 2026 10:00
2129bc8 to
93ac5b2
Compare
The two differed only in the queue they pick, but each had its own copy of the scheduling code, and the copies had drifted. Two of the three divergences the audit listed are already gone — the ActivityWG bookkeeping no longer exists, and both call activityOptionsWithDefaults — leaving the duplicated retry-policy switch. Both now call executeOnQueue with a queue. Extracting it exposed a gap the duplication hid. The switch only names the worker, transcode and audio queues, so an activity on any other queue got no retry policy at all unless the workflow had set one — and low-priority is by definition a queue the switch does not name, so ExecuteWithLowPrioQueue was routing activities to exactly the case that falls through. It is latent today because both callers set GetDefaultActivityOptions, which carries a policy. retryPolicyForQueue now has a default branch: low priority and live ingest carry the same kind of work as the worker queue, so they get the same loose policy. Two details worth keeping when reading this: The low-priority remap compares against environment.QueueWorker, the constant, not GetWorkerQueue(). In debug mode the accessor returns the debug queue and the debug worker polls only that queue, so remapping there would leave the activity unscheduled. The comparison is deliberate, not an oversight. Debug mode also collapses the worker, transcode and audio accessors onto one value, which made the original a switch with three identical cases where the first won. The extracted version keeps worker first for that reason, and retryPolicyForQueueNames takes the names as arguments so a test can exercise the collapsed arrangement without the process-wide QUEUE variable that decides it — a variable read at package-var time, so t.Setenv cannot reach it. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
KillerX
force-pushed
the
refactor/execute-shared-body
branch
from
August 14, 2026 10:04
93ac5b2 to
b2f8d27
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
12/n of a stack. Base:
refactor/remove-dynamic-trigger-rpc(#450). Closes ExecuteWithLowPrioQueue has drifted from Execute.The two differed only in the queue they pick, but each had its own copy of the scheduling code and the copies had drifted. Two of the three divergences the audit listed are already gone earlier in this stack — the
ActivityWGbookkeeping no longer exists (#440) and both callactivityOptionsWithDefaults(#443) — leaving the duplicated retry-policy switch. Both now callexecuteOnQueuewith a queue.Extracting it exposed a gap the duplication hid. The switch only names the worker, transcode and audio queues, so an activity on any other queue got no retry policy at all unless the workflow set one — and low-priority is by definition a queue the switch does not name, so
ExecuteWithLowPrioQueuerouted activities to exactly the case that falls through. Latent today because both callers passGetDefaultActivityOptions, which carries a policy.retryPolicyForQueuenow has a default branch: low priority and live ingest carry the same kind of work as the worker queue, so they get the same loose policy.Two details worth keeping in mind when reading the diff, both about debug mode:
environment.QueueWorker, the constant, notGetWorkerQueue(). WithQUEUE=debugthe accessor returns the debug queue and the debug worker polls only that queue, so remapping there would leave the activity unscheduled. The asymmetry is deliberate.retryPolicyForQueueNamestakes the names as arguments so a test can exercise the collapsed arrangement — theQUEUEvariable that decides them is read at package-var time, sot.Setenvcannot reach it.Worth knowing while reviewing: the test environment here runs with
QUEUE=debug, so anything asserting on the accessors is asserting the collapsed arrangement.🤖 Generated with Claude Code