Skip to content

[Feature] Add configurable timeout for tool execution #906

@QuietyAwe

Description

@QuietyAwe

Problem

Currently, tool execution timeout is hardcoded to 60 seconds in the shell tool implementation. This affects:

  1. exec tool - Shell commands may hang indefinitely if the default timeout is insufficient
  2. web_fetch - HTTP requests could timeout at inappropriate times
  3. subagent/spawn - Long-running tasks have no configurable timeout

From code inspection:

  • pkg/tools/shell.go has a hardcoded timeout: 60 * time.Second
  • pkg/config/config.go ExecConfig struct only has EnableDenyPatterns and CustomDenyPatterns
  • No way to configure timeout via config file or environment variable

Proposed Solution

Add timeout configuration to ExecConfig:

{
  "tools": {
    "exec": {
      "enable_deny_patterns": true,
      "custom_deny_patterns": [],
      "timeout_seconds": 120
    }
  }
}

Changes needed:

  1. Config struct - Add TimeoutSeconds field to ExecConfig
  2. Environment variable - Support PICOCLAW_TOOLS_EXEC_TIMEOUT_SECONDS
  3. Apply timeout - Use configured timeout in NewExecToolWithConfig
  4. Default value - Keep 60 seconds as default for backward compatibility

Benefits:

  • Users can increase timeout for long-running operations (e.g., video processing, large file downloads)
  • Users can decrease timeout for faster failure detection
  • Consistent with other configurable parameters

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions