Repository navigation
Description
Problem Statement
Today, a Triage run (thirdshift triage) only investigates a raw text Report given via --file <path> or standard input, deduplicating it against open issues and filing new issues or commenting on matches (#1323).
When issues are filed directly on GitHub with needs-triage—whether by a human on the Day shift, an Architect run filing an Architect idea, a Security run recording a Security finding on a private repository, or a review session filing an Unaddressed finding—thirdshift triage cannot investigate and triage those existing issues in place. Operators cannot run thirdshift triage <Issue URL or number> on a specific issue to get an Agent Brief, a Questionnaire, or a wontfix closure, nor can they schedule thirdshift triage in cron as an unattended Pass that steadily works through a repository's needs-triage backlog. In addition, when an issue includes screenshots or image attachments, the triage session (especially inside the read-only whole-machine sandbox) has no way to inspect them locally.
Solution
Extend thirdshift triage so a Triage run supports three entry modes:
- Single-issue mode (
thirdshift triage <Issue URL or number> [base <branch>]): Investigates a specific open GitHub issue in the repository against the Base branch (even if it already carries another triage role such asneeds-infoorready-for-human), pre-downloads any images attached by Trusted accounts into the triage worktree so the session can view them, reserves the issue onoriginand holds anin-progressClaim while running, and updates the issue in place (or only prints the recommendation with--recommend-only):- Applies the recommended repository category label only if the issue does not already carry one;
- Posts one AI-attributed comment containing the
## Agent Brief(ready-for-agent), the investigation summary +## Questionnaire(ready-for-humanorneeds-info), or the closure explanation (wontfix); - Replaces
in-progresswith the target triage role (ready-for-agent,ready-for-human,needs-info, orwontfix, closing the issue whenwontfix), or—whentriage.allow_ready_for_agentisfalseand--allow-ready-for-agentwas not given—transitions a recommendedready-for-agenton an existing issue toready-for-human(with a note thatready-for-agentwas recommended) so an unattended Pass never loops on the same issue.
- Report mode (
thirdshift triage --file <path> [base <branch>]or... | thirdshift triage [base <branch>]when non-terminal standard input has non-whitespace bytes): Keeps the existing Triage run: turn a Report into triaged issues #1323 behavior unchanged. - Pass mode (
thirdshift triage [base <branch>]with no<Issue>and no--file, when standard input is a terminal or 0-byte EOF as undercron): Runs as an unattended Pass that checks the repository's Command limit, runs the Sweep, checks the Failure limit, selects the next eligible openneeds-triageissue in the configured Pickup order, reserves and claims it, and triages it in place—so a recurringcronjob works through even a largeneeds-triagebacklog one issue per Pass while stopping automatically if systemic failures reach the Failure limit.
User Stories
- As a Day shift developer, I want to run
thirdshift triage <Issue URL or number> [base <branch>]on an open issue in my repository, so that thirdshift investigates the issue read-only against the Base branch and updates it in place with a category label, triage role, and Agent Brief, Questionnaire, orwontfixclosure. - As a Day shift developer, I want
thirdshift triage <Issue URL or number>to work on an open issue regardless of its current triage label (for example, re-triaging an issue after a human answers itsneeds-infoorready-for-humanQuestionnaire), so that I can re-run triage on demand without manually resetting labels first. - As an operator scheduling
thirdshift triageorthirdshift triage base <branch>incron(where standard input is/dev/null, non-terminal and 0 bytes), I wantthirdshift triagewith no<Issue>, no--file, and either terminal or empty standard input to run as a Pass, while non-empty piped standard input continues to run Report mode. - As an operator running an unattended Triage Pass, I want the Pass to take only open issues in the repository labelled
needs-triagethat have no other triage state label (ready-for-agent,ready-for-human,needs-info,wontfix), noin-progressClaim, noagent-failedlabel, are not parent Specs with sub-issues, and whose author and title/body edits come only from Trusted accounts, ordered bypickup.order(lowest-firstorhighest-first). - As an operator running
thirdshift triageacross multiple machines or alongsidethirdshift pickup, I want an issue Triage run to reserve the issue onoriginand replace its triage label with anin-progressClaim while the Triage run is active, so that competing machines do not triage the same issue twice. - As a Day shift developer who keeps
triage.allow_ready_for_agent = false(the default), I want an existing issue for which the Triage run recommendsready-for-agentto receive the## Agent Briefcomment (noting thatready-for-agentwas recommended) and be relabelledready-for-human, so that I only need to review the brief and flip the label toready-for-agent, and the next unattended Triage Pass moves on to the nextneeds-triageissue instead of looping on the same issue. - As a Day shift developer who sets
triage.allow_ready_for_agent = trueor passes--allow-ready-for-agent, I want an existing issue for which the Triage run recommendsready-for-agentto receive the## Agent Briefcomment and be relabelledready-for-agent, so that a subsequent Pickup run can implement it automatically. - As a Day shift developer, when an existing issue already carries a repository category label (such as
bugorenhancement), I want in-place triage to preserve its existing category label rather than adding a second category label, and to apply the recommended category label only when the issue has none. - As a Day shift developer, when an existing issue is too large for a single Ticket or mixes multiple concerns that should be split into a Spec and Tickets, I want in-place issue triage to update that issue to
ready-for-humanwith a## Questionnaireproposing how to split or scope it, never creating additional new issues automatically. - As a Day shift developer, when an existing issue
#Nduplicates another already-open issue#Min the repository, I want in-place issue triage to close#Naswontfixwith an explanation referencing#M, and optionally post a cross-reference comment on#Mwith any new context from#N. - As an operator running a
thirdshift triagecron job across a repository with a hundredneeds-triageissues, when an issue Triage run fails on one issue#N, I want thirdshift to replacein-progresson#Nwithready-for-humanandagent-failed, so that later Triage Passes skip#Nand keep triaging the rest of the queue, whileagent-failedcounts towardpickup.failure_limitto stop the Pass if systemic failures accumulate. - As a Day shift developer, when I run
thirdshift stop <command>on a live issue Triage run, I want it to replacein-progresswithready-for-human(withoutagent-failed) when stopped normally, or restoreneeds-triage(withoutagent-failed) when stopped withthirdshift stop --requeue. - As a Day shift developer who attaches screenshots or images to an issue body or comment, I want thirdshift to download HTTPS GitHub-hosted images from the trusted issue body and trusted comments into the throwaway triage worktree before starting the session and reference their local paths in
.thirdshift-issue.md, so that the triage session can inspect the screenshots even inside the--read-machinesandbox. - As an operator, I want a skipped Triage Pass to write no Run notification and to record its skip in the Activity log only when the skip reason changes (honouring
activity.quiet_skips), while a Triage Pass that takes an issue records its start and end in the Activity log, keeps its Command log and Session trace, and sends a Run notification when configured.
Implementation Decisions
- Mode selection on
thirdshift triage:thirdshift triageaccepts either an optional positional<Issue URL or number>, an optionalbase <branch>, and the existing triage flags (--file <path>,--recommend-only,--allow-ready-for-agent,--read-machine,--email <address>,--harness <name>,--model <model>,--effort <level>).- Positional
<Issue URL or number>and--file <path>are mutually exclusive. - When
<Issue URL or number>is given,thirdshift triageruns in single-issue mode on that issue against the selected Base branch (defaulting to the Launch directory's checked-out branch whenbase <branch>is omitted). - When neither
<Issue URL or number>nor--file <path>is given: if standard input is not a terminal, thirdshift reads standard input before command startup; if the read text contains non-whitespace bytes, it runs Report mode; if standard input is a terminal or yields 0 non-whitespace bytes (such as/dev/nullundercron), it runs Pass mode.
- Trust gate and
.thirdshift-issue.md:- Both single-issue mode and Pass mode verify that the target issue is open in the Launch directory's repository, authored by a Trusted account (
OWNER,MEMBER, orCOLLABORATOR), and has no title or body edit by an account that is not a Trusted account. - Before starting the triage session, thirdshift writes
.thirdshift-issue.mdat the root of the throwaway triage worktree containing the issue's title, URL, body, and only comments from Trusted accounts (replacing untrusted comments with the standard placeholder).
- Both single-issue mode and Pass mode verify that the target issue is open in the Launch directory's repository, authored by a Trusted account (
- Pre-downloading trusted issue images:
- From the trusted issue body and trusted comments only (never untrusted comments), thirdshift extracts image URLs from Markdown
and HTML<img ... src="url">tags whose host isgithub.comor*.githubusercontent.comoverhttps://. - Before starting the session (outside the sandbox, using authenticated
gh/ HTTP requests as needed), thirdshift downloads up to 10 unique images (at most 20 MiB per image, with a bounded timeout) into.thirdshift-issue-images/inside the triage worktree. If an image download fails or exceeds the limit, thirdshift logs a warning and continues with the issue text. .thirdshift-issue.mdappends a section mapping each downloaded image's original URL to its local path in.thirdshift-issue-images/so the session can view the image directly with its file reader.
- From the trusted issue body and trusted comments only (never untrusted comments), thirdshift extracts image URLs from Markdown
- In-place issue recommendation & publication contract:
- The session uses the same final
Triage recommendation: {...}JSON envelope. - For an existing issue
#N,recommendation.issuesmust contain exactly one entry representing the in-place update to#N(withbodyholding the## Agent Brief, investigation summary, orwontfixexplanation,questionnairerequired forneeds-infoandready-for-humanunlessreadiness_helddowngradedready-for-agent, and optionalconfirmation_blocked), plus optionalrecommendation.commentstargeting other open issues in the same repository (used when#Nis closed as awontfixduplicate of another open issue#M). - If an existing issue needs to be split into multiple Tickets or a Spec, the prompt and
thirdshift-triageskill instruct the session to recommendready-for-humanon#Nwith a## Questionnaireproposing the split rather than proposing multipleissues. - When publishing an in-place update to
#N(unless--recommend-onlyis set):- Category label: if
#Ndoes not already carry a repository category label (any repository label that is not a factory label), thirdshift applies the recommended category label; if#Nalready carries one, its existing category label is kept. - Readiness gating: if the triaged state is
ready-for-agentandallow_ready_for_agentisfalse,readiness_heldis set and the resulting state label for an existing issue isready-for-human(unlike Report mode on a brand-new issue, which usesneeds-triage), with the note explaining thatready-for-agentwas recommended andready-for-humanwas applied until readiness is permitted. - Comment: thirdshift posts a single comment on
#Nprefixed with> *This was generated by AI during triage.*containing the body, anyreadiness_heldorconfirmation_blockednotice, and any## Questionnairesection. - State label & closure: thirdshift replaces
in-progress(and any prior triage role label) on#Nwith the resulting triage state label (ready-for-agent,ready-for-human,needs-info, orwontfix), and closes#Nwhen the state iswontfix. Any cross-referencerecommendation.commentson other open issues are posted as AI-attributed comments.
- Category label: if
- The session uses the same final
- Reservation, Claim, Failure, and Stop lifecycle on an existing issue:
- Before starting an issue Triage run on
#N, thirdshift takes the per-issue reservation onorigin(held until the Triage run ends and released on drop) and appliesin-progressin place of#N's triage role label (needs-triage, or the prior triage role in single-issue mode) andagent-failed(unless--recommend-onlyis set, which makes no GitHub writes). - If the issue Triage run ends with an error or interruption:
- On
thirdshift stop --requeue: completion replacesin-progresswithneeds-triage(withoutagent-failed). - On
thirdshift stop(without--requeue): completion replacesin-progresswithready-for-human(withoutagent-failed). - On any other failure or interruption: completion replaces
in-progresswithready-for-humanandagent-failed.
- On
- Before starting an issue Triage run on
- Triage Pass lifecycle:
- A Triage Pass starts via
launch::start(base, config.command_limit, Sharing::UpToTheLimit). If the repository is at its Command limit, it is skipped withAlreadyRunning. - Otherwise it runs the Sweep (which also clears
agent-failedfrom open issues where the Day shift removedready-for-humanor closed the issue) and checkspickup.failure_limitagainst openagent-failedissues. - It lists open
needs-triageissues inpickup.order, passing over any issue that carries another triage state label (ready-for-agent,ready-for-human,needs-info,wontfix), carriesin-progressoragent-failed, is a parent Spec with sub-issues, or fails the Trusted-account check, logging a progress line for each issue passed over. - For the first eligible candidate, it takes the per-issue reservation on
origin, rechecks that the issue is still open,needs-triage, un-Claimed, and trusted, and runs in-place issue triage on it. If another host reserved it or its state went stale, it passes over it for the next candidate. - When no candidate is eligible or reservable, the Pass is skipped cleanly (
exit 0, no Run notification, deduplicated Activity log skip line respectingactivity.quiet_skips).
- A Triage Pass starts via
Testing Decisions
- Good tests exercise observable CLI behavior, GitHub API mutations, reservation refs on
origin, worktree files (.thirdshift-issue.mdand.thirdshift-issue-images/), stdout JSON, Activity log lines, and Run notifications through the existing fakegh/ fake harness / in-memory Pass seams rather than internal helper functions. - Seams to test at:
- Unit and module tests in
triage,args,claim, andpassfor mode selection (including 0-byte non-terminal stdin vs piped Report stdin), recommendation validation for single-issue updates, readiness hold-back toready-for-human, and Claim completion on success, failure (ready-for-human+agent-failed),stop, andstop --requeue. - End-to-end integration tests with the fake
ghand fake harness binaries (following existing triage and pickup tests) covering:thirdshift triage <Issue>updating an open issue in place (ready-for-agent,ready-for-humanhold-back,needs-infowith Questionnaire,wontfixclosure + duplicate comment, preserving existing category labels).- Pre-downloading trusted issue images into
.thirdshift-issue-images/and omitting untrusted comment images. thirdshift triagePass mode under/dev/nullstdin selecting eligibleneeds-triageissues inpickup.order, skipping untrusted/Spec/agent-failedissues, respectingpass.command_limitandpickup.failure_limit, and labelling failed runsready-for-human+agent-failed.
- Prompt and documentation verification (
cargo test prompts_pageandnpm run docs:check --prefix site).
- Unit and module tests in
Out of Scope
- Interactive attended
/triagesessions (tracked separately under Run every core flow skill unattended #1691). - Automatically creating new sub-issue Tickets for a Spec during an issue Triage run (multi-ticket Specs are routed to
ready-for-humanwith a Questionnaire). - Triaging pull requests as issues (
PRs as a request surfaceisnoin this repository).
Activity
JacobStephens2 commentedon Nov 6, 2026
Grilling — Round 1 (open)
Pick up this grilling in a new session with
/grill-with-docs 1695.❓ Q1 - How on-demand and Pass triage are invoked (
thirdshift triageCLI):Currently
thirdshift triageonly takes a Report from standard input or--file <path>, and the glossary states "it is never a Pass". Meanwhile,thirdshift reviewsupports both a single-target form (thirdshift review <PR URL>) and a Pass form (thirdshift review --author <login>), whilethirdshift pickup,architect, andsecureare Pass commands with no target argument.How should
thirdshift triagedistinguish its three input modes?--needs-triage(or--pass), or Report:thirdshift triage <Issue URL or number>: on-demand Triage run on that existing GitHub issue.thirdshift triage --needs-triage(orthirdshift triage --pass): a Pass that selects and triages one openneeds-triageissue in the Launch directory's repository per invocation (respectingpass.command_limit,activity.logskip deduplication, andlast-firedtracking like other Passes).thirdshift triage --file <path>or piped stdin (with no issue argument and no--needs-triageflag): existing Report mode.thirdshift triagewith no arguments and a terminal stdin be the Pass: if stdin is a pipe or--fileis given, it triages a Report; if an<Issue URL or number>is given, it triages that issue; if neither is given and stdin is a terminal, it runs theneeds-triagePass. (Note: undercron, stdin is a non-terminal pipe/dev/null, which would collide with empty piped Report detection unless gated by a flag.)thirdshift triage [<Issue URL or number> | --file <path>]for on-demand work and add a separate top-level Pass command.➡️ (a):
thirdshift triage <Issue URL or number>for a single issue,thirdshift triage --needs-triagefor the cron Pass (since cron jobs have non-terminal stdin, an explicit flag avoids ambiguity with an empty piped Report), and--file <path>/ piped stdin for a raw Report. Update Triage run and Pass inGLOSSARY.mdaccordingly.❓ Q2 - Which issues are eligible to be triaged (Trust & state rules):
When triaging an existing GitHub issue, someone wrote the issue title/body and possibly comments. In thirdshift, a Ticket run or Review run only accepts issues/PRs authored by a Trusted account (
OWNER,MEMBER,COLLABORATOR), and strips untrusted comments viaissue_for_session.thirdshift triage <Issue>andthirdshift triage --needs-triagerequire the issue's author to be a Trusted account and refuse issues whose title or body was edited by an untrusted account (usingtrust::Reads), replacing any untrusted comments with_A comment from an account that is not a Trusted account was left out._in.thirdshift-issue.md.--needs-triagePass, eligible candidates are open issues in the repository labelledneeds-triagethat do not carryin-progress,agent-failed,ready-for-agent,ready-for-human,needs-info, orwontfix, and are not already a Spec (i.e. has sub-issues: a Spec in progress of being published is labelledneeds-triageuntil its Tickets are linked).thirdshift triage <Issue URL or number>, any open issue by a Trusted account is accepted (even if not yet labelledneeds-triage).--allow-ready-for-agentwhen the author is untrusted).➡️ (a): Require a Trusted account author (and no untrusted title/body edits) and pass the issue through
issue_for_session(.thirdshift-issue.md), and in the--needs-triagePass skip Specs (issues with sub-issues), claimed/in-progressissues,agent-failedissues, and issues that already carry another triage state.❓ Q3 - What triaging an existing issue does on GitHub (Update in place vs. split into multiple issues):
When
thirdshift triageruns on a raw Report, it creates new issue(s). When it runs on an existing GitHub issue#N, what should it do on GitHub?#Nin place (plus optional split/duplicate handling):#N(starting withThis comment was generated by AI.) containing the Agent Brief (plus## Questionnaireifneeds-infoorready-for-human, andConfirmation needs the Day shift: ...if confirmation-blocked), apply the recommended repositorycategorylabel, and replaceneeds-triagewith the resulting state label (ready-for-agentif permitted elseneeds-triagewith the held note,ready-for-human,needs-info, orwontfix—closing#Nifwontfix). Keep#N's original title and body intact (since the Agent Brief comment is the contract, just as/triagedoes).#M: Comment the new evidence on#M(if any), and close#Naswontfix(duplicate of#M) with a comment linking#Mand removingneeds-triage.#N: Shape#Nin place for the first problem, file any additional problems as new triaged issues quoting#N, and cross-link them in#N's comment.--recommend-only: Check everything against GitHub, write nothing, and output the recommendation JSON and Run notification.#N's title and body directly instead of posting an Agent Brief comment.#N: always treat#Nas a single issue to comment on and relabel.➡️ (a): Update
#Nin place by posting the Agent Brief / Questionnaire comment and updating its category and triage-state labels (closing#Nifwontfixor duplicate of an open issue#M, and filing cross-linked sibling issues only if#Ncontained multiple distinct problems).❓ Q4 - Preventing the
--needs-triagePass from re-triaging an issue stuck inneeds-triage:Suppose
triage.allow_ready_for_agentisfalse(the default), and the Triage run recommendsready-for-agent. Because readiness is held back, the issue stays labelledneeds-triage("ready-for-agentwas recommended;needs-triageis applied until the Day shift permits readiness"). Or suppose two machines runthirdshift triage --needs-triageat the same time.How should the Pass avoid re-triaging the same
needs-triageissue in an infinite loop, and avoid two machines triaging it at once?in-progress+ origin ref during the run, and skip issues already triaged unless there is newer Trusted activity:Review runandPickup run, reserve the issue across machines withReservation::take+ thein-progresslabel while the Triage run is active, removing both when it finishes.needs-triage: skip anyneeds-triageissue that already has a thirdshift Triage comment from the authenticated GitHub user, unless a Trusted account has edited the issue or commented after that Triage comment (or someone explicitly runsthirdshift triage <Issue>).allow_ready_for_agentisfalseon an existing issue, transition heldready-for-agentissues toready-for-humaninstead of leaving them inneeds-triage, soneeds-triageis always cleared when a Triage run finishes.allow_ready_for_agentto be enabled whenever--needs-triagePass mode is used.➡️ (a): Reserve the issue with an origin ref +
in-progressduring the Triage run, and in--needs-triagePass mode skip any issue that already has a thirdshift Triage comment unless a Trusted account edited or commented after it (whilethirdshift triage <Issue>by hand always runs).❓ Q5 - Screenshots and images in GitHub issues (like
#1821):In
#1821, you dragged a screenshot into the GitHub issue body, which GitHub stores as<img ... src="https://github.com/user-attachments/assets/..." />or.When thirdshift writes
.thirdshift-issue.mdfor a session, those URLs are in the markdown text, but:user-attachments), fetching image URLs requires GitHub authentication or redirects toprivate-user-images.githubusercontent.comwith a signed JWT.--read-machinesandbox mode (or restricted network environments), or for harnesses reading local files, local image files in the worktree are directly viewable with the agent'sRead/ image-viewing tool without the agent needing tocurlURLs itself.How should
thirdshifthandle images referenced in the issue body and trusted comments?When preparing
.thirdshift-issue.md(for a Triage run on an issue—or for any Run writing.thirdshift-issue.md), thirdshift finds GitHub attachment/image URLs in the trusted issue markdown, downloads them (using the host's authenticatedgh/ HTTP client, bounded in count and byte size, verifying image content-type) into an excluded directory in the worktree (e.g..thirdshift-issue-assets/), and notes their local paths alongside the URLs in.thirdshift-issue.mdso the session can inspect the images directly with its file reader.thirdshift triageon an issue (not in ordinary Ticket/Spec runs).https://github.com/user-attachments/assets/...URLs in.thirdshift-issue.mdand tell the session in the prompt to fetch them itself if needed.➡️ (a): Have thirdshift download GitHub-hosted attachment images referenced in the trusted issue text into an excluded worktree folder (bounded in size/count) and reference their local paths in
.thirdshift-issue.md, so both Triage runs and Ticket/Spec runs can view screenshots like#1821's directly from the worktree.❓ Q6 - Interaction between
thirdshift triage --needs-triageand other Passes (pickup,architect,secure):When a repository schedules
thirdshift triage --needs-triagein cron alongsidethirdshift pickup,thirdshift architect, andthirdshift secure:triage --needs-triagePasses run in parallel up topass.command_limit(Sharing::UpToTheLimit, using per-issue reservation likepickupandreview --author), or at most onetriagePass at a time (Sharing::OneOfAKind)?triage --needs-triagepick the lowest-numbered eligibleneeds-triageissue first?architectandsecurekeep their existing gates, or wait whenneeds-triageissues are waiting to be triaged?➡️ Up to
pass.command_limit(Sharing::UpToTheLimit) with per-issue reservation and lowest-numbered issue first (matchingreview --author), without changingarchitectorsecuregates.❓ Q7 -
needs-infoissues when a Trusted reporter replies:In
/triage(and noted in#1695's description), an issue inneeds-infowhere the reporter has replied since the last triage notes needs re-evaluation.Should
thirdshift triage --needs-triageonly look atneeds-triageissues, or should it also pick upneeds-infoissues that have a newer comment from a Trusted account after the last triage comment?needs-triageissues (keeping the state machine explicit and predictable:needs-triageis the queue for unattended triage, andthirdshift triage <Issue>can always be run on any issue by hand).needs-triageissues andneeds-infoissues that have a newer Trusted-account comment after the last triage comment.➡️ (a): Only open issues carrying
needs-triagefor the automated Pass.Merge pull request #1894 from JacobStephens2/grill-1695-unattended-is…
JacobStephens2 commentedon Nov 9, 2026
The #1165 grill (Q2.1), now Spec #1901, settles one take-over rule for every failure, Triage runs included.
agent-failedcomes off when the Day shift putsready-for-agentback, takesagent-failedoff, or closes the issue, and not whenready-for-humanis removed. See the note on #1891 for what that means if #1891 lands before #1902.Fix whole-Spec triage review findings (#1695)
Merge origin/main into issue-1695