Skip to content

feat: adopt mode for impl-generate (source_ref) - #12274

Merged
MarkusNeusinger merged 3 commits into
mainfrom
feat/impl-generate-adopt
Oct 23, 2026
Merged

MarkusNeusinger merged 3 commits into
mainfrom
feat/impl-generate-adopt

Conversation

@MarkusNeusinger

Copy link
Copy Markdown
Owner

Summary

  • impl-generate.yml and bulk-generate.yml get a source_ref input (default empty). With it set, impl-generate takes plots/{spec}/implementations/{language}/{library}{ext} from that branch, tag or SHA of origin instead of running Claude. A new step, "Adopt implementation from source ref", renders it in both themes with the generator's Step 3 commands (Python MPLBACKEND=Agg python -P, the JS render harness), checks both PNGs with core.canvas, and commits and pushes that one file. Every later step runs unchanged: metadata, adaptability smoke run, image processing, PR, staging upload, preview, review dispatch. The purpose is to let a gemini/* branch that migrates the 323 MUI X implementations to MUI X 9 reach main only through render, Opus review, repair and impl-merge.
  • An adopted run is always a forced regeneration: the REGEN_GATE expression (the same in all three steps) treats source_ref != '' like regen_gate=false, so the PR is labelled regen:forced. Both Claude steps and the prompts overlay are skipped with if:. The routed model only runs repair. The PR body adds a **Generation:** adopted from <ref> (<sha>) line and keeps the **Model:** line, because the rescue paths of impl-review and impl-repair parse exactly that line. The metadata records generated_by: adopted:<ref>.
  • A source failure (the file or the ref is missing, the render fails, or the pair is R or Julia) writes cause before the step fails. The failure handler then posts one issue comment with its own marker (impl-adopt-fail). It does not auto-retry, counts no attempt and never sets impl:<lib>:failed, because a retry would read the same file. Any later failure takes the ordinary path, and dispatch_retry now forwards source_ref.

Plan

N/A. The design follows the lead's contract. Decisions are listed in the test plan notes below.

Test plan

  • New tests/unit/workflows/test_impl_generate_adopt.py (77 cases). It runs the real adopt step against a throwaway origin under bash -e and bash -eo pipefail, covering: Python and JS renders, branch/tag/SHA refs, a file identical to main (empty adopt commit), canvas drift (warns, still pushes), a missing file or ref, a failing or silent or non-PNG render, R/Julia refused, numpy installed into the helper venv, and staged unrelated changes kept out of the commit. It also runs "Extract inputs" (normalization of origin/, validation, notices), the metadata writer (generated_by), the failure handler (source failure vs later failure, retry forwarding), and bulk-generate's dispatch loop. Wiring guards cover if: conditions, step order and the shared REGEN_GATE expression.
  • test_model_routing.py: the adopted PR body round-trips through impl-review's "Extract PR info" and impl-repair's "Resolve model" rescues (model opus survives).
  • uv run ruff check ., ruff format --check ., mypy api core agents, uv run pytest tests/unit -n 4 (13240 passed), and tools.changelog check --base origin/main. actionlint is not installed locally, so it was not run.
  • Real run from this branch: impl-generate run 39976443391, gauge-activity-rings / muix / source_ref=main (a spec whose muix.tsx renders identically on MUI X 9). The adopt step succeeded, the Claude steps and the overlay were skipped, and canvas_gate passed at 2400x2400 in both themes. PR feat(muix): implement gauge-activity-rings #12273 opened with regen:forced, the adopted-from line, generated_by: adopted:main and library_version: 9.16.0, and its review dispatched. impl-review, impl-repair and impl-merge are unchanged, so their Claude steps pass claude-code-action's workflow validation on the branch ref.

impl-generate.yml and bulk-generate.yml get a `source_ref` input. With it
set, impl-generate takes plots/{spec}/implementations/{language}/{library}{ext}
from that ref of origin instead of running Claude, renders it in both themes
with the generator's commands (Python `python -P`, the JS render harness),
checks both PNGs with core.canvas, and commits and pushes that one file.
Every later step runs unchanged: metadata, adaptability smoke run, image
processing, PR, staging upload, review dispatch.

An adopted run is always a forced regeneration (regen:forced). The routed
model only runs repair; the PR body adds a **Generation:** line above the
**Model:** line that review and repair rescues parse, and the metadata
records generated_by: adopted:<ref>. A missing file or ref, a failed
render, or an R/Julia pair is a source failure: one issue comment with its
own marker, no auto-retry, no attempt counted, never impl:<lib>:failed.
Later failures retry as before and the retry forwards source_ref.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0175hA62juZoajMcqKxWFGza
Copilot AI lite review requested due to automatic review settings October 23, 2026 15:16

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Unresolved workflow defects include a critical dependency-install failure path and multiple moderate adoption validation, fetch, failure-notification, and regeneration-gate issues.

3 open issues
What changed in this PR

This pull request adds an adoption mode that lets implementation files from a branch, tag, or commit SHA pass through rendering, validation, review, repair, and merge without initial Claude generation.

Changes:

  • Adds source_ref handling to the single and bulk generation workflows.
  • Adds source rendering, canvas validation, metadata, PR-body, retry, and failure-reporting support.
  • Adds workflow tests and documents adoption behavior, routing, and operational usage.
File Summary Review notes
tests/​unit/​workflows/​test_regen_gate_workflows.py Updates regeneration and failure-handler coverage. No final comments.
tests/​unit/​workflows/​test_model_routing.py Verifies adopted PR model metadata survives review and repair rescue paths. No final comments.
tests/​unit/​workflows/​test_impl_generate_adopt.py Tests adoption rendering, validation, metadata, commits, failures, retries, and bulk wiring. No final comments.
docs/​workflows/​overview.md Documents adoption mode, forced regeneration, and failure behavior. Nit: the documented 323-item migration exceeds the bulk workflow’s 360-minute timeout at its default pacing.
changelog.d/​impl-generate-adopt.md Adds the changelog entry for the new capability. No final comments.
agentic/​docs/​project-guide.md Documents adoption behavior in the pipeline and regeneration architecture. No final comments.
.github/​workflows/​impl-generate.yml Implements source adoption, rendering, canvas checks, metadata, PR creation, retry, and failure handling. Moderate: raw source_ref=origin/ can force regeneration despite normalization. Critical: failed dependency installation can be treated as tolerated canvas drift. Moderate: adoption failures without an issue receive neither notification nor cleanup. Moderate: fetch failures are treated as missing refs and suppress retries. Moderate: invalid refs follow the ordinary retry path and consume attempts.
.github/​workflows/​bulk-generate.yml Passes source_ref through bulk dispatches and reports adoption mode. No final comments.
.claude/​skills/​babysit-pipeline/​SKILL.md Documents monitoring and retry behavior for adopted runs. No final comments.

Review effort: Lite

Comment thread .github/workflows/impl-generate.yml Outdated
Comment thread .github/workflows/impl-generate.yml
Comment thread .github/workflows/impl-generate.yml
@codecov

codecov Bot commented Oct 23, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

From the Copilot review of #12274:
- A failed numpy install, or a core.canvas crash, exited 1 like a canvas
  drift and let the file be pushed unchecked. numpy is now installed and
  verified fatally, and exit 1 counts as drift only when the check printed
  its failing canvas_gate verdict; anything else fails without a cause, so
  the ordinary retry path takes it.
- A failed fetch always read as a missing ref, which is never retried. The
  step now asks origin with ls-remote first: unreachable is the runner's
  failure, reachable means the ref is missing.
- `source_ref=origin/` normalized to an ordinary generation while the
  REGEN_GATE expressions, which read the raw input, still forced the regen.
  A non-empty input that normalizes to nothing is now an error.

Docs: the pacing arithmetic for a whole-catalogue adoption (about 115 pairs
per bulk run at 180 s before the 6-hour timeout).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_0175hA62juZoajMcqKxWFGza
@MarkusNeusinger
MarkusNeusinger merged commit bedcca2 into main Oct 23, 2026
21 checks passed
@MarkusNeusinger
MarkusNeusinger deleted the feat/impl-generate-adopt branch October 23, 2026 17:27
MarkusNeusinger added a commit that referenced this pull request Oct 23, 2026
## Summary
- The owner authorized this metadata correction on 2026-10-23. Metadata
is normally written by the pipeline; this PR edits it by hand once, for
20 files.
- The 20 MUI X 9 implementations below were migrated by Gemini 4 Argon
in the owner's interactive Antigravity session (issue #12267, draft
#12275) and adopted by the pipeline from `gemini/12267-muix-9-batch1`
(PRs #12276 to #12295). Their metadata recorded `generated_by:
adopted:gemini/12267-muix-9-batch1`, the only form adopt mode had before
`source_model`.
- In each `plots/<spec>/metadata/javascript/muix.yaml`, `generated_by`
becomes `gemini-4-argon` and `adopted_from: gemini/12267-muix-9-batch1
(8cfea56)` follows it. Nothing else changes: 20 files, 40 insertions,
20 deletions.

Specs: alluvial-basic, calibration-beer-lambert, datamatrix-basic,
genome-track-multi, horizon-basic, map-marker-clustered, phase-diagram,
recurrence-basic, sequence-logo-basic, ternary-density, area-basic,
confusion-matrix, hexbin-basic, line-stepwise, scatter-color-mapped,
acf-pacf, calibration-curve, gauge-basic, line-loss-training,
scatter-annotated.

**Merge after #12297**, which adds `source_model` to adopt mode and
documents the `adopted_from` key. Plots-only, so no changelog fragment.

Not touched: `gauge-activity-rings`, whose metadata says `generated_by:
adopted:main` from the adopt-mode smoke run of #12274. That file came
from `main`, not from Gemini.

## Plan
N/A

## Test plan
- [x] Before the edit, each of the 20 files carried `generated_by:
adopted:gemini/12267-muix-9-batch1` exactly once, and no other metadata
file did.
- [x] `8cfea568c` resolves to
`8cfea568c8ff9311e21de7c0133a2e5ee506f089`, the current head of
`gemini/12267-muix-9-batch1` and the SHA on the `**Generation:**` line
of #12276.
- [x] The diff is exactly the two-line change in each of the 20 files
(`git diff` grouped by line: 20 removals and 2 × 20 additions, no other
lines).
- [x] Every file parses as YAML with `generated_by: gemini-4-argon` and
`adopted_from` directly after it.
- [x] `sync_to_postgres` reads a fixed key list, so `adopted_from` is
ignored and the next sync writes `gemini-4-argon` into the existing
`generated_by` column (covered by a test in #12297).

🤖 Generated with [Claude Code](https://claude.com/claude-code)

https://claude.ai/code/session_0175hA62juZoajMcqKxWFGza

Co-authored-by: Claude Fable 5.1 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants