# CI and Runner Boundary

**Status:** Approved target-state baseline  
**Substrate:** I0/I1  
**Full product activation:** I5

## Target State

GitHub Actions is the initial CI execution provider. Actions Runner Controller (ARC) manages ephemeral runner infrastructure on K3s. AWP owns CI intent, correlation, required evidence, progression and operator UX.

```text
ChangeSet / policy
      ↓
AWP CIExecution / Verification intent
      ↓ CIProvider
GitHub Actions workflow/job execution
      ↓
ARC listener/scale set -> ephemeral runner pod
      ↓
normalized CIResult / VerificationEvidence
      ↓
AWP gate/progression
```

## Invariants From Day 1

- ARC is runner infrastructure, not the CI product model;
- project `.github/workflows/*` remain project-owned source definitions;
- runners are ephemeral by default and treated as untrusted execution workloads;
- runners have no reusable Git publication/control-plane credentials;
- fork/untrusted jobs receive no protected secrets;
- trust/privilege differences use separate runner profiles/scale sets rather than one broad privileged pool;
- AWP correlates provider check/workflow IDs to Project/ChangeSet/CIExecution without using provider ID as AWP identity;
- MergeGate consumes actual provider/check results plus AWP evidence/review state;
- direct workspace checks are preflight/ad-hoc evidence, not a replacement for declared CI provider execution.

## I1 Thin Evidence Boundary

I1 deliberately does not implement the I5 CI planner/optimizer. It needs:

```text
focused task/change verification
+ repository-required GitHub checks if configured
+ normalized check/result references
+ Review disposition
+ ChangeSet fidelity/base verification
= trusted MergeGate input
```

This thin evidence identity is a valid subset of the final `VerificationEvidence`/`CIExecution` model.

## I5 Full CI Control Plane

I5 adds:

- change classification;
- dependency/capability mapping;
- required `CIInvariant` selection;
- CIExecutionPlan;
- VerificationAuthority admission/evidence invalidation;
- CI provider dispatch/reconciliation;
- result normalization;
- resolver/optimizer;
- compatibility gates at declared stable boundaries;
- rich operator history/why-ran/why-blocked UX.

## Runner Trust Profiles

At least:

```text
untrusted/general
trusted-internal
privileged-build (only if required)
```

Each profile defines namespaces, ServiceAccount, secret eligibility, runtime class, network/storage access and resource limits. gVisor is preferred where compatible.

## Required Check Reconciliation

AWP policy must reconcile with actual GitHub branch protection/required checks. It cannot mark a ChangeSet green because its internal plan forgot a provider-required check.

## Flakiness and Retry

Retry is evidence, not automatic erasure. Repeated pass-after-fail results remain visible and may trigger flaky-check classification/resolver policy in I5.

## Increment Realization

| Increment | CI realization |
|---|---|
| I0 | GitHub Actions/ARC provider and trust substrate, repository architecture checks. |
| I1 | consume required checks/focused evidence for MergeGate. |
| I5 | full CI/VerificationAuthority product semantics. |
| I6 | release/deployment gates consume verified artifact/change evidence. |
| I9 | external API/tenant/enterprise CI policy hardening. |

## Current Implementation State

Provider selection and runner boundary are ratified; workflows/ARC resources are implemented with I0/I1.

## Deferred Realization

Other CI providers are adapters; no bespoke CI executor is built. Full change-impact optimization waits for I5.

## Temporary Dogfood Behavior

AWP itself may initially have a small required-check set. The MergeGate must consume real results and cannot fabricate a green receipt.

## Decisions / ADRs

See ADR 0007 and Verification specs. Changing CI provider is an adapter/Decision change, not a reason to change AWP CI identity.