fix(kugetsu): wrap cmd_continue in subshell with cd for correct worktree dir #129

Merged
shoko merged 1 commits from fix/cmd-continue-worktree-dir into main 2026-04-03 15:58:20 +02:00
Owner

Summary

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.

Fix

Apply the same subshell+cd pattern that was used in cmd_start:

# Before (broken):
opencode run "$message" --continue --session "$opencode_session_id" --dir "$worktree_path" 2>&1 &

# After (fixed):
(cd "$worktree_path" && opencode run "$message" --continue --session "$opencode_session_id" --dir "$worktree_path" 2>&1) &

Testing

  1. Start a session with kugetsu start <issue> <message>
  2. Wait for completion or let it run
  3. Continue with kugetsu continue <issue> <message>
  4. Verify the forked session's directory is set to the worktree, not the base session's directory

Closes

Fixes #127

## Summary 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. ## Fix Apply the same subshell+cd pattern that was used in `cmd_start`: ```bash # Before (broken): opencode run "$message" --continue --session "$opencode_session_id" --dir "$worktree_path" 2>&1 & # After (fixed): (cd "$worktree_path" && opencode run "$message" --continue --session "$opencode_session_id" --dir "$worktree_path" 2>&1) & ``` ## Testing 1. Start a session with `kugetsu start <issue> <message>` 2. Wait for completion or let it run 3. Continue with `kugetsu continue <issue> <message>` 4. Verify the forked session's directory is set to the worktree, not the base session's directory ## Closes Fixes #127
shoko added 1 commit 2026-04-03 15:06:39 +02:00
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
han approved these changes 2026-04-03 15:57:48 +02:00
han left a comment
First-time contributor

lgtm

lgtm
shoko merged commit f7fe22de25 into main 2026-04-03 15:58:20 +02:00
Sign in to join this conversation.