Skip to content

Command limit: Pickup runs share a repository up to [pass] command_limit - #1580

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

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

Conversation

@JacobStephens2

@JacobStephens2 JacobStephens2 commented Oct 29, 2026 •

Copy link
Copy Markdown
Owner

Summary

[pass] command_limit (default 1) replaces the Pass lock. It is the number of live Commands on one repository on one machine at which a Pass there is skipped. Closes #1571.

~/.thirdshift/command-slots/<owner>/<repo>/
├── count.lock        # short lock: a Pass counts and takes a slot under it
├── <n>.slot          # one per live Command, held until its process ends
├── alone.lock        # held by a Pass that keeps the repository to itself
└── legacy-held.lock  # held by a new Pass that also holds the old lock
 launch::start(base)                      # Pickup run, Architect run, Security run
-  hold_pass(repo)                        # one Pass at a time
+  command_limit::hold_pass(repo, limit, sharing)
+    under count.lock:
+      alone.lock held                    -> skip ("an Architect run is running alone on …")
+      running = held slots + (old lock held by an older thirdshift ? 1 : 0)
+      Pickup run and running >= limit    -> skip ("at the Command limit on …: 2 Commands are running, pass.command_limit is 2")
+      runs alone and running >= 1        -> skip
+      take a slot, plus alone.lock and the old lock where they apply
 run::run(StartedBy::Command)             # Ticket run or Spec run on an Issue URL
+  command_limit::hold_slot(repo)         # takes a slot without counting: never refused
 processes::run_process
-  no issue: hold_pass(repo)
+  no issue: hold_pass(repo, limit, Alone("a Custom process"))
+  with issue: hold_slot(repo)
  • At the default limit of 1, every skip still says another Pass is already running on <owner>/<repo>. The existing ALREADY_RUNNING tests pass unchanged.
  • A Pass's dispatched Spec run or Ticket run runs inside the Pass's process, so it uses the Pass's slot. A Spec run's child Ticket runs take no slot either.
  • Architect runs, Security runs and issue-less Custom processes still keep the repository to themselves, as the Ticket asks. Mixed Passes are Mixed Passes: an Architect run and a Security run beside Pickup runs, never two of a kind #1572.
  • Docs updated: the User config defaults and comment, the guide's new The Command limit section (how to raise it, next to [resources]), the README anchor, the hand-written site pages, docs/code-navigation.md, and the glossary's Sweep line.

Evidence

  • Before: at command_limit = 2, a second Pickup run was skipped while the first was live. A Custom process with an issue did not count. And an older thirdshift holding its lock next to one new Pickup run let a second new one start, making 3 Commands at limit 2. That last case is the review's at_a_command_limit_of_2_a_pass_from_before_the_command_limit_and_a_pickup_run_fill_the_repository: it failed with the second Pickup run taking CI watching, CI-fix Repair and the Repair cap #9.
    After: these CLI tests pass, each running two or more thirdshift processes at once:

    pickup_run  at_a_command_limit_of_2_two_pickup_runs_run_at_once_and_a_third_is_skipped_naming_the_count  # status --json shows 2 rows; one Activity log line for 2 skips
    pickup_run  a_ticket_run_started_by_hand_is_never_refused_at_the_limit_and_fills_a_slot_that_skips_a_pass
    pickup_run  a_killed_pickup_run_or_ticket_run_frees_its_slot_for_the_next_pass
    pickup_run  a_pass_is_skipped_while_a_thirdshift_from_before_the_command_limit_holds_its_lock_and_takes_it_itself
    pickup_run  at_a_command_limit_of_2_a_pass_from_before_the_command_limit_and_a_pickup_run_fill_the_repository
    pickup_run  at_a_command_limit_of_2_a_pass_that_runs_alone_is_skipped_beside_a_pickup_run_and_skips_every_pass_itself
    process     at_a_command_limit_of_2_a_process_with_no_issue_runs_alone_and_one_with_an_issue_fills_a_slot
    process     a_process_with_an_issue_fills_a_slot_so_a_pickup_run_runs_beside_it_only_above_a_command_limit_of_1
    user_config a_command_limit_that_is_not_a_whole_number_from_1_up_stops_the_pass_and_the_run   # 0, -1, 1.5, "2"
    config::tests command_limit_is_read_and_defaults_to_1, the refusal table, the defaults' comments
    
  • Local validation: npm test --prefix site passed 51/51, and npm run docs:check --prefix site passed. cargo test --bin thirdshift -- --skip sandbox::tests passed 1536. cargo test --no-fail-fast --test '*' passed everything except 28 tests that can't run on this machine:

    • 27 sandboxed Trial, Scoring and Experiment tests. Each comes back void with sandbox failed to start: socat is not on PATH, because socat is not installed here.
    • bug_origins::settlement::historical_review_and_reclosed_origin_regressions, which needs Python's tomllib; this machine has Python 3.9.

    None of these tests touches this change. The 22 unit tests in sandbox::tests fail for the same socat reason. CI should run all of them.

Merge Danger

Door: two-way

The default of 1 behaves as today, and so does an older thirdshift next to a newer one at that limit. Reverting removes the [pass] key. A User config that sets it would then be refused as an unknown key until the line is deleted.

Blast Radius: scheduling

Every Pass, and every Ticket run, Spec run or Custom process started with an issue, now takes a slot under ~/.thirdshift/command-slots/. A slot that can't be taken is only a warning for a hand-started Command, but a Pass fails on it, as it did on the old lock. With the limit above 1, overlapping Pickup runs can pass the Claim limit by up to the Command limit minus one (accepted in the Spec). They can also pick the same Ready issue, and the loser is skipped until #1570 lands.

Review coverage

Both reviewers read every changed file in the first commit, 1c2fbb2. site/docs/index.html is generated from docs/guide.md; both reviewers left it unread, relying on npm run docs:check --prefix site passing. Changes made after the review were not read by it:

  • src/setup.rs and tests/setup.rs (Setup's expected defaults gain [pass]).
  • GLOSSARY.md, line 51 (the Sweep wording). The reviewers had read that line only before the change.
  • The review-fix edits in 86646f7, to files the reviewers had read: src/command_limit.rs, src/launch.rs, src/processes.rs, src/run.rs, tests/pickup_run.rs, tests/process.rs, docs/guide.md.

Unaddressed findings

Standards

  • 1. ADR 0009 is not superseded. Spec Spec: keep working Ready issues - a Failure limit for pickup and a Command limit for Passes #1564, under Implementation Decisions, says the ADR is "written with the first Ticket". That ADR records that Passes share a repository up to a Command limit, and that it supersedes ADR 0009's "one unattended run per repository at a time on a machine". The first Ticket is the Failure limit, Failure limit: pickup counts agent-failed issues, not Claims #1569, which is open and covers it.
  • 2. The glossary's Command limit entry describes mixed Passes. Spec Spec: keep working Ready issues - a Failure limit for pickup and a Command limit for Passes #1564 says "GLOSSARY.md already defines the Failure limit and the Command limit as this Spec builds them". The entry describes the Spec's end state, and "never two of a kind" arrives with Mixed Passes: an Architect run and a Security run beside Pickup runs, never two of a kind #1572. Scoring runs and Experiments: see Spec 4. The Sweep line was fixed.
  • 6. (partly) Sharing::Alone(&'static str) as a primitive. Renamed: Slots::alone is now try_alone, and Why::Alone is now Why::HeldAlone. The phrase stays a string because logs::Pass (src/logs.rs:168-172) has no Custom process to reuse.
  • 7. (partly) Middle Man in launch::start. processes.rs now goes straight to command_limit. launch::start still passes on limit and sharing, because it owns the Pass's order: preflight, then pass_fired, then the slot (src/launch.rs, start).
  • 8. Data Clump (config.command_limit, Sharing). Declined. It is two values at four call sites, so a type to bundle them would be Speculative Generality.
  • 9. Duplicated Activity log reader in tests. Declined. Each integration test file defines its own reader, which is the repository's pattern: tests/process.rs:3102 and tests/process.rs:3419 both read it, and tests/architect_run.rs reads it inline.

Spec

  • 3. Untested criteria.
    • Cross-repository: cargo test --test architect_run an_architect_run_on_a_different_repository_at_the_same_time_is_not_skipped passes. It exercises the per-repository slot directories at limit 1: the first run holds a slot and alone.lock on acme/widgets while acme/gadgets runs.
    • Two Passes starting together: Slots::counting takes a blocking File::lock on count.lock around counting and taking (src/command_limit.rs). The CLI has no seam to interleave two processes inside that window deterministically.
    • The Console's rows: the Console reads the same Command records as status (src/logs/status/inbox.rs per docs/code-navigation.md). The diff doesn't change the records, and the limit-2 test shows two rows in status --json.
    • A Spec run by hand: it takes the same StartedBy::Command path as a Ticket run, at src/run.rs:197.
  • 4. Scoring runs and Experiments take no slot. Declined, because the Day shift must decide: the glossary says "Every live Command counts", but neither of these is a Command on one repository. Filed as a needs-triage issue: Command limit: should a Scoring run or an Experiment count toward it? #1581.
  • 5. ADR 0009 not updated. As Standards 1: owned by Failure limit: pickup counts agent-failed issues, not Claims #1569.

Security

  • None. The security review of this change found no introduced finding: the slot paths under ~/.thirdshift/command-slots/ are built from a repository that has already passed the Origin match, and their state stays in the user's own home directory.

Closes #1571

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

Security review outcome

No unaddressed introduced findings.

Each live Command on a repository holds a slot, an advisory file lock the
operating system frees when its process ends. A Pass counts the held slots
and takes one under a short lock; a Ticket run, Spec run or Custom process
started with an issue takes one without counting, so it is never refused.
Each Pass also tries the pre-Command-limit lock, so old and new binaries
keep each other out at command_limit = 1. Architect runs, Security runs and
issue-less Custom processes still keep the repository to themselves.

Closes #1571
… review

A Pass that holds the pre-Command-limit lock also holds a marker, so a lock
held without the marker is an older thirdshift's Pass and counts as one more
Command at any limit. The limit-1 message is chosen in one place, hold_slot
warns for itself, and a Custom process with an issue now makes a Pickup run
skip at the default limit, as every live Command does.
# Conflicts:
#	docs/guide.md
#	site/docs/index.html
#	src/pickup.rs
@JacobStephens2
JacobStephens2 merged commit f54350e into issue-1564 Oct 29, 2026
18 checks passed
@JacobStephens2
JacobStephens2 deleted the issue-1571 branch October 29, 2026 01:27
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