Report signal_reason when failing jobs via the Stacks API - #916
Open
walkerdb wants to merge 1 commit into
Open
Conversation
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
|
Thanks for submitting this @walkerdb. I'll be reviewing and hope to respond in a couple of days. |
isaacsu
self-requested a review
July 14, 2026 03:33
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.
Problem
When the controller fails a Buildkite job for infrastructure reasons — pod pending timeout, init container failure, podSpec rejection, image-pull failure — the job lands in Buildkite as a bare
failed/exit_status: -1with nosignal_reason.Every failure site already constructs
FailureInfo{Reason: agent.SignalReasonStackError}, butfailForK8sObjectonly forwardsfailureInfo.Message, andstacksapi.FinishJobRequesthas no field to carry a reason — soFailureInfo.Reasonis currently dead code.This appears to be a regression from the temporary-agent era (a leftover comment in
fail_job.gostill referenced connecting "the temporary agent"): an agent finishing a job could reportsignal_reason: stack_error, which is why the retry docs document matching on it and the v0.29.0 release notes advertise it for stack-level visibility. The Stacks API finish path lost it.Impact
retry: automatic: [{signal_reason: stack_error}]— the documented way to auto-retry infra failures — can't match jobs failed by this controller.exit -1) in the REST API, webhooks, EventBridge, and OpenTelemetry notification payloads, except by parsing free-text detail. (We found this while trying to build an infra-failure metric for our CI: jobs killed by pod-scheduling failures had no machine-readable marker at all.)Change
FailureInfo.ReasonthroughfailForK8sObject→AgentClient.FailJob→FinishJobRequest.SignalReason.SignalReasonStackErroron the image-pull-failure path, which previously sent no reason (it carried a// Do we have a better status code to report here?comment).Dependencies
Depends on buildkite/stacksapi#7 adding
SignalReasontoFinishJobRequest— and on the/stacks/.../finishendpoint accepting the parameter server-side. If the server already supports it, only these client changes are needed; if not, please treat the pair of PRs as the feature request. The go.mod bump is intentionally omitted until stacksapi tags a release containing #7.Testing
go build ./...andgo test ./internal/controller/scheduler/...pass with a localreplacepointing at the stacksapi branch.🤖 Generated with Claude Code