Skip to content

Ignore a job's agent error opt-in when the agent protects it - #4524

Merged
123sarahj123 merged 1 commit into
mainfrom
capture-agent-errors-protected-opt-in
Oct 16, 2026
Merged

123sarahj123 merged 1 commit into
mainfrom
capture-agent-errors-protected-opt-in

Conversation

@123sarahj123

Copy link
Copy Markdown
Contributor

Description

With --protected-environment-variables (or --protect-dangerous-git-environment-variables) matching BUILDKITE_CAPTURE_AGENT_ERRORS, the bootstrap drops the job's value and uses the agent's own. The job runner, which reports refused jobs and Kubernetes container failures directly, read the job's value anyway. A job could therefore turn on (or off) the job runner's reports when the agent had protected the opt-in, and the two could disagree about whether the job opted in.

The job runner now falls back to the agent's value for a protected name, the same way the bootstrap does.

The opt-in is new and unreleased, so this fixes it before it ships in v4.6.0 (#4523).

Changes

  • agentErrorCaptureEnabled ignores the job's value when the name is protected.
  • Two test cases, which fail without the change: a job opting in on an agent that protects the opt-in, and a job opting out on an agent that protects an opt-in it set.

Testing

  • Tests have run locally (with go test ./agent/...). Buildkite employees may check this if the pipeline has run automatically.
  • Code is formatted (with go tool gofumpt -extra -w .)

Disclosures / Credits

Written with Amp.

createEnvironment drops a job-supplied value for a name matched by
--protected-environment-variables, so bootstrap reads the agent's own
BUILDKITE_CAPTURE_AGENT_ERRORS. The job runner read the job's value
anyway, so its direct reports could disagree with bootstrap about
whether the job opted in. Fall back to the agent's value for a protected
name too.

Amp-Thread-ID: https://ampcode.com/threads/T-48370e54-5702-4610-a9d5-18b0dd17d98d
Co-authored-by: Amp <amp@ampcode.com>
@123sarahj123
123sarahj123 requested review from a team as code owners October 16, 2026 01:27
@123sarahj123 123sarahj123 added the internal Non-user facing, internal change. label Oct 16, 2026
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 16, 2026 •

Copy link
Copy Markdown

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-16T01:29:28.174069Z 49d0e44 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@123sarahj123
123sarahj123 merged commit 0e76785 into main Oct 16, 2026
5 checks passed
@123sarahj123
123sarahj123 deleted the capture-agent-errors-protected-opt-in branch October 16, 2026 02:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

internal Non-user facing, internal change.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant