Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 2 additions & 0 deletions GLOSSARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ _Avoid_: task, sub-task
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.
_Avoid_: queued issue, backlog item

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.

**Trusted account**:
The repository's owner, a member of the organization that owns it, a collaborator on it, or the account thirdshift's own `gh` credentials act as, such as a GitHub App's `<app>[bot]`: an issue author's `authorAssociation` of `OWNER`, `MEMBER` or `COLLABORATOR`, or that login; for an actor with no association field, and for an issue author with an untrusted one, equivalent repository membership or that login. The rule is fixed, with no **User config** setting. A **Spec run** stops before starting the Ticket run of a **Ticket** whose author is neither a Trusted account nor a named author, or whose title or body anyone else edited after the later of the Ticket's and its Spec's last `ready-for-agent` labellings by a Trusted account. A Ticket needs no `ready-for-agent` labelling of its own: the labelling that counts is its Spec's, checked when a **Pickup run** takes the Spec. **Ticket runs** and **Spec runs** check their issue again before a session, **Resume**, push or **Self-merge**. Title or body edits since a few minutes before the run started may come only from Trusted accounts or the issue's authorized author. A **Fix run** accepts only a Trusted account's edits on every linked closing issue (retaining previously linked ones during that run) around every **Repair**, **Resume**, push and **Self-merge**, and a **Review run** or pull-request **Custom process** accepts only a Trusted account's edits on every linked closing issue before writing `.thirdshift-review-input.md`, before and after each **Step**, session, **Repair** and **Resume**, before **Delivery** pushes fixes or posts its comment, and through any **Self-merge**, without drafting the pull request. The named-author exception does not apply to those pull-request checks. A **Review run**, a **Fix run**, or a pull-request **Custom process**, including one started as a **Pass**, also stops before using a linked closing issue unless that issue's author is a Trusted account and no account that is not one has edited its title or body. Each session that works on an issue gets the issue from thirdshift, written into its worktree again before the session starts: its title, its body, and only the comments by Trusted accounts and the issue's authorized author, each other comment replaced by a line saying it was left out. The **Session prompt** and **Factory skills** tell the session to work from that and not to fetch the issue's comments itself.

Expand Down
1 change: 1 addition & 0 deletions docs/guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -4509,6 +4509,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
1 change: 1 addition & 0 deletions site/docs/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4202,6 +4202,7 @@
<li>is not a sub-issue. A sub-issue is a <strong>Ticket</strong> of a <strong>Spec</strong>, and is never run on its own, whatever the Spec&#39;s labels: it is reached through its Spec, when the Spec is itself a Ready issue, so its work always goes through the <strong>Spec branch</strong>. Labelling one Ticket never promotes its Spec, either;</li>
<li>is not labelled <code>base-fix</code> or <code>security-fix</code>: the Ticket run that opened a <a href="#base-fix">Base fix</a>&#39;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;</li>
<li>has no open blocker, by GitHub&#39;s &quot;blocked by&quot; links, never the text of its body. Once every blocker is closed, it can be taken;</li>
<li>has no open pull request whose latest locally recorded Run ended at a <strong>Self-merge check</strong> 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;</li>
<li>either was never started (no <strong>Issue branch</strong> on <code>origin</code> and no pull request from one, open, merged or closed), or you handed it back by applying <code>ready-for-agent</code> at or after its last <a href="#the-claim">Claim</a> 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&#39;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 <code>in-progress</code> application and its removal, with <code>ready-for-agent</code> applied at that removal&#39;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 <a href="#continuation">Continuation</a> rule; merged or closed PRs follow ADR 0002 and start a fresh numbered branch. This is deliberate hand-back, not automatic retries;</li>
<li>if it is a <strong>Spec</strong> whose <strong>Tickets</strong> are all closed, its Spec run can continue its Spec branch on <code>origin</code> under <a href="https://github.com/JacobStephens2/thirdshift/blob/main/docs/adr/0002-existing-issue-branch-means-continue.md">ADR-0002</a>: 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&#39;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 <code>ready-for-agent</code> off;</li>
<li>is settled: by default, five minutes have passed since the latest of <code>ready-for-agent</code> being applied to it, a sub-issue being added to it or removed, and a &quot;blocked by&quot; 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&#39;s timeline, since adding a sub-issue does not change the issue&#39;s update time, and <code>pickup.wait_minutes</code> in the <a href="#user-config">User config</a> 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;</li>
Expand Down
1 change: 1 addition & 0 deletions site/how-it-works/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -270,6 +270,7 @@ <h1>How thirdshift works</h1>
<summary class="sec-head"><p class="eyebrow">07 / Where the next issue comes from</p><h2 id="scheduled-title">Choose how the next work starts</h2></summary>
<p>Every Pass checks the machine's GitHub Quota wait, then the quota, before other GitHub work or taking a Command-limit slot. It skips during a wait or below 500 REST requests or GraphQL points, with no stdout or Run notification. Pickup, Architect, Security, Triage without input, Review with <code>--author</code>, Fix without a pull request and issue-less Custom processes all follow this rule, from cron or by hand. The Activity log records each kind's changed reason; <code>status</code> and the Inbox show the wait beside last-fired Passes until reset. Budget Pass frequency per GitHub user across all hosts and repositories sharing that user's quota. After the quota, a Pass reads this machine's <strong>Plan usage</strong>, refreshing a stale Claude, Codex, Muse or agy snapshot with its non-billed read, and skips the same way when every route its sessions may take is held, with a banner in <code>status</code> and the Inbox naming the held routes and the earliest reset.</p>
<div class="guide-content" id="scheduled">
<p>If an issue's pull request is still open and the latest run recorded on this machine ended at a Self-merge check hold, Pickup leaves it for the Day shift and looks for the next Ready issue.</p>
<p>Review Passes (<code>review --author</code>) and Fix Passes skip <code>release-*</code> pull requests targeting <code>main</code>, leaving their version-only heads to the Release run. Explicit <code>thirdshift fix &lt;pr-url&gt; --no-merge --no-base-fix</code> still repairs those pull requests.</p>
<p>Review Passes recognize reviewed and pushed heads only in comments by the GitHub account thirdshift acts as. When an upper pull request lacks Review run fixes delivered to its base, its comment says it needs updating before merge; the author updates the stack.</p>
<p>A Review Pass also checks the base Spec's issue when the PR targets an Issue branch, including numbered continuations. An <code>in-progress</code> Claim or issue reservation skips the PR with a line naming that Spec. When GitHub links no closing issue, local closing references in the body (<code>Closes #7</code>, <code>Fixes #7</code>, <code>Resolves #7</code>) get the same hold checks, so Ticket PRs into a non-default Spec branch stay with their Spec run.</p>
Expand Down
2 changes: 1 addition & 1 deletion site/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -437,7 +437,7 @@ <h2 id="grows-title">Seven workflows</h2>
<summary><span class="workflow-name">Pickup run</span><span class="workflow-description">Take a Ready issue and put the factory to work.</span></summary>
<div class="workflow-content">
<p>Add <code>skip-author &lt;login&gt;</code> or <code>--skip-author &lt;login&gt;</code> to a Pickup or Triage cron line to leave that author's issues alone, even for a Trusted account. Repeat it for several logins; matching ignores case. Pickup passes over the whole Spec when its author is skipped, and its dispatched Spec run stops before a skipped author's Ticket. Each exclusion logs why. Explicit Issue URL runs keep their usual trust checks.</p>
<p>A <a href="/docs/#pickup-runs">Pickup run</a> takes the lowest-numbered Ready issue by default, the highest-numbered with <code>pickup.order = "highest-first"</code> or <code>highest-first</code>, after it has settled and while the repository is below its Failure limit: fewer open issues labelled <code>agent-failed</code> than <code>pickup.failure_limit</code>, 3 by default. A pull request waiting for review never holds it back. It immediately re-runs failed Base branch push CI once: green on re-run files a Flaky-test Ticket, and red again files an ordinary bug Ticket after 30 minutes. That CI-red Ticket leaves job names and log lines out of its title, body and later comments, and waits until you write the task and apply <code>ready-for-agent</code>. New failing commits are added to an open CI-red Ticket; one in <code>needs-info</code> does not block a new report. A run the host ran out of disk space under gets <code>ready-for-agent</code> back instead, as a host problem, not the issue's, and so does a Paused Command that no route had Plan usage left for, unless an untrusted edit leaves <code>needs-triage</code> or it is a Security fix. Other failed work stays with the Day shift, labelled <code>agent-failed</code> in place of <code>in-progress</code>, with a generated comment giving its cause, where it stopped, what was preserved and the machine, until you hand it back by applying <code>ready-for-agent</code> again, take <code>agent-failed</code> off, or close the issue. A Spec run only waiting on gated, blocked or out-of-repository Tickets is no failure: its Spec gets <code>ready-for-agent</code> back and a comment naming each undone Ticket and what it waits on, and a later Pickup run continues it once a Ticket can start. A run that leaves its pull request ready for review takes <code>in-progress</code> off and puts nothing back.</p>
<p>A <a href="/docs/#pickup-runs">Pickup run</a> takes the lowest-numbered Ready issue by default, the highest-numbered with <code>pickup.order = "highest-first"</code> or <code>highest-first</code>, after it has settled and while the repository is below its Failure limit: fewer open issues labelled <code>agent-failed</code> than <code>pickup.failure_limit</code>, 3 by default. Pickup leaves an issue for the Day shift if the latest run this machine recorded for its open pull request ended at a Self-merge check hold. Other Ready issues can still move ahead. It immediately re-runs failed Base branch push CI once: green on re-run files a Flaky-test Ticket, and red again files an ordinary bug Ticket after 30 minutes. That CI-red Ticket leaves job names and log lines out of its title, body and later comments, and waits until you write the task and apply <code>ready-for-agent</code>. New failing commits are added to an open CI-red Ticket; one in <code>needs-info</code> does not block a new report. A run the host ran out of disk space under gets <code>ready-for-agent</code> back instead, as a host problem, not the issue's, and so does a Paused Command that no route had Plan usage left for, unless an untrusted edit leaves <code>needs-triage</code> or it is a Security fix. Other failed work stays with the Day shift, labelled <code>agent-failed</code> in place of <code>in-progress</code>, with a generated comment giving its cause, where it stopped, what was preserved and the machine, until you hand it back by applying <code>ready-for-agent</code> again, take <code>agent-failed</code> off, or close the issue. A Spec run only waiting on gated, blocked or out-of-repository Tickets is no failure: its Spec gets <code>ready-for-agent</code> back and a comment naming each undone Ticket and what it waits on, and a later Pickup run continues it once a Ticket can start. A run that leaves its pull request ready for review takes <code>in-progress</code> off and puts nothing back.</p>
</div>
</details>
<details class="workflow">
Expand Down
7 changes: 7 additions & 0 deletions src/branch.rs
Original file line number Diff line number Diff line change
Expand Up @@ -279,6 +279,13 @@ impl History {
})
}

pub(crate) fn open_pull_requests(&self) -> impl Iterator<Item = &PullRequest> {
self.prs
.iter()
.map(|(_, pr)| pr)
.filter(|pr| pr.state == PrState::Open)
}

pub(crate) fn remember_bodies(&self, bodies: &mut FirstPrBodies) {
for (_, pr) in &self.prs {
if let Some(body) = &pr.body {
Expand Down
8 changes: 3 additions & 5 deletions src/fix.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use anyhow::Context;
use chrono::Utc;

use crate::args::{self, FixArgs};
use crate::asks::{Asks, Flags};
use crate::asks::{Asks, Flags, SelfMergeCheckAsk};
use crate::base_fix::{BaseFix, BaseFixAsk};
use crate::child_run::ChildAsks;
use crate::config::UserConfig;
Expand Down Expand Up @@ -78,10 +78,8 @@ pub(crate) fn run(
author.as_deref(),
behind,
sign_off_hold,
command
.flags
.merge_check_for(&launch.repo, config)
.map(|_| config.logs_dir.as_path()),
(command.flags.self_merge_check != Some(SelfMergeCheckAsk::Skip))
.then_some(config.logs_dir.as_path()),
&mut passed_over,
)? {
let selected = FixArgs {
Expand Down
Loading
Loading