Skip to content

feat(bin): add a forge=external review rail that never pushes task branches - #7368

Merged
kunchenguid merged 3 commits into
kunchenguid:mainfrom
Marsjohn-11:rail/external-review-rail
Oct 16, 2026
Merged

kunchenguid merged 3 commits into
kunchenguid:mainfrom
Marsjohn-11:rail/external-review-rail

Conversation

@Marsjohn-11

Copy link
Copy Markdown
Contributor

Intent

The captain wants the 'never push task branches to a shared origin' protection for code-review briefs upstream in kunchenguid/firstmate, without publishing any employer-internal code. Implement the vendor-neutral 'external code-review rail' per the approved-by-default design note (its vendor-neutral sections are the upstream-bound parts; anything naming internal tools stays local and must not appear upstream). A project whose review tool uploads its own snapshot means workers never need to push a branch and must never push task branches to a shared origin; an optional personal backup remote may hold durable copies, never with the task prefix. Deliver a PR to kunchenguid/firstmate main from the captain's fork Marsjohn-11/firstmate, on a branch without an fm/ prefix, with tests. Do not merge; the maintainer decides.

Substance of the referenced design note's upstream-bound sections:

  • The rail is a fourth value of the existing closed forge= registry binding, forge=external, registered by the captain as [direct-PR forge=external] and never detected. It means the project's reviews are created by a review tool that uploads its own snapshot of the worker's local commits, so the worker never needs to push a branch and must never push a task branch to the project's shared origin; firstmate cannot observe, approve, or merge such a review, so it always escalates.
  • It composes with direct-PR only: local-only is refused like every forge, no-mistakes is refused for now because the pipeline's push, pr, and ci steps would push to the shared origin, a base branch is refused, and yolo is refused.
  • Home configuration is private and gitignored: a required config/external-review.md holding the worker instructions for the home's review tool (rendered verbatim into the Definition of done, refused when missing or when it carries its own Delivery contract line), an optional config/external-review-url holding one regular expression a ready review URL must match in full, and an optional config/external-review-backup naming the captain's personal backup remote plus an optional prefix= line (default backup/).
  • The worker's first rule forbids pushing to origin or any remote whose URL is the shared server, and forbids pushing the task branch or any task-prefixed branch to any remote; with a backup configured it allows exactly one push, a durable copy to on the backup remote. The ready report is done: review <url> uploaded for review.
  • The ready-report gate accepts that report on a canonical https review URL alone when no backup is recorded, and only once HEAD is on the backup remote's backup namespace when one is; a PR report on such a project is refused.
  • Enforcement is three layers: a per-task pre-push guard installed through the existing per-task hooks directory (even when the home keeps AI trailers) that refuses pushes to origin or a URL matching origin's, task-branch and task-prefixed refs on any remote, and refs outside the backup prefix on the backup remote, chaining to the repository's own pre-push hook; spawn validation that refuses yolo, a missing adapter, an absent backup remote, a backup remote aliasing origin, or a backup prefix equal to or starting with the task prefix, and records forge, backup remote, and backup prefix in the task record; and the brief text. git push --no-verify, non-git ref writers, and differently spelled alias URLs are a documented accepted residual.
  • A new review-record script records review= and review_head= with no merge watch, refuses forge PR URLs and non-external tasks, and publishes the child's review-ready line in a secondmate home; the ship-landing skill uses it instead of the PR check for external tasks and always escalates the review URL.
  • Teardown's landed-work test is unchanged. Docs: a short design doc, the configuration reference, the scripts reference, and the project-management and ship-landing skills. Tests use only reserved example hosts and an invented review tool.

What Changed

  • Adds forge=external as a fourth value of the registry's forge binding. The