Scheduled Tasks: auto-close session after task completion
Resolved 💬 3 comments Opened Mar 17, 2026 by jakobwechselberger Closed Apr 22, 2026
Problem
Scheduled tasks leave their sessions open indefinitely after the agent finishes all work. The user must manually /exit or archive each session from the sidebar.
Running multiple daily cron tasks (smoke tests, imports, briefings) creates zombie sessions that need manual cleanup every morning.
Current behavior
- Scheduled task fires at cron time
- Agent completes all work (writes results to DB, no more actions needed)
- Session stays open in sidebar with spinning indicator
- User must manually close each completed session
Desired behavior
Sessions spawned by scheduled tasks should auto-terminate once the agent has no more work to do. Possible implementations:
autoClose: truefrontmatter in SKILL.md — close session when agent stops generatingmaxDuration: 300frontmatter — timeout in seconds, session terminates after that- Built-in exit tool the agent can call to programmatically end its own session
Workaround attempted
Adding explicit "terminate immediately" instructions to the task prompt. The agent stops talking but the session remains open — this is a platform-level issue, not solvable via prompt.
Environment
- Claude Code Desktop (Windows 11)
- Multiple recurring cron tasks (daily smoke test, daily import, daily briefing)
This issue has 3 comments on GitHub. Read the full discussion on GitHub ↗