Repository navigation
feat(launch): cap hangar concurrency and queue launches beyond it - #52
Merged
Merged
Conversation
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
A launch that finds the hangar full answers 202 with its place in line and starts when a slot frees; an offline hangar is refused with 503, a card already waiting with 409. GET /api/cards reports the cap, the occupancy and the queue, and marks queued cards as not dispatchable. Co-Authored-By: Claude Sonnet 5.5 <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.
Summary
The hangar now runs at most a fixed number of agents at once. A dispatch beyond that waits in an in-memory queue and starts by itself when a slot frees.
/usr/sbin/sysctl -n hw.perflevel0.physicalcpu. If the count can't be read, the cap is 4.CC_MOBILE_HANGAR_CAPoverrides it, and a malformed value stops startup. Startup prints one line,hangar cap N (source).agent.list, plus launches admitted but not finished. A launch's reservation counts toward every reading issued before it finished, and toward none issued after.POST /api/launch:201as today.202 {queued: true, position}and starts FIFO on a 10 s poll, or as soon as a launch finishes or a hangar teardown runs.409 already_queued.agent.listsilent for 2 s) gets503 hangar_offline.GET /api/cards: each card gainsqueued, and a waiting or starting card is not dispatchable. The reply gainshangar: {cap, occupied, queued} | null. Card identity (cardKey) is normalized for both bindings and the queue.docs-launch-claims.test.ts.Each commit typechecks and passes
bun teston its own (2661 pass at the tip).Breaking
A caller that treats only
201as success reads a queued card as a failure. The iPhone QuickAdd script gets this handling under its own card (quickadd-launch-queued-reply).Live verification (human-run, after merge +
pm2 restart cc-mobile-prod)pm2 logs cc-mobile-prodshowshangar cap 4 (6 performance cores).CC_MOBILE_HANGAR_SESSION=fleet CC_MOBILE_HANGAR_CAP=2 bun run dev:server, thencurl -s http://127.0.0.1:3001/api/cards | jq .hangar.capgives2.202 position: 1, and the hangar never exceeds 4 agents./exitone claude with its pane left open: the fifth card starts within 10 s. Then close a pane: the slot frees too.bun run test:herdrcoversserver/integration/launch-worktree.e2e.test.ts, which was edited for tsc and not yet run.🤖 Generated with Claude Code
Summary by CodeRabbit