fix(codegraph): make install + init robust on Windows (Access-denied, hung init)#2863
Merged
Conversation
added 2 commits
June 3, 2026 00:17
os.Rename onto an existing v<ver> dir fails on Windows with Access denied, so a partial cache from an interrupted install made every launch re-fail. Clear a stale (incomplete) dest first and retry the move to ride out a transient AV lock; on real permission failure point at REASONIX_CACHE_DIR.
EnsureInit ran init unbounded; a broken/partial launcher could hang it for the whole session. Cap it with a timeout and tree-kill the cmd->node tree on cancel (a plain Process.Kill leaves the node grandchild holding the pipes).
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.
Problem
On Windows the codegraph background install could fail at the final step with
os.Renameonto an existingv<ver>directory fails with Access denied on Windows, so once a partial/interrupted install left a stalev<ver>behind, every subsequent launch re-hit the same rename and never recovered — it just degraded to grep/glob and retried forever. A freshly-extracted.exebriefly locked by an AV scanner produces the same failure transiently.Separately,
EnsureInitrancodegraph initunbounded (ctx = app lifetime). A broken/partial launcher could hang it, and since thecmd → nodetree isn't killed as a unit on Windows, that could wedge boot.Fix
install.go—promote()clears a stale (incomplete) destination before the move and retries to ride out a transient AV lock. On a genuine permission failure the error now points atREASONIX_CACHE_DIRso users on a locked-down or read-only install location can relocate the cache.codegraph.go—EnsureInitnow capscodegraph initwith a timeout and tree-kills the process tree on cancel (reusingproc.KillTree), so a hung init can't hold up startup.Tests
TestPromoteReplacesStalePartialDest— a non-empty stale dest (the exact Access-denied repro; plainos.Renameonto it fails on every OS) is replaced cleanly.Notes
Builds on the stdio tree-kill fix already on main-v2 — together these make codegraph never able to wedge boot or loop on a failed install. codegraph remains optional: when it can't install, the agent degrades to grep/glob and the app stays fully usable.