Skip to content

Add SignalReason to FinishJobRequest - #7

Open
walkerdb wants to merge 1 commit into
buildkite:mainfrom
walkerdb:add-signal-reason-to-finish-job
Open

Add SignalReason to FinishJobRequest#7
walkerdb wants to merge 1 commit into
buildkite:mainfrom
walkerdb:add-signal-reason-to-finish-job

Conversation

@walkerdb

@walkerdb walkerdb commented Jul 13, 2026

Copy link
Copy Markdown

Problem

Stacks (e.g. agent-stack-k8s) fail jobs via POST /stacks/{key}/jobs/{uuid}/finish, but FinishJobRequest only carries exit_status and detail. That means stack-terminated jobs land in Buildkite with no machine-readable signal_reason, so:

  • retry: automatic: [{signal_reason: stack_error}] — the documented way to auto-retry infrastructure failures — can't match jobs failed through this API.
  • API/webhook/EventBridge/OpenTelemetry consumers can't distinguish "the stack failed to provision this job" (pod pending timeout, image pull failure, podSpec rejection) from an ordinary lost agent: both surface as failed / exit_status: -1.

Temporary-agent-based stacks used to set signal_reason: stack_error when acquiring and failing a job; the Stacks API finish path dropped that capability. agent-stack-k8s still computes the reason at every failure site (FailureInfo{Reason: agent.SignalReasonStackError}) but has nowhere to send it.

Change

Adds an optional SignalReason field (json:"signal_reason,omitempty") to FinishJobRequest — backward-compatible, omitted when unset.

If the server-side /finish endpoint doesn't yet accept this parameter, please treat this PR as the feature request for it.

Companion PR: buildkite/agent-stack-k8s#916 plumbs the already-computed reason through the controller.

Testing

go test ./... passes; the round-trip is asserted in TestFinishJob.

🤖 Generated with Claude Code

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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