Skip to content

Harness Field Reference

This is a living document. It is the authoritative reference for harness field classifications, merge rules, and the ForgeConfig struct. Update this document whenever you add a new field to Harness or ForgeConfig, move a field between classification tiers, or change merge semantics.

The architectural decisions behind these rules are recorded in ADR-0045 (forge-portable schema) and ADR-0088 (CEL-guarded overlays). Those ADRs are point-in-time records; this document reflects the current state.

Field classification

Harness fields are classified into two tiers based on whether they can be overridden inside forge.<platform> blocks or overlays: entries.

Fields that can appear at both levels

These fields can appear at the harness top level (as defaults) and inside ForgeConfig (forge blocks or overlay entries):

FieldRationale
pre_scriptScripts often call forge-specific CLIs (gh, glab)
post_scriptPush, PR/MR creation is forge-specific
skillsSome skills wrap forge-specific APIs
runner_envToken names and event URLs differ per forge
validation_loopValidation scripts may call forge-specific tools
policySandbox policies may need forge-specific filesystem or process rules; network access is managed via providers (ADR-0065) but non-network policy sections can still differ per forge
providersProviders may need forge-specific entries (e.g., different API endpoints per platform); concatenated (top-level + forge)
openshellOpenShell profiles may need forge-specific configuration; profiles concatenated (top-level + forge)
host_filesHost files may need forge-specific entries (e.g., different credential files per platform); deduplicated by dest path (child wins)
envEnv config (runner and sandbox sub-maps) may need forge-specific entries (e.g., different token names per forge); sub-maps merged independently, forge/child keys win (ADR-0055)

Fields that stay at top level only

These fields are platform-neutral and cannot be overridden per-forge or per-overlay:

FieldRationale
agentAgent definitions are forge-agnostic
modelModel selection is independent of forge
imageContainer images are platform-neutral
api_serversREST proxies abstract forge details
pluginsPlugin directories are forge-agnostic; each entry is a local path or a pinned URL and keeps its own env/pi options (ADR-0038, ADR-0094). Top level only — not a ForgeConfig field, so it is not settable under forge: or overlays: (a plugins: key there is ignored, not an error)
agent_inputAgent prompt input is forge-agnostic
timeout_minutesTimeouts are operational, not forge-specific
sandbox_timeout_secondsSandbox-level timeout, not forge-specific
securitySecurity scanning is forge-agnostic
allowed_remote_resourcesURL allowlist for resource fetching (ADR 0038)
descriptionDocumentation, no runtime effect
roleAgent identity is forge-agnostic
slugKept top-level; per-forge slug differences handled via base composition
baseComposition is a structural concern, not forge-specific
docDocumentation path, no runtime effect
effortEffort level is operational, not forge-specific
readonly_repoRepo access mode is forge-agnostic
allow_runtime_fetchRuntime fetch opt-in is forge-agnostic
max_runtime_fetchesFetch cap is operational, not forge-specific
triggerCEL trigger expression is evaluated against normalized events, not forge-specific (ADR-0061)

Merge and inheritance rules

When a forge block or overlay is merged into the harness top level, each field type follows specific merge semantics. The same rules apply during base: composition (base → child merging).

Two independent precedence axes govern field resolution (see #6798):

  • Specificity (within a layer): Conditional forge/overlay values override same-layer top-level values.
  • Derivation (across layers): Child-layer values override inherited base-layer values. Each base layer's forge and overlay blocks are resolved into top-level fields before merging into the child, so inherited conditional values cannot override the child's explicit settings.
Field typeMerge behaviorNil vs empty
Scalar fieldsForge/child value overrides top-level/base valueAbsent = inherit from top level / base
skillsMerged with deduplication by basename (forge/child overrides top-level/base)Absent (nil) = inherit; skills: [] = empty list merged with base (base entries are returned)
runner_envTop-level/base map merged with forge/child map; forge/child keys winAbsent (nil) = inherit; runner_env: {} = no forge-specific keys (top-level env still inherited)
validation_loopForge/child value replaces top-level/base value entirelyAbsent (nil) = inherit from top level / base; explicit empty struct = intended to mean "no validation" (see ADR-0045 open questions)
providersConcatenated (top-level/base + forge/child)Absent (nil) = inherit; providers: [] = no forge-specific additions (top-level providers still apply)
openshellprofiles concatenated (top-level/base + forge/child)Absent (nil) = inherit; empty profiles: [] = no forge-specific additions
host_filesConcatenated (base + child); deduplicated by dest path (child wins)Absent (nil) = inherit
pluginsConcatenated (base + child)Absent (nil) = inherit
api_serversConcatenated (base + child)Absent (nil) = inherit
envSub-maps (runner, sandbox) merged independently; forge/child keys win (ADR-0055)Absent (nil) = inherit
securityChild replaces base entirely (if non-nil)Absent (nil) = inherit
overlaysConcatenated (base + child); all matching entries merged at resolution with later precedence (ADR-0088)Absent (nil) = inherit

ForgeConfig struct

ForgeConfig is the shared field payload used by both legacy forge: platform blocks and current overlays: entries (via OverlayEntry's yaml:",inline" embedding). The type name is a legacy artifact from the original forge feature (ADR-0045); it was retained when ADR-0088 introduced overlays to avoid a rename-heavy migration. Both mechanisms use mergeForgeConfig to apply their fields onto harness top-level values.

go
// ForgeConfig holds platform-specific harness configuration.
// This is purely declarative YAML config — it selects which
// scripts, skills, host files, and env vars to use per platform. It is
// distinct from the forge.Client interface (internal/forge/),
// which is the runtime abstraction for forge API operations.
type ForgeConfig struct {
    PreScript      string            `yaml:"pre_script,omitempty"`
    PostScript     string            `yaml:"post_script,omitempty"`
    Policy         string            `yaml:"policy,omitempty"`
    Skills         []SkillEntry      `yaml:"skills,omitempty"`
    Providers      []string          `yaml:"providers,omitempty"`
    OpenShell      *OpenShellConfig  `yaml:"openshell,omitempty"`
    HostFiles      []HostFile        `yaml:"host_files,omitempty"`
    ValidationLoop *ValidationLoop   `yaml:"validation_loop,omitempty"`
    RunnerEnv      map[string]string `yaml:"runner_env,omitempty"`
    Env            *EnvConfig        `yaml:"env,omitempty"`
}

Current resolution pipeline

The current forge resolution pipeline is:

Unmarshal → validateForge → ResolveForge(platform) → Validate

Overlay resolution (ADR-0088)

overlays: is the successor to deprecated forge: blocks. Each overlay entry has a when: CEL expression and the same override fields as ForgeConfig. All entries whose when evaluates to true are merged in order, with later matches taking precedence over earlier matches.

Resolution pipeline

Unmarshal → validateForge → validateOverlays →
ResolveForge(platform) → ResolveOverlays(event, forgePlatform, config) → Validate

When event is nil (CLI flows without event context, such as fullsend lock or fullsend run when no event can be recovered), ResolveOverlays substitutes an empty map so overlays conditioned on runtime.forge or config can still evaluate and match. Overlays that reference event fields should use has() to guard field access (e.g., has(event.source) && event.source.system == "jira").

CEL environment

Overlay when expressions are evaluated with:

VariableTypeSource
eventnormevent.EventThe triggering event — fields like source.system, entity.kind, transition.kind
runtime.forgestringEffective forge platform (precedence: CLI flag > config.forge > CI env vars)
configmap[string]anyFull per-repo config from config.yaml

Mutual exclusion

forge: and overlays: must not coexist in the same harness (post-merge). forge: is deprecated; new harnesses should use overlays: instead.

  • ADR-0045: Forge-portable harness schema — original architectural decision (Superseded by ADR-0088)
  • ADR-0088: CEL-guarded overlays — current overlay mechanism
  • Harness Composition: Merge function checklist (step 6 references this document)
  • Issue #5579: Harness field integration pipeline (complementary checklist)