Repository navigation
fix(cli): start on Windows when USERPROFILE is empty - #2345
Merged
morluto merged 4 commits intoOct 13, 2026
Merged
Conversation
Node's Windows home lookup throws ERR_SYSTEM_ERROR (uv_os_homedir ENOENT) for an empty USERPROFILE instead of consulting the account profile. Incur resolves the home while it is imported, so every command, including `rea --version`, stopped with a raw stack trace before REA ran. Treat the empty selection as unset in the launcher, before any runtime import, and cover startup with a compiled-CLI regression. Co-Authored-By: Claude Opus 5.5 <[email protected]>
|
Codex usage limits have been reached for code reviews. Please check with the admins of this repo to increase the limits by adding credits. |
N0zoM1z0
added a commit
that referenced
this pull request
Oct 13, 2026
Follow-up to #2345; thanks to @gefrezim for the import-time home lookup diagnosis. Normalize only an empty Windows USERPROFILE before runtime dependency imports, preserving all nonempty caller selections. Reuse the existing public setup dry-run regression in the Windows curated CI lane. No additional filesystem query, engine call, cache or retry. Verified real Windows Node 24.18.0 CLI unset/empty/selected-profile controls, setup dry-run home selection and unchanged configuration, and baseline/candidate SDK stdio MCP catalogue parity. Nine related tests and static/docs checks passed. No IDA or Ghidra engine was used. Scoped resource observations and measurement limits are recorded in experiments/analysis-efficiency/windows-empty-profile.md. Fixed the review finding and original CI package-scope ownership failure. Current-head CI is green; the unrelated MCP identity timeout passed on a failed-job rerun without changing its code or timeout. Current-head review completed with no further findings.
Owner
|
@greptileai review |
Contributor
|
This PR is set for a Plus review. TREX isn't supported with Plus or Apex reviews yet, so Greptile reviews this PR at Base while TREX is on. |
Contributor
|
Node timers can fire while performance.now() is still a fraction of a millisecond short of the monotonic deadline. ProviderStartupDeadline then reported interruption "timeout" and an aborted signal while remainingMs() returned ceil(0.x) = 1, so polling loops guarded by remainingMs() > 0 (Hopper and Ghidra startup) could run past an elapsed deadline, and the real-timer test "aborts a bounded wait when its real monotonic deadline expires" failed intermittently in CI (expected 1 to be 0). Once the deadline's own timer has classified a timeout, report zero remaining time. A deterministic regression test fires the timer with the monotonic clock 0.4 ms short of the deadline. Co-Authored-By: Claude Opus 5.5 <[email protected]>
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
On Windows, an empty
USERPROFILEstops everyreacommand at startup, includingrea --version, with a raw Node stack trace. This makes the launcher treat that empty selection as unset so the CLI starts and resolves the account profile.Related to #2325 / #2332 (empty home selections), but a separate failure: the crash happens while Incur is imported, before
homeDirectoryFromEnvironmentruns, so the Windows fallback added in #2332 is not reachable from the real CLI without this.Problem and expected behavior
Smallest trigger, native Windows, current main:
Node's
os.homedir()on Windows throws for a set-but-emptyUSERPROFILEinstead of consulting the account profile (os.userInfo().homedirstill returns it).incur/dist/internal/agents.jscallsos.homedir()at module scope, so the import inscripts/rea.mjsrejects.Expected: an empty
USERPROFILEbehaves like an unset one, as #2325 describes forHOME.Change and scope
scripts/rea.mjsdeletes an emptyUSERPROFILEfromprocess.envonwin32before any runtime import. The launcher is the earliest stage and the only one that runs before Incur's import-time lookup. Node then falls back to the account profile, and REA's own resolver sees the variable as unset.Not included: POSIX
HOMEhandling (owned by #2332), any change to Incur, and relative non-empty home values.Follow the contribution scope: not applicable, ordinary fix within existing boundaries.
Contract and boundary impact
scripts/rea.mjs), before runtime imports.Expected effects:
Evidence and regression coverage
tests/boundary/cli/emptyHomeStartup.test.tsruns the compiled CLI withHOME=""andUSERPROFILE=""and expects--versionand--helpto succeed.--version,doctor --json,setup --client cursor --yes --dry-run --jsonandmcp doctorall exit 1 with theuv_os_homedirerror. With the launcher change reverted, the new test fails on that same error; with it, the test passes.USERPROFILE="" rea --versionprints the version, andsetup --dry-runplans against the account profile (C:\Users\<account>\.cursor\mcp.json).--mcpserver mode was not exercised (the launcher change applies before that branch).Validation performed
npm run build:cached— passednpx vitest run tests/boundary/cli/emptyHomeStartup.test.ts— 1 passed (fails without the launcher change)npm run check:fast— typecheck and lint passednpm run verify:test-discovery— all test files discovered exactly oncenpx oxfmt --checkon both changed files — passednpm run check,npm run check:pr.Compatibility, safety, and release
Before merge
type(scope): outcome.