Skip to content

feat(cron): add manual exec command for existing jobs#357

Open
xukp20 wants to merge 5 commits intochenhg5:mainfrom
xukp20:feat/cron-exec
Open

feat(cron): add manual exec command for existing jobs#357
xukp20 wants to merge 5 commits intochenhg5:mainfrom
xukp20:feat/cron-exec

Conversation

@xukp20
Copy link
Copy Markdown
Contributor

@xukp20 xukp20 commented Mar 29, 2026

Summary

Add a manual cron exec entrypoint so an existing cron job can be triggered immediately by job ID.

This reuses the existing cron execution path instead of introducing a separate ad-hoc runner.

Fixes #263

What changed

  • add CronScheduler.TriggerJob(id) for manual execution of existing jobs
  • add /cron exec <id> in chat command handling
  • add cron card Run Now action button
  • add local API endpoint POST /cron/exec
  • add CLI command cc-connect cron exec <id>
  • update cron help text and i18n strings
  • add regression tests for scheduler, card action, text command, API, and CLI usage

Why

Today cron jobs can be created, listed, edited, enabled, disabled, muted, and deleted, but they cannot be run immediately.

This makes testing and one-off triggering awkward because users have to wait for the next scheduled time.

cron exec solves that by letting an existing job run once on demand while preserving its configured project, session, prompt/exec mode, timeout, and
other execution settings.

Validation

  • go test ./core -run 'Cron|ExecuteCronJob|HandleCronExec' -v
  • go test ./cmd/cc-connect -run 'Cron' -v
  • $(go env GOPATH)/bin/staticcheck ./core/... ./cmd/cc-connect/...
  • go build ./...
  • go test ./...

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. Useful feature for cron job testing.

Review notes:

  • ✅ CI passes
  • Adds cron exec <id> command for manual trigger
  • Includes CLI, API endpoint, card action
  • Good test coverage
  • Fixes issue #263

Approved for merge.

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.

[Feature] cron 功能应该增加一个 cron exec,立即执行某个 id 的任务

2 participants