From a130a79bd7c5b4f91c285bfb96c8c2ddb9be3af7 Mon Sep 17 00:00:00 2001 From: shokollm <270575765+shokollm@users.noreply.github.com> Date: Tue, 7 Apr 2026 01:55:34 +0000 Subject: [PATCH] fix: use temp file for message to avoid shell parsing issues The message passed to opencode run contains newlines and special characters (parentheses, etc.) which break shell parsing when passed directly in double quotes. Fix by writing message to temp file and using '@msg_file' syntax to pass to opencode run. This handles any characters in the message. --- skills/kugetsu/scripts/kugetsu-session.sh | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/skills/kugetsu/scripts/kugetsu-session.sh b/skills/kugetsu/scripts/kugetsu-session.sh index 8b49d84..e1a7b9f 100755 --- a/skills/kugetsu/scripts/kugetsu-session.sh +++ b/skills/kugetsu/scripts/kugetsu-session.sh @@ -225,7 +225,10 @@ cmd_delegate() { exit 1 fi - nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '$message' --session '$new_session'" >> "$log_file" 2>&1 & + local msg_file="$LOGS_DIR/msg-$new_session.txt" + printf '%s' "$message" > "$msg_file" + nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '@$msg_file' --session '$new_session'" >> "$log_file" 2>&1 & + rm -f "$msg_file" echo "Delegated to new session (logged to $(basename "$log_file"))" } @@ -373,7 +376,10 @@ cmd_start() { load_agent_env "dev" cd "$worktree_path" - nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '$dev_message' --session '$new_session_id'" >> "$LOGS_DIR/dev-$new_session_id.log" 2>&1 & + local msg_file="$LOGS_DIR/msg-$new_session_id.txt" + printf '%s' "$dev_message" > "$msg_file" + nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '@$msg_file' --session '$new_session_id'" >> "$LOGS_DIR/dev-$new_session_id.log" 2>&1 & + rm -f "$msg_file" echo "Session started for '$issue_ref': $new_session_id" echo "Worktree: $worktree_path" @@ -436,7 +442,10 @@ cmd_continue() { fi cd "$worktree_path" - nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '$message' --session '$opencode_session_id'" >> "$LOGS_DIR/dev-$opencode_session_id.log" 2>&1 & + local msg_file="$LOGS_DIR/msg-$opencode_session_id.txt" + printf '%s' "$message" > "$msg_file" + nohup sh -c "GITEA_TOKEN='${GITEA_TOKEN:-}' opencode run '@$msg_file' --session '$opencode_session_id'" >> "$LOGS_DIR/dev-$opencode_session_id.log" 2>&1 & + rm -f "$msg_file" } cmd_list() { -- 2.49.1