temporalio / temporalio/temporal

Updater.addWorkflowTaskToMatching may be missing NotFound logging and build-ID assignment handling present in pushWorkflowTask

Open
#10,775 4 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

potential-bug
Dominant language
Go
Stars
23.2k
Forks
1.9k
Avg merge
2d 8h
Merged PRs (30d)
228

Description

Expected Behavior

When a workflow task is added to matching via
Updater.addWorkflowTaskToMatching (used by Update-with-Start's
speculative WFT path), it should behave consistently with
pushWorkflowTask (used by the transfer queue active task
executor) for the same matchingClient.AddWorkflowTask call —
specifically:

  1. Logging when matching unexpectedly returns a NotFound error
  2. Updating the workflow's assigned build ID via
    initializeWorkflowAssignedBuildId when assignment rules are in use

Actual Behavior

addWorkflowTaskToMatching (service/history/api/updateworkflow/api.go:317)
builds the same AddWorkflowTaskRequest and calls
matchingClient.AddWorkflowTask, but returns immediately on
success without:

  1. Logging if a NotFound error is unexpectedly returned
    (pushWorkflowTask logs this case explicitly, since it's
    not expected for AddTasks calls)
  2. Calling initializeWorkflowAssignedBuildId to persist the
    assigned build ID returned in the response, when
    directive.GetUseAssignmentRules() is set

A TODO comment at the call site acknowledges this code was
copied from transferQueueActiveTaskExecutor.processWorkflowTask
and should be extracted into a shared helper, but the extraction
was never completed — leaving this functional gap.

This may mean worker build-ID assignment is not tracked
correctly for workflow tasks added via the Update-with-Start
speculative WFT path, though I have not yet confirmed user-visible
impact.

Steps to Reproduce the Problem

  1. Compare service/history/api/updateworkflow/api.go:317
    (addWorkflowTaskToMatching) against
    service/history/transfer_queue_task_executor_base.go:147
    (pushWorkflowTask) — both construct the same
    AddWorkflowTaskRequest and call matchingClient.AddWorkflowTask
  2. Note that pushWorkflowTask additionally logs on NotFound
    and calls initializeWorkflowAssignedBuildId(...) on success
    when assignment rules are in use
  3. Observe that addWorkflowTaskToMatching has neither behavior,
    returning nil immediately after a successful matching call

Specifications

  • Version: present on latest main
  • Platform: any

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by comparing addWorkflowTaskToMatching in service/history/api/updateworkflow/api.go with pushWorkflowTask in service/history/transfer_queue_task_executor_base.go. Trace the matchingClient.AddWorkflowTask response and the existing initializeWorkflowAssignedBuildId call; done means the speculative WFT path handles unexpected NotFound results and assigned build IDs consistently with pushWorkflowTask.

Written by the indexing model from the issue text.

Assessment

Tech stack
go
Domain
distributed-systems
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
72/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.