Skip to content

Go SDK: fail a task whose return-value XCom push fails - #75443

Merged
jason810496 merged 3 commits into
apache:mainfrom
jason810496:go-sdk-beta-final-nits
Oct 23, 2026
Merged

jason810496 merged 3 commits into
apache:mainfrom
jason810496:go-sdk-beta-final-nits

Conversation

@jason810496

@jason810496 jason810496 commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

Final nit before the Go SDK beta release.

A failed return-value XCom push no longer leaves the task successful

The return-value push logged the error and returned nothing, so the task finished successful
and its downstream tasks failed later with XComNotFound. It now returns the
error and fails the task.

A task whose function already returned an error also stops pushing its result:
that result is the zero value, not one the task produced. The branch path
already worked this way.

The guide's labelled-edge example did not compile

Label takes only the text, and On names the tasks its edges reach.

// before
loaded.Before(airflow.Label(cleaned, "done"))

// after
loaded.Before(airflow.Label("done").On(cleaned))

Was generative AI tooling used to co-author this PR?
  • Yes (please specify the tool below)

Generated-by: Claude Code (Opus 5.5) following the guidelines

… doc

A failed return-value push was logged and the task was left successful, so the
downstream tasks that read it failed later with XComNotFound. Fail the task
instead, and stop pushing a result the task never produced when its function
already returned an error, as the branch path does.

The guide's labelled-edge example did not compile: Label takes only the text,
and On names the tasks its edges reach.

Co-Authored-By: Claude <noreply@anthropic.com>
@jason810496 jason810496 self-assigned this Oct 23, 2026
@jason810496 jason810496 added the backport-to-v3-4-test Backport to v3-4-test label Oct 23, 2026
@jason810496 jason810496 added this to the Airflow 3.4.0 milestone Oct 23, 2026
@jason810496
jason810496 marked this pull request as ready for review October 23, 2026 06:27
Comment thread go-sdk/internal/bundle/task.go Outdated
Comment thread go-sdk/internal/bundle/task.go Outdated
Comment thread go-sdk/internal/bundle/task.go Outdated
Comment thread go-sdk/internal/bundle/task_test.go Outdated
Comment thread go-sdk/internal/bundle/task_test.go Outdated
Comment thread go-sdk/internal/bundle/task_test.go Outdated
Comment thread go-sdk/internal/bundle/task.go Outdated
Comment thread go-sdk/internal/bundle/task.go Outdated
Comment thread go-sdk/internal/bundle/task_test.go Outdated
Push the task instance from the runtime context as is, share its lookup
with startBranch, and cover the failed push on the branch path. Merge the
copied test helper into runTask.

Co-Authored-By: Claude <noreply@anthropic.com>
@jason810496
jason810496 requested a review from uranusjr October 23, 2026 09:08
Comment thread go-sdk/internal/bundle/task.go
Only the branch path covered this check, and a nil pointer that slipped
past it would be pushed as null now that a push can fail the task.

Co-Authored-By: Claude <noreply@anthropic.com>
@jason810496
jason810496 requested a review from phanikumv October 23, 2026 11:01
@jason810496
jason810496 merged commit 1a50a18 into apache:main Oct 23, 2026
79 checks passed
@jason810496
jason810496 deleted the go-sdk-beta-final-nits branch October 23, 2026 13:40
@github-actions

Copy link
Copy Markdown
Contributor

Backport successfully created: v3-4-test

Note: As of Merging PRs targeted for Airflow 3.X
the committer who merges the PR is responsible for backporting the PRs that are bug fixes (generally speaking) to the maintenance branches.

In matter of doubt please ask in #release-management Slack channel.

Status Branch Result
✅ v3-4-test PR Link

jason810496 added a commit that referenced this pull request Oct 23, 2026
…75443) (#75476)

* Go SDK: fail a task whose return-value XCom push fails, fix the Label doc

A failed return-value push was logged and the task was left successful, so the
downstream tasks that read it failed later with XComNotFound. Fail the task
instead, and stop pushing a result the task never produced when its function
already returned an error, as the branch path does.

The guide's labelled-edge example did not compile: Label takes only the text,
and On names the tasks its edges reach.

* Go SDK: address review on the return-value XCom push

Push the task instance from the runtime context as is, share its lookup
with startBranch, and cover the failed push on the branch path. Merge the
copied test helper into runTask.

* Go SDK: test that a task pushes no nil-pointer return value

Only the branch path covered this check, and a nil pointer that slipped
past it would be pushed as null now that a push can fail the task.

---------
(cherry picked from commit 1a50a18)

Co-authored-by: Jason(Zhe-You) Liu <68415893+jason810496@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants