Skip to content

Triage run: turn a Report into triaged issues - #1715

Merged
JacobStephens2 merged 27 commits into
mainfrom
issue-1323
Nov 4, 2026
Merged

JacobStephens2 merged 27 commits into
mainfrom
issue-1323

Conversation

@JacobStephens2

@JacobStephens2 JacobStephens2 commented Nov 4, 2026 •

Copy link
Copy Markdown
Owner

thirdshift triage turns a Report (an email, chat message, call transcript or machine alert) into triaged issues with nobody in the loop. It reads the Report from standard input or --file, investigates it read-only in a throwaway worktree, and files shaped issues with one category and one state label each, or with --recommend-only reports what it would file and writes nothing to GitHub. This PR gathers the five Tickets of Spec #1323 (#1707 to #1711) and the fixes from its Spec review.

Closes #1323

Summary

thirdshift triage [--recommend-only] [--file <path>] [--read-machine] [--allow-ready-for-agent] [email <address>]
  Report::read                     stdin or --file, read before Setup can take stdin
  command::start(TriageRun)        Command record, Activity log, status, Inbox, Run notification
  triage::run                      always takes a Command slot, even at the Command limit; never a Pass
    ReviewWorktree::for_triage     unique throwaway worktree at origin's Base branch
    sandbox::triage::prepare       only with --read-machine or [triage] read_machine:
                                     / read-only, worktree writable, private Harness home,
                                     seccomp refuses AF_UNIX, datagram socketpairs, io_uring, x32
    thirdshift-triage session      investigates, searches open issues, writes nothing to GitHub
      thirdshift-to-questionnaire  for needs-info and ready-for-human outcomes
      -> Triage recommendation: {json}
    parse_recommendation           states, questionnaires, comment URLs
    check_publication              both modes: comment targets open and in this repository,
                                     categories are repository labels and not factory labels
    publish                        skipped with --recommend-only
      file each issue              AI disclaimer, readiness note, questionnaire, quoted Report
      cross-link 2+ issues
      close wontfix issues
      comment on covering issues   labels unchanged
  Ending::Triage                   JSON on stdout; Run notification with questionnaires

thirdshift, not the session, applies every label. ready-for-agent becomes needs-triage with a note unless --allow-ready-for-agent or triage.allow_ready_for_agent = true allows it, and a problem that needs credentials or production access to confirm is ready-for-human with the reason.

What the Spec review changed:

 investigate
   parse_recommendation
-  if !recommend_only: publish        # checks and writes
+  check_publication                  # both modes, so --recommend-only fails wherever filing would
+  if !recommend_only: publish        # writes only, and closes wontfix issues
 read_machine
-  --read-machine
+  --read-machine || [triage] read_machine = ["owner/repo", ...]
 host_socket_filter
+  nr >= 0x40000000 (x32) -> EPERM

Seams under test:

  • thirdshift triage, the real binary, against the fake gh and a fake Harness session: tests/triage_run.rs, tests/issue_1711_retained_home.rs
  • sandbox::triage: the read-machine launch through prepare_around, and the host-socket filter in a child test process: src/sandbox/triage.rs
  • UserConfig::parse for triage.read_machine: src/config.rs

Evidence

  • Before: main has no Triage run. On 9c73bb8, the review's tests failed as its findings said:

    • host_socket_filter_refuses_x32_socket_calls: x32 socket(AF_UNIX) passed the filter: fd -1, errno Some(38)
    • recommend_only_and_filing_agree_on_what_can_be_published: filing succeeded=false but --recommend-only succeeded=true for a closed comment target
    • a_wontfix_recommendation_does_not_leave_an_open_issue: a Triage run left wontfix issue #8 open

    After: on 34b00d1 all three pass, as do the new reading_the_whole_machine_follows_the_flag_or_a_per_repository_user_config_setting, the_read_machine_launch_reads_the_host_and_writes_only_its_worktree and triage_read_machine_opts_in_named_repositories_whatever_their_case. scripts/affected-tests main passed: npm test --prefix site in 65.95s, and cargo test in 2029.96s with compilation (3,668 passed, 0 failed, 77 ignored across 85 targets). cargo clippy --all-targets -- -D warnings, cargo fmt --check, cargo test --bin thirdshift prompts_page and npm run docs:check --prefix site pass. CI passed on 9c73bb8, before the review fixes.

Merge Danger

Door: two-way, with one catch.

Reverting removes the Command, but a User config that sets [triage] would then fail to parse, since unknown keys are errors. A revert after someone adopts allow_ready_for_agent or read_machine breaks their config until they delete the section. Issues a Triage run filed stay filed; closing them undoes them.

Blast Radius: small.

Shared code that changed: GitHub::ensure_labels lists labels through the new repository_labels; labels::UNREADY names its labels by constant; Launch gained a seccomp program that only the Triage launch sets; write_seccomp_fd closes its memfd through OwnedFd; the Muse and OpenCode completion readers can read a private home; thirdshift help lost one blank line to stay compact with the Triage line. The --read-machine sandbox needs bwrap and Linux user namespaces, and fails the Command rather than running unsandboxed.

Review coverage

The Standards and Spec reviewers each read all 50 files changed at 9c73bb8, with no generated-output exclusions. The fixes also change src/harness.rs and README.md, which no reviewer read. The reviews raised 13 Standards findings and 8 Spec findings.

Unaddressed findings

Standards

  • 1. The two bwrap launches duplicate the per-Harness login lists and the startup probe. They differ on purpose. The Trial binds settings read-only and takes Claude's login from the Credentials setup token (src/sandbox.rs:836-838); the Triage launch copies the ordinary login into a writable private home (src/sandbox/triage.rs:135). A failed Trial probe becomes Unavailable (src/sandbox.rs:518-527) and voids the Trial as sandbox_unavailable (src/trial.rs:317-318), while ADR 0013's Let a Triage run read the whole machine in a read-only sandbox #1711 exception makes a failed Triage probe fail the Command (src/sandbox/triage.rs:92-97). A shared table and probe would need a mode for each.
  • 3. quoted_report repeats prompts_page::fence. prompts_page compiles only for tests (src/main.rs:83-85), so production code can't call its fence, and the third copy counts line-leading backticks, a different rule (src/github/advisories/description.rs:93-100).
  • 4, in part. publish keeps its published out-parameter. A failure partway still has to name the writes that landed, which run adds to the failure (src/triage.rs:440-454); returning them would take an error type that carries them. The Report type and the Options struct from this finding are in.
  • 6. The factory-label deny-list stays in src/triage.rs. Each factory label is defined by its owner, and each owner imports crate::labels (src/claim.rs:31,37, src/base_fix.rs:27, src/security/fixing.rs:22, src/architect.rs:65, src/github/advisories.rs:24), so a labels::is_factory_owned would make labels import its own importers. The comma check stays in check_publication, so --recommend-only refuses a comma too (Spec finding 4).
  • 9. Each ending spells out the whole Account. Every arm of run_ending::read names all 18 fields, a pattern older than this Spec (the Scoring arm, src/run_ending.rs:36-58), so a new field is a compile error in each arm rather than a silent default. Changing that is its own refactor.
  • 10. The Triage run lays out its own Run notification. The laid-out analysis has to survive a failed publication too, where FailedRun carries only the error: run attaches it as Triage analysis retained (src/triage.rs:421), which notification::body never sees.
  • 13, in part. for_triage repeats at_commit. at_commit recovers a worktree left at its fixed path and prints a progress step (src/worktree.rs:496-500), which a uniquely named Triage checkout never needs, leaving only the lock and acquisition::add in common. The write_seccomp_fd half is fixed.

Spec

  • 1. A session can apply ready-for-agent itself. The review's test fails as written on 9c73bb8: ready-for-agent kept without permission on #8: ["bug", "ready-for-agent"]; exit Some(0). Neither the Spec's model, where the session files and reports, nor this branch's, where thirdshift files, catches a session that writes to GitHub without reporting it. Closing the gap means amending the Spec or ADR 0013's trust in the session, which is the Day shift's call: Triage run: a session can label its own issue ready-for-agent with the user's gh login #1725.
  • 7. "Where it came from" records only the input channel. Q3.2 of the grilling settled "the Report quoted verbatim in a collapsed section at the bottom, and where it came from", and thirdshift knows only what it was given: Source: standard input or Source: file: <path> (src/triage.rs:62). Who reported it travels in the Report itself; a --source flag would be new surface the Spec doesn't name.

Security review outcome

No unaddressed introduced findings.

Tickets

Built with claude 2.1.316 · claude-opus-5-5 · max

Add recommendation-only Triage runs for Reports
A read-only mount still lets the session connect to a host service, which can then write outside the worktree. The sandbox now loads a seccomp filter that returns EAFNOSUPPORT for AF_UNIX and io_uring_setup, on both the startup probe and the session. TCP stays available.
Combine factory-owned Triage filing and readiness with opt-in machine reads through the read-only sandbox. Regenerate prompt documentation and the user manual, and exercise sandboxed filing in the real Bubblewrap regression.
Write questionnaires for Triage issues that need a person
Preserve opt-in read-only machine access alongside forwardable Triage questionnaires. Keep questionnaire publication and notification in the shared investigation path, regenerate the manual and prompt site, and cover sandboxed filing with a questionnaire in the real Bubblewrap regression.

Validation so far: cargo check --all-targets, cargo fmt --check, 13 prompt-generation tests, 17 Triage tests, 2 retained-home regressions and all 61 site checks pass. The required scripts/affected-tests origin/issue-1323 run is continuing through the full Rust suite.
Let Triage read the machine through an opt-in read-only sandbox
Preserve existing-issue comments from #1709 alongside the forwardable questionnaires from #1710. Regenerate the manual and prompt reference from their merged sources, and cover comments alongside mixed questionnaire outcomes.

Validation: cargo check --locked, cargo fmt --check, prompt generation/verification, 61 site checks, 18 Triage integration tests, 47 notification tests and 16 skill tests passed. The unit suite passed 1619 tests in 268.69s with three unchanged stalled Harness/session fixtures excluded. The required affected-tests run passed its site checks but was stopped at those three fixtures without an assertion failure.
Preserve comments on covering issues alongside opt-in machine-reading confinement and forwardable questionnaires. Regenerate the manual and prompt reference from their merged sources, and extend the real Bubblewrap regression to verify comment publication, unchanged labels and notification links.

Validation: cargo check --all-targets, cargo fmt --check, 13 prompt-generation tests, 21 Triage integration tests and 2 retained-home tests passed. The required affected-tests run follows this commit.
Comment on open issues covering a Triage Report
…ed for possible cybersecurity risk. If this seems wrong, try rephrasing your request. If you’re doing authorized security work that requires more cyber permissive safeguards, apply for Daybreak access via https://platform.openai.com/settings/organization/status-and-access before retrying.)

2026-11-04T04:32:10Z, host stephens. Uncommitted work at the time of failure is included in this commit.
--recommend-only now makes filing's GitHub checks, so it fails wherever
filing would: a closed or foreign comment target, or a category that is
not a repository label or is a factory label. Filing closes a wontfix
issue, as the Day shift's triage does. The User config's
triage.read_machine names repositories whose Triage runs read the whole
machine, as --read-machine does.

The host-socket seccomp filter refuses x32 syscall numbers, which share
x86_64's arch value and slipped past its exact matches. The read-machine
launch is tested at the sandbox seam, with bwrap, the Harness program
and the user's home passed in. The private home's XDG layout is one
table the sandbox and the OpenCode and Muse readers share, and the
seccomp memfd closes by ownership.

A Report is its own type, the run's flags one Options struct, and each
proposed issue's state is resolved once.
The guide's Triage section moves beside the other workflows, and the
architecture page gives it a section of its own instead of opening The
Passes. The glossary's Activity log and Run notification entries,
README's Workflows table and docs/code-navigation.md name it. The pages,
ADR 0013 and the thirdshift-triage skill describe triage.read_machine,
closing wontfix issues and the checks --recommend-only makes.
@JacobStephens2
JacobStephens2 marked this pull request as ready for review November 4, 2026 06:28
@JacobStephens2
JacobStephens2 merged commit 5f51dd7 into main Nov 4, 2026
16 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-1323 branch November 4, 2026 06:50
@JacobStephens2 JacobStephens2 mentioned this pull request Nov 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Triage run: turn a Report into triaged issues

1 participant