openclaw - 💡(How to fix) Fix [Bug] Subagent task stays in 'running' state forever when /approve is never given [1 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#62360Fetched 2026-04-08 03:05:29
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Participants

Error Message

  • Error in audit: stale_running / running task appears stuck Task error stale_running 52a588c9-… running 4d21h running task appears stuck

Fix Action

Fix / Workaround

Workaround: Manually update SQLite: UPDATE task_runs SET status='cancelled' WHERE task_id='...'

Code Example

Task     error    stale_running          52a588c9-… running    4d21h    running task appears stuck

---

[Thu 2026-04-02 17:18 GMT+8] OpenClaw runtime context (internal):
[Internal task completion event]
source: subagent
type: subagent task
Result: 需要批准才能执行此操作(涉及重启 gateway 进程)。
请回复 `/approve ee1ebec2 allow-once` 以继续执行。
RAW_BUFFERClick to expand / collapse

Bug Description

When a subagent task requires user approval via /approve <token> allow-once, if the user never provides the approval, the task remains in 'running' state indefinitely.

Expected behavior: Tasks waiting for approval should either timeout automatically or be cleaned up after a reasonable period.

Actual behavior: The task stays in 'running' state forever, creating persistent 'stale_running' audit errors. In one case, a task was stuck for 5+ days.

Steps to Reproduce

  1. Have a subagent execute a task that requires approval (e.g. a gateway restart operation)
  2. Never provide the /approve response
  3. Task remains in 'running' state indefinitely

Environment

  • OpenClaw version: 2026.4.5
  • Task ID: 52a588c9-7c00-40ea-a3f9-596d0cca991c
  • Error in audit: stale_running / running task appears stuck

Additional Context

Task audit output:

Task     error    stale_running          52a588c9-… running    4d21h    running task appears stuck

Task label at time of stall:

[Thu 2026-04-02 17:18 GMT+8] OpenClaw runtime context (internal):
[Internal task completion event]
source: subagent
type: subagent task
Result: 需要批准才能执行此操作(涉及重启 gateway 进程)。
请回复 `/approve ee1ebec2 allow-once` 以继续执行。

Workaround: Manually update SQLite: UPDATE task_runs SET status='cancelled' WHERE task_id='...'

Suggested Fix

  1. Auto-timeout tasks waiting for approval (suggested: 5 minutes)
  2. Mark tasks as 'pending_approval' instead of 'running'
  3. Auto-cancel running tasks with no progress for > X minutes

extent analysis

TL;DR

Implement an auto-timeout for tasks waiting for approval to prevent them from remaining in the 'running' state indefinitely.

Guidance

  • Introduce a timeout mechanism for tasks awaiting approval, such as auto-cancelling or transitioning them to a 'pending_approval' state after a specified period (e.g., 5 minutes).
  • Update the task status to 'pending_approval' instead of 'running' when waiting for user approval to better reflect the task's state.
  • Consider implementing a mechanism to auto-cancel tasks with no progress after a certain period to prevent stale tasks.

Example

-- Example SQL query to update task status to 'cancelled' after a certain period
UPDATE task_runs 
SET status = 'cancelled' 
WHERE status = 'running' AND timestamp < (CURRENT_TIMESTAMP - INTERVAL 5 MINUTE);

Notes

The suggested fix implies modifying the task management logic to include timeouts and status updates. However, the exact implementation details depend on the underlying system architecture and the OpenClaw version being used.

Recommendation

Apply a workaround by introducing an auto-timeout for tasks waiting for approval, as this directly addresses the issue of tasks remaining in the 'running' state indefinitely.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING