acme-ollie-ensure: always update agent cwd

Match ollie-session-here behavior: update cwd for existing agents,
not just on creation. Ensures agent cwd reflects current project root
when invoked from a different context.
This commit is contained in:
Levi Neely 2026-10-07 15:24:46 +02:00
parent f7a52088db
commit a899f933fb
1 changed files with 6 additions and 2 deletions

View File

@ -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