Skip to content

CI shepherd: wait/merge/re-merge/rerun deterministically, failure digest + local repro, bounded fixer hook (was: merge watcher upgrades) #4790

Closed

Description

@squid-protocol

Owner-approved efficiency work (2026-10-09). handoffs/tools/merge_watch.sh and merge_train.sh work, but they need babysitting.

Add:

  • Post a note on a PR, once, when it goes dirty or stale.
  • After each merge, run cics_census.py history append --pr N (still owed for many PRs).
  • Optionally run as a scheduled routine or workflow, not a local script.
  • Commit the scripts into the repo (tests/tools/box/) with a small README.

🤖 Generated with Claude Code

Activity

  1. added
    enhancement
    ci-cd
    on Oct 9, 2026
  2. squid-protocol commented on Oct 9, 2026

    @squid-protocol
    OwnerAuthor

    Scope expanded (owner, 2026-10-09): a CI shepherd. Ushering PRs through CI currently takes hours: an LLM does the waiting and polling, reads raw logs, treats every red result as a code problem, and re-pushes to test a fix. Move all waiting and sorting into a deterministic script, and call an LLM only with a pre-digested real failure.

    State machine per PR (replaces handoffs/tools/merge_watch.sh + merge_train.sh; runs every ~10 min, then as a scheduled routine/workflow):

    State Action (no LLM)
    pending wait
    green pr_check.py N --merge; then cics_census.py history append --pr N
    dirty, only generated files conflict (det-sweep ledger files, register page, evidence records/report) merge main, regenerate with the owning tool (det_coverage_ledger.py split --base / update, register.py render, …), push; post one PR note
    dirty, code conflict post one PR note; mark as needing a fixer
    red, infra (cancelled, runner lost, startup_failure) gh run rerun --failed, once
    red, known flake (list kept in-repo, e.g. #4477) rerun once, count it
    red, real write the digest, dispatch one fixer
    still red after 2 fix rounds one PR comment, needs a person

    The shepherd keeps a dependency map for stacked PRs (as merge_train.sh does) and a merge order for PRs that touch the same generated files.

    Digest: pr_check.py N --digest. Per failed check:

    • the last ~60 lines of the failed step (gh run view --log-failed, trimmed) plus the error/FAILED/assert lines;
    • the local repro command, from a committed table (tests/tools/ci_repro.toml): e.g. ruff-audit → python tests/ruff_audit.py --ci; mypy-audit → python tests/mypy_audit.py --ci; det → proof_sweep.py --det-only --cases <failed cases>; full-suite → pytest <failed node ids>; golden → golden-lock.sh python tests/tools/crucible_check.py.

    The digest goes to a file and to the job summary.

    Fixer hook. One bounded task: "here is the digest and the repro; make the repro pass; commit". The fixer never waits for CI and never pushes; the shepherd pushes. The backend is chosen per call: agy via ~/.local/bin/agy-worker, which now flags soft-denials with exit 3, or a Claude worker.

    Also (original scope): post a note when a PR goes dirty or stale; append census history after each merge; commit the scripts to tests/tools/box/ with a README; optionally run as a scheduled routine.

    Build order:

    1. --digest + repro table.
    2. Shepherd state machine.
    3. Fixer hook.

    Related: #4814 (shorter CI, fewer full sweeps), #4813, #4811 (fewer generated-file conflicts).

    🤖 Generated with Claude Code

  3. changed the title [-]merge watcher: detect dirty / stale-evidence PRs, append census history after merges, run as a scheduled routine[/-] [+]CI shepherd: wait/merge/re-merge/rerun deterministically, failure digest + local repro, bounded fixer hook (was: merge watcher upgrades)[/+] on Oct 9, 2026
  4. added
    priority: high
    and removed on Oct 9, 2026
  5. squid-protocol commented on Oct 10, 2026

    @squid-protocol
    OwnerAuthor

    Progress (2026-10-10):

    🤖 Generated with Claude Code

  6. squid-protocol commented on Oct 10, 2026

    @squid-protocol
    OwnerAuthor

    Done; closing. Delivered 2026-10-09/10:

    Not done: the bounded fixer hook (needs an LLM API; owner parked it) and auto re-merge of generated-only conflicts (mostly moot since generated pages moved to the generated branch, #4827). Both are tracked in #4847.

    🤖 Generated with Claude Code

  7. added
    scope:infra
    on Oct 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    ci-cdenhancementpriority: highscope:infra

    Type

    No type

    Projects

    No projects

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions