Environment
- OS: Ubuntu on WSL2 (Windows 11)
- Bash: GNU bash 5.2.21
- Agent OS: Latest from main branch
Steps to Reproduce
- Navigate to any project directory (not the agent-os base directory)
- Run:
~/agent-os/scripts/project-install.sh --verbose
- Script prints "Configuration:" and hangs indefinitely
- Never creates the
agent-os/ directory structure
Observed Behavior
Script output stops after printing:
=== Agent OS Project Installation ===
[VERBOSE] Using profile: default
[VERBOSE] Inheritance chain: default
Configuration:
[hangs here - no further output]
Root Cause
The script uses set -e (line 8) which exits on any non-zero return code. The bug occurs at line 450:
In bash arithmetic:
((chain_depth++)) increments the variable (0 → 1)
- But the expression returns the old value (0)
- Zero is falsy in arithmetic context, producing exit code 1
set -e interprets this as an error and terminates the script
Recommended Fix
Add || true to all ((variable++)) statements to prevent set -e from triggering:
Lines to fix:
- Line 244:
((profile_file_count++)) → ((profile_file_count++)) || true
- Line 248:
((profiles_used++)) → ((profiles_used++)) || true
- Line 338:
((new_count++)) → ((new_count++)) || true
- Line 342:
((entry_count++)) → ((entry_count++)) || true
- Line 360:
((new_count++)) → ((new_count++)) || true
- Line 364:
((entry_count++)) → ((entry_count++)) || true
- Line 402:
((count++)) → ((count++)) || true
- Line 450:
((chain_depth++)) → ((chain_depth++)) || true
Alternative: Use count=$((count + 1)) which always returns 0 exit code.
Tested Solution
After applying the fix, the script completes successfully and creates the expected directory structure.
Environment
Steps to Reproduce
~/agent-os/scripts/project-install.sh --verboseagent-os/directory structureObserved Behavior
Script output stops after printing:
Root Cause
The script uses
set -e(line 8) which exits on any non-zero return code. The bug occurs at line 450:((chain_depth++))In bash arithmetic:
((chain_depth++))increments the variable (0 → 1)set -einterprets this as an error and terminates the scriptRecommended Fix
Add
|| trueto all((variable++))statements to preventset -efrom triggering:Lines to fix:
((profile_file_count++))→((profile_file_count++)) || true((profiles_used++))→((profiles_used++)) || true((new_count++))→((new_count++)) || true((entry_count++))→((entry_count++)) || true((new_count++))→((new_count++)) || true((entry_count++))→((entry_count++)) || true((count++))→((count++)) || true((chain_depth++))→((chain_depth++)) || trueAlternative: Use
count=$((count + 1))which always returns 0 exit code.Tested Solution
After applying the fix, the script completes successfully and creates the expected directory structure.