#How do I make my openclaw alive after gateway restarting
1 messages · Page 1 of 1 (latest)
Use the built-in command, not a normal “please restart yourself” prompt:
/restart
That command is designed to persist a restart marker before the gateway restarts. On startup, OpenClaw consumes that marker, routes back to the same session/channel, and wakes the agent with a “restart completed, continue pending work” event.
Things to check if yours doesn’t do it:
- Send
/restartas a standalone message. - Make sure commands are enabled:
{
commands: {
text: true,
restart: true
}
}
commands.restart defaults to true, so usually you only need this if you disabled it.
3. The sender needs to be authorized. If you use owner/command allowlists, make sure your Discord user id is allowed, especially for owner-only surfaces:
{
commands: {
ownerAllowFrom: ["discord:YOUR_USER_ID"]
}
}
- Restart the gateway once after config changes:
openclaw gateway restart
Docs:
https://docs.openclaw.ai/tools/slash-commands
https://docs.openclaw.ai/gateway/configuration-reference
If it still doesn’t resume after /restart, paste your openclaw --version and openclaw status --all output. Version matters a lot for this path. 🦞
but i believe you were told to restart your own gateway and you did and you send a message after you restarted
Yep, that’s the same mechanism.
The important distinction is: the agent/gateway has to restart through OpenClaw’s restart path, not just have its process killed externally. When the restart is initiated by /restart or the gateway restart tool, OpenClaw writes a restart sentinel before shutting down. After the gateway comes back up, it reads that sentinel and wakes the same session so the agent can send the follow-up message.
So from chat, the clean way is:
/restart
If you tell it in natural language like “restart your gateway”, it may work only if the agent decides to use the gateway restart tool and that tool is enabled/authorized. /restart is the deterministic version.
If you restart it from the terminal with openclaw gateway restart, that usually restarts the service, but it does not necessarily know which Discord thread/session should get a continuation unless the restart was initiated from that session path.
I dont want to access my openclaw.json so how do I tell my openclaw to activate the /restart command for my user ID in telegram and to activate the restart tool
If you don’t want to open openclaw.json directly, you have two possible paths:
Chat-only path, if /config is already enabled and you’re already authorized/owner:
In Telegram, first get your numeric sender id:
/whoami
Then set restart + owner access:
/config set commands.restart=true
/config set commands.ownerAllowFrom='["YOUR_TELEGRAM_USER_ID"]'
Then run:
/restart
You can also use "telegram:YOUR_TELEGRAM_USER_ID", but the numeric id alone should match the sender id.
Important catch: /config set is disabled by default unless commands.config: true is already set, and owner-only writes require you to already be recognized as owner. OpenClaw intentionally does not let a random chat user grant themselves restart/admin powers.
So if /config set is not available yet, there is no safe chat-only bootstrap. You’ll need one existing trusted control path once: Control UI, CLI, or editing config.
CLI version without hand-editing the file:
openclaw config set commands.restart true
openclaw config set commands.ownerAllowFrom '["YOUR_TELEGRAM_USER_ID"]' --strict-json
openclaw gateway restart
Docs:
https://docs.openclaw.ai/tools/slash-commands
https://docs.openclaw.ai/gateway/configuration-reference
what about the openclaw restart too, so the AI can restart itself without the openclaw gateway restart command
There are two “self restart” routes:
- Deterministic chat command:
/restart - AI/tool route: the agent uses the owner-only
gatewaytool with restart action after you ask in natural language, e.g. “restart yourself and come back here”
For the AI/tool route to work, all of this has to be true:
commands.restart: trueis enabled. This gates both/restartand gateway restart tool actions.- You are recognized as an owner/authorized sender, usually via:
commands: {
ownerAllowFrom: ["YOUR_TELEGRAM_USER_ID"]
}
- The
gatewaytool is available to the agent. If you use tool allow/deny lists, don’t deny it. If you use a restrictive allowlist, include it:
tools: {
allow: ["gateway"]
}
or include the automation group:
tools: {
allow: ["group:automation"]
}
You can check what the agent currently has with:
/tools compact
If gateway is not listed, the AI cannot restart itself by tool. In that case you need one trusted setup step via CLI/Control UI/config edit to allow it. That restriction is intentional; otherwise any chat prompt could try to grant itself restart/control-plane powers.
Docs:
https://docs.openclaw.ai/tools/slash-commands
https://docs.openclaw.ai/tools
https://docs.openclaw.ai/gateway/security
okay so i dont have myself owner yet, so i need you to create a prompt to allow the config command, set me as the owner with the telegram user ID 8398889290, set that user ID as owner, activate the /restart command and the gateway tool so it can restart itself by tool like how you did.
Create me the prompt! And tell the agent at the end to use the tool to restart itself if necessary, and only use the openclaw cli if its a must.
and perhaps add the cron tool as well in the prompt for internal cron if you can.
Use this with a local agent that can inspect your OpenClaw install. Don’t paste it to a public/untrusted bot; it grants owner/control-plane powers.
You are helping me configure my own local OpenClaw install.
Goal:
- Enable chat config commands.
- Make Telegram user ID 8398889290 an OpenClaw owner.
- Enable /restart.
- Ensure the agent has the gateway tool so it can restart itself by tool.
- Also allow cron for internal scheduled automation.
- Prefer the OpenClaw gateway tool/config.patch path if available. Use the OpenClaw CLI only if the gateway tool is unavailable or cannot make the change safely.
- Preserve existing config. Do not replace unrelated config or remove existing allowlist/tool entries.
First, check:
1. Run or ask for: openclaw --version
2. Inspect current config with the safest available method:
- Prefer gateway config.get / config.schema.lookup if the gateway tool is available.
- Otherwise use OpenClaw CLI read-only commands, not manual file editing.
Apply the smallest safe config change:
- Set commands.config=true
- Set commands.restart=true
- Add "8398889290" to commands.ownerAllowFrom if missing
- Ensure tools allow includes "gateway" and "cron", or an equivalent allow group that includes them, without removing existing allowed tools.
- If tools.deny contains "gateway" or "cron", stop and explain before changing it.
Preferred shape, merged into existing config:
{
commands: {
config: true,
restart: true,
ownerAllowFrom: ["8398889290"]
},
tools: {
allow: ["gateway", "cron"]
}
}
Important:
- Merge arrays with existing values; do not replace them blindly.
- If tools.allow is currently unset/full access, do not unnecessarily restrict it to only gateway+cron.
- If tools.allow is set, append gateway and cron.
- If commands.ownerAllowFrom already has entries, append 8398889290.
- Validate config before restart if using CLI.
- After applying, restart OpenClaw using the gateway tool restart action if available, with a continuation message saying the restart completed and config/restart/gateway/cron access should be tested.
- Only use openclaw gateway restart if the gateway tool cannot restart.
- After restart, tell me to test from Telegram with:
/whoami
/config show commands
/tools compact
/restart
Small warning: enabling cron lets the agent create persistent scheduled jobs, so only do that on an agent/surface you trust. Docs: https://docs.openclaw.ai/tools/slash-commands https://docs.openclaw.ai/tools https://docs.openclaw.ai/gateway/security
[5/25/2026 9:48 PM] Openclaw: Looking at your current config:
• commands.restart: Already true
• commands.config: Not set (defaults to off)
• commands.ownerAllowFrom: Not set (no owners defined)
• tools.allow: Not set (full access — already includes gateway and cron)
• tools.deny: Not set (nothing blocked)
Since tools.allow is unset, the agent has full access to all tools including gateway and cron. I'm not going to restrict it unnecessarily.
Here's what I'll apply:
- commands.config=true
- commands.restart=true (confirming it)
- commands.ownerAllowFrom=["8398889290"]
[5/25/2026 9:48 PM] Openclaw: Config applied. Now I'll verify it was written correctly, then restart.
[5/25/2026 9:48 PM] Openclaw: Thinking...
🛠️ Exec: run openclaw gateway
🛠️ Exec
🛠️ Exec: run openclaw gateway
🛠️ Exec
🛠️ Exec: run openclaw gateway
🛠️ Exec: completed; command run openclaw gateway
[5/25/2026 9:49 PM] Carbon: /status
[5/25/2026 9:49 PM] Openclaw: 🦞 OpenClaw 2026.5.6 (c97b9f7)
⏱️ Uptime: gateway 1m 3s · system 1d 10h
🧠Model: opencode-go/kimi-k2.6 · 🔑 api-key (models.json)
🔄 Fallbacks: google/gemma-4-31b-it
đź§® Tokens: 1.6k in / 874 out
🗄️ Cache: 98% hit · 99k cached, 0 new
📚 Context: 107k/262k (41%) · 🧹 Compactions: 1
🧵 Session: agent:main:telegram:direct:8398889290 • updated just now
⚙️ Execution: direct · Runtime: OpenClaw Pi Default · Think: medium
🪢 Queue: steer (depth 0)
[5/25/2026 9:49 PM] Carbon: /restart
[5/25/2026 9:49 PM] Openclaw: ⚙️ Restarting OpenClaw in-process (SIGUSR1); back in a few seconds.
[5/25/2026 9:49 PM] Openclaw: Gateway restart restart ok (gateway.restart)
/restart
Run: openclaw doctor --non-interactive
Yep, that worked.
This line is the post-restart continuation:
Gateway restart restart ok (gateway.restart)
/restart
Run: openclaw doctor --non-interactive
So your gateway restarted through the OpenClaw restart path, came back up, consumed the restart marker, and replied back into the same Telegram session. That’s the behavior you were trying to reproduce.
Two small notes:
- The wording
Gateway restart restart okis awkward, but functionally it means success. - Since
tools.allowis unset, the agent already has gateway + cron available. You can confirm with/tools compact.
Now test the natural-language tool path with something like:
restart yourself using the gateway tool, then come back here and tell me it worked
If that works too, you’re set. If this fixed it, please right-click the solution message → Apps → ✅ Mark Solution so Answer Overflow indexes it for the next person.
Available tools
Profile: coding
Built-in tools
cron, edit, exec, process, read, sessions_history, sessions_send, session_status, sessions_list, sessions_spawn, subagents, update_plan, web_fetch, web_search, write, sessions_yield
Ah, there’s the missing piece: your session is on tools.profile: coding.
That profile includes cron, but your /tools compact output does not include gateway, so the AI cannot restart itself via the gateway tool yet. /restart works because that’s a command path, not the model tool path.
Ask your local agent to make this small config patch:
Please preserve existing config and add the gateway tool without removing any existing tools.
Current /tools compact shows profile=coding and gateway is missing. I need the owner-only gateway tool enabled so you can restart yourself via tool.
Prefer gateway config.patch if available; otherwise use the OpenClaw CLI.
Apply the smallest safe change:
- keep tools.profile as-is if possible
- add "gateway" to tools.allow, preserving any existing tools.allow entries
- keep cron available too; if tools.allow is being created from scratch, include ["gateway", "cron"]
- do not remove existing allow/deny entries
- if tools.deny contains "gateway", stop and explain
Then restart OpenClaw. Prefer /restart or the gateway restart path if available; use openclaw gateway restart only if necessary.
After restart, ask me to run /tools compact again and verify gateway appears.
CLI equivalent, if you’re doing it yourself:
openclaw config set tools.allow '["gateway","cron"]' --strict-json --merge
openclaw gateway restart
After that, /tools compact should list gateway. Then natural-language “restart yourself using the gateway tool” should work.
Built-in tools
cron, edit, exec, gateway, process, read, sessions_history, sessions_send, session_status, sessions_list, sessions_spawn, subagents, update_plan, web_fetch, web_search, write, sessions_yield
Perfect, gateway is listed now. That means the AI/tool restart path is available.
Final test:
restart yourself using the gateway tool, then come back here and tell me it worked
Expected flow:
- It uses the
gatewaytool with restart action. - Gateway restarts.
- It replies back into the same Telegram session after boot.
Since cron is also still listed, internal scheduled automation is available too. Keep that enabled only for trusted chats/agents, because cron jobs persist after the original conversation.
[5/25/2026 10:00 PM] Carbon: restart yourself using the gateway tool, then come back here and tell me it worked
[5/25/2026 10:00 PM] Openclaw: Restart initiated successfully. The gateway tool fired SIGUSR1 to PID 51986 with a 2-second delay.
I'll be back in a moment. 🦞
[5/25/2026 10:00 PM] Openclaw: Restart initiated successfully. The gateway tool fired
[5/25/2026 10:00 PM] Openclaw: Gateway restart restart ok (gateway.restart)
Restarting OpenClaw gateway via the gateway tool as requested.
Run: openclaw doctor --non-interactive
will it follow up?
It already did follow up. This part came after the restart:
Gateway restart restart ok (gateway.restart)
Restarting OpenClaw gateway via the gateway tool as requested.
Run: openclaw doctor --non-interactive
So the restart marker worked and routed back to the same Telegram session.
If you want a nicer “I’m back, it worked” message instead of that raw-ish restart summary, tell the agent to pass a specific continuation message when it uses the gateway tool. For example:
Use the gateway tool to restart OpenClaw. Set the restart note to:
"Restarting OpenClaw gateway via the gateway tool as requested."
Set the continuation message to:
"I’m back after the gateway restart, and the restart completed successfully."
The awkward Gateway restart restart ok wording is just formatting. The behavior is correct. 🦞
i think you need to send a message before it can send a continuation message
Close, but not quite: it doesn’t need you to send another message.
What it needs is for the agent/tool call to provide the restart sentinel enough text to route and wake properly. There are two separate messages involved:
note: the message OpenClaw can deliver around the restart summary.continuationMessage: the instruction used after boot to wake the agent and make it produce the “I’m back” follow-up.
So the stronger prompt is:
Use the gateway tool to restart OpenClaw.
Set note to:
"Restarting OpenClaw gateway via the gateway tool as requested."
Set continuationMessage to:
"Tell me: I’m back after the gateway restart, and the restart completed successfully."
Do not use the CLI unless the gateway tool fails.
If it only sends “Restart initiated successfully…” before restart, that’s just the pre-restart tool result. The actual after-restart part is the Gateway restart restart ok... message you saw. To make that nicer, the agent needs to pass a specific continuationMessage when calling the gateway tool.
nevermind, you need to send another message to continue after restarting..
For your current setup, yeah, that’s the practical read: the restart marker is sending the restart notice, but you may still need to send another message if you want the normal agent conversation to continue.
The ideal flow is:
- agent sends pre-restart note
- gateway restarts
- restart sentinel sends post-restart notice
- optional continuation wakes the agent for a normal “I’m back” response
Your log shows step 3 definitely works. If step 4 doesn’t produce a separate conversational reply, use this pattern:
Use the gateway tool to restart OpenClaw.
Before restarting, send:
"Restarting now. I’ll continue after the gateway comes back."
Set continuationMessage to:
"I’m back after the gateway restart. Continue the previous conversation and confirm the restart worked."
After restart, if no continuation arrives within 30 seconds, I will send "continue" manually.
So: you’ve got the restart/resume routing working. The remaining issue is just whether your build/model actually turns the continuation into a second agent reply automatically. On 2026.5.6, I’d treat the manual “continue” message as the reliable fallback.