Skip to content

feat(config): add GOCLAW_CRON_JOB_TIMEOUT env var for cron timeout#1099

Open
hoakhongmau98 wants to merge 1 commit intonextlevelbuilder:devfrom
hoakhongmau98:feat/cron-job-timeout-env-var
Open

feat(config): add GOCLAW_CRON_JOB_TIMEOUT env var for cron timeout#1099
hoakhongmau98 wants to merge 1 commit intonextlevelbuilder:devfrom
hoakhongmau98:feat/cron-job-timeout-env-var

Conversation

@hoakhongmau98
Copy link
Copy Markdown

Summary

  • Adds GOCLAW_CRON_JOB_TIMEOUT env var mapping in applyEnvOverrides(), completing the GOCLAW_* env var pattern for CronConfig.JobTimeout.
  • Lets operators override cron job timeout without editing the JSON config file — useful for deployments running multi-turn LLM agents with large contexts where 10m default is too short.
  • Zero breaking change: unset/invalid values fall through to the existing DefaultJobTimeout (10m) behavior via the existing JobTimeoutDuration() helper, which already handles parse errors with slog.Warn.

Closes #1098

Changes

internal/config/config_load.go — one new section in the operational-config block (next to Browser):

// Cron job execution
envStr("GOCLAW_CRON_JOB_TIMEOUT", &c.Cron.JobTimeout)

internal/config/config_load_test.go — 4 new test cases:

  • TestLoad_CronJobTimeout_EnvVarGOCLAW_CRON_JOB_TIMEOUT=1h1h
  • TestLoad_CronJobTimeout_Invalid_FallsBackToDefault — invalid value → 10m (logs warn)
  • TestLoad_CronJobTimeout_Unset_UsesDefault — unset → 10m
  • TestLoad_CronJobTimeout_EnvOverridesFile — file 5m + env 30m30m (env wins)

Test plan

  • go build ./... (PG build)
  • go build -tags sqliteonly ./... (Desktop/SQLite build)
  • go vet ./...
  • go test ./internal/config/ — 4 new + all existing tests pass
  • Manual: run gateway with GOCLAW_CRON_JOB_TIMEOUT=1h and confirm a long cron job is no longer killed at 10m

Notes for reviewers

  • Placement chosen near the operational-config block (Sandbox/Browser) rather than the secrets block at the top, since cron timeout is a runtime parameter, not a credential.
  • No new error handling needed — CronConfig.JobTimeoutDuration() already validates and falls back. This was confirmed by the existing TestCronConfig_JobTimeoutDuration_Invalid test.
  • No changes to default behavior; existing deployments without the env var see no difference.

Allow overriding the cron job execution timeout via env var, matching
the existing GOCLAW_* env var pattern used throughout the codebase.

Falls back to the existing default (10m) when unset or invalid, since
CronConfig.JobTimeoutDuration() already handles parse errors with a
slog.Warn and the DefaultJobTimeout constant.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
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.

feat(config): add GOCLAW_CRON_JOB_TIMEOUT env var for configurable cron timeout

2 participants