Skip to content

fix(code): keep CODE_ALLOWED_TARGET_BRANCHES optional #6858

Description

@ralphbean

The code post-script already has the behavior we want when CODE_ALLOWED_TARGET_BRANCHES is unset: it discovers the repository default branch through the forge API and falls back to main. If a user sets the variable, it becomes an explicit comma-separated allowlist (or *).

Right now, the base code harness maps CODE_ALLOWED_TARGET_BRANCHES: "${CODE_ALLOWED_TARGET_BRANCHES}" into env.runner. Harness validation therefore requires the host variable before the post-script can use its unset behavior. Jira code dispatches fail with:

validating env: env.runner[CODE_ALLOWED_TARGET_BRANCHES]: host variable CODE_ALLOWED_TARGET_BRANCHES is not set

Let’s keep this configuration optional. The base harness should not require the host variable; without an override, code runs should use the repository default branch. Repositories that want a narrower or broader policy can set CODE_ALLOWED_TARGET_BRANCHES in an extending harness.

Acceptance criteria:

  • A code run succeeds without CODE_ALLOWED_TARGET_BRANCHES in the host environment.
  • An unset value uses the forge-detected default branch, with the existing main fallback.
  • An explicitly configured allowlist continues to be enforced.
  • The base harness and documentation agree about the default behavior.

Metadata

Metadata

Assignees

Labels

agent/codeCode agentbugcomponent/harnessAgent harness, config, and skills loadingpriority/highSignificant impact, address soonready-to-codeTriaged and ready for the code agenttype/bugConfirmed defect in existing behavior

Type

No type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions