Skip to content

Mixed Passes: an Architect run and a Security run beside Pickup runs, never two of a kind - #1599

Merged
JacobStephens2 merged 4 commits into
issue-1564from
issue-1572
Oct 29, 2026
Merged

JacobStephens2 merged 4 commits into
issue-1564from
issue-1572

Conversation

@JacobStephens2

@JacobStephens2 JacobStephens2 commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

Up to the Command limit, an Architect run and a Security run can each run beside Pickup runs and beside each other, but never two of a kind on one repository.

 hold_pass(repo, limit, sharing)            # src/command_limit.rs
   count slots under the short lock
-  Alone(kind):  skipped if any other Command runs; holds alone.lock
+  OneOfAKind(PassKind):  skipped if <kind>.lock is held ("an Architect run is already running on …")
+                         skipped beside an older thirdshift's Pass (its kind can't be told)
+                         holds <kind>.lock until the process exits
   UpToTheLimit:  Pickup run, and now an issue-less Custom process (no lock of a kind)
 Architect run                         Security run
   review in <repo>-architect            audit / fix publishing / close in
                                       -   <repo>-architect
                                       +   <repo>-security
   check plan                            check fix issue
+  Reservation::of_published(plan)    +  Reservation::of_published(fix)   # refs/heads/thirdshift/pickup/<n>
   needs-triage → ready-for-agent        needs-triage → ready-for-agent
   dispatch …                            dispatch …, record ending
+  release reservation                +  release reservation
  • src/pickup/reservation.rs moved to src/reservation.rs, since all three Pass kinds now share it. ADR 0017 and ADR 0014 are amended.
  • The Security run reads a pending fix as failed only while it holds the Security lock. The comment in src/github/advisories/description.rs now says why.
  • The guide, GLOSSARY.md, docs/code-navigation.md and the hand-written site pages say the same. site/docs/index.html was regenerated from the guide.

Evidence

  • Before: at command_limit = 2, thirdshift architect beside a live Pickup run said 1 Command is running on acme/widgets, and this Pass runs only alone there. Architect and Security runs shared <repo>-architect, and the plan or fix was dispatched with no origin reservation.
  • After: new CLI tests, each with two or more thirdshift processes at once:
    • architect_run::at_a_command_limit_of_3_an_architect_run_reserves_its_plan_beside_a_live_pickup_run_and_another_passes_it_over
      • An Architect run's plan Ticket run goes live beside a Pickup run's Ticket run.
      • refs/heads/thirdshift/pickup/8 is on origin.
      • A gh hook starts a third Pickup run after the plan is marked ready but before its Claim. That run says #8 is reserved by another run or is no longer Ready and takes CI watching, CI-fix Repair and the Repair cap #9.
      • The ref is gone once the dispatched run ends.
    • architect_run::a_second_architect_run_is_skipped_while_one_runs_saying_why_and_a_pickup_run_runs_beside_it: exit 0, an Architect run is already running on acme/widgets.
    • security_run::at_a_command_limit_of_3_a_security_run_audits_beside_a_pickup_run_and_an_architect_run_in_a_worktree_of_its_own
      • The audit runs in work/widgets-security, while the live review is in work/widgets-architect.
      • The Architect run's worktree survives the Security run.
    • security_run::a_second_security_run_is_skipped_while_one_dispatches_a_fix_it_reserved_and_never_reads_it_as_failed
      • The private record says Fix Run: pending, and the fix is reserved on origin.
      • A second Security run exits 0 with a Security run is already running on acme/widgets, not as a failed fix, and changes nothing.
    • pickup_run::at_a_command_limit_of_2_an_architect_run_or_a_security_run_is_skipped_beside_a_pass_from_before_the_command_limit
    • process::at_a_command_limit_of_2_a_process_with_no_issue_runs_beside_any_other_command_up_to_the_limit and process::at_a_command_limit_of_2_an_architect_run_reviews_beside_a_process_with_no_issue
  • New unit tests:
    • worktree::acquisition_tests::an_architect_run_and_a_security_run_review_in_worktrees_of_their_own_neither_disposing_of_the_other
    • architect::tests::a_plan_another_run_holds_reserved_is_refused_with_no_edit
    • security::fixing::publication::tests::a_fix_another_run_holds_reserved_on_origin_is_never_marked_ready
    • The publication and plan call orders now show reserve 8 before edit 8.
  • Validation:
    • scripts/affected-tests origin/issue-1564 selected the site tests (51/51 pass, with PLAYWRIGHT_BROWSERS_PATH pointed at this machine's browser) and the full Rust suite.
    • The full Rust suite (cargo test --no-fail-fast -- --skip sandbox::tests) found two failures this change caused, both now fixed:
      • architect_run::a_dispatch_that_fails_its_launch_checks_still_has_a_record: its broken user.name now stops the plan's reservation commit first. It now breaks user.email, which still trips the dispatch's launch checks, and asserts the reservation is released.
      • security_run::review_acquisition_failure_is_pre_audit: its planted work now goes at <repo>-security.
    • After the fixes, these pass:
      • cargo test --bin thirdshift -- --skip sandbox::tests: 1547 passed
      • architect_run: 93
      • pickup_run: 118
      • process: 152
      • review_acquisition_failure_is_pre_audit
    • Clippy and rustfmt are clean.
    • Not passing here, environment only:
      • sandbox::tests and 21 tests in trial, scoring, bug_origins and experiments fail on this machine. Their logs show socat is not on PATH or Python's missing tomllib. The same 21 fail on the base origin/issue-1564, and none of their files is in this diff.
      • CI has neither gap.

Merge Danger

Door: two-way

The reservation refs and lock files are the existing kinds. Reverting restores one Architect or Security run alone per repository.

Blast Radius: scheduling

This only changes anything above the default command_limit = 1. At 1, every skip still says another Pass is already running on <owner>/<repo>. A reservation already held fails the Architect run or Security run before any label is changed.

Unaddressed findings

Standards

  • 4. PassKind beside logs::Pass (judgement call): declined. They are different concepts. PassKind is only the kinds that hold a lock of their kind, and a Pickup run is deliberately not one (src/command_limit.rs, Sharing::UpToTheLimit). Deriving one from the other would give the lock a variant it must never take.
  • 5. PassKind::word() naming / worktree naming in command_limit: partly addressed. It is renamed slug(). Worktree names stay keyed by PassKind on purpose: the safety of stale disposal comes from the lock of that kind (now recorded in ADR 0014). The mixed import paths are left as is, since launch re-exports what its callers pass to launch::start.
  • 6. ReviewWorktree::create takes a bare PassKind, not a lock token: partly addressed. ADR 0014 now records the assumption. A token type is declined for this Ticket: every caller reaches create only after launch::start has taken the lock. Making that a type would thread a token through pass::Outside and the Security seams for a single invariant.
  • 7. Reservation threaded through tuples (judgement call): declined. Each tuple is a single private return, and the reservation is held only to be dropped after dispatch. A Reserved<T> wrapper would add a type for three call sites.
  • 9. publication::Shell built twice; reserve on two traits (judgement call): declined. The two Shells are in exclusive branches of fixing::publish. The two traits are the two seams (pass::Outside, publication::Outside), each with its own in-memory adapter, and both call one function, Reservation::of_published.
  • 10. Test helpers copied between test files (judgement call): declined. These integration test files keep their own script helpers, as with agent_opens_pr, which is defined in architect_run.rs, pickup_run.rs and process.rs already.
  • 11. Mechanical PassKind::Architect edits in the worktree tests (judgement call): declined. The edits make each test name the kind of review worktree it exercises. A defaulting helper would hide the parameter the new disposal rule depends on.

Spec

  • 3. Security fix reservation not shown end to end through Pickup: declined. The run cargo test --test security_run -- a_second_security_run exercises the window: the gh hook starts a Pickup run between marking the fix ready and its Claim. Pickup's Ready search already passes a security-fix issue over (#8 a Security fix: its Security run owns it), so it never reaches the reservation. The same test asserts refs/heads/thirdshift/pickup/8 is held through the dispatch and released after. The refused-reservation path for a fix is covered by a_fix_another_run_holds_reserved_on_origin_is_never_marked_ready.
  • 4. One direction of worktree disposal tested only as a unit test: partly addressed. process::at_a_command_limit_of_2_an_architect_run_reviews_beside_a_process_with_no_issue is added, and the misleading comment in the other process.rs test is fixed. The reverse disposal direction stays a unit test: worktree::acquisition_tests::an_architect_run_and_a_security_run_review_in_worktrees_of_their_own_neither_disposing_of_the_other creates and disposes of both kinds against one Launch directory, without a session.
  • 5. Scope creep (Why::Older, the reworded Pickup line, the module move): kept. Each follows from the change, as the review notes, and each is documented and tested.

Security review outcome

No unaddressed introduced findings.

Review coverage

Both reviewers read every changed file in commit 5c84223, except site/docs/index.html. Both confirmed that exclusion as generated output: npm run docs:check --prefix site exits 0, and site/generate-docs.mjs is unchanged. Changed after the review, in addressing its findings, and not read by it: docs/adr/0014-successful-review-acquisition-authorizes-stale-disposal.md (an amendment bullet).

Closes #1572

Built with claude 2.1.312 · claude-opus-5-5 · high

… never two of a kind (#1572)

An Architect run and a Security run each take a slot up to the Command
limit and hold a lock of their kind, so a second of the same kind is
skipped, saying why. Each reviews in a worktree of its own, <repo>-architect
or <repo>-security, so neither's stale disposal removes the other's live
worktree. Each reserves the plan or fix it dispatches on origin before
marking it ready, as a Pickup run reserves its Ready issue, and releases it
the same way. An issue-less Custom process takes no lock of a kind and
counts only toward the Command limit. An Architect run or a Security run is
skipped beside an older thirdshift's Pass, whose kind it can't tell.
Correct the site's Custom process line and the code navigation index,
the stale Pickup and Architect comments, rename PassKind::word to slug,
build the reservation ref in one place, and record in ADR 0014 why a
review worktree of each kind is never live when found. Test an Architect
run beside an issue-less Custom process, and keep the launch-check
failure test on a dispatch the reservation commit no longer pre-empts.
Brings in the Failure limit (#1569): Pickup counts agent-failed issues,
not Claims.

Conflicts resolved, keeping both intents:
- docs/guide.md: Pickup step 2 keeps this branch's wording (no Pass keeps
  the repository to itself any more); steps 3 and 4 take the Failure limit
  and the agent-failed Sweep.
- docs/code-navigation.md: the Claim and Failure limit rows from #1569,
  with the reservation at src/reservation.rs and the PassKind lock from
  this branch.
- src/pickup.rs: the module comment names the Failure limit and the
  agent-failed clearing, and a reservation held by any run, Pickup,
  Architect or Security.
- site/docs/index.html regenerated from docs/guide.md.
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.

1 participant