fix(setup): anchor config paths to script directory#96
Open
0xghost42 wants to merge 1 commit into
Open
Conversation
Closes sentient-agi#86. Reported in sentient-agi#86: 'just setup' fails with ✗ No profiles found in config/profiles error: Recipe 'setup' failed on line 73 with exit code 1 even on a clean checkout where config/profiles/*.yaml clearly exist. Root cause: CONFIG_DIR was set as the relative string "config". PROFILES_DIR is composed from it once at the top of the script ("config/profiles"), so it captures the string, not the resolved path. Later setup steps cd around (e.g. install_optional_tools cd's into temp directories while installing goofys/e2b), and if the working directory drifts before select_profile runs, the relative "config/profiles" glob expands against the wrong directory and finds nothing. Make every config path absolute by anchoring CONFIG_DIR to SCRIPT_DIR. Also surface the absolute path and current working directory in the error message so future occurrences are easier to diagnose at a glance.
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
Closes #86.
just setupfails withon a clean checkout where
config/profiles/*.yamlclearly exists.Root cause
CONFIG_DIRwas set as the relative string"config", andPROFILES_DIR=\"$CONFIG_DIR/profiles\"captures that string (not a resolved path) at script load time.The top of the script does
cd \"$SCRIPT_DIR\"once, but later setup steps cd around — notablyinstall_optional_toolscd's into temporary directories while installinggoofys/e2b(lines 540–572). If any of those install attempts leaves the working directory drifted beforeselect_profileruns, the relative\"config/profiles\"/*.yamlglob expands against the wrong directory anddiscover_profilesreturns an empty array.This is consistent with the trace in #86 where the failure lands right after the optional-tools step.
Change
setup.sh:CONFIG_DIRto\"$SCRIPT_DIR/config\". Every downstream path (PROFILES_DIR,EXAMPLES_DIR,DEFAULTS_DIR) becomes an absolute path, immune to cwd drift between functions.Verification
bash -n setup.shclean.cd \"$SCRIPT_DIR\"is retained; this PR is purely defensive against cwd drift in helper functions further down.CONFIG_DIRbeing relative.