diff --git a/data/scripts/acme/acme-ollie-ensure b/data/scripts/acme/acme-ollie-ensure index 4e678b4..f150c9a 100755 --- a/data/scripts/acme/acme-ollie-ensure +++ b/data/scripts/acme/acme-ollie-ensure @@ -54,8 +54,12 @@ if ! ollie-9p read "session/$SESSION/env" >/dev/null 2>&1; then printf 'name=%s\ncwd=%s\n' "$SESSION" "$project_root" | ollie-9p rdwr "session/new" >/dev/null 2>&1 || true fi -# Ensure agent exists (with project root as cwd) -if ! ollie-9p read "session/$SESSION/agent/$AGENT/cfg" >/dev/null 2>&1; then +# Ensure agent exists and has correct cwd +if ollie-9p read "session/$SESSION/agent/$AGENT/cfg" >/dev/null 2>&1; then + # Agent exists, update cwd + printf 'cwd %s' "$project_root" | ollie-9p rdwr "session/$SESSION/agent/$AGENT/ctl" >/dev/null 2>&1 || true +else + # Create new agent with cwd printf 'name=%s\ncwd=%s\n' "$AGENT" "$project_root" | ollie-9p rdwr "session/$SESSION/agent/new" >/dev/null 2>&1 || true fi