Skip to content

fix(setup): anchor config paths to script directory#96

Open
0xghost42 wants to merge 1 commit into
sentient-agi:mainfrom
0xghost42:fix/86-setup-anchor-script-dir
Open

fix(setup): anchor config paths to script directory#96
0xghost42 wants to merge 1 commit into
sentient-agi:mainfrom
0xghost42:fix/86-setup-anchor-script-dir

Conversation

@0xghost42
Copy link
Copy Markdown

Summary

Closes #86.

just setup fails with

✗ No profiles found in config/profiles
error: Recipe `setup` failed on line 73 with exit code 1

on a clean checkout where config/profiles/*.yaml clearly exists.

Root cause

CONFIG_DIR was set as the relative string "config", and PROFILES_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 — notably install_optional_tools cd's into temporary directories while installing goofys / e2b (lines 540–572). If any of those install attempts leaves the working directory drifted before select_profile runs, the relative \"config/profiles\"/*.yaml glob expands against the wrong directory and discover_profiles returns an empty array.

This is consistent with the trace in #86 where the failure lands right after the optional-tools step.

Change

setup.sh:

  • Anchor CONFIG_DIR to \"$SCRIPT_DIR/config\". Every downstream path (PROFILES_DIR, EXAMPLES_DIR, DEFAULTS_DIR) becomes an absolute path, immune to cwd drift between functions.
  • Add a second line to the "No profiles found" error that prints the current working directory, so any future occurrence is one error message away from being diagnosable instead of needing a reproducer.

Verification

  • bash -n setup.sh clean.
  • The existing top-of-file cd \"$SCRIPT_DIR\" is retained; this PR is purely defensive against cwd drift in helper functions further down.
  • No other path in the script depends on CONFIG_DIR being relative.

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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

just setup output ✗ No profiles found in config/profiles error: Recipe setup failed on line 73 with exit code 1

1 participant