Skip to content

Queued/scheduled sessions and auto-continue on usage reset#95

Merged
mattmoran56 merged 2 commits into
mainfrom
session/feat/auto-restart
May 6, 2026
Merged

Queued/scheduled sessions and auto-continue on usage reset#95
mattmoran56 merged 2 commits into
mainfrom
session/feat/auto-restart

Conversation

@mattmoran56
Copy link
Copy Markdown
Owner

Summary

Two related affordances around Claude usage limits:

  1. Schedule a session for later — pick a time (the dialog pre-fills from your next 5 h reset), enter a custom prompt, and it sits in a Scheduled sidebar panel until fire time. At fire time the worktree, branch, and agent are spun up automatically, with the prompt piped into claude via heredoc so it's bulletproof; claude's existing auto-restart then drops you back into claude --resume so you can keep chatting. Doesn't yank your view to the new session.
  2. Auto-continue on usage reset — when an active session's 5 h window crosses 95 %, surface a toast (or, with a setting toggled on, queue silently) that lines up continue to fire ~1 minute after reset. The in-session chip shows the queued message + cancel.

Both queue items persist via electron-store, so a closed app picks them up on next launch (with a 2.5 s renderer-ready buffer for past-due items).

Test plan

  • Unit: 39 tests across scheduleTime, schedulerStore, scheduler.service, useSchedulerBootstrap, writeWhenReady
  • E2E: 5 Playwright tests covering dialog flow, fire path, prompt injection, and cancel
  • Manual: scheduled a 2-min session with a custom prompt; worktree + branch were created at fire time, prompt appeared in claude's input, claude responded, and the session was reachable via the sidebar afterward
  • Screenshots — the PR touches UI (Scheduled panel, schedule dialog, usage-limit toast, queued-message chip, settings section). I'll attach them in a follow-up commit unless you'd like to grab them from your dev run.

Notes

  • The original >-detection-then-write injection path (used by manually-created sessions with a preset startup prompt) is unchanged — it's still the path startup prompts use. The queued-fire path uses a new IPC scheduler:spawn-agent-with-prompt that pipes the prompt via heredoc, which is more reliable in the queued context where the renderer subscribe-to-data timing is racy.
  • Cross-project firing has explicit unit-test coverage to make sure the target project's session list never gets corrupted.

🤖 Generated with Claude Code

mattmoran56 and others added 2 commits May 6, 2026 11:15
Adds two related affordances around Claude usage limits:

1. Schedule a session for later — pick a time (the dialog pre-fills from
   your next 5h reset), enter a custom prompt, and it sits in a "Scheduled"
   sidebar panel until fire time. At fire time the worktree, branch, and
   agent are spun up automatically, with the prompt piped into claude via
   heredoc so it's bulletproof; claude's existing auto-restart then drops
   you back into `claude --resume` so you can keep chatting. Doesn't yank
   your view to the new session.

2. Auto-continue on usage reset — when an active session's 5h window
   crosses 95%, surface a toast (or, with a setting toggled on, queue
   silently) that lines up "continue" to fire ~1 minute after reset. The
   in-session chip shows the queued message + cancel.

Tested with 39 unit tests + 5 Playwright e2e tests.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
# Conflicts:
#	src/renderer/components/layout/SessionSidebar.tsx
@mattmoran56 mattmoran56 merged commit d89ea66 into main May 6, 2026
3 checks passed
@mattmoran56 mattmoran56 deleted the session/feat/auto-restart branch May 6, 2026 11:35
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.

1 participant