fix(queue-daemon): implement timeout handling for long-running tasks #228

Merged
shoko merged 2 commits from fix/issue-166 into main 2026-04-08 04:51:54 +02:00
Owner

Summary

Implement timeout handling for queue daemon tasks that run too long.

Changes

  • Check notified_at timestamp in check_task_completion()
  • Mark tasks as error if they exceed TASK_TIMEOUT_HOURS (defaults to 1 hour)
  • When timeout detected:
    • Kill the task process (PID) if running
    • Stop the opencode session if exists
    • Mark queue item as error state

Fixes

Fixes #166

## Summary Implement timeout handling for queue daemon tasks that run too long. ## Changes - Check `notified_at` timestamp in `check_task_completion()` - Mark tasks as error if they exceed `TASK_TIMEOUT_HOURS` (defaults to 1 hour) - When timeout detected: - Kill the task process (PID) if running - Stop the opencode session if exists - Mark queue item as error state ## Fixes Fixes #166
shoko added 1 commit 2026-04-07 16:02:40 +02:00
Check notified_at timestamp in check_task_completion() and mark tasks
as error if they exceed TASK_TIMEOUT_HOURS (defaults to 1 hour).

When timeout is detected:
- Kill the task process (PID) if running
- Stop the opencode session if exists
- Mark queue item as error state

Fixes #166
han reviewed 2026-04-08 04:04:37 +02:00
@@ -44,0 +62,4 @@
opencode session stop "$session_id" 2>/dev/null || true
fi
update_queue_item_state "$queue_id" "error"
echo "Task $queue_id ($issue_ref) marked error — timeout after ${hours_elapsed}h"
First-time contributor

for echo related stuff in this PR, I'd like to possibly use kugetsu-log rather than a raw echo so we can have a unified formatted log. what do you think?

for echo related stuff in this PR, I'd like to possibly use kugetsu-log rather than a raw echo so we can have a unified formatted log. what do you think?
First-time contributor

for echo related stuff in this PR, I'd like to possibly use kugetsu-log rather than a raw echo so we can have a unified formatted log. what do you think?

for echo related stuff in this PR, I'd like to possibly use kugetsu-log rather than a raw echo so we can have a unified formatted log. what do you think?
shoko added 1 commit 2026-04-08 04:39:50 +02:00
Use log_warn and log_error instead of echo for unified log formatting.
han approved these changes 2026-04-08 04:51:08 +02:00
han left a comment
First-time contributor

lgtm

lgtm
shoko merged commit 44c84280f8 into main 2026-04-08 04:51:54 +02:00
Sign in to join this conversation.