Commit 968a22e
ci: auto-chain stage-2 scaffold into stage-3 verify (autogen pipeline) (#462)
* ci: auto-chain stage-2 scaffold into stage-3 verify (autogen pipeline)
Merge the scaffold (stage 2) and verify (stage 3) workflows so a single
scaffold run auto-verifies its own draft PR in the same run, instead of
requiring a second manual dispatch.
Why a merge, not a cross-workflow trigger: GitHub's GITHUB_TOKEN cannot start
new workflow runs (anti-recursion), so `gh workflow run` / `workflow_run`
chaining would need a non-GITHUB_TOKEN credential (GitHub App or PAT) -- a new
shared secret on a public repo. Running verify in-run as a reusable-workflow
call sidesteps that entirely: no new credential, no new secret.
- verify-reusable.yml (new): the verify job, `on: workflow_call`. Single source
of truth; byte-identical job body to the previous verify-scaffold.yml.
- verify-scaffold.yml: now a thin workflow_dispatch wrapper that calls the
reusable workflow (manual re-verify of an existing scaffold/* PR preserved).
- scaffold-resource.yml: the scaffold job exposes the new PR number (agent
writes scaffold-result.json; case-insensitive branch-match fallback); a
downstream `verify` job (needs: scaffold) calls the reusable workflow when a
PR was produced and VERIFY_AGENT_ENABLED is true.
Auto-verify is gated by the VERIFY_AGENT_ENABLED kill switch only (no per-family
safelist). This intentionally drops the previous human gate between scaffold and
verify: a scaffold now triggers a real apply against the verification account
automatically. Blast radius stays bounded by the kill switch, the per-PR
tf-verify-pr<N> project namespacing, and end-of-run destroy of account
singletons (unchanged behavior).
Stage-1 Slack one-click was intentionally not built: Slack Workflow Builder has
no native authenticated HTTP step, so true one-click would require a Slack app
install; the drift message's existing "Scaffold it" link + pre-filled gh command
remain the stage-2 entry point.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* ci: source agent prompts, model + kill switch from LaunchDarkly AI Configs
Move the scaffold and verify agent prompts out of the workflow YAML into LD
AI Configs (agent mode, catfood) so prompt/model changes need no PR.
Each stage resolves its prompt from the AI-config-backed flag's PRODUCTION-
served variation (fallthrough when targeting is on, else offVariation) via the
flags REST API, then composes a "## This run" header (per-run values) on top of
the LD instructions. The served variation's value._ldMeta.enabled is the kill
switch -- pointing a flag's production fallthrough at its 'disabled' variation
stops the agent -- so the SCAFFOLD_AGENT_ENABLED / VERIFY_AGENT_ENABLED repo
variables are removed. Fail-closed: if LD is unreachable the run aborts; in
verify the gate runs BEFORE AWS-OIDC / SSM / pre-clean so a disabled run never
assumes the prod token or deletes the project.
Pure-YAML (curl + jq, no SDK / Node / mustache): the Go AI SDK has no
AgentConfig method (pre-release) and the Node/Python SDKs would add a foreign
runtime to a Go repo. Only instructions + model are taken from LD; --allowedTools
and the OIDC/build steps stay in the workflow (security-scoped). In-repo
.github/agent-prompts/*.md are the prompt fallback, used only when LD is
reachable + enabled but a variation carries no instructions.
Reads via a read-only catfood token (LD_AICONFIG_READ_TOKEN secret, scoped to
flag read on project default).
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
* ci: address code-review findings on the autogen pipeline workflows
Fixes from the #462 review (15 findings; by-design items excluded):
- verify-reusable: Notify Slack now also gates on steps.prompt.outcome ==
'success', so a kill-switch-disabled or fail-closed (transient-LD) run no
longer posts a misleading "verification did not complete" message. Reads
verify-result.json by absolute $GITHUB_WORKSPACE path (cwd-independent).
- scaffold: pass `family` to the extract step via env ("$FAMILY") instead of
inlining ${{ inputs.family }} into the run script (GHA template injection).
- both: resolve the LD model with a literal "Anthropic." prefix strip instead
of ${model##*.} (which mangled versioned ids like claude-3.5-x), then reject
any model name outside [A-Za-z0-9._:-] so it can't inject extra claude_args.
- scaffold: resolve the auto-verify PR number SOLELY from scaffold-result.json;
drop the branch-name `gh pr list` fallback that could send stage-3 to verify
a STALE same-name PR (real prod apply on the wrong PR). Missing file -> verify
skipped + warning to dispatch manually.
- both: random heredoc delimiter for the multiline prompt output so prompt
content can't prematurely close it (and swallow the model_arg line).
- scaffold: add per-family `concurrency` so a double dispatch can't race two
runs onto the same scaffold/<slug> branch + PR.
- both: scope agent allowedTools — git to needed subcommands (no `git config`),
make to `make fmt` (not the token-needing `make generate`). (Branch protection
on preview-v3 remains the authoritative guard against a direct push.)
- both: treat whitespace-only LD instructions as empty -> in-repo fallback;
::add-mask:: the LD read token; label the "## This run" header as DATA to blunt
prompt-injection via PR title / operator notes.
- verify-scaffold + scaffold: correct stale/incomplete comments (the dead
VERIFY_AGENT_ENABLED kill switch; the inherited-secrets list).
Validated: actionlint clean (3 workflows); bash/jq sims for model parsing,
whitespace fallback, delimiter uniqueness, and the notify if-guard truth table.
Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
---------
Co-authored-by: Claude Opus 4.8 (1M context) <noreply@anthropic.com>1 parent 4316582 commit 968a22e
5 files changed
Lines changed: 698 additions & 363 deletions
File tree
- .github
- agent-prompts
- workflows
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
| 1 | + | |
| 2 | + | |
| 3 | + | |
| 4 | + | |
| 5 | + | |
| 6 | + | |
| 7 | + | |
| 8 | + | |
| 9 | + | |
| 10 | + | |
| 11 | + | |
| 12 | + | |
| 13 | + | |
| 14 | + | |
| 15 | + | |
| 16 | + | |
| 17 | + | |
| 18 | + | |
| 19 | + | |
| 20 | + | |
| 21 | + | |
| 22 | + | |
| 23 | + | |
| 24 | + | |
| 25 | + | |
| 26 | + | |
| 27 | + | |
| 28 | + | |
| 29 | + | |
| 30 | + | |
| 31 | + | |
| 32 | + | |
| 33 | + | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
| 55 | + | |
| 56 | + | |
| 57 | + | |
| 58 | + | |
| 59 | + | |
| 60 | + | |
| 61 | + | |
| 62 | + | |
| 63 | + | |
| 64 | + | |
| 65 | + | |
| 66 | + | |
| 67 | + | |
| 68 | + | |
| 69 | + | |
| 70 | + | |
| 71 | + | |
| 72 | + | |
| 73 | + | |
| 74 | + | |
| 75 | + | |
| 76 | + | |
| 77 | + | |
| 78 | + | |
| 79 | + | |
| 80 | + | |
| 81 | + | |
| 82 | + | |
| 83 | + | |
| 84 | + | |
| 85 | + | |
0 commit comments