From 59f6a4883e515369ab43791dea0f8aea03d7cf1e Mon Sep 17 00:00:00 2001 From: shokollm <270575765+shokollm@users.noreply.github.com> Date: Mon, 6 Apr 2026 00:40:55 +0000 Subject: [PATCH] fix(kugetsu): remove duplicate update_queue_item_state to use fixed version from kugetsu-index.sh The main kugetsu script had its own update_queue_item_state() definition with broken os.system() calls that overwrote the fixed version in kugetsu-index.sh. Now kugetsu will use the fixed version from kugetsu-index.sh (which sources kugetsu-log.sh) since that module is sourced first. Fixes #170 --- skills/kugetsu/scripts/kugetsu | 49 ---------------------------------- 1 file changed, 49 deletions(-) diff --git a/skills/kugetsu/scripts/kugetsu b/skills/kugetsu/scripts/kugetsu index ec9e3f5..89055b4 100755 --- a/skills/kugetsu/scripts/kugetsu +++ b/skills/kugetsu/scripts/kugetsu @@ -361,55 +361,6 @@ get_queue_stats() { echo "{\"total\": $total, \"pending\": $pending, \"notified\": $notified, \"completed\": $completed, \"error\": $error}" } -update_queue_item_state() { - local queue_id="$1" - local new_state="$2" - local session_id="${3:-}" - local pid="${4:-}" - - local item_file="$QUEUE_ITEMS_DIR/${queue_id}.json" - if [ ! -f "$item_file" ]; then - echo "Error: Queue item not found: $queue_id" >&2 - return 1 - fi - - python3 << PYEOF -import json -import os -from datetime import datetime - -item_file = "$item_file" -new_state = "$new_state" -session_id = "$session_id" -pid = "$pid" - -with open(item_file, 'r') as f: - item = json.load(f) - -issue_ref = item.get('issue_ref', '') - -item['state'] = new_state - -if new_state == "notified": - item['notified_at'] = datetime.now().isoformat() + "Z" - if session_id: - item['opencode_session_id'] = session_id - if pid: - item['pid'] = int(pid) if pid.isdigit() else None -elif new_state == "completed": - item['completed_at'] = datetime.now().isoformat() + "Z" - os.system(f"kugetsu_add_notification 'task_completed' 'Task completed: {issue_ref}' '{issue_ref}'") -elif new_state == "error": - item['error'] = datetime.now().isoformat() + "Z" - os.system(f"kugetsu_add_notification 'task_error' 'Task error: {issue_ref}' '{issue_ref}'") - -with open(item_file, 'w') as f: - json.dump(item, f, indent=2) - -print(f"Updated $queue_id to state: $new_state") -PYEOF -} - check_task_timeouts() { if [ ! -d "$QUEUE_ITEMS_DIR" ]; then return -- 2.49.1