Skip to content

feat(cron): add global session_mode config#377

Open
mkloveyy wants to merge 2 commits intochenhg5:mainfrom
mkloveyy:feat/cron-default-session-mode
Open

feat(cron): add global session_mode config#377
mkloveyy wants to merge 2 commits intochenhg5:mainfrom
mkloveyy:feat/cron-default-session-mode

Conversation

@mkloveyy
Copy link
Copy Markdown

@mkloveyy mkloveyy commented Mar 30, 2026

Summary

  • Add session_mode field to [cron] config section, allowing a global default for all cron jobs
  • Supported values: "reuse" (default, share active session) or "new_per_run" (fresh session each run)
  • Per-job session_mode still overrides the global default
  • Follows the existing IsSilent / SetDefaultSilent pattern

Motivation

Cron jobs sharing active sessions often hit "session is busy" errors. Users can now set session_mode = "new_per_run" once globally instead of per-job.

Test plan

  • go build ./... passes
  • go test ./core/ -run TestCron — all cron tests pass
  • Set [cron] session_mode = "new_per_run" in config, verify cron jobs create independent sessions
  • Per-job session_mode = "reuse" overrides the global default

ma_k added 2 commits March 30, 2026 21:09
Allow setting a default session_mode ("reuse" or "new_per_run") for all
cron jobs via [cron] config, so users don't need to set it per-job.
Per-job session_mode still overrides the global default.
@mkloveyy mkloveyy force-pushed the feat/cron-default-session-mode branch from 14bbd8b to 312a142 Compare March 30, 2026 13:09
Copy link
Copy Markdown
Owner

@chenhg5 chenhg5 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Practical cron configuration improvement.

Review summary:

  • ✅ Global session_mode default for cron jobs
  • ✅ Per-job override still supported
  • ✅ Follows existing IsSilent pattern
  • ✅ CI passes

Reduces config repetition for users with many 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