fix: queue daemon crashes on every task (issue #174) #175
Reference in New Issue
Block a user
Delete Branch "fix/issue-174-queue-daemon-crashes"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Summary
Fix 3 bugs from issue #174 that caused silent failure loop where tasks are immediately marked error and the daemon cycles endlessly.
Bug 1 — json.loads with newlines
File: kugetsu-log.sh, kugetsu_add_notification() function.
Problem: Notifications JSON was embedded in a single-quoted Python string literal, but newlines in the JSON (after pretty-printing) broke the Python parser.
Fix: Pass JSON via stdin to Python instead of embedding in string.
Bug 2 — logs directory not created
File: kugetsu-queue-daemon.sh line 114/125.
Problem: log_file = ~/.kugetsu/logs/delegate-.log but the logs/ directory was never created during kugetsu init.
Fix: Add mkdir -p for LOGS_DIR, WORKTREES_DIR, QUEUE_DIR, and QUEUE_ITEMS_DIR to ensure_dirs() and ensure_queue_dirs().
Bug 3 — issue_ref parsed incorrectly from URL format
File: kugetsu script, parse_issue_ref_from_message() function.
Problem: When parsing #158, the function used buggy grep/sed that incorrectly extracted the instance.
Fix: Use bash regex (=~) for reliable URL parsing with proper capture groups.
Testing
References
c1385f22fdtofb33be3a64lgtm