fix: stabilize bulk registration admission and polling#18
Open
AmPlace wants to merge 6 commits into
Open
Conversation
AmPlace
marked this pull request as ready for review
July 21, 2026 17:42
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
waiting_admissionand refresh their durable heartbeatchrome131profile to the maintainedchromeprofilemax_workers must be greater than 0error when the live signup page contains no JavaScript chunksRoot causes
Batch workers changed a session to
startedbefore polling the global registration semaphore. While all slots were occupied, that polling loop had neither a timeout nor a session heartbeat. The watchdog could therefore classify a healthy queued worker as stale, setcancel_requested, and the worker would later reportcancelled while waiting for admission.The full sessions listing used the same 750 ms client as small, high-frequency status polls. A real Docker Desktop list took 2.09 seconds to produce its first byte, so the start-registration preflight failed before
POST /jobswas sent.The registration client silently read only the first 4 MiB of every sidecar response. The same real 1,000-session list was 5,486,793 bytes, so after extending the timeout its valid JSON was cut in the middle and surfaced as
unexpected end of JSON input.The vendored registration client hard-coded curl_cffi's
chrome131impersonation profile. The current xAI/Cloudflare signup endpoint returned HTTP 403 for that profile, while the maintainedchromeprofile and a normal browser returned HTTP 200. Because the 403 page contained no expected Next.js chunks, the parser later produced the unrelatedmax_workers must be greater than 0message instead of identifying the blocked fingerprint.The bulk-list client is isolated so this fix does not make ordinary single-session polling wait for a slow sidecar.
Verification
python -m unittest discover -s tests -p "test_*.py"(20 consecutive runs for the admission/polling changes)python -m py_compile grok2api/upstream/registration_admission.py grok2api/upstream/grok_build_adapter.pygo test ./internal/registration/client ./internal/server -count=1chromefingerprint:ok=1 fail=0git diff --check