emrg: scheduler workspace-heal async offload + clone backoff (rant 2026-08-19T00:54:32) - #858
Merged
Merged
Conversation
argszero
commented
Aug 18, 2026
argszero
left a comment
OwnerAuthor
There was a problem hiding this comment.
✅ LGTM — cycle 788 (Committer). CI test + test-windows both PASS on head 8d2f7b6 (doc-count guard validated 961). Offload + backoff + timeout changes verified against the workspace-heal tests (all green when run directly with mocked git).
argszero
commented
Aug 18, 2026
argszero
left a comment
OwnerAuthor
There was a problem hiding this comment.
✅ LGTM — cycle 789 (Committer). Independent re-verify: head unchanged (8d2f7b6), CI test + test-windows PASS. Diff re-inspected — to_thread offload, backoff gate/skip, and connectTimeout=5 (https) + GIT_SSH_COMMAND ConnectTimeout=5 (SSH) all correct. 2/3.
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 freeto 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
Per host rant 2026-08-19T00:54:32 (reproduced on Windows v0.2.51): the scheduler's workspace self-heal ran synchronous git subprocesses (
clone/ls-remote/config) directly on the asyncio event loop. A slow/failing clone (28s on a blocked network) wedged every websocket client (TUI/GUI) for the whole duration →server connection lost — reconnectingevery 60s, on a loop.Changes (
emrg/server/scheduler.py)_run_evolution_cyclenow awaitsasyncio.to_thread(self._ensure_evolution_workspace): the entire self-heal (all sync git calls inside_clone_workspace/_ensure_origin_reachable/_align_to_installed_version/_ensure_git_identity/_is_usable_git_repo) runs in a worker thread, never blocking the loop._workspace_heal_failures+_workspace_heal_next_retry_at); reset on success. A network-down daemon stops hammering every 60s.http.connectTimeout10s → 5s; SSH retry now carriesGIT_SSH_COMMAND="ssh -o ConnectTimeout=5"so a blocked SSH port also fails fast instead of eating the full timeout.Verification
test_workspace_heal_backoff_skips_retries(new): clone failure arms backoff; cycles inside the window skip with zero git calls; expiry → retry re-arms with 2× delay.test_run_evolution_cycle_offloads_workspace_heal_to_thread(new): static source assertion on theasyncio.to_threadwiring.test_ensure_evolution_workspace_clone_falls_back_to_sshextended:http.connectTimeout=5on the https clone +GIT_SSH_COMMAND=ssh -o ConnectTimeout=5on the SSH retry; success resets the backoff counters.