Skip to content

New repos cannot create their initial main — the org ruleset's creation rule has no bootstrap path #111

Closed

Description

@aitrawog

Summary

The new org-wide ruleset (org-wide required workflow & main protection, applied 2026-09-22 by #109) blocks the creation of refs/heads/main on every repo it targets, and its only bypass actor is the charly-auto-merge GitHub App. A brand-new repo therefore has no way to create its initial main: an operator push is rejected, the contents/git-data APIs are rejected, and branch rename is rejected. There is no documented bootstrap path.

This was found while landing a new integration (three brand-new repos: layer-qdrant, pod-qdrant, plugin-qdrant), all created 2026-09-22 16:28 — after the ruleset landed at 16:11.

Evidence (measured)

$ git push -u origin main
remote: error: GH013: Repository rule violations found for refs/heads/main.
remote: - Required workflow 'charly/pr-validator, charly/pr-validator' is not satisfied
remote: - Required status check "validate / validate" is expected.
remote: - Cannot create ref due to creations being restricted.

Also rejected: the contents API (PUT /contents/... → 409 same message), clone-with-auto_init (GitHub's own initial commit is ALSO blocked — repo stays empty, default_branch set but no ref), and branch rename (bootstrap → main → 422 "repository rules do not permit renaming branch").

Every repo created after the ruleset is affected:

$ gh repo list opencharly --limit 1000 --json name,createdAt,defaultBranchRef \
  --jq '[.[]|select(.createdAt > "2026-09-22T14:11:00Z")]|.[]|"\(.createdAt) \(.name) main=\(.defaultBranchRef.name)"'
2026-09-22T16:58:35Z zz-test-bootstrap2 main=
2026-09-22T16:28:55Z plugin-qdrant      main=
2026-09-22T16:28:52Z pod-qdrant         main=
2026-09-22T16:28:48Z layer-qdrant       main=

(No repo created after the ruleset has a main ref.)

Why it happens

scripts/org-ruleset.sh applies a single ruleset with creation + deletion + non_fast_forward + required_status_checks (context validate / validate) + the workflows rule, targeting refs/heads/main on ~ALL minus a small exclude list. do_not_enforce_on_create: false. The validate / validate check can only be produced by a workflow run that itself requires the workflow to exist on the default branch — a cycle for a repo that has no default-branch commit yet. The only bypass is the App, which is not reachable by a human/operator or by a repo that isn't yet in a workflow run.

Options (please pick)

  1. Exclude empty repos — add a rule condition or extend discover_excludes so a repo with no default-branch ref is not targeted until its main exists. Cleanest, but needs GitHub to support "no ref" conditions (it does not directly) — likely needs a two-phase apply.
  2. Operator bootstrap step — document a once-per-new-repo bootstrap: temporarily add the repo to the ruleset exclude list, push main, remove the exclusion. Deterministic; keeps main protected afterwards.
  3. App-bootstrap workflow — a reusable workflow_dispatch in opencharly/.github that, given a repo name, mints the charly-auto-merge App token and creates main via the git-data API. Matches the existing retire-per-repo-dispatchers.yml pattern (same App, same reason: a protected-main write needs the bypass actor).

Whichever is chosen, the fix belongs to the ruleset's owner (opencharly/.github); I have not touched the ruleset or its scripts.

Impact

  • Three finished, live-proven repos (layer-qdrant, pod-qdrant, plugin-qdrant) are blocked from having a main branch, so no PR can be opened and nothing can land. Their work is preserved on each repo's feat/qdrant-integration branch.
  • Any future new repo in the org hits the same wall.

Activity

  1. self-assigned this
    on Oct 4, 2026
  2. aitrawog commented on Oct 5, 2026

    @aitrawog
    ContributorAuthor

    RESOLVED — closed by merged #112.

    opencharly/.github#112 ("bootstrap the initial main on empty org repos") states closes opencharly/.github#111 and merged 2026-09-22, adding the bootstrap path for the org ruleset's creation rule. The gap is fixed (not auto-closed).

    Agent: cleanup-superseded · session ses_ef2ca2adaffeWiEs7e1xAeOCUh
    Assisted-by: OpenCode DeepSeek V4.1 Flash (analysed on a live system)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions