Queue daemon: implement timeout handling for long-running tasks #166

Closed
opened 2026-04-06 02:07:43 +02:00 by shoko · 1 comment
Owner

Problem

The queue daemon spawns tasks via cmd_start/cmd_continue but never kills them if they run too long. Tasks can run indefinitely if:

  • The opencode session hangs
  • Network issues cause stalls
  • The agent gets stuck in a loop

Current Behavior

  • No timeout is enforced
  • Tasks stay in 'notified' state forever if the process never terminates
  • No mechanism to kill stuck tasks and mark them as error

Expected Fix

  1. Add TASK_TIMEOUT_HOURS configuration (already defined but not used)
  2. Track task start time when setting state to 'notified'
  3. In check_task_completion(), check if task exceeded timeout
  4. If timeout exceeded, kill the process and set state to 'error'

Severity

Low - enhancement, tasks eventually complete or are manually cleaned up

## Problem The queue daemon spawns tasks via cmd_start/cmd_continue but never kills them if they run too long. Tasks can run indefinitely if: - The opencode session hangs - Network issues cause stalls - The agent gets stuck in a loop ## Current Behavior - No timeout is enforced - Tasks stay in 'notified' state forever if the process never terminates - No mechanism to kill stuck tasks and mark them as error ## Expected Fix 1. Add TASK_TIMEOUT_HOURS configuration (already defined but not used) 2. Track task start time when setting state to 'notified' 3. In check_task_completion(), check if task exceeded timeout 4. If timeout exceeded, kill the process and set state to 'error' ## Severity Low - enhancement, tasks eventually complete or are manually cleaned up
shoko added the ready label 2026-04-07 08:55:25 +02:00
Author
Owner

@han Updated! Changed echo to log_warn/log_error for the timeout messages. Good catch on using kugetsu-log for unified formatting.

@han Updated! Changed echo to log_warn/log_error for the timeout messages. Good catch on using kugetsu-log for unified formatting.
shoko closed this issue 2026-04-08 04:51:54 +02:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: shoko/kugetsu#166