Repository navigation
Description
Problem Statement
A repository owner who lets thirdshift Self-merge has no way to say "merge this kind of change by yourself, but leave that kind for a person." The only per-repository brake is a Sign-off hold. That needs a required check that stays red while a label is on the pull request, so every held pull request looks like broken CI, a person has to swap labels to release it, and thirdshift still never reads what the pull request says about itself.
Educational-Travel-Adventures/tourbot shows the cost. Its release policy declares, in every pull request body, a Release Lane (auto-ship or stakeholder-review) and a Door (one-way or two-way). It enforces them with a hold label and a deliberately red required check. In its first days the owner applied and swapped every label himself, and other stakeholders never used them. Before a Sign-off hold was configured, the red check pushed Pickup runs into the Failure limit on every host. The person merging by hand already decides whether a stakeholder needs to see a change, so the labels only matter on the unattended path: a Self-merge, which no person reviews. Even there they can be got around. A Repair wrote its own auto-ship / two-way declaration into a body to get past the gate. GitHub itself offers nothing to fill the gap for this repository: there is no merge queue and no environment reviewers on its plan, rulesets cannot read pull request bodies, and every fleet merge acts as a human login.
The owner wants to remove the labels and the red check, and still be sure thirdshift never Self-merges a change the repository says a person must merge. He also wants thirdshift able to run with a lot of autonomy elsewhere: an obvious PHP fatal error reported through Tourbot Help's Engineering Report should go from Triage to Self-merge with no one reading it, while a wording, UI, business-logic or feature change is held for review.
Solution
A new per-repository Self-merge check: a command the repository or the host provides, which thirdshift runs immediately before every Self-merge. Exit 0 lets the merge go ahead. Any other exit ends the Run ready for review. The command's first line of output is the reason, shown in the Inbox, the Run notification and the Command log. thirdshift knows nothing about lanes or Doors: the command owns the rule. A command that lives in the repository runs as it is on the Base branch, never as the pull request's own branch has it, so no Run can rewrite the check it is judged by. A command given as an absolute host path is outside every worktree. One host script can then serve many repositories, for example a "hold one-way doors" rule across personal repositories that Self-merge everything today.
The check is set per repository in the User config, can be turned on or off for one Command by flag, and is off for any repository without an entry. Every Self-merge path is covered, and so is the Spec's final merge. Tickets landing on a Spec branch are not.
For Tourbot, the repository will provide a script that holds stakeholder-review, one-way, or undeclared pull requests, and that refuses a declaration downgraded during the Run. Tourbot will then drop its hold labels, its Sign-off hold entry and its red gate. That change is tracked separately in Tourbot, and lands only after this ships and is configured.
User Stories
- As a repository owner, I want to name a Self-merge check for my repository in the User config, so that thirdshift asks my rule before it ever merges by itself.
- As a repository owner, I want the check to be any command, so that my repository, not thirdshift, decides what may merge unattended.
- As a repository owner, I want thirdshift to know nothing about lanes or Doors, so that my release vocabulary can change without a thirdshift release.
- As a repository owner, I want a check that is a script in my repository to run as committed on the Base branch, so that a Run cannot edit the script on its own Issue branch to let itself through.
- As a repository owner, I want changing the check itself to take a merged pull request, so that the rule only changes through the same review as any other change to the Base branch.
- As an operator with many personal repositories, I want the check to be an absolute path to a host script, so that one rule covers every repository without a file in each.
- As an operator, I want a host script to sit outside every worktree, so that no Run can change it either.
- As an operator, I want the command to receive the pull request's number and current body in its environment, so that a simple shell script can read the declaration.
- As an operator, I want the command to also receive the pull request's body as it was when the Run first observed the pull request, so that the check can refuse a declaration that moved toward merging during the Run.
- As an operator, I want that earlier body to be the body the pull request was opened with when the Run opened it, so that a later Repair edit cannot pose as the original declaration.
- As a repository owner, I want exit
0to mean "merge", and any other exit to mean "hold", so that the contract is one rule. - As a Day shift reviewer, I want the first line the check prints to be the hold reason, so that I see why a Run stopped without opening a log.
- As a Day shift reviewer, I want a generic reason naming the exit status when the check prints nothing, so that a silent hold is still explained.
- As a repository owner, I want a missing command, a command that cannot start, and a command that does not finish within the timeout all to hold, so that a broken check can never let a merge through.
- As a repository owner, I want a check that keeps running to be stopped after a fixed timeout and counted as a hold, so that a hung script cannot hold a Claim forever.
- As a Day shift reviewer, I want a held Run to end ready for review exactly as a Sign-off hold does: Claim released, no
agent-failed, no Repair and no Check re-run, so that a hold is never mistaken for a failure. - As an operator, I want a held Run not to count toward the Failure limit, so that deliberate holds cannot stop Pickup and Triage Passes the way the red gate did.
- As a Day shift reviewer, I want held Runs to appear in the console's ready-for-review section with the check's reason, so that I have one queue of pull requests waiting for a person.
- As a Day shift reviewer, I want the Run notification to carry the reason, so that
[email] unless_mergedtells whoever it is configured for that a person is needed. - As an operator, I want the Command log to record the check, its exit and its reason, so that I can audit every unattended merge decision afterwards.
- As an operator, I want the check to run for a Self-merge asked for by the
mergelabel, so that the label never merges what the repository says a person must merge. - As an operator, I want the check to run for a Base fix's merge, so that the one path that merges with no label is covered too.
- As an operator, I want the check to run for a merge-mode Review run, so that a Review run that Self-merges obeys the same rule.
- As an operator, I want the check to run at a Custom process's
self-mergeStep, so that a Process I define cannot step around it. - As an operator, I want the check to run for a Self-merge that Pickup or
[merge] alwaysasked for, so that turning on full autonomy keeps the repository's rule. - As an operator, I want Ticket runs inside a Spec run to land on the Spec branch without the check, so that a Spec's Tickets keep flowing.
- As an operator, I want the check to run before the Spec run's own Self-merge into the Base branch, so that the whole Spec is judged once at the point it reaches production.
- As an operator, I want a
--self-merge-checkflag to turn the check on for one Command, so that I can apply a repository's rule on a host or Run where config leaves it off. - As an operator who has already reviewed a pull request, I want a
--no-self-merge-checkflag, so that a merge I start deliberately is not held for my own review. - As an operator, I want flags on the cron line to follow the same word conventions as other Command words, so that crontab entries stay readable.
- As an operator, I want a repository with no entry to behave exactly as today, so that the 30-odd repositories on my personal host see no change.
- As an operator, I want the Self-merge check and a Sign-off hold to work independently on the same repository, so that I can move a repository from one to the other without a gap.
- As an operator, I want the check to run against the pull request's head as last observed immediately before the merge request, so that the body it reads is the body of the commit being merged.
- As an operator, I want a body edit after the check passes and before the merge request to be caught by the existing readiness recheck, so that the check cannot be raced.
- As an operator, I want the check to run only after CI is settled green and the pull request is otherwise ready to Self-merge, so that a hold never hides a real failure that a Repair should fix.
- As a repository owner, I want a Run held by the check to keep its Issue branch and pull request, so that a person can merge it as it stands.
- As an operator, I want a Pickup run that later finds the same issue's pull request open and held to leave it waiting for a person rather than retry, so that holds do not churn.
- As a Tourbot operator, I want the Engineering Report → Triage →
ready-for-agent→ Pickup flow to Self-merge an obvious bug fix declaredauto-shiptwo-way, so that urgent breakage is fixed with no one waiting. - As a Tourbot operator, I want the same flow to hold a pull request declared
stakeholder-reviewor one-way, so that business-logic, wording, UI and feature changes reach a person first. - As a Tourbot operator, I want a pull request with no declaration held, so that "when unsure, treat it as one-way" is the default.
- As a Tourbot operator, I want a Repair that adds a missing declaration to be allowed, so that an honest fix to the body does not block the Run on its own.
- As a Tourbot operator, I want a declaration a Run downgraded (
stakeholder-review→auto-ship, one-way → two-way) held, so that an agent cannot declare its way past the rule. - As an operator, I want the guide and glossary to define the Self-merge check and how it differs from a Sign-off hold, so that I can choose between them.
- As a future maintainer, I want an ADR recording why the repository or host owns the rule, why a repository script runs from the Base branch, and why built-in lanes and Doors are deferred, so that the design is not undone by accident.
- As a future maintainer, I want that ADR to name "several repositories running the same check" as the signal to build a lane or Door rule into thirdshift, so that the deferral has an exit.
Implementation Decisions
- Glossary term: Self-merge check. "A command a repository or host provides, which thirdshift runs immediately before a Self-merge. A repository script runs as committed on the Base branch. A nonzero exit ends the Run ready for review with the command's first output line as the reason." Avoid: gate, Sign-off hold (a different mechanism: a named red check plus a label), merge precondition. The Self-merge, Sign-off hold and ready-for-review entries cross-reference it.
- User config. A new per-repository map under
[merge],self_merge_check, keyed the same way assign_off_holdandlabel_from, whose value is a command string. A repository with no entry has no check. Every host needs its own entry, as with a Sign-off hold. - Command words.
self-merge-checkandno-self-merge-check, plus their flag forms, override the User config for one Command and are inherited by child Runs like other Command choices.self-merge-checkwith no User config entry for the repository is a usage error before any work, because there is no command to run. - Resolving the command. If the first word of the command is an absolute path, it is a host script and runs as it is. Otherwise it is a path inside the repository. thirdshift reads that file as committed at the Base branch tip on
origin, immediately before the check, writes it to Command scratch, and runs that copy. The Issue branch's copy is never run. A file missing from the Base branch is a hold. Remaining words are passed as arguments. - Environment contract. The command gets
PR_NUMBER,PR_BODY(the body as observed at the merge-readiness observation for the head about to be merged),PR_BODY_AT_START(the body when this Command first observed the pull request; for a pull request the Command opened, the body it was opened with), the repository asowner/name, and the Base branch. Working directory is Command scratch, not the worktree. - Outcome contract. Exit
0means merge. Any other exit, failure to start, or exceeding a fixed timeout (one minute) means hold. The reason is the first non-empty stdout line, trimmed and length-capped. If there is none, it isSelf-merge check exited <status>(ortimed out/could not start). - Where it runs. At the single Self-merge step every path reaches, after CI is settled green and the readiness and mergeability observation, and before the merge request. The existing recheck between observation and request (head, branches and the
mergelabel) stays in force, and a body change counts as a change of readiness. This covers merge-label Ticket runs,[merge] alwaysand Pickup merges, Base fixes, merge-mode Review runs, a Custom process'sself-mergeStep, and the Spec run's final Self-merge. Tickets landing on a Spec branch do not reach this step and are not checked. - A hold. It ends the Run ready for review, the same way a Sign-off hold does: the Claim or pull request reservation is released, the Issue branch and pull request stay, and there is no
agent-failed, no Repair, no Check re-run, and no Failure limit count. The reason goes to the Inbox's ready-for-review row, the Run notification, the Command log and stderr. The exit code follows the existing convention for a Run that ends ready for review when a Self-merge was asked for. - Fix Pass. A Fix Pass treats a pull request whose last Run ended on a Self-merge check hold the way it treats a Sign-off hold: it passes over it and does not repair it, unless something else is red.
- Relationship to the Sign-off hold. The two are independent and can both be configured. The Sign-off hold still decides CI readiness. The Self-merge check runs only once a Run would otherwise Self-merge.
- The downgrade rule belongs to the command. thirdshift supplies both bodies and does not compare declarations itself. The Tourbot script will hold when the start body declared
stakeholder-reviewor one-way and the current body declares otherwise, and allow a declaration added where the start body had none. - ADR. A new ADR, following ADR 0035, records that the repository or host owns the rule, that a repository script runs from the Base branch, and that built-in lanes and Doors are deferred until several repositories run the same check. Its considered options are:
- lanes written by
thirdshift-prand parsed by thirdshift; - a built-in Door-only hold;
- running the Issue branch's copy of the script;
- a Custom process
commandStep, which cannot sit betweendeliveryandself-merge.
- lanes written by
Testing Decisions
-
Seam. Test only external behavior, through the
thirdshiftbinary in aScenariowith the fakegh, the fake Harness and a per-test User config. That is the same seam as the Sign-off hold tests intests/ci.rsandtests/fix_pass.rs. Assert outcomes:- whether the pull request merged or the Run ended ready for review;
- the reason on stdout, stderr and in the Command log;
- the Claim and labels left on the issue;
- whether the Failure limit counted;
- the exit code.
Do not assert how the command is spawned or where scratch lives.
-
New test file for the Self-merge check, with a small check script written by each test. Cases:
- Exit
0merges, and nonzero holds with its first output line as the reason. - No output gives the generic reason. A missing command, a command that cannot start, and a timeout each hold.
- A repository script is read from the Base branch, even when the Issue branch changed it to always pass.
- A repository script absent from the Base branch holds.
- An absolute host path runs.
PR_NUMBER,PR_BODYandPR_BODY_AT_STARThold the right values, including for a pull request the Command opened.- A body edited between the check and the merge request is caught by the recheck.
self-merge-checkturns it on without config and errors without an entry,no-self-merge-checkturns it off, and a repository with no entry is unchanged.- A hold releases the Claim, adds no
agent-failed, and does not count toward the Failure limit.
- Exit
-
One case per Self-merge path, beside its existing tests:
- a merge-label Ticket run (
tests/merge_run.rs); - a Base fix (
tests/base_fix.rs,tests/fix_base_ci.rs); - a merge-mode Review run (
tests/review_merge.rs); - a Custom process
self-mergeStep; - a Spec run: Tickets land on the Spec branch unchecked, and the final Self-merge is checked (
tests/process/spec_run.rs).
- a merge-label Ticket run (
-
Fix Pass: passes over a held pull request, and repairs one that also has another red check (prior art: the Sign-off hold cases in
tests/fix_pass.rs). -
Console and Run notification: the ready-for-review row and the notification carry the reason, using the existing console and inbox tests.
-
Coexistence: a repository with both a Sign-off hold and a Self-merge check behaves as each alone would.
Out of Scope
- Any knowledge of Release Lanes or Doors inside thirdshift, or any change to
thirdshift-pr's body format. - A built-in lane or Door rule. It is deferred by the ADR.
- Tourbot's side:
- its check script and its
--holdmode; - renaming its required check;
- deleting its labels;
- its policy, PR template and glossary changes.
- its check script and its
- Fleet configuration: setting
self_merge_checkon the five ETA hosts, removing Tourbot'ssign_off_holdentries, and any later move to[merge] always = truefor Tourbot. - Removing or changing the Sign-off hold feature.
- Changing who may apply the
mergelabel. - Triage's issue category influencing the hold. The pull request's declaration alone decides.
Further Notes
-
The decisions and the evidence behind them are in Educational-Travel-Adventures/orchestration#1530: the plan
docs/plans/2026-12-03-tourbot-release-hold-redesign.mdand the researchdocs/research/2026-12-03-tourbot-release-hold-mechanisms.md. -
Rollout order matters:
- release this;
- configure it for Tourbot on every host;
- only then land the Tourbot change that removes the labels and the gate.
Reversing the order leaves a window where nothing stops a Self-merge of a
stakeholder-reviewpull request. -
Every fleet host acts as one GitHub login, so GitHub cannot tell thirdshift's merges from a person's. The Command log line for each check is the audit trail for unattended merges.
Activity
JacobStephens2 commentedon Dec 3, 2026
This comment was generated by AI.
thirdshift's Run on this issue failed, so it waits for the Day shift.
issue-2421on originPut
ready-for-agentback to retry.Fix CI failures inherited from the interrupted Self-merge check work (#…
JacobStephens2 commentedon Dec 4, 2026
This comment was generated by AI.
thirdshift's Run on this issue failed, so it waits for the Day shift.
issue-2421on origin, with pull request Self-merge check: a repository-owned command that can hold any Self-merge #2433Put
ready-for-agentback to retry.