From 4464e5d91fba33eb2e79390d14328d17a088dd05 Mon Sep 17 00:00:00 2001 From: shokollm <270575765+shokollm@users.noreply.github.com> Date: Tue, 7 Apr 2026 09:51:46 +0000 Subject: [PATCH] fix: remove race condition in cmd_delegate msg file deletion cmd_delegate deletes the message file immediately after spawning the background nohup process, causing a race condition where opencode run may not have read the file yet. Error: File not found: msg-ses_xxx.txt Fix by removing rm -f "$msg_file", consistent with cmd_start and cmd_continue which write to $worktree_path/.kugetsu-msg.txt and never delete it. Orphaned msg files in $LOGS_DIR/ are harmless. Fixes #210 --- skills/kugetsu/scripts/kugetsu-session.sh | 1 - 1 file changed, 1 deletion(-) diff --git a/skills/kugetsu/scripts/kugetsu-session.sh b/skills/kugetsu/scripts/kugetsu-session.sh index 52676d6..79d1ded 100755 --- a/skills/kugetsu/scripts/kugetsu-session.sh +++ b/skills/kugetsu/scripts/kugetsu-session.sh @@ -228,7 +228,6 @@ cmd_delegate() { 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"))" }