Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
39 commits
Select commit Hold shift + click to select a range
e491e70
Run repository Self-merge checks before requesting merges (#2421)
JacobStephens2 Dec 3, 2026
c57035c
Preserve original PR bodies and review hold outcomes (#2421)
JacobStephens2 Dec 3, 2026
73d5912
Clarify Fix Pass holds in the site summaries (#2421)
JacobStephens2 Dec 3, 2026
7541aa1
thirdshift: failed ticket run (interrupted)
JacobStephens2 Dec 3, 2026
6e738fc
Name missing Base branch Self-merge scripts in holds (#2423)
JacobStephens2 Dec 3, 2026
5e0e790
Report repository script read errors without pathspecs (#2423)
JacobStephens2 Dec 3, 2026
db4f69e
thirdshift: failed ticket run (CI red on 5e0e790 and the Repair found…
JacobStephens2 Dec 3, 2026
83fb0b7
Fix CI failures inherited from the interrupted Self-merge check work …
JacobStephens2 Dec 4, 2026
d17f127
Resolve Base branch Self-merge policy links and clarify overrides (#2…
JacobStephens2 Dec 4, 2026
ede2a1c
Merge pull request #2429 from JacobStephens2/issue-2423
JacobStephens2 Dec 4, 2026
7abd10c
Cover Self-merge checks across Delivery paths (#2426)
JacobStephens2 Dec 4, 2026
0c1e0ec
Preserve first-observed PR bodies for Self-merge checks (#2424)
JacobStephens2 Dec 4, 2026
9776047
Honor Self-merge check overrides before dispatch and selection (#2425)
JacobStephens2 Dec 4, 2026
3b3bda4
Address Self-merge check review findings (#2426)
JacobStephens2 Dec 4, 2026
6a7fcdd
Preserve required checks through Custom Process dispatch
JacobStephens2 Dec 4, 2026
e5c66ac
Keep starting PR bodies across Pickup and opening sessions
JacobStephens2 Dec 4, 2026
647a9d0
Carry required checks through Review and finding dispatch
JacobStephens2 Dec 4, 2026
d248800
Preserve PR bodies across Pickup retries and replacement PRs
JacobStephens2 Dec 4, 2026
c7300d0
List non-Pickup run origins explicitly
JacobStephens2 Dec 4, 2026
ec8a04b
Merge pull request #2434 from JacobStephens2/issue-2426
JacobStephens2 Dec 4, 2026
a91872d
Leave Self-merge check holds for the Day shift (#2427)
JacobStephens2 Dec 4, 2026
b28af69
Merge remote-tracking branch 'origin/issue-2421' into issue-2425
JacobStephens2 Dec 4, 2026
0f2f75b
Address hold attribution and Inbox review findings (#2427)
JacobStephens2 Dec 4, 2026
75d1b5e
Bind the Base fix assertion to its Ready for review PR
JacobStephens2 Dec 4, 2026
c960d58
Merge pull request #2435 from JacobStephens2/issue-2425
JacobStephens2 Dec 4, 2026
ec99bf1
Merge remote-tracking branch 'origin/issue-2421' into issue-2424
JacobStephens2 Dec 4, 2026
d4a4625
Leave Self-merge check holds for the Day shift
JacobStephens2 Dec 4, 2026
7494ce9
Merge issue-2421 and keep the explicit Fix Pass hold override
JacobStephens2 Dec 4, 2026
62d411a
Preserve and surface Self-merge check holds across Runs
JacobStephens2 Dec 4, 2026
eec86a1
Merge pull request #2436 from JacobStephens2/issue-2424
JacobStephens2 Dec 4, 2026
349ea98
Read hold history from repository Command records
JacobStephens2 Dec 4, 2026
dccf184
Merge issue-2421 and retain Pickup PR body observations
JacobStephens2 Dec 4, 2026
392511a
Merge issue-2421 and share Pickup branch and PR observations
JacobStephens2 Dec 4, 2026
cc8dbab
Recheck holds under reservation and reuse readiness observations
JacobStephens2 Dec 4, 2026
448b4c5
Recheck held PRs and Spec branches before Pickup
JacobStephens2 Dec 5, 2026
4092219
Preserve held Run notifications through Custom processes (#2427)
JacobStephens2 Dec 5, 2026
140e18f
Merge pull request #2440 from JacobStephens2/issue-2428
JacobStephens2 Dec 5, 2026
4a18c3e
Merge remote-tracking branch 'origin/issue-2421' into issue-2427
JacobStephens2 Dec 5, 2026
e2e2901
Merge pull request #2438 from JacobStephens2/issue-2427
JacobStephens2 Dec 5, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions GLOSSARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@ _Avoid_: task, sub-task

**Ready issue**:
An open issue a **Pickup run** may take: labelled `ready-for-agent`, written by a **Trusted account** or a named author, with its most recent `ready-for-agent` labelling made by a Trusted account and with later title and body edits only by Trusted accounts or the authorized author, with no label that makes an **Unready Ticket** and no **Claim**, not a sub-issue, not a **Base fix**'s or a **Security run**'s fix issue, with no open blocker, either never started (no **Issue branch** and no pull request) or handed back at or after the last **Claim** ended, as recorded in its label history: by the **Day shift** applying `ready-for-agent`, or by thirdshift putting it back on a Spec whose Spec run ended only waiting, which it does only when only Trusted accounts or the authorized author have edited the Spec since its last Trusted `ready-for-agent` labelling, and otherwise labels the Spec `needs-triage`, and only when each of its open Tickets in its repository passes the Trusted account check for Tickets, and otherwise labels it `agent-failed`, left untouched long enough that whoever is shaping it has finished, and, if it is a **Spec**, with a **Startable Ticket** or with every Ticket closed and a resumable **Spec branch** on `origin` (the latest numbered branch, with no PR or an open PR). A hand-back made in the same edit as the Claim's removal counts in either listed order at that timestamp; a Claim applied at the same timestamp leaves the issue Claimed. On a Spec, the label says its Tickets are published. A `ready-for-agent` Ticket inside a Spec is not one: it is reached through its Spec, when the Spec is itself a Ready issue.

An open pull request whose latest locally recorded Run ended at a **Self-merge check** hold keeps its issue waiting for the **Day shift**, even after a hand-back.
_Avoid_: queued issue, backlog item

**Trusted account**:
Expand Down Expand Up @@ -262,10 +264,12 @@ _Avoid_: computer use, video artifact, test skill, app harness
**Self-merge**:
The step at the end of a **Ticket run** asked to merge in which thirdshift itself merges Delivery's captured pull request by number in its repository, with a merge commit at the exact head whose CI it watched. A **Custom process** reaches that same step through a `self-merge` catalogue Step directly after `delivery`, and only when its command or the **User config** asks. A fresh observation validates its expected **Issue branch** and **Base branch**, open state, readiness and mergeability immediately before the request. GitHub guards the requested head, but offers no atomic expected-base guard against a retarget between that observation and the server merge. No human reviews it first. A failed or interrupted request counts as merged only when a completion observation of the same number confirms the requested head and expected branches. Completion then continues even after Command interruption. It ends with the **Issue branch** deleted, the issue closed by thirdshift, unless it is already closed, and the issue's **Claim** removed. A protected path in a Custom process holds it and leaves the pull request ready for review, as an unaddressed **Security finding** does.

Before a Self-merge into the Base branch, a configured **Self-merge check** can leave the pull request ready for review.

**Repair loop**:
The rounds a **Delivery** goes through until the pull request's head is mergeable with the **Base branch** and its CI is green or absent. Each round merges the Base branch in (and, in a **Ticket run** asked to merge, any **Foreign commits**), pushes, watches CI, and starts a **Repair** for a conflict or for the branch's own red checks. When the Base branch moved while green or absent CI ran, a Ticket run asked to merge goes round again to merge it in. A Delivery that leaves the pull request ready for review stops on that head if GitHub reports the pull request mergeable, and the move is not counted; otherwise it goes round again. Repairs and upstream moves have fixed budgets. A **Custom process** may set a lower Repair cap. It cannot set a higher one.

A **Sign-off hold** can end the loop ready for review once the pull request is mergeable.
A **Sign-off hold** can end the loop ready for review once the pull request is mergeable. A **Self-merge check** can hold a requested **Self-merge** after the loop has settled CI.

**Repair**:
A follow-up agent session a **Ticket run** starts after the pull request exists, or a **Spec run** starts on its **Spec PR** after the **Spec review**: to resolve a merge conflict with the **Base branch** or the **Issue branch** on `origin`, to fix failing CI checks, or, in a **Ticket run** asked to merge, to review and fix **Foreign commits**.
Expand All @@ -290,6 +294,11 @@ Settled CI with a failing check. **CI watch** identifies which failures belong t
**Sign-off hold**:
A named check and hold label for a repository in the **User config**. When **CI watch** sees that check red, the open pull request carries the label on the watched head, and every other check has settled green, a **Ticket run**, **Spec run** or **Fix run** ends ready for review. The run releases its **Claim** or pull request reservation, and a requested **Self-merge** waits for the **Day shift**. The check and label appear in the **Inbox**, **Run notification** and **Command log**. Each machine that runs on the repository needs its own entry.

CI watch handles the Sign-off hold independently of the **Self-merge check**.

**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. The **Sign-off hold** handles its named red check earlier in Delivery.

**Check re-run**:
The [one re-run](docs/guide.md#check-re-run-allowance) of a branch's own failed checks allowed per head commit within a **Delivery**, after a CI-fix **Repair** leaves that head unchanged and before a **Declined CI fix**. It gives a transient CI failure one chance to pass without another Repair. It is separate from the re-run of **Abandoned jobs**, which comes before any Repair.
_Avoid_: retry, re-trigger, CI re-run
Expand Down Expand Up @@ -397,7 +406,7 @@ Inbox, without adding to its count of active Commands.
Ready for review shows one row per validated pull request across the visible
**Commands**, including across the **Fleet**. A grouped pull request keeps its
contributing Commands available individually.
An ending at a **Sign-off hold** appears in Ready for review with its check and label.
An ending at a **Sign-off hold** or a **Self-merge check** appears in Ready for review with the reason.
_Avoid_: dashboard, feed, queue

**Needs you**:
Expand Down
33 changes: 33 additions & 0 deletions docs/adr/0037-repositories-own-the-self-merge-check.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
# Repositories own the Self-merge check

A repository can configure one command to run immediately before a Self-merge
into its Base branch. A successful exit allows the merge request. A nonzero
exit, start failure or timeout leaves the pull request ready for review. The
check receives the current and first-observed pull request bodies so the
repository can apply its own policy and recognize a changed declaration.

The checkout for an Issue branch can change during a Run. Read a repository
command directly from the tip of the Base branch on origin, and execute the
copy in Command scratch. An operator can also name an absolute host path
outside worktrees and share it across repositories. The last readiness
observation binds the check to the head and body being considered. GitHub
guards the head at the merge request. A body edit detected in the final
observation holds the PR, and GitHub offers no atomic expected-body guard
after that observation.

[ADR 0035](0035-a-sign-off-hold-is-ready-for-review-past-one-named-red-check.md)
still governs Sign-off holds. The Self-merge check runs once CI and the other
merge checks have cleared. Tickets landing in a Spec branch bypass it. The
Spec PR runs it before landing in the Base branch.

## Considered options

- Teach `thirdshift-pr` to write Release Lanes and thirdshift to parse them.
Repositories own what their declarations mean and how their rules evolve.
- Ship a built-in Door-only hold. Wait until several repositories run the same
check before promoting a lane or Door rule into thirdshift.
- Run the command from the Issue branch. That would let a Run change the
policy deciding whether its own branch may merge.
- Use a Custom process `command` Step. Delivery and Self-merge share a Repair
loop, and the catalogue puts no command Step between them. Built-in
processes also need the same check.
67 changes: 65 additions & 2 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -2907,6 +2907,61 @@ label_from = { "owner/repo" = ["maintainer-login"] }

Configure one **Sign-off hold** per repository with `delivery.sign_off_hold`. Repository keys and label names match without regard to case. Check names match exactly. Config validation rejects blank checks or labels, repository keys that differ only in case, and the factory's `in-progress` reservation label. Add the entry on each machine that runs on the repository.

Configure a **Self-merge check** with `merge.self_merge_check`. Add the entry
on every host that runs on the repository. Repository keys match without regard
to case. The same repository can also have a Sign-off hold. CI watch handles
the named red check and label first. The Self-merge check runs only when the
pull request is otherwise ready to Self-merge.

```toml
[merge]
self_merge_check = { "owner/repo" = "scripts/self-merge-check 'release policy'" }
```

The first word is the executable and the remaining words are its arguments.
Use shell quoting to group words. A relative path names a repository script.
Immediately before the check, thirdshift reads the committed script at the tip
of the Base branch on `origin`, copies it to Command scratch and runs that copy.
A symbolic link must resolve to a file in that same commit.
To change the rule, merge a pull request that updates the script. Edits on the
Issue branch have no effect on the check judging that branch. If the script is
absent from the Base branch, the hold reason reports the missing path.

An absolute path such as `/usr/local/bin/self-merge-check` names a host
executable outside Git worktrees.

Both forms run from Command scratch with `PR_NUMBER`, `REPOSITORY`
(`owner/repo`), `BASE_BRANCH` and two pull request bodies in their environment.

- `PR_BODY` comes from the readiness observation of the head about to merge.
- `PR_BODY_AT_START` contains the opening body for a pull request created by
the Command. For an existing pull request, including a Fix run or
Continuation, it contains the body at the Command's first observation.

A Repair can change `PR_BODY` while `PR_BODY_AT_START` keeps the starting text.
The repository's check can allow a declaration where the starting body had
none and hold a Repair that changes an existing declaration.
If the starting body is unavailable, the Run leaves the PR ready for review.

Exit `0` allows Self-merge. Any other exit, a missing or unstartable executable,
or a one-minute timeout leaves the pull request ready for review. The first
nonempty stdout line, trimmed and capped at 240 characters, becomes the
reason. Without a line, thirdshift reports the exit status, timeout, missing
path or start failure. The reason appears on stderr, in the Command log, in
the Run notification and in the Inbox. The Run releases its Claim or PR reservation
and keeps the open PR. A targeted Review that asked to Self-merge exits with
status `1` when held. Ticket, Spec and Fix runs and author Review Passes
exit successfully. If the body changes during the check, the Run leaves the
pull request ready for review.

Use `no-self-merge-check` or `--no-self-merge-check` to turn the check off for
one Command. Use `self-merge-check` or `--self-merge-check` to require a
configured command. If the repository has no entry, this is a usage error
before work starts. Give at most one of these options per Command. The
choice carries through to Runs dispatched by a Pass and to Base fixes. It
applies to requested Self-merges into the Base branch, including the Spec PR.
Tickets land into the Spec branch without running the check.

After saving the User config and any entered Credentials, `thirdshift setup`
checks the host tools for pull request **Visual evidence**: `gh >= 2.103.2`,
`ffmpeg` on `PATH`, and an installed Playwright Chromium executable. It checks
Expand Down Expand Up @@ -3834,8 +3889,9 @@ The word applies only to a Fix Pass: targeted Fix runs and other commands reject
it. An existing `fix-<base>-<sha>` PR selected later gets no merge permission
from its branch name or this word; use a targeted `thirdshift fix <PR> merge`
to request its Self-merge explicitly. `--author` still skips Base branch CI
maintenance. A Ticket run's own `base-fix` still always merges, as
[ADR 0008](adr/0008-inherited-failures-fail-the-run.md) requires.
maintenance. A Ticket run's own `base-fix` still requests Self-merge under
[ADR 0008](adr/0008-inherited-failures-fail-the-run.md). A configured Self-merge
check can hold the Base fix for review.

For a crontab line that repairs the Base branch unattended while leaving feature
PRs for review, whatever the User config's merge default:
Expand Down Expand Up @@ -3866,6 +3922,10 @@ behind threshold, and continues to the next candidate. A Merge conflict or
other settled CI red keeps the PR eligible, with the held check left out of
the Repair's failure list. An explicit Fix run on a PR held only by a Sign-off
hold succeeds ready for review and names the check and label it is waiting on.
A Fix Pass also passes over a PR whose latest Run on the machine ended at a
Self-merge check, unless the PR has a Merge conflict or settled CI red. Use
`no-self-merge-check` to let a Fix Pass consider such a PR under its usual
eligibility rules and skip the check if it Self-merges.

The Pass skips `in-progress` PRs. It reserves and rechecks each candidate;
if another machine reserved it first, it continues to the next candidate.
Expand Down Expand Up @@ -4432,6 +4492,8 @@ thirdshift pickup trust-author 'intake[bot]' # approve this author for one Pass
Pickup has no Built-in process file. It selects and reserves the Ready issue,
then starts `ticket-run` or `spec-run` as a command on that Issue URL would.

Pickup passes over an open pull request whose latest run on this machine ended at a Self-merge check hold, even if the issue has been handed back. It prints the hold reason and looks for the next Ready issue.

Which end of the issue numbers the pass takes is its order: `lowest-first` by default, `highest-first` with `pickup.order = "highest-first"` in the [User config](#user-config), or for one pass with `lowest-first` or `highest-first` on the command, which wins over the User config. Two schedules working through the same queue from opposite ends, one with each order, collide less often; the reservation below still protects either choice.

Add `skip-author <login>` (or `--skip-author <login>`) on each cron line to pass over issues written by that account, even a **Trusted account**. Repeat it for several accounts; logins match case-insensitively. The Pass logs `#947 passed over: written by alice, whom this Pass skips` and searches for the next Ready issue. A skipped Spec author excludes the whole Spec. A Spec run dispatched by this Pass also stops before a Ticket written by a skipped account, with the same failure handling as an untrusted Ticket author. These choices belong to this Pass, with no User config setting; explicitly running `thirdshift <Issue URL>` still runs the named issue under the usual trust checks. The word never makes an untrusted author eligible.
Expand All @@ -4449,6 +4511,7 @@ A Ready issue is an open issue that:
- is not a sub-issue. A sub-issue is a **Ticket** of a **Spec**, and is never run on its own, whatever the Spec's labels: it is reached through its Spec, when the Spec is itself a Ready issue, so its work always goes through the **Spec branch**. Labelling one Ticket never promotes its Spec, either;
- is not labelled `base-fix` or `security-fix`: the Ticket run that opened a [Base fix](#base-fix)'s issue, or the Security run that dispatched a fix, owns it. A failed Security fix is still passed over if GitHub prevented its Claim from being made;
- has no open blocker, by GitHub's "blocked by" links, never the text of its body. Once every blocker is closed, it can be taken;
- has no open pull request whose latest locally recorded Run ended at a **Self-merge check** hold. The hold keeps the issue with the Day shift even after a hand-back. Pickup looks for the next Ready issue. Architect and Security use the same readiness rule when deciding whether to defer to Ready work;
- either was never started (no **Issue branch** on `origin` and no pull request from one, open, merged or closed), or you handed it back by applying `ready-for-agent` at or after its last [Claim](#the-claim) ended. A Spec whose Spec run ended only waiting is handed back by thirdshift the same way, unless someone other than a Trusted account or the Spec's authorized author edited its title or body after its last Trusted Ready labelling. For started work, the full label history must show an earlier `in-progress` application and its removal, with `ready-for-agent` applied at that removal's timestamp or later. A swap made in one edit counts in either listed order; a new Claim applied at the same timestamp leaves the issue Claimed. Work never Claimed, or without that hand-back, stays with you. An eligible branch with no PR or an open PR follows the existing [Continuation](#continuation) rule; merged or closed PRs follow ADR 0002 and start a fresh numbered branch. This is deliberate hand-back, not automatic retries;
- if it is a **Spec** whose **Tickets** are all closed, its Spec run can continue its Spec branch on `origin` under [ADR-0002](adr/0002-existing-issue-branch-means-continue.md): the latest numbered branch is present, with no PR or an open PR. The dispatched Spec run goes straight to the Spec review and the Spec PR's Delivery and Repair loop, without running a Ticket again. A PR without its branch, or a retained branch whose latest PR is closed or merged, does not qualify. Without a resumable branch, waiting never makes it a Ready issue: close it, or take its `ready-for-agent` off;
- is settled: by default, five minutes have passed since the latest of `ready-for-agent` being applied to it, a sub-issue being added to it or removed, and a "blocked by" link being added to it or removed. So a Spec is not taken while its Tickets are still being attached. These are read from the issue's timeline, since adding a sub-issue does not change the issue's update time, and `pickup.wait_minutes` in the [User config](#user-config) sets the window in whole minutes from 0 up, within the supported duration range; 0 disables waiting. An Architect run also waits for an issue that meets every other Ready issue condition while it is settling. A later pass takes the issue once it has settled;
Expand Down
Loading
Loading