Remove HTTP-era leftovers from the WebSocket coordinator - #475
Closed
hermabr wants to merge 2 commits into
Closed
Conversation
lease_job now blocks on the coordinator's condition until a job is available or the run is done, deleting the "wait" token and the server's 1s wake poll (and with it a missed-wakeup race). The lock and wake primitives merge into a single Condition notified by mutators. The strictly sequential worker channel drops its envelopes: workers send a bare JobResult instead of ResultMessage, hellos validate directly, and worker_message_adapter goes away. lease_job also stops releasing prior leases per request - connection teardown (worker_lost) is the single release path. client.py folds into its only caller, worker_loop. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
Owner
Author
|
Warning This pull request is not mergeable via GitHub because a downstack PR is open. Once all requirements are satisfied, merge this PR as a stack on Graphite.
This stack of pull requests is managed by Graphite. Learn more about stacking. |
hermabr
marked this pull request as ready for review
August 1, 2026 23:14
This was referenced Aug 1, 2026
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.

Stacked on #470. Follow-up simplification: the transport migrated to WebSockets, but three HTTP-era concepts survived in the new code. This deletes them (−94 production lines net, plus one fewer race and two fewer protocol concepts).
Changes
lease_jobon a single Condition."wait"existed because HTTP couldn't block a request.lease_jobnow blocks until a job is available or the run is done (Job | None), thelock/wakepair merges into onethreading.Conditionnotified by mutators inside the locked section, and the server's 1s wake poll disappears — along with the missed-wakeup race betweenlease_jobreleasing the lock and the server thread acquiringwake. Tests that asserted"wait"now assert viacount_satisfiable_jobs(same predicate, non-blocking).HelloMessage.model_validate_json, result frames are a bareJobResult(already discriminated onstatus; the adapter moves fromexecute.pytoprotocol.py), andResultMessage,worker_message_adapter, andHelloMessage.kindgo away.AssignMessage | StopMessagestays — that direction is a genuine union.lease_jobno longer releases prior leases. Release-on-re-lease was load-bearing under HTTP (a crashed worker could simply request again). Over the socket the server thread enforces the sequence — it never re-leases while results are outstanding — so connection teardown (worker_lost) is now the single release path, andlease_jobis side-effect-free on other state.client.pyintoworker_loop. One caller, oneconnect()+ onesend(), and an always-trueisinstanceassert.Explicitly considered and rejected: an explicit protocol state machine (the thread-per-connection blocking design already encodes the states in control flow), in-process execution for the local backend, and event-driven pool scaling.
Testing
pytest tests/test_worker_execution_coordinator.py tests/test_worker_subprocess.py tests/test_slurm_backend.py: 127 passed.test_furu_locking_contention.pyreproduce identically without this change (deadline-sensitive tests on AFS) and are unrelated.ruff check,ruff format,ty check: clean.