Skip to content

feat(orchestrator): lanes spread over machines and accounts - #339

Open
bfcarrasco wants to merge 1 commit into
mainfrom
feat/orchestrator-spread-lanes
Open

bfcarrasco wants to merge 1 commit into
mainfrom
feat/orchestrator-spread-lanes

Conversation

@bfcarrasco

Copy link
Copy Markdown
Owner

Request

#325 (behaviour 8 of #318):

  • The slots are a list of machine and account pairs, read from T3 (linked environments, the providers enabled on each, the projects on each), not written into the skill.
  • A lane goes only to a slot whose machine has the repo.
  • Among those, the slot with the fewest running lanes wins; where the research ticket found a readable quota figure, the account with more left wins a tie.
  • An account that hit its limit gets no new lanes until its reset, and a lane that failed on the limit restarts on another slot from its pushed branch.
  • Each placement is one line on the ticket: slot and reason.
  • Evidence: four lanes started at once land on both machines and both accounts, and a lane started on the other machine merges.

Closes #325

What changed

  • place.mjs pick takes T3's own answers per environment (capabilities, projects, threads) plus quota, and prints per ticket the slot (environment, project, provider instance) and the line to post. It keeps machines whose project matches the repo, counts threads that hold a process (running, starting, preparing, queued; not waiting), breaks a tie by quota left, and skips an account whose probe says rejected until resetsAt. All tickets of a round go in one call, so they spread.
  • place.mjs quota probes each enabled Claude account in this machine's T3 settings (config.homePath as CLAUDE_CONFIG_DIR) with one headless haiku call and reads the rate_limit_event, as the closing comment on Can a session read each Claude account's remaining quota and each machine's load? #320 recommends.
  • The orchestrator skill places every lane through it, posts the line, and restarts a lane that failed on the limit from its pushed branch.

Tradeoffs

  • Accounts are keyed by provider instance id, measured to be the same on both machines. The line names them account <n> and machines by an id prefix, so no private names land on public tickets.
  • No stored state: the limit gate is the fresh probe each round.

Verification

  • node --test tests/*.test.mjs: 0 fail. tests/place.test.mjs covers each criterion, including four lanes on two machines and two accounts.
  • Live probe on one machine: one account allowed_warning with 0.18 left, the other rejected with resetsAt 1796706000, in 7.9 s.
  • Live pick on T3's real answers for both machines, 4 tickets: all on the open account of the machine with fewer running lanes (1 against 4), each line ending skipped: account 2 at its limit until 2026-12-08 05:00 UTC.
  • Not run: a real lane started on the other machine through to merge (optional per the owner's decision on Orchestrator: one T3 Code thread that runs work in all repos from goal to merged #318).

place.mjs reads the slots (machine and Claude account pairs) from T3's own
answers, keeps only machines with the repo, takes the slot with the fewest
running lanes and the account with more quota left in a tie, and skips an
account at its limit until its reset. quota probes each account once with a
headless call. The skill places every lane through it, posts the line on the
ticket, and restarts a lane that failed on the limit from its pushed branch.
@bfcarrasco

Copy link
Copy Markdown
Owner Author

bstack-judge: UNPROVEN tier=1 missing=T3 delegate tools and a linked second machine: could not start a lane on the oth sha=cb44bd1f470dc288aa524ddcde06ae8b78b0531f

Owner: the proof could not be run here: T3 delegate tools and a linked second machine: could not start a lane on the oth; run the judge on a machine that has it, or give the owner's OK line as the whole PR comment: bstack-user-ok sha=cb44bd1f470dc288aa524ddcde06ae8b78b0531f. Nothing is asked of the builder.

Every criterion is proven except the last one's second half, a lane started on the other machine merging. I have no T3 delegate tools, so that is UNPROVEN. I found no defects.

Criteria

  1. Slots read from T3, not the skill: proven. pick builds slots from per-environment capabilities, projects and threads. tests/place.test.mjs covers a non-Claude provider, one that can't run a child task, and a disabled account. node --test tests/place.test.mjs gives 10 pass, 0 fail on head cb44bd1.
  2. Repo filter: proven. The tests show a machine without the repo is skipped, along with archived projects, a null repositoryIdentity and a different case. No slot raises an error naming why.
  3. Fewest running lanes, quota breaks a tie: proven. Waiting and completed threads count as 0, and starting and queued count as 1. An unknown quota loses the tie. The place.mjs pick CLI prints the expected line.
  4. Account at its limit: proven in pick. An account whose probe says rejected gets no lanes until resetsAt, and it is usable again at the reset moment. With every account out, the command exits 1 with the reset times. I also ran the CLI with resetsAt already past, and it placed the lane. The restart on another slot from the pushed branch exists only as text in plugins/bstack/skills/orchestrator/SKILL.md; a test checks that the skill names the place.mjs commands but not that restart wording.
  5. One line per ticket: proven. The Placement: <slot>. Reason: … line is asserted verbatim, and the skill step 5 posts it.
  6. Evidence:
    • Four lanes landing on both machines and both accounts: proven by the first test.
    • A lane on the other machine merging: UNPROVEN, see missing below.

New tests on base: place.mjs and tests/place.test.mjs don't exist on base, so the tests can't pass there.

Risk tier: risk-tier.mjs --pr 339 gives tier 1 with no weakened-check reasons.

Dropped hypotheses

  • A rejected account with a missing resetsAt stays blocked and doesn't crash. That is conservative and fine.
  • Duplicate tickets, or several tickets in one round, spread correctly because the running count rises after each pick.
  • A BOM on stdin is handled (tested).
  • The real claude probe: I didn't run it, because that would call a real account. The PR body reports a live probe.
  • A failed probe (timeout or empty output) gives unknown, so a limited account can still be picked. That is a possible gap, but the skill's restart-on-limit path covers it and it isn't a normal-input defect. No finding.

The #318 comment from 5 Dec 2026 makes a real T3 run optional for #323-#326. It says that when the judge returns UNPROVEN only for lack of T3 delegate tools, the owner tests it and gives the OK line on the PR.

{"findings":[],"missing":"T3 delegate tools and a linked second machine: could not start a lane on the other machine and watch it merge (last half of the final acceptance criterion). Per the owner's decision on #318 the owner tests it and gives the OK line on the PR."}

@bfcarrasco

Copy link
Copy Markdown
Owner Author

Status: checks green on cb44bd1; the judge found no defects and returned UNPROVEN only because it has no T3 delegate tools (the case the 5 Dec 2026 decision on #318 covers). Branch feat/orchestrator-spread-lanes. Next step: squash-merge once the head has an OK, then close #325.

@bfcarrasco

Copy link
Copy Markdown
Owner Author

bstack-user-ok sha=016544bc10629f27a95701473ea02739ca1f97f2

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.

Orchestrator: lanes spread over machines and accounts

1 participant