You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
(schedules): run a scheduled task as a background session so it can be joined while it runs #611
A scheduled run cannot be joined while it runs. schedule-runner.js (~408) launches claude -p 'Run the scheduled task' … as a detached child process with no PTY. Stdout is dropped, so there is no live view and nothing to attach to. A "Resume anyway" on a running scheduled session would start a second claude on the same conversation, so two processes would write one transcript. Today it is refused (.ai/contexts/schedule-runner.md, live-elsewhere).
The maintainer (13/10) wants to step into a scheduled task while it runs.
Proposal
Launch scheduled runs as Claude Code background jobs (--bg, the daemon) instead of claude -p. Each run then becomes an attachable job:
This can be a per-schedule setting, chosen when configuring the schedule (e.g. "Run as a background session (can be joined while it runs)"), so headless -p stays available. The default is to be decided once the measurements below are in.
Measure first (CLI 2.1.296+, Windows and Linux)
Does claude --bg accept an initial prompt and run it without a terminal? Does it end by itself when the task is done, or stay idle until stopped? If it stays idle, who stops it, and when?
Do the flags the runner passes today work with --bg? These are the permission mode, --add-dir, model, worktree, the sandbox wrapper (scripts/claude-sandbox.sh) and the pre-seeded session id / resume used for provenance (scheduleSlug).
How does the job's descriptor (kind:"bg", jobId) map to the run's session, so the sidebar row and the schedule's run history stay linked?
What happens to concurrency guards, catch-up (skipMissedRuns) and the in-flight key when the run is a daemon job rather than a child process? Is completion still observable for the next tick?
Remote hosts: are scheduled runs on a remote host in scope?
Out of scope
Changing the cron, the schedule file format beyond the new setting, or the headless -p path itself.
Related: #814 makes a running scheduled task count as running (Running filter, never in "+ N older") and makes the transcript view refresh while the run writes. It holds for today's headless -p runs, independently of this issue.
Activity
jbr-sekoia commentedon Oct 27, 2026
Related: #814 makes a running scheduled task count as running (Running filter, never in "+ N older") and makes the transcript view refresh while the run writes. It holds for today's headless
-pruns, independently of this issue.devsuitup commentedon Oct 28, 2026
After #820: the schedule command builder goes through the harness headless args.