From 3ce43ffa6531504e91363a98071a529d66d4e25b Mon Sep 17 00:00:00 2001 From: shokollm <270575765+shokollm@users.noreply.github.com> Date: Fri, 3 Apr 2026 13:06:02 +0000 Subject: [PATCH] fix(kugetsu): wrap cmd_continue in subshell with cd for correct worktree dir The --dir flag only sets directory for the subprocess, not the session's stored directory in opencode's SQLite DB. This was already fixed for cmd_start in v0.1.10, but cmd_continue still had the bug. Fixes #127 --- skills/kugetsu/scripts/kugetsu | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/skills/kugetsu/scripts/kugetsu b/skills/kugetsu/scripts/kugetsu index c381026..79bc0c4 100755 --- a/skills/kugetsu/scripts/kugetsu +++ b/skills/kugetsu/scripts/kugetsu @@ -1439,12 +1439,13 @@ cmd_continue() { echo "Continuing session for '$session_name'..." # Note: --continue always allowed (existing sessions don't count toward limit) + # Wrap in subshell with cd to ensure worktree directory is set correctly in session DB if [ -n "$worktree_path" ] && [ -d "$worktree_path" ]; then echo "Using worktree: $worktree_path" if [ "$DEBUG_MODE" = true ]; then - opencode run "$message" --continue --session "$opencode_session_id" --dir "$worktree_path" 2>&1 | tee "$session_path.debug.log" & + (cd "$worktree_path" && opencode run "$message" --continue --session "$opencode_session_id" --dir "$worktree_path" 2>&1) | tee "$session_path.debug.log" & else - opencode run "$message" --continue --session "$opencode_session_id" --dir "$worktree_path" 2>&1 & + (cd "$worktree_path" && opencode run "$message" --continue --session "$opencode_session_id" --dir "$worktree_path" 2>&1) & fi else if [ "$DEBUG_MODE" = true ]; then