Skip to content

workspace: warn against feature-first push on an empty repo - #95

Open
gas2own wants to merge 8 commits into
mainfrom
fix-workspace-empty-repo-bootstrap
Open

workspace: warn against feature-first push on an empty repo#95
gas2own wants to merge 8 commits into
mainfrom
fix-workspace-empty-repo-bootstrap

Conversation

@gas2own

@gas2own gas2own commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Problem

On a repo with no commits, the first branch pushed silently becomes the default branch. If a headless agent follows a generic "always branch and open a PR" habit and pushes a feature branch first, there is then no main to open a PR against or deploy GitHub Pages from, and correcting the default branch requires repo-admin access the agent may not have.

Change

Add a concise warning before the first-save feature-push step. It tells the agent to check for main first and, when it is absent, have the repo initialized with a commit or ask an authorized operator to create main before continuing.

This is intentionally guidance rather than a mechanical guard: a direct main push may be blocked by the agent's host policy, a bespoke wrapper can be bypassed by raw git push, and CI runs too late to prevent the first pushed branch becoming default.

Validation

  • python scripts/validate-skills.py
  • git diff --check

Validation (per the improve-skills eval workflow)

Measured through an asta_skills eval case rather than by inspection: allenai/asta-bench-private#230 adds empty_repo_bootstrap_no_feature_first_push + setups/empty_remote.sh, which stand up a scaffolded project whose remote has no branches and ask a headless agent to save+deploy.

  • Intent metric checked_remote_for_main — did the agent check for main before pushing.
  • Outcome guard no_feature_branch_on_empty_remote — the load-bearing metric; fails iff a non-main branch is pushed onto the empty remote (the exact lock-in this PR prevents).

The outcome metric command was exercised directly against three end-states and discriminates them: bare/pre-fix agent pushing a feature branch first → 0 (bug); fixed agent checking ls-remote and handing off → 1; permitted agent seeding main first → 1.

The full paired LLM arms (baseline origin/main skills vs this branch's skills, --epochs 3) need docker + inspect + ASTA_IMAGE, which weren't available where this was authored — flagging for a maintainer to run the arms per steps 3/5 of improve-skills and confirm the lift (baseline should fail no_feature_branch_on_empty_remote; this branch should pass).

Move the main-branch existence check ahead of the first push so branch-first policies cannot accidentally establish a feature branch as the default in an empty repository. Clarify the bootstrap exception and document recovery for repositories already in that state.
@gas2own
gas2own force-pushed the fix-workspace-empty-repo-bootstrap branch from 9d02f8f to 6967a11 Compare July 17, 2026 22:04
@gas2own gas2own changed the title workspace: make empty-repo main bootstrap an ordered gate, not a soft aside workspace: prevent feature-first pushes to empty repositories Jul 18, 2026
gas2own and others added 2 commits July 18, 2026 07:30
The mechanical guards can't reliably prevent the empty-repo default-branch
trap: a guarded agent is blocked from pushing HEAD:main, a bespoke
make push-feature target is easily bypassed by a raw git push, and fixing
a mis-set default branch needs repo-admin access an agent lacks. Drop the
Makefile target and reduce the skill to a concise warning that steers the
agent to get main created before its first push.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
@gas2own gas2own changed the title workspace: prevent feature-first pushes to empty repositories workspace: warn against feature-first push on an empty repo Jul 18, 2026
gas2own-agent and others added 4 commits July 18, 2026 16:08
Restore the git push -u origin HEAD:main bootstrap for agents that can
write main, alongside the operator-handoff path for guarded agents.
Both stay before the feature-branch step so sequential execution is safe.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
If main can't be created, stop instead of pushing the feature branch
(which becomes the default and needs repo-admin to repair); hand off
to an operator, then resume.

Co-Authored-By: Claude Opus 4.8 <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.

1 participant