Repository navigation
fix(config): treat an empty HOME as unset - #2332
Closed
kaoru0822-kitauji wants to merge 1 commit into
Closed
kaoru0822-kitauji wants to merge 1 commit into
kaoru0822-kitauji wants to merge 1 commit into
Conversation
homeDirectoryFromEnvironment selected HOME (or USERPROFILE, HOMEDRIVE, HOMEPATH) with ??, so an empty value was used as the home. Every path joined onto it became relative, and rea setup wrote client registrations and the REA skill into the working directory while reporting ready. Treat empty home variables as unset and fall back to the account home, as shells and most tools do. Fixes #2325 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. |
8 of 16 tasks
Collaborator
Author
|
Superseded by c339f9e (fix(setup): ignore empty home directory selections), which fixed #2325 on main with the same precedence and broader setup/doctor/uninstall coverage. The CI failures here came from main-side test breakage already fixed by 8224aeb and ac57c88. Closing. (AI agent maintenance loop.) |
Owner
|
Thanks, @kaoru0822-kitauji, for catching the empty-HOME case that could redirect configuration writes into the current directory. Main now shares a safe fallback across setup, doctor, and uninstall (main). |
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
homeDirectoryFromEnvironment(src/config/homeDirectory.ts) chose the home with??, so an emptyHOME(orUSERPROFILE/HOMEDRIVE/HOMEPATHon Windows) was used as the home. Every path joined onto it became relative. WithHOME="",rea setupwrote.cursor/mcp.jsonand.agents/skills/reverse-engineer-anything/…into the current working directory and reportedready. Run from a project checkout, that writes REA configuration into the repository, and the real client configuration is never registered.doctor,uninstalland config parsing use the same value.Empty home variables are now treated as unset, so resolution falls back to the account home, as shells and most tools do. A non-empty selected home, including relative values, is unchanged.
This is the
HOMEcounterpart of #2168 / #2189 (emptyXDG_CONFIG_HOMEfor OpenCode).Fixes #2325
Before / after (empty working directory,
env -i PATH="$PATH" HOME="" rea setup --client cursor --dry-run --json)Before the change, a non-dry-run
--yesin an empty directory created./.cursor/mcp.jsonand./.agents/skills/reverse-engineer-anything/SKILL.md.Validation
src/config.test.ts(home directory selection) covers emptyHOMEon darwin, emptyHOME+USERPROFILEon linux, all-empty variables on win32, a selected home kept as-is, and the Windows fallback past an emptyUSERPROFILEtoHOMEDRIVE+HOMEPATHand thenHOME. The four new tests fail on main and pass with this change; 44/44 in the file pass. They are unit tests so they never read or write the real account home; the end-to-end check above was a dry run.npm run lintpasses.npm test: 9833 passed, 17 failed in 9 files. All of them also fail on cleanorigin/main(f611d8c) on this host:ibtool,hdiutil, inspector target locations.processSettlementDeadline(macOS cannot observe/bin/sleep's environment).tests/boundary/cli/referenceSourceImportStatus.test.ts: 2full-outputcases expect the wrapper'sok: truefor a failed import, which main's recent full-output failure-semantics change appears to have altered.🤖 Generated with Claude Code