Set last hook exit status for unwrapped hooks - #4286
Open
francoiscampbell wants to merge 3 commits into
Open
Conversation
francoiscampbell
marked this pull request as draft
August 28, 2026 20:52
Contributor
Author
|
Could a maintainer please add the |
francoiscampbell
marked this pull request as ready for review
August 28, 2026 21:13
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.
Description
Unwrapped hooks (non-shell scripts and binaries) currently do not update
BUILDKITE_LAST_HOOK_EXIT_STATUS. This differs from wrapped shell hooks and can leave the variable unset or stale for subsequent hooks, even when the unwrapped hook succeeded.Set the variable from the unwrapped process result so later hooks observe the same exit-status behavior regardless of hook type.
Context
This surfaced after converting a plugin command hook from Bash to Python. Its pre-exit hook used
BUILDKITE_LAST_HOOK_EXIT_STATUSto report the command result, but the value was no longer populated after the successful Python hook.Changes
BUILDKITE_LAST_HOOK_EXIT_STATUSafter running an unwrapped hook, using the sameshell.ExitCodeconversion as wrapped hooks.Testing
go test ./...). Buildkite employees may check this if the pipeline has run automatically.go tool gofumpt -extra -w .)Passed:
Affiliation (optional, external contributors)
Instacart
Disclosures / Credits
OpenAI Codex via Pi helped diagnose the behaviour, implement the change, and write the regression test. The PR was then reviewed and refined by a human.