cloudflare / cloudflare/moltworker

SANDBOX_SLEEP_AFTER never doesn't work. My container is still sleeping!

Open
#139 11 comments 0 reactions 0 assignees View on GitHub
Dominant language
TypeScript
Stars
10k
Forks
1.7k
PR merge metrics
No merged PRs in 30d

Description

Every night, and sometimes during the day, i will lose connection to my moltbot because the container shuts down/sleeps. Sometimes this happens mid conversation. Here is the conversation with my bot this morning diagnosing the issue. (the same convo we've had last couple days)

Me:
ok great, so, we need to debug something... last night i sent you a message on Telegram at 12:12 am, this was in the middle o9f our conversation about seting discord. Your last message before that was 12:11 am "Script works! Let me send a message there:"

You never replied to my message until this morning at 7:41 pm just now, this was AFTER i accessed the moltbot-sandbox gateway in my browser. So did you container go to sleep at 12:12 am and then not wake up until i hit the sandbox from my browser? Can you check your logs? (yesterday you set it up so that you would log container shutdowns)

BOT:
Restart log shows:
[2026-02-02 07:06:52 UTC] Container started - uptime: up 4 hours, 4 minutes
[2026-02-02 08:00:11 UTC] Container started | uptime: 17854s | location: qro02

So there were 2 restarts logged - but nothing after 08:00 UTC.

What likely happened:
After the 08:00 UTC restart, the container was running fine. We exchanged messages until ~08:12 UTC (your "Ok" message). Then... the container probably went idle and got paused by Cloudflare (not a full restart, just suspended).

When you hit /_admin/, that HTTP request woke the container back up.

The issue: Clawdbot's heartbeat crons were running internally, but if the container was suspended, the cron scheduler would also be frozen. When it woke up, everything resumed - including processing the queued "Ok" message.
The gap: ~7.5 hours of silence because the container was in a sleep state, not a crashed/restarted state.

Contributor guide

Open the contributing guide

Research direction

Start with the SANDBOX_SLEEP_AFTER setting and the sandbox gateway's /_admin/ endpoint, then compare the reported Telegram gap with the startup and container-suspension logs. No source file or test is named; done means explaining why the container sleeps despite the setting and establishing the expected sleep behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
typescript
Domain
cloud, infrastructure
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
30/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.