Skip to content

Make agents default-branch-agnostic; add regen/lint gates, roster relocation, MergePatrol conflict fix, and CI hardening#63

Merged
stempeck merged 2 commits into
mainfrom
issues/62
Jun 14, 2026
Merged

Make agents default-branch-agnostic; add regen/lint gates, roster relocation, MergePatrol conflict fix, and CI hardening#63
stempeck merged 2 commits into
mainfrom
issues/62

Conversation

@stempeck

Copy link
Copy Markdown
Owner

Fixes #62.

Summary

Agentfactory hardcoded main/origin/main into the formulas and rendered role
templates, so every generated agent mis-targeted its rebase, push, merge, PR-base,
and verification git ops on any repo whose default branch isn't main (e.g.
master). This makes the factory default-branch-agnostic and adds the durability
interlocks, roster fixes, MergePatrol correctness fix, and CI hardening tracked in
the issue.

What changed

Default-branch resolution (the headline)

  • New internal/cmd/detect_default_branch.go: layered, read-only detection —
    origin/HEAD symbolic-ref → ls-remote --symrefgh repo view — with a
    branch-name allowlist (the template-expansion path does no shell escaping) and a
    per-callout timeout so an unreachable remote can't hang af sling.
  • sling.go injects an ambient {{default_branch}} token before template
    expansion: an operator --var override wins, and on detection failure it warns
    loudly instead of silently assuming main.
  • Formulas (design-v3, factoryworker, mergepatrol) and the rendered role
    templates rolled over from literal main to {{default_branch}}.

Durability interlocks

  • make check-regen + a CI regen job: fail if committed role templates diverge
    from what regeneration produces from the current formulas.
  • formula_literal_absence_test.go: lint rejecting any re-introduced executable
    branch literal, while leaving legitimate prose mentions of "main" alone.
  • .gitignore now tracks installed skill copies so a clean checkout can't drift
    make check-skills.

Agent roster

  • Relocated to .agentfactory/AGENTS.md (single source of truth in paths.go),
    written atomically, auto-regenerated on af formula agent-gen add/delete, with
    the worktree symlink and manager template updated. af install --init no longer
    touches a host project's own root AGENTS.md.

MergePatrol

  • Distinguishes a rebase-replay conflict from a true merge conflict (a branch can
    fail rebase yet merge cleanly), so mergeable PRs are no longer skipped and no
    spurious conflict tasks are filed. Added wake discipline: instantiate the formula
    before judging the work queue.

CI

  • Concurrency/supersession control, push trigger narrowed to main + tags
    (workflow_dispatch added), and libsqlite3-0 for the Python issue-store.

Test plan

  • make test — green (all packages ok).
  • make build, make sync-formulas, make sync-skills — clean and idempotent.
  • New coverage: default-branch detection chain, literal-absence lint, and the
    .agentfactory/AGENTS.md relocation behavioral test.

🤖 Generated with Claude Code

stempeck and others added 2 commits June 13, 2026 23:00
…ates instead of hardcoding `main`, so generated agents work on non-`main` repos. Add regen-parity and branch-literal-absence CI gates, relocate the agent roster to `.agentfactory/AGENTS.md` with auto-regeneration, fix MergePatrol's rebase-vs-merge conflict handling and wake discipline, and harden CI. Fixes #62.
@CLAassistant

Copy link
Copy Markdown

CLA assistant check
Thank you for your submission! We really appreciate it. Like many open source projects, we ask that you all sign our Contributor License Agreement before we can accept your contribution.
1 out of 2 committers have signed the CLA.

✅ stempeck
❌ agentfactory


agentfactory seems not to be a GitHub user. You need a GitHub account to be able to sign the CLA. If you have already a GitHub account, please add the email address used for this commit to your account.
You have signed the CLA already but the status is still pending? Let us recheck it.

@stempeck stempeck merged commit 6484b4b into main Jun 14, 2026
4 of 5 checks passed
@stempeck stempeck deleted the issues/62 branch June 14, 2026 03:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants