workspace: warn against feature-first push on an empty repo - #95
Open
gas2own wants to merge 8 commits into
Open
Conversation
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
force-pushed
the
fix-workspace-empty-repo-bootstrap
branch
from
July 17, 2026 22:04
9d02f8f to
6967a11
Compare
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>
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>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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
mainto 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
mainfirst and, when it is absent, have the repo initialized with a commit or ask an authorized operator to createmainbefore continuing.This is intentionally guidance rather than a mechanical guard: a direct
mainpush may be blocked by the agent's host policy, a bespoke wrapper can be bypassed by rawgit push, and CI runs too late to prevent the first pushed branch becoming default.Validation
python scripts/validate-skills.pygit diff --checkValidation (per the
improve-skillseval workflow)Measured through an
asta_skillseval case rather than by inspection: allenai/asta-bench-private#230 addsempty_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.checked_remote_for_main— did the agent check formainbefore pushing.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
mainfirst → 1.The full paired LLM arms (baseline
origin/mainskills 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 ofimprove-skillsand confirm the lift (baseline should failno_feature_branch_on_empty_remote; this branch should pass).