A team wants Claude Code to triage failing builds automatically on a build machine with no person watching. Each run must read the build log, inspect files in the checked-out commit and write one comment, and an operations rule states that a run must never stop waiting for an interactive approval, because a stalled run holds a build agent until it times out. The team also requires that the set of tools a run may use be identical on every build agent and visible to a reviewer before it changes. How should the team set this up?
- ARun Claude Code interactively on the build agent under a service account, and have an engineer approve tool use for the first run of each day so later runs inherit that decision.
- BRun Claude Code in its non-interactive headless mode with the permitted tools defined in a committed settings.json, so each run proceeds without prompting and the permission set is reviewed like code. Correct
- CRun Claude Code interactively but grant it unrestricted tool use on the build agent, since the agent is disposable and any unwanted action is discarded when the container is destroyed.
- DRun Claude Code with the permitted tools passed as arguments from the pipeline definition on each build agent, leaving the repository configuration untouched so the pipeline owns the decision.
Why A is wrong: Tempting because a single daily approval sounds like a small burden, but an interactive run still blocks whenever a new tool is requested, which is the stall the operations rule forbids.
Why B is correct: Correct because headless operation removes the interactive prompt that would stall the agent, and holding the permissions in committed configuration makes the tool surface identical across agents and reviewable before it changes.
Why C is wrong: Tempting because a disposable container does limit lasting damage, but unrestricted tool use gives no reviewable boundary and the build log is untrusted input that can steer the run.
Why D is wrong: Tempting because pipeline definitions are often version controlled too, but the permission set then differs per pipeline and drifts between agents, which breaks the stated requirement for one identical surface.