Skip to content

Commit dd15bed

Browse files
authored
Merge pull request #406 from githubnext/codex/install-evergreen
Install Evergreen agentic workflow
2 parents ff7cbdb + de8d899 commit dd15bed

32 files changed

Lines changed: 3243 additions & 0 deletions

.github/workflows/evergreen.lock.yml

Lines changed: 2194 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.github/workflows/evergreen.md

Lines changed: 482 additions & 0 deletions
Large diffs are not rendered by default.
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
# Evergreen CI Activation Policy
2+
3+
Use existing CI as the source of truth. Readiness requires configured gates to
4+
pass on the current PR head in GitHub.
5+
6+
Default order:
7+
8+
1. Wait for pending checks.
9+
2. Rerun failed or stale checks when supported and allowed.
10+
3. Dispatch configured workflows when allowed.
11+
4. Use an empty trigger commit only when repo policy requires a push event and
12+
the configured token may push to the PR branch.
13+
14+
Do not rerun green checks. Do not count empty trigger commits as semantic repair
15+
attempts.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Evergreen Labels
2+
3+
Default labels:
4+
5+
| Label | Owner | Meaning |
6+
| --- | --- | --- |
7+
| `evergreen` | Human | Persistent opt-in for greenkeeping work. |
8+
| `evergreen-ready` | Deterministic controller | Configured gates pass for the current PR head. |
9+
| `evergreen-blocked` | Orchestrator | A blocker exists, but future work may still be useful. |
10+
| `evergreen-human-needed` | Orchestrator | A human decision, credential, review, or protected edit is needed. |
11+
| `evergreen-exhausted` | Orchestrator | Per-PR quota is exhausted. |
12+
13+
Update labels only when underlying state changes.
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
# Evergreen Memory Policy
2+
3+
Memory is for future-useful facts, not run logs.
4+
5+
Store:
6+
7+
- merge gates and branch protection expectations
8+
- label meanings
9+
- CI failure signatures
10+
- known flaky checks and rerun policy
11+
- reusable accepted fixes
12+
- review patterns that affect mergeability
13+
- skill outcomes
14+
- velocity metrics
15+
- per-PR blockers and attempts to avoid
16+
17+
Do not store secrets, raw logs, large diffs, or stale speculation. Write small,
18+
structured, source-aware entries.
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
# Evergreen Orchestrator Policy
2+
3+
The orchestrator removes merge blockers; it does not perform general code
4+
review. The deterministic readiness controller owns readiness state. The
5+
orchestrator may repair, wait, report blockers, request human input, update
6+
non-ready state labels, write memory, dispatch workflows, and push to the PR
7+
branch only when the installed repo policy allows those actions.
8+
9+
Order work by current evidence:
10+
11+
1. Trust and label eligibility.
12+
2. Current-head gate state.
13+
3. Branch freshness or merge conflicts.
14+
4. Deterministic commands.
15+
5. Targeted repair skills.
16+
6. Safe output verification.
17+
7. Memory and concise reporting.
18+
19+
Stop rather than improvising when a gate depends on a human-owned decision,
20+
credential, protected edit, ambiguous policy, or repeated failure signature.
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
# Evergreen Quota Policy
2+
3+
Quota is per PR and per continuous application of the opt-in label.
4+
5+
Quota starts when the label is applied, continues across runs while the label
6+
remains, and stops when the PR becomes ready, the label is removed, or exhausted
7+
state is reached. New commits do not reset quota by themselves.
8+
9+
On exhaustion:
10+
11+
1. Stop work immediately.
12+
2. Request removal of the opt-in label.
13+
3. Request addition of the exhausted label.
14+
4. Leave one terse comment.
15+
5. Record future-useful memory.
16+
17+
Hard-cap errors from the AI engine are terminal for the current quota window.
Lines changed: 178 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,178 @@
1+
# Evergreen Repo Policy
2+
3+
Confirmed install-time decisions for `githubnext/tsessebe`. The deterministic
4+
readiness controller and the agentic orchestrator must both respect this file.
5+
6+
## Merge Gates
7+
8+
- Required checks: none are enforced by branch protection (`main` is not
9+
protected). The following CI checks are treated as configured merge gates:
10+
- `Test & Lint`
11+
- `Playground E2E (Playwright)`
12+
- `Build`
13+
- `Validate Python Examples`
14+
- Non-required checks treated as gates: the four checks above.
15+
- Not a gate: `OpenEvolve benchmark` — it runs only on `autoloop/*-evolve` PRs,
16+
reports `neutral` when there is no fitness, and is not a mergeability blocker.
17+
- Review requirements: none required (no branch protection, no required reviews).
18+
- CODEOWNERS requirements: none.
19+
- Unresolved thread policy: not a merge gate. Do not chase review threads.
20+
- Draft PR policy: do not mark drafts ready for review. Monitor only.
21+
- Required labels: `evergreen` opts a PR into the work loop.
22+
- Blocker labels: `evergreen-blocked`, `evergreen-human-needed`.
23+
- Deployment/environment gates: none.
24+
- Auto-merge behavior: GitHub auto-merge is ENABLED on the repository. Evergreen
25+
never merges directly, but by making the configured gates pass it can
26+
indirectly cause a PR with auto-merge armed to merge. This is accepted by the
27+
repository owner.
28+
29+
## Readiness Controller
30+
31+
- Ready label: `evergreen-ready`.
32+
- Controller owns ready label: yes.
33+
- Add ready label only when: all four configured gate checks report success for
34+
the current PR head SHA, there are no pending/failing checks, and the merge
35+
state is not dirty/conflicted.
36+
- Remove ready label when: the controller state is anything other than `ready`
37+
(new head SHA, pending, failing, missing check, conflict, out of scope).
38+
- Current-head SHA policy: readiness is evaluated only against the current PR
39+
head SHA. A new push invalidates prior readiness.
40+
- Pending check policy: `waiting` — do not repair pending or in-progress checks.
41+
- Missing/stale check policy: `needs_ci` — reactivate the latest `CI` run for the
42+
head SHA once (see CI/CD Activation). Never rerun green checks.
43+
- Branch freshness ready criterion: not required to be up to date with `main`;
44+
freshness is only enforced when the branch is conflicted (`DIRTY`/`UNKNOWN`).
45+
- Additional deterministic ready criteria: PR open, has `evergreen`, not
46+
`evergreen-exhausted`, allowed by the trust model.
47+
48+
## Branch Updates
49+
50+
- Base branch: `main`.
51+
- Freshness requirement: not a standalone gate; only merge `main` when the branch
52+
is behind and conflicted or CI requires a fresh merge.
53+
- Merge-main policy: allowed. Prefer ordinary merge commits from `main`.
54+
- Rebase or force-push policy: force-push is DISABLED. No rebasing history.
55+
- Fork PR behavior: do not merge `main` into or push to fork branches unless a
56+
trusted maintainer has approved the current head (see Trust Model).
57+
58+
## Trust Model
59+
60+
- Repository visibility: public.
61+
- Fork PR policy: fork PRs are accepted.
62+
- Are PR branch pushers trusted: not for fork PRs.
63+
- Default trust level:
64+
- Same-repo branches (e.g. `autoloop/*`, maintainer branches): `trusted-branch`.
65+
- Fork PRs: `metadata-only` until a trusted maintainer approves the current
66+
head SHA.
67+
- Current-head approval policy: for fork PRs, run PR code / push repairs only
68+
after a trusted maintainer approves via `workflow_dispatch` bound to the
69+
current head SHA. A new head SHA returns the PR to metadata-only monitoring.
70+
- Authorized `/evergreen` users: slash commands are not wired in v1. Trusted
71+
activation for fork PRs is via manual `workflow_dispatch`.
72+
- What invalidates approval: any new commit / head SHA change on the PR branch.
73+
74+
## Event Fast Paths
75+
76+
- `pull_request` activity types: `labeled`, `synchronize`, `reopened`,
77+
`ready_for_review`.
78+
- Default-branch `push` policy: `push` to `main` wakes the reconciliation loop
79+
because it can make labeled PRs stale or conflicted.
80+
- `workflow_run` policy: not wired in v1; the schedule + `synchronize` cover CI
81+
state changes.
82+
- Review event policy: not wired (reviews are not merge gates here).
83+
- Deployment event policy: not wired (no deployment gates).
84+
- Slash-command policy: not wired in v1.
85+
- Schedule interval: every 15 minutes (reconciliation and fork-PR fallback).
86+
87+
## CI/CD Activation
88+
89+
- Workflows/checks Evergreen may rerun: the `CI` workflow run for the current
90+
head SHA (via `gh run rerun --failed`, falling back to a full rerun).
91+
- Workflows/checks Evergreen may dispatch: none by name in v1; activation is
92+
rerun-based only.
93+
- Stale check policy: reactivate the latest `CI` run for the head SHA once per
94+
head; never rerun green checks; never re-trigger an already in-progress run.
95+
- Missing check policy: if no `CI` run exists for the head SHA, wait for the
96+
normal `pull_request`/schedule CI to start rather than forcing activation.
97+
- Empty commit policy: empty trigger commits are a last resort only, requested
98+
through safe outputs by the agent (never from preflight) and labeled
99+
`evergreen: trigger CI`; they do not count as semantic repair attempts.
100+
- Token policy: `GITHUB_TOKEN` for reads and control-plane label writes.
101+
`GH_AW_CI_TRIGGER_TOKEN` (existing PAT) is used by gh-aw for pushes so that PR
102+
branch pushes trigger CI (default-token pushes do not).
103+
104+
## Repair Policy
105+
106+
- Allowed edits: source, tests, playground, config, and workflow files needed to
107+
clear a configured gate. Keep changes small and targeted (one feature/fix per
108+
commit per repo convention).
109+
- Protected files: `README.md` and `.autoloop/programs/**` must not be modified
110+
unless explicitly requested. `.autoloop/**` and `memory/autoloop` branch state
111+
are Autoloop-owned. Issue #1 (program definition) must not be modified.
112+
- High-risk file policy: dependency manifests and lockfiles (`package.json`,
113+
`bun.lock`, `bunfig.toml`) may be edited only when the failing gate requires
114+
it; prefer deterministic tooling.
115+
- Deterministic commands (repo-native, run before agentic edits):
116+
- Install: `bun install`
117+
- Typecheck: `bun run typecheck`
118+
- Lint: `bun run lint`
119+
- Test: `bun test`
120+
- Cross-validation: `bun test ./tests/xval/`
121+
- E2E: `bun run test:e2e`
122+
- Golden snapshots: `python golden/generate.py`
123+
- Workflow compile: `gh aw compile` (and `apm compile` when APM sources change)
124+
- Generated file policy: recompile committed lockfiles/snapshots when their
125+
sources change. After editing any `.github/workflows/*.md` workflow, recompile
126+
and commit the generated `.lock.yml`.
127+
- Signed commit policy: signed commits are not required. Use the token's natural
128+
identity; add Evergreen context in the commit body.
129+
130+
## Review Policy
131+
132+
- Reviewer request policy: do not request or re-request reviewers.
133+
- Review thread policy: do not resolve threads. Comment only when a thread maps
134+
to a configured merge gate.
135+
- Human-needed cases: protected-file edits, credential/permission needs, fork-PR
136+
code execution before approval, and disallowed operations.
137+
- Comment style: terse. Comment only for meaningful work, blockers, human-needed
138+
decisions, or quota exhaustion. Do not comment on unchanged state.
139+
140+
## Skills
141+
142+
- Vendored generic skills: all files under
143+
`.github/workflows/shared/skills/`.
144+
- Existing repo skills to reuse: none dedicated to mergeability were found;
145+
respect `AGENTS.md`/`CLAUDE.md` conventions.
146+
- Conditional skills enabled: `playground-e2e-diagnoser` (Playwright E2E gate),
147+
`autoloop-coordinator` (Autoloop branches), `lint-policy-review`,
148+
`docs-release-gate-repair`, `dependency-gate-repair`, and other conditional
149+
skills when evidence identifies the matching gate.
150+
- Skills not to use: none disabled.
151+
152+
## Quotas
153+
154+
- Per-PR AIC/token/cost budget: 50000 AI credits per continuous application of
155+
the `evergreen` label.
156+
- Max runs: bounded by the per-PR budget; cheap deterministic monitoring should
157+
consume little or no quota.
158+
- Max repeated attempts per failure signature: do not retry the same failure
159+
signature indefinitely; record it in memory and stop.
160+
- Wall-clock limit: none beyond the per-PR budget and schedule cadence.
161+
- Exhaustion behavior: remove `evergreen`, add `evergreen-exhausted`, leave one
162+
terse comment. A human may reapply `evergreen` for a fresh quota.
163+
164+
## Discovered Repo Context
165+
166+
- Agent guidance: `AGENTS.md` and `CLAUDE.md` — Bun + strict TypeScript, zero
167+
core deps, 100% coverage, one feature per commit, never modify `README.md` or
168+
`.autoloop/programs/**`, recompile gh-aw/apm after workflow edits.
169+
- Existing workflow conventions: gh-aw workflows (`autoloop`, `goal`,
170+
`ci-doctor`, `agentics-maintenance`) use `engine: copilot` with
171+
`COPILOT_GITHUB_TOKEN`; `GH_AW_CI_TRIGGER_TOKEN` PAT is used for CI-triggering
172+
pushes. CI workflow name is `CI`.
173+
- Last 50 closed PR process scan: PRs merge without auto-merge requests or
174+
required reviews; many are Autoloop/goal automation PRs labeled
175+
`automation`/`autoloop`. No CODEOWNERS or required-review process observed.
176+
- Uncertainties: `main` has no branch protection, so gate enforcement relies on
177+
this policy's configured checks rather than platform-required checks. If branch
178+
protection is added later, sync `REQUIRED_CHECKS_JSON` in `evergreen.md`.
Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
# Evergreen Report Template
2+
3+
Use short reports. Prefer no comment when state has not changed.
4+
5+
Required fields when commenting:
6+
7+
- Current blocker or action.
8+
- Evidence source.
9+
- What changed, if anything.
10+
- What happens next.
11+
12+
Avoid broad narration. Do not say a fix landed, a check is green, or a PR is
13+
ready unless the relevant GitHub state proves it.
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
# Evergreen Safe Output Policy
2+
3+
Allowed safe outputs in v1:
4+
5+
- PR comments for meaningful work, blockers, human-needed decisions, quota
6+
exhaustion, or verified state changes.
7+
- Non-ready state labels.
8+
- PR branch pushes for PRs that still have the opt-in label and satisfy trust
9+
policy.
10+
- Workflow dispatch or rerun according to repo policy.
11+
- Pull request reviews or review comments only when configured.
12+
13+
Disallowed safe outputs in v1:
14+
15+
- Direct PR merge.
16+
- Base-branch writes.
17+
- Adding or removing the ready label from the agentic workflow.
18+
- Secret disclosure in comments, logs, commits, generated policy, or memory.
19+
20+
Every safe output must be verified before the orchestrator describes it as
21+
successful.

0 commit comments

Comments
 (0)