#Long running task for sub-agent/ cron job - how to not get timeout kill
1 messages · Page 1 of 1 (latest)
Exec approval is required, but native chat exec approvals are not configured on Discord.
Approve it from the Web UI or terminal UI for now. Discord supports native exec approvals for this account. Configure channels.discord.execApprovals.approvers or commands.ownerAllowFrom; leave channels.discord.execApprovals.enabled unset/auto or set it to true.
I’m checking the docs paths for the long-running/background-task behavior so I can give you the verified answer, not a guess.
First, what does openclaw --version show?
For the general fix, a 30 min job should be run as detached background work, not as one chat turn waiting around.
- One-off long task: use a sub-agent via
sessions_spawn - Scheduled long task: use cron with
--session isolated - If you’re waiting on another session inline: use
timeoutSeconds: 0so it becomes fire-and-forget
Important timeout knobs:
{
agents: {
defaults: {
timeoutSeconds: 7200, // whole run cap
llm: { idleTimeoutSeconds: 600 }, // if provider/model goes quiet
subagents: { runTimeoutSeconds: 0 } // 0 = no sub-agent timeout
}
}
}
A couple gotchas that match what you described:
- Sub-agents are already non-blocking and completion is push-based
- For isolated cron, let cron own final delivery with
--announce - Don’t make the child agent do the final chat send itself unless you really need to, that’s where some delivery weirdness shows up
- Use the task ledger to inspect failures:
openclaw tasks list
openclaw tasks show <id>
openclaw tasks audit
If this is a slow local model, the real killer is often agents.defaults.llm.idleTimeoutSeconds, not the overall run timeout.
If you paste these, I can tell you exactly which layer is killing it:
openclaw --version
openclaw status --all
openclaw gateway status
openclaw logs --follow
Docs:
https://docs.openclaw.ai/help/faq
https://docs.openclaw.ai/automation/tasks
https://docs.openclaw.ai/automation/cron-jobs
https://docs.openclaw.ai/concepts/session-tool
https://docs.openclaw.ai/tools/subagents
ok. and what about how do i send to a speicifc channel in my group chat of telegram? Session: agent:worbot:telegram:group:-1003891861601:topic:220?
Yep, for Telegram forum topics, don’t use the whole session key as the send target.
Use just:
-1003891861601:topic:220
So the mapping is:
- session key / internal session
agent:worbot:telegram:group:-1003891861601:topic:220 - actual delivery target
-1003891861601:topic:220
Examples:
openclaw cron edit <job-id> --announce --channel telegram --to "-1003891861601:topic:220"
openclaw message send --channel telegram --target "-1003891861601:topic:220" --message "hi"
Telegram also supports the equivalent “chat + threadId/topicId” shape, but the :topic: form is the clearest.
If the task was started from that Telegram topic, subagent/cron completion should usually preserve that route automatically.
Docs:
https://docs.openclaw.ai/automation/cron-jobs
https://docs.openclaw.ai/channels/telegram
https://docs.openclaw.ai/channels/groups
If you want, send the exact cron/message config you’re using and I’ll sanity-check it.
91e34560-dd3d-4b40-a7ee-efc27ccaea6e · Error
Daily job scout completed successfully for tz_test profile.
Run Summary:
- LinkedIn: 10 jobs found (1 query, 2m 47s)
- SerpAPI: 18 jobs found (5 queries, 33s)
- Total: 28 raw jobs → 24 after Notion dedup
- All 24 jobs scored
- PDF report generated:
/home/herb/.openclaw/workspace-worbot/skills/job_scout/output/20260420-154034/job_report_20260420.pdf
Report includes roles scoring ≥8.0
The PDF report is ready at skills/job_scout/output/20260420-154034/job_report_20260420.pdf and should be delivered to the user via the configured channel.
Unknown
auto-zzapi
lazyrouter
20/04/2026, 16:46:07
Run at 20/04/2026, 16:39:53
374223ms
Next in 21h
Open run chat
Error: Discord bot token missing for account "default" (set discord.accounts.default.token or DISCORD_BOT_TOKEN for default).
i am using a subagent tho?
Yep, and that error actually makes sense for a subagent.
Your subagent run succeeded.
What failed was the completion announce step.
By default, a subagent announces back to the requester chat channel. In this case that requester was Discord, so OpenClaw tried to send the result back to Discord and hit:
Discord bot token missing for account "default"
So the shape is:
- worker run: âś… succeeded
- announce back to requester channel: ❌ failed
- reason: no Discord
defaulttoken configured
What to do
If you want the result back in Discord
Set a default Discord token:
channels.discord.accounts.default.token- or
DISCORD_BOT_TOKEN
If you want the result to go to Telegram instead
Don’t rely on the default subagent announce from a Discord-started run. Use one of these:
- Spawn/run it from the Telegram topic so requester origin is Telegram
- Use cron announce explicitly
--channel telegram --to "-1003891861601:topic:220" - Have the child send directly via
messageto Telegram
This is also the better option if you need to send the PDF file, not just a text summary
Important bit: sessions_spawn itself does not take channel/to for final delivery. Its built-in announce target is the requester channel.
Docs:
https://docs.openclaw.ai/tools/subagents
https://docs.openclaw.ai/automation/tasks
https://docs.openclaw.ai/automation/cron-jobs
If you paste the exact sessions_spawn call or cron config, I can tell you the cleanest fix fast.
I dont get it, the task is succesful:
91e34560-dd3d-4b40-a7ee-efc27ccaea6e · Error
Daily job scout completed successfully for tz_test profile.
Results:
- 28 jobs found (10 LinkedIn, 18 SerpAPI)
- 24 jobs after Notion deduplication
- 24 jobs scored
- PDF report generated with roles scoring ≥8.0
Output directory: /home/herb/.openclaw/workspace-worbot/skills/job_scout/output/20260420-155348/
PDF report: /home/herb/.openclaw/workspace-worbot/skills/job_scout/output/20260420-155348/job_report_20260420.pdf
Runtime: 4m 4s
Delivered
auto-zzapi
lazyrouter
20/04/2026, 16:58:05
Run at 20/04/2026, 16:52:43
321731ms
Next in 21h
Open run chat
⚠️ ✉️ Message failed
but still: says message failed.
i actually got the response.
unning daily job scout for tz_test profile...
.
Tool
16:53
auto-zzapi
Daily job scout completed successfully for tz_test profile.
Results:
28 jobs found (10 LinkedIn, 18 SerpAPI)
24 jobs after Notion deduplication
24 jobs scored
PDF report generated with roles scoring ≥8.0
Output directory: /home/herb/.openclaw/workspace-worbot/skills/job_scout/output/20260420-155348/
PDF report: /home/herb/.openclaw/workspace-worbot/skills/job_scout/output/20260420-155348/job_report_20260420.pdf
Runtime: 4m 4s
Yep, that means the run succeeded, but one delivery attempt failed.
You’re seeing 2 layers mixed together:
-
Task/run outcome → success
The scout job finished and produced the PDF. -
Message delivery outcome → one send attempt failed
But another path still got the result to you, which is why you did receive the response.
So Delivered + ⚠️ Message failed usually means something like:
- direct send failed, then fallback delivery succeeded, or
- the summary got through, but a second send (often attachment/PDF or duplicate announce) failed
That’s why the card feels contradictory. The job itself is fine.
What I’d check next
Did you receive:
- just the text summary, or
- the actual PDF file too?
If you only got the text summary, then the failed message was probably the file/attachment send, while the built-in subagent/cron summary still made it through.
Practical fix
Pick one final delivery path:
- Let the subagent/cron announce the result, or
- Have the child send the final message/file itself
Mixing both can create exactly this weird “success + message failed” combo.
If you want to debug the exact failed leg
Paste:
openclaw --version
openclaw tasks show 91e34560-dd3d-4b40-a7ee-efc27ccaea6e
and ideally the matching bit from:
openclaw logs --follow
This honestly sounds like delivery bookkeeping/UI being confusing, not the worker actually failing.
Docs:
https://docs.openclaw.ai/automation/tasks
https://docs.openclaw.ai/tools/subagents
https://docs.openclaw.ai/automation/cron-jobs
so this is gvbinhg me erro:
Run the daily job scout:
-
Execute: cd skills/job_scout && uv run python scripts/run_job_scout.py --sources linkedin,serpapi --profile tz_ai
-
Find the latest output directory under skills/job_scout/output/ (sorted by timestamp)
-
Print a summary and then attach the pdf report.
⚠️ Cron job "Daily Job Scout-TZ" failed: ⚠️ ✉️ Message failed
- In your summary, include the full path to the PDF report so it can be attached in the delivery. Use the format: MEDIA:/path/to/pdf this didnt generate fail, but then i dont see attachment anyhow?
I’m checking the delivery behavior here, because this smells like the cron runner is only treating the result as text instead of an actual attachment.
Yep, I think I see it.
The reply you pasted earlier did not actually contain a raw MEDIA: line. It had plain text like:
PDF report: /home/herb/.openclaw/workspace-worbot/...
OpenClaw treats that as text, not an attachment.
For auto-attachment, it has to be literally this on its own line:
MEDIA:/home/herb/.openclaw/workspace-worbot/skills/job_scout/output/20260420-155348/job_report_20260420.pdf
Rules:
- own line
- no backticks
- no bullets
- no
**bold** - absolute path is best
But for cron, the more reliable fix is:
Have the job use the message tool to send the PDF, instead of hoping the final text gets parsed into an attachment.
Docs say isolated cron jobs can send directly with message, and --announce is only the fallback if the agent did not send.
Better prompt
Use this instead:
Run the daily job scout:
1. Execute: cd skills/job_scout && uv run python scripts/run_job_scout.py --sources linkedin,serpapi --profile tz_ai
2. Find the latest output directory under skills/job_scout/output/ (sorted by timestamp)
3. Find the generated PDF report
4. Use the message tool to send the PDF file as an attachment to the current/configured target, with a short caption summarizing the results.
5. After sending the file, reply NO_REPLY.
6. Do not just print the PDF path or MEDIA: line unless the message tool send fails.
If you want to force the Telegram topic explicitly, target:
-1003891861601:topic:220
So yeah, the issue is probably “path mentioned in text” != “file actually sent”.