Gateway restarts kill the current agent process. If you need to restart mid-task, you must create a durable wakeup before restarting.
This skill uses cron + isolated agentTurn + explicit delivery route (not systemEvent) so it:
Send a short message in the current chat before you schedule the restart:
Keep this as its own message (don’t bundle it with other info).
Common failure mode: writing a plan but forgetting to actually schedule the cron + restart. If you don’t run Steps 3–4, the gateway won’t go down and you won’t come back.
Do not require a user 'go' message. Instead, schedule the restart to occur ~15s in the future (see Step 4) so this message has time to deliver before the gateway is killed.
Write memory/post-restart-task.md:
# Post-restart: <brief description>
- Channel: <where to reply>
- Was doing: <what was in progress>
- Next step: <what to do next on resume>
- Status: pending
From the current chat/session, capture:
sessionKey (e.g. agent:main:discord:channel: or agent:main:telegram:direct:)deliveryChannel (e.g. discord, telegram)deliveryTo:channel:user:-100…:topic:modelProvider + model for the session (e.g. openai-codex + gpt-5.2)thinkingLevel for the sessionTip: openclaw sessions --active 240 --json includes these fields.
Use the bundled script (Option B: it infers route + model from the session store):
skills/gateway-resume/scripts/schedule-resume-cron.sh \
--back-delay 75s \
--delay 90s \
--session-key "<sessionKey>"
The script will:
openclaw sessions --json to infer modelProvider/model and thinking level1) a short, personable "I’m back" message (own message)
2) a resume job that reads memory/post-restart-task.md and completes the next step
Notes:
--delay 90s (or more) so the job fires well after the gateway finishes restarting.Do not restart immediately (it can kill the process before the pre-restart message delivers). Instead schedule a restart a few seconds in the future using systemd-run:
skills/gateway-resume/scripts/delayed-gateway-restart.sh 15
This schedules a systemctl --user restart openclaw-gateway.service in a transient user unit.
The scheduled jobs should:
1) Send a short, personable "I’m back" message (by itself).
2) Then resume:
memory/post-restart-task.mdNext stepDo not include raw markers like BACK_FROM_RESTART in user-facing text.
openclaw cron listsessionKey pattern.--session-key.--active window.schedule-resume-cron.sh to use a larger --active range or no filter.systemEvent?systemEvent targets the main session, which may be a different model/provider and may fail (or respond in the wrong place). Isolated agentTurn + explicit delivery is deterministic.
共 1 个版本