[BUG]Cloud routine "run now" consistently stalls before init — session-start hook never resolves
Preflight Checklist
- [x] I have searched existing issues and this hasn't been reported yet
- [x] This is a single bug report (please file separate reports for different bugs)
- [x] I am using the latest version of Claude Code
What's Wrong?
Summary
Manually firing a scheduled cloud routine (RemoteTrigger action: "run") reliably stalls the resulting session before it ever reaches model init. Reproduced 4/4 times, including with a minimal zero-connector, one-word-prompt configuration, ruling out prompt content and MCP connectors as the cause.
Environment
- Feature: Cloud routines (claude.ai/code/routines), created via the
RemoteTriggerAPI (action: "create") from a Claude Code CLI session. - Environment: Default (
env_01Xa3JcWJDBted2mfTDdoLrQ, kindanthropic_cloud) - Model:
claude-sonnet-5
Steps to reproduce
- Create a routine with
job_config.ccrpointing at the Default environment, aclaude-sonnet-5session, and oneuser-role event as the initial prompt. (Reproduced both with 4 MCP connectors attached — Gmail, Slack, Google Calendar, Notion — and with zero connectors attached.) - Call
RemoteTrigger action: "run"on the trigger. - Poll
RemoteTrigger action: "get_run_log"on the returnedsession_id.
Observed behavior
The log always stops at the same point, across all 4 attempts:
env[info]: Allocating sandbox
env[info]: Environment runner started
env[info]: No sources configured
env[info]: No setup script configured
env[info]: Starting Claude Code
env[info]: Claude Code process started
followed only by non-transcript bookkeeping events (system/hook_started, system/hook_response, system/commands_changed, autocompact_state, active_goal). No init: line ever appears, no assistant turn ever starts, and list_runs reports worker_status: "idle" indefinitely (observed idle 8+ minutes before giving up). This happened on 3 separate full-config runs and 1 minimal (no MCP connectors, one-word prompt) diagnostic run.
Expected behavior
The session should reach init: model=... cwd=... and begin processing the initial prompt shortly after "Claude Code process started," as it does when a user manually types a message into the same stalled session (observed: typing "continue" into a stalled session did successfully reach init — but as a brand-new session with no memory of the original prompt, since persist_session: false, so the original task was lost, not resumed).
Notes
- This may be specific to sessions started via the trigger's
runaction / initialeventsarray vs. a user-typed message — since manual typing into the same stalled session did unstick it (but into a fresh context). - Have not yet been able to confirm whether the actual cron-scheduled fire (as opposed to manual "run now") hits the same code path / same bug.
- Session IDs from reproduction, if useful for backend log lookup:
cse_01VyVvsjANKwnoMZXhghfJP3,cse_013JhabXiBYSzz6N3Vmg5wRa,cse_01AVpE1TDevU1B68SNn7m9i4(full-config runs),cse_01Bfe91zhfhUXWoicVE89xoN(minimal diagnostic run).
What Should Happen?
Expected behavior
The session should reach init: model=... cwd=... and begin processing the initial prompt shortly after "Claude Code process started," as it does when a user manually types a message into the same stalled session (observed: typing "continue" into a stalled session did successfully reach init — but as a brand-new session with no memory of the original prompt, since persist_session: false, so the original task was lost, not resumed).
Error Messages/Logs
This may be specific to sessions started via the trigger's `run` action / initial `events` array vs. a user-typed message — since manual typing into the same stalled session did unstick it (but into a fresh context).
- Have not yet been able to confirm whether the actual cron-scheduled fire (as opposed to manual "run now") hits the same code path / same bug.
- Session IDs from reproduction, if useful for backend log lookup: `cse_01VyVvsjANKwnoMZXhghfJP3`, `cse_013JhabXiBYSzz6N3Vmg5wRa`, `cse_01AVpE1TDevU1B68SNn7m9i4` (full-config runs), `cse_01Bfe91zhfhUXWoicVE89xoN` (minimal diagnostic run).
Steps to Reproduce
- Create a routine with
job_config.ccrpointing at the Default environment, aclaude-sonnet-5session, and oneuser-role event as the initial prompt. (Reproduced both with 4 MCP connectors attached — Gmail, Slack, Google Calendar, Notion — and with zero connectors attached.) - Call
RemoteTrigger action: "run"on the trigger. - Poll
RemoteTrigger action: "get_run_log"on the returnedsession_id.
Claude Model
Sonnet (default)
Is this a regression?
No, this never worked
Last Working Version
_No response_
Claude Code Version
2.1.241
Platform
Anthropic API
Operating System
macOS
Terminal/Shell
PowerShell
Additional Information
_No response_