Skip to content

feat(cron): add configurable execution timeout for cron jobs#225

Merged
yinwm merged 4 commits intosipeed:mainfrom
yinwm:feat/cron-exec-timeout-config
Feb 17, 2026
Merged

feat(cron): add configurable execution timeout for cron jobs#225
yinwm merged 4 commits intosipeed:mainfrom
yinwm:feat/cron-exec-timeout-config

Conversation

@yinwm
Copy link
Collaborator

@yinwm yinwm commented Feb 15, 2026

Summary

  • Add exec_timeout_minutes config option under tools.cron section
  • Default timeout is 5 minutes (appropriate for LLM operations)
  • Set to 0 to disable timeout entirely
  • Configurable via config file or PICOCLAW_TOOLS_CRON_EXEC_TIMEOUT_MINUTES env var

Problem

Cron jobs executing LLM operations were timing out at the hardcoded 60-second limit, causing errors like:

Error executing scheduled command: Command timed out after 1m0s

Solution

Make the timeout configurable with a sensible default for LLM workloads.

Changes

  • pkg/config/config.go: Add CronToolsConfig struct
  • pkg/tools/cron.go: Accept execTimeout parameter in NewCronTool
  • cmd/picoclaw/main.go: Pass config value to cron tool
  • config/config.example.json: Add cron config example
  • README.md, README.zh.md, README.ja.md: Update config examples

Test plan

  • make build succeeds
  • go test ./pkg/config/... ./pkg/tools/... passes
  • Verified config is correctly parsed and applied

🤖 Generated with Claude Code

Add a new configuration option `exec_timeout_minutes` under the `tools.cron`
section to control the maximum execution time for cron jobs. The default
timeout is set to 5 minutes, which is appropriate for LLM operations.

The configuration can be set in the config file or via the
`PICOCLAW_TOOLS_CRON_EXEC_TIMEOUT_MINUTES` environment variable. A value of
0 disables the timeout entirely.

This change improves system reliability by preventing cron jobs from running
indefinitely in case of unexpected failures or hanging processes.
@Leeaandrob
Copy link
Collaborator

@Zepan Adds configurable execution timeout for cron jobs — prevents a stuck job from blocking the cron service forever. Important for reliability on long-running deployments.

Recommendation: Merge. +36/-6, small but important resilience improvement.

Replace unconditional WithTimeout usage with conditional context creation
based on timeout configuration. Zero values now bypass timeout enforcement,
using WithCancel for graceful cancellation while preserving existing timeout
behavior for positive values. Simplifies CronTool initialization by removing
unnecessary conditional timeout assignment.
@yinwm yinwm merged commit 7b9b810 into sipeed:main Feb 17, 2026
3 checks passed
@yinwm yinwm deleted the feat/cron-exec-timeout-config branch February 17, 2026 13:39
SebastianBoehler pushed a commit to SebastianBoehler/picoclaw that referenced this pull request Feb 22, 2026
feat(cron): add configurable execution timeout for cron jobs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants