Repository navigation
scripts/wait-for-slot.sh: read-only client gate that waits for a free slot (#23) - #24
Merged
Merged
Conversation
… slot (#23) A client can only count its own requests, so a fan-out cannot tell how many of the endpoint's 8 slots other consumers already hold. The script samples vllm:num_requests_running and vllm:num_requests_waiting through llama-swap and returns once running + waiting + NEED <= LIMIT (default 6), or gives up after --max-wait. --check takes a single sample. One GET of /metrics per sample; no inference request, nothing changes on the server. The key comes from an environment variable or a key file and reaches curl on stdin, never argv. A sample with no answer counts as busy. It is advisory: concurrencyLimit in llama-swap.yaml stays the hard limit. README lists it and shows the call; examples/opencode/AGENTS.md runs it before launching more than one sub-agent. Tested against a local mock metrics server (room, busy, wait-then-room, give-up, 401, 404, 500, timeout, missing gauges, key file with CRLF) and with one read-only sample from the live endpoint. Not verified: the AGENTS.md line being followed by a model in a real session. Co-Authored-By: Claude Fable 5.1 <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.
Closes #23.
What
A client can only count its own requests, so a fan-out cannot tell how many of the endpoint's 8 slots other consumers already hold.
scripts/wait-for-slot.shsamplesvllm:num_requests_runningandvllm:num_requests_waitingthrough llama-swap and exits 0 oncerunning + waiting + NEED <= LIMIT, or gives up after--max-wait./upstream/<model>/metricsper sample. No inference request; nothing changes on the server.scripts/check-keys.sh).--limit 6,--need 1, sample every 5 s, give up after 600 s. The 6 is a policy choice (leave 2 slots for latency-sensitive consumers), not a measurement.--checktakes one sample: exit 0 room, 1 no room.concurrencyLimitinllama-swap.yamlstays the hard limit.Docs: the README lists the script and shows the call under Operations;
examples/opencode/AGENTS.mdruns the gate before launching more than one sub-agent;examples/opencode/README.mdshows the wrapper that putswait-for-slotonPATH.Tested
--max-wait, 401, 404, 500, request timeout, missing gauges, key file with CRLF, usage errors.--check), exit 0.bash -nandshellcheckpass; gitleaks passes over the tree and full history.Not verified
AGENTS.mdline in a real session.No change on the box and no change to
llama-swap.yaml.🤖 Generated with Claude Code