Repository navigation
feat(placement): load-aware placement that fills headless machines first - #85
Conversation
Placement now reads load per core, running agents, and whether a machine belongs to a person. Headless machines take work first; someone's computer only when every headless one is full and nobody is using it, and agents there are capped so it stays responsive. Fresh worktrees from origin are placed by default in Closura builds. Model: claude-opus-5-5 Task: implementation Agent: Builder Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… machine From review: logind errors no longer read as headless, a machine without agent scopes reports no agent count, default placement needs the caller's clientRequestId so a retry finds the chosen machine, and work started on someone's computer stays there when nothing else has room. Model: claude-opus-5-5 Task: fix Agent: Builder Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
Independent review round (Claude Opus 5.5 subagent, read-only, against the common ancestor Findings and what happened to each:
Checked fine by the reviewer: resetting the headless quota with Re-verified after the rebase: server, web and mobile typecheck pass. |
94f6b28 to
12c8580
Compare
Today the ASUS (8 cores) reached a load of 64 and stopped responding while the R720 (48 cores) sat mostly idle. Automatic placement only compared a short CPU sample with free memory. It could not see run-queue saturation or how many agents a machine already runs, and it had no way to keep work off the computers Kameron and Jeff use.
What changes
HostResourcesSnapshot, optional fields so older servers still decode): load per host CPU, running agent scopes on the host across every T3 server, the machine's placement role, and whether its person is active.packages/shared/src/loadBalancing.ts, used by serverplacement:'auto'and the web auto-balance draft): two tiers. Headless machines fill first. A machine counts as saturated at load ≥ 1 per CPU, CPU ≥ 95%, or memory under 5% or 1.5 GB. The score is cores × idle share × free memory share ÷ (1 + running agents). Someone's computer is a candidate only if every headless machine is full, its person is idle, CPU and load per CPU are under 50%, at least 3 GB and 40% of memory are free, and fewer than 2 agents run there. A machine that doesn't report a role, or can't tell whether someone is active, is never used.machinePlacementRole, defaultauto): Detect treats the desktop app, macOS, Windows, or a local Linux graphical login (logindDisplaysession of type x11/wayland, not remote) as someone's computer. Activity comes from logind Active/Locked/Idle on Linux and HIDIdleTime under 10 minutes on macOS.agentScope.ts): the agents slice gets CPUQuota of half the cores, CPUWeight=1 and IOWeight=1. Agents start slowing once free memory falls to 4 GB or 40% of RAM, and one is killed at 3 GB or 30%. Headless limits are unchanged. Limits follow a role change at the next launch.automaticPlacementByDefault, Closura defaulttrue): an agent'st3_thread_launchof a worktree started from origin is placed without asking.placement:'here'or the setting turned off keeps it local. If nothing has room, it starts here, as before. An explicitplacement:'auto'still fails loudly.delegate_taskwithoutplacementstill shares the parent's checkout. A child moved elsewhere would silently lose uncommitted edits. Itsplacementdescription now steers agents to'auto'for independent work.docs/user/remote-access.md.Verified locally (R720, Node 22): typecheck for contracts, shared, server, web and mobile. Tests:
threadPlacement(7),HostResources(8),MachinePresence(4),agentScope(17),RemoteDelegation(53, including 2 new default-placement tests), project handlers,OrchestratorMcpService,McpHttpServer,ProviderSessionManager,serverSettings, and the contracts suite all pass.DesktopTelemetryReceiver.test.tshas one failure that also fails on the unmodified base.vp lintcould not load the repo's TypeScript oxlint plugin on this host's Node 22 (the repo pins Node 26), so CI owns lint.Not covered here: Jeff's machines run their own builds and are read-only links, so they are already never placement targets from the fleet. macOS agent processes get no CPU cap, because there is no systemd there.
Model: claude-opus-5-5
Task: implementation
🤖 Generated with Claude Code