Repository navigation
feat(placement): fleet host order and lane caps, branch reuse, held-setup retry - #138
Merged
Merged
Conversation
…; retry held worktree setup Automatic placement now tries hosts in a configured order (R720, ASUS, omarchy, then the laptop) and refuses a host at its lane cap or memory floor. It never falls back to the machine the work started on, so a full fleet answers no-eligible-environment and cloud overflow can take it. The refusal no longer tells callers to name an environment, which is how R720 was pinned past its limits. Worktree setup reuses an existing branch with no commits of its own instead of failing with branch_already_exists. A send held behind a failed worktree setup now retries that setup. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
|
Important
This repository does not receive automatic reviews because it has fewer than 10 stars.
|
Branch reuse now needs the caller to ask for it, and only thread launch does, so the worktree handoff tool and worktree restore keep refusing an existing branch. A failed worktree add after a reuse puts the branch back on its old tip instead of deleting it. Placement counts its own accepted choices from the last minute against a host's lanes, so launches fanned out against one resource sample cannot all land on the same host. The refusal no longer names a cloud overflow route this server does not have, and a host entry without a memory floor decodes with 4 GiB instead of discarding the settings. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
…t scopes Idle provider sessions keep an agent scope populated for 30 minutes to 4 hours, so the scope count held host lane caps closed with little running. Snapshots now carry activeRuns: threads with a preparing, starting, running, waiting or unheld queued run. Caps and the recent-placement reservation use it, falling back to the scope count for peers that do not report it yet. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
… run A placement reserved a lane for a flat 60 seconds on top of the host's fresh count, so sequential launches were refused at about half the cap. Each reservation now records the lane count the host reported when it was placed, and a host counts the larger of its reported lanes and any reservation's lanes plus the reservations made since. Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Lane placement, per-host caps and the memory check (Linear CLO-932).
Why "no machine with spare capacity" kept appearing
The refusal was correct. R720 was at about 1.27 load per CPU against a headless limit of 1, and ASUS was over its limits as well. The refusal message then told callers to "name an environment". Callers did that and pinned R720 by id, which skipped placement altogether. About 14 lanes piled onto R720 and it hung around 01:30 UTC. Two other gaps contributed: headless hosts had no lane cap, and the origin fallback let a laptop keep work it started.
Changes
Host order and caps (Closura default, rule 19). The new
automaticPlacementHostsserver setting defaults to:Every host also has a 4 GiB available-memory floor. Within each tier the order listed wins, then whichever host has the most room. A host at its cap, below its memory floor, or not reporting its lane count is refused. Hosts that are not listed come after the listed ones and have no cap.
No origin fallback. When nothing has room the result is
no-eligible-environment, and the caller retries later (cloud overflow is separate work, Linear CLO-929). The laptop is used only for laptop-bound work (requiresOrigin). ForbyDefaultplacement, the fallback to here now happens only within here's own cap. The refusal text no longer encourages pinning.Worktree branch reuse. When
git branchfails withbranch_already_exists, an existing branch is reused (git branch --force) if both of these hold:Otherwise the original error stands. The normal path makes no extra git calls. Only thread launches opt in (
reuseEmptyBranch). If setup fails after a reuse, the branch goes back to its old tip instead of being deleted.Held runs after a failed setup. An MCP
thread_sendthat comes back queued and held behind a failed worktree preparation now callsretryPreparationfor that run. Before, only the UI Retry button released the hold. The websocketmessage.dispatchpath is unchanged and still relies on Retry.Caps count active runs. Host snapshots now carry
activeRuns: the threads on that server with a preparing, starting, running, waiting or unheld queued run. Caps use that number. Idle provider sessions keep an agent scope populated for 30 minutes to 4 hours, so the scope count kept caps closed while little was running. Peers that do not reportactiveRunsyet fall back to the scope count. Each placement also reserves a lane, recording the lane count the host reported at that moment. Until the host's own count catches up, it is counted as the larger of what it reports and any reservation's count plus the reservations made since, for up to 60 seconds. So launches that see the same sample cannot both take the last lane, and sequential launches still fill every lane.Tests
threadPlacement(fleet order, caps, never the laptop, laptop-bound work)RemoteDelegation(cap refusal, 0-lane laptop, reservation, active runs preferred over scopes)HostResources(snapshot carriesactiveRuns) andProjectionRecovery(active-run thread count)GitVcsDriverCore(reuse versus refuse)OrchestratorMcpService(held send retries setup)Failures that already happen on the base, unchanged by this PR:
projectGroupingload-balancing fixtures, which have noplacementRoleDeploy notes
Deploy: fleet
hostResources, so it is never eligible until it does.waitingruns, for example a thread waiting on an approval, hold a lane until answered.activeRunscovers one server, not the whole host.maxLanesorenvironmentIdstill fails the whole settings decode.🤖 Generated with Claude Code