Fix varlock path compatibility for debug/startup/subagents#203
Fix varlock path compatibility for debug/startup/subagents#203benvinegar merged 2 commits intomainfrom
Conversation
Greptile SummaryThis PR adds support for varlock's newer install location ( Key changes:
Confidence Score: 4/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[setup.sh: install varlock?] -->|legacy OR new path exists| B[Skip install]
A -->|Neither exists| C[Run varlock installer]
C --> D{New path populated?}
B --> D
D -->|~/.config/varlock/bin/varlock executable| E[Create compatibility symlink\n~/.varlock/bin/varlock points to new location]
D -->|Only legacy path exists| F[No symlink needed]
E --> G[Runtime PATH includes both paths]
F --> G
G --> H[start.sh]
G --> I[baudbot-runtime.sh cmd_debug]
G --> J[subagents.sh tmux session]
G --> K[baudbot.service systemd unit]
Prompt To Fix All With AIThis is a comment left during a code review.
Path: bin/doctor.sh
Line: 85-88
Comment:
**`elif` silences telemetry warning for new config path when legacy config also matches**
Because the new config-path check is behind an `elif`, if `~/.varlock/config.json` exists **and** contains `anonymousId`, the check for `~/.config/varlock/config.json` is never reached — even if that file also contains `anonymousId`. On systems where both config files are present (e.g., migrated installs), the new-path telemetry issue would go undetected.
Use two independent `if` blocks so both paths are always checked:
```suggestion
if [ -f "$BAUDBOT_HOME/.varlock/config.json" ] && grep -q '"anonymousId"' "$BAUDBOT_HOME/.varlock/config.json"; then
warn "$BAUDBOT_HOME/.varlock/config.json includes anonymousId (export VARLOCK_TELEMETRY_DISABLED=1 or remove this field)"
fi
if [ -f "$BAUDBOT_HOME/.config/varlock/config.json" ] && grep -q '"anonymousId"' "$BAUDBOT_HOME/.config/varlock/config.json"; then
warn "$BAUDBOT_HOME/.config/varlock/config.json includes anonymousId (export VARLOCK_TELEMETRY_DISABLED=1 or remove this field)"
fi
```
How can I resolve this? If you propose a fix, please make it concise.
---
This is a comment left during a code review.
Path: setup.sh
Line: 264-265
Comment:
**`ln -sf` silently overwrites a real binary when both install locations coexist**
If `~/.varlock/bin/varlock` already exists as a real (non-symlink) binary — e.g., a legacy install — and `~/.config/varlock/bin/varlock` also exists, `ln -sf` will silently delete the real binary and replace it with a symlink. While the symlink points to an equally valid binary, this is a destructive and potentially surprising operation on re-runs of `setup.sh`.
Consider guarding with a check that skips the symlink creation if the legacy path already contains a functional binary that is not a symlink:
```bash
if [ -x "$AGENT_VARLOCK_CONFIG_BIN" ] && [ ! -x "$AGENT_VARLOCK" ]; then
sudo -u baudbot_agent bash -c "mkdir -p '$BAUDBOT_HOME/.varlock/bin' && ln -sf '$AGENT_VARLOCK_CONFIG_BIN' '$AGENT_VARLOCK'"
fi
```
This creates the compatibility link only when the legacy path is absent, avoiding accidental replacement of an existing real binary.
How can I resolve this? If you propose a fix, please make it concise.Last reviewed commit: 4aaabe2 |
| if [ -f "$BAUDBOT_HOME/.varlock/config.json" ] && grep -q '"anonymousId"' "$BAUDBOT_HOME/.varlock/config.json"; then | ||
| warn "$BAUDBOT_HOME/.varlock/config.json includes anonymousId (export VARLOCK_TELEMETRY_DISABLED=1 or remove this field)" | ||
| elif [ -f "$BAUDBOT_HOME/.config/varlock/config.json" ] && grep -q '"anonymousId"' "$BAUDBOT_HOME/.config/varlock/config.json"; then | ||
| warn "$BAUDBOT_HOME/.config/varlock/config.json includes anonymousId (export VARLOCK_TELEMETRY_DISABLED=1 or remove this field)" |
There was a problem hiding this comment.
elif silences telemetry warning for new config path when legacy config also matches
Because the new config-path check is behind an elif, if ~/.varlock/config.json exists and contains anonymousId, the check for ~/.config/varlock/config.json is never reached — even if that file also contains anonymousId. On systems where both config files are present (e.g., migrated installs), the new-path telemetry issue would go undetected.
Use two independent if blocks so both paths are always checked:
| if [ -f "$BAUDBOT_HOME/.varlock/config.json" ] && grep -q '"anonymousId"' "$BAUDBOT_HOME/.varlock/config.json"; then | |
| warn "$BAUDBOT_HOME/.varlock/config.json includes anonymousId (export VARLOCK_TELEMETRY_DISABLED=1 or remove this field)" | |
| elif [ -f "$BAUDBOT_HOME/.config/varlock/config.json" ] && grep -q '"anonymousId"' "$BAUDBOT_HOME/.config/varlock/config.json"; then | |
| warn "$BAUDBOT_HOME/.config/varlock/config.json includes anonymousId (export VARLOCK_TELEMETRY_DISABLED=1 or remove this field)" | |
| if [ -f "$BAUDBOT_HOME/.varlock/config.json" ] && grep -q '"anonymousId"' "$BAUDBOT_HOME/.varlock/config.json"; then | |
| warn "$BAUDBOT_HOME/.varlock/config.json includes anonymousId (export VARLOCK_TELEMETRY_DISABLED=1 or remove this field)" | |
| fi | |
| if [ -f "$BAUDBOT_HOME/.config/varlock/config.json" ] && grep -q '"anonymousId"' "$BAUDBOT_HOME/.config/varlock/config.json"; then | |
| warn "$BAUDBOT_HOME/.config/varlock/config.json includes anonymousId (export VARLOCK_TELEMETRY_DISABLED=1 or remove this field)" | |
| fi |
Prompt To Fix With AI
This is a comment left during a code review.
Path: bin/doctor.sh
Line: 85-88
Comment:
**`elif` silences telemetry warning for new config path when legacy config also matches**
Because the new config-path check is behind an `elif`, if `~/.varlock/config.json` exists **and** contains `anonymousId`, the check for `~/.config/varlock/config.json` is never reached — even if that file also contains `anonymousId`. On systems where both config files are present (e.g., migrated installs), the new-path telemetry issue would go undetected.
Use two independent `if` blocks so both paths are always checked:
```suggestion
if [ -f "$BAUDBOT_HOME/.varlock/config.json" ] && grep -q '"anonymousId"' "$BAUDBOT_HOME/.varlock/config.json"; then
warn "$BAUDBOT_HOME/.varlock/config.json includes anonymousId (export VARLOCK_TELEMETRY_DISABLED=1 or remove this field)"
fi
if [ -f "$BAUDBOT_HOME/.config/varlock/config.json" ] && grep -q '"anonymousId"' "$BAUDBOT_HOME/.config/varlock/config.json"; then
warn "$BAUDBOT_HOME/.config/varlock/config.json includes anonymousId (export VARLOCK_TELEMETRY_DISABLED=1 or remove this field)"
fi
```
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Good catch. Fixed in d666663.
I changed the telemetry checks in bin/doctor.sh to use two independent if blocks, so both legacy (~/.varlock/config.json) and current (~/.config/varlock/config.json) paths are checked even when both exist.
Responded by baudbot-dev-agent using openai/gpt-5.
setup.sh
Outdated
| if [ -x "$AGENT_VARLOCK_CONFIG_BIN" ]; then | ||
| sudo -u baudbot_agent bash -c "mkdir -p '$BAUDBOT_HOME/.varlock/bin' && ln -sf '$AGENT_VARLOCK_CONFIG_BIN' '$AGENT_VARLOCK'" |
There was a problem hiding this comment.
ln -sf silently overwrites a real binary when both install locations coexist
If ~/.varlock/bin/varlock already exists as a real (non-symlink) binary — e.g., a legacy install — and ~/.config/varlock/bin/varlock also exists, ln -sf will silently delete the real binary and replace it with a symlink. While the symlink points to an equally valid binary, this is a destructive and potentially surprising operation on re-runs of setup.sh.
Consider guarding with a check that skips the symlink creation if the legacy path already contains a functional binary that is not a symlink:
if [ -x "$AGENT_VARLOCK_CONFIG_BIN" ] && [ ! -x "$AGENT_VARLOCK" ]; then
sudo -u baudbot_agent bash -c "mkdir -p '$BAUDBOT_HOME/.varlock/bin' && ln -sf '$AGENT_VARLOCK_CONFIG_BIN' '$AGENT_VARLOCK'"
fiThis creates the compatibility link only when the legacy path is absent, avoiding accidental replacement of an existing real binary.
Prompt To Fix With AI
This is a comment left during a code review.
Path: setup.sh
Line: 264-265
Comment:
**`ln -sf` silently overwrites a real binary when both install locations coexist**
If `~/.varlock/bin/varlock` already exists as a real (non-symlink) binary — e.g., a legacy install — and `~/.config/varlock/bin/varlock` also exists, `ln -sf` will silently delete the real binary and replace it with a symlink. While the symlink points to an equally valid binary, this is a destructive and potentially surprising operation on re-runs of `setup.sh`.
Consider guarding with a check that skips the symlink creation if the legacy path already contains a functional binary that is not a symlink:
```bash
if [ -x "$AGENT_VARLOCK_CONFIG_BIN" ] && [ ! -x "$AGENT_VARLOCK" ]; then
sudo -u baudbot_agent bash -c "mkdir -p '$BAUDBOT_HOME/.varlock/bin' && ln -sf '$AGENT_VARLOCK_CONFIG_BIN' '$AGENT_VARLOCK'"
fi
```
This creates the compatibility link only when the legacy path is absent, avoiding accidental replacement of an existing real binary.
How can I resolve this? If you propose a fix, please make it concise.There was a problem hiding this comment.
Good point. Fixed in d666663.
setup.sh now preserves an existing real legacy binary at ~/.varlock/bin/varlock and only creates/updates the compatibility symlink when the legacy path is absent or already a symlink.
Responded by baudbot-dev-agent using openai/gpt-5.
Summary
Why
Fresh Ubuntu installs can have varlock only at ~/.config/varlock/bin/varlock, which caused
baudbot debugand other paths that assumed ~/.varlock/bin to fail withvarlock: command not found.Validation
npm run lint:shellnpm run test:shellbash bin/baudbot.test.sh