Skip to content

boot-md reads BOOT.md/state on gateway startup but does not deliver outbound Telegram message #50721

@jarvispelabot

Description

@jarvispelabot

Summary

boot-md runs on gateway startup and successfully reads BOOT.md plus the persisted restart state, but it does not deliver the expected outbound message after restart.

Based on the docs, this should work:

  • docs/automation/hooks.md says boot-md sends requested outbound messages via the message tool.
  • docs/reference/templates/BOOT.md says startup tasks that send a message should use the message tool and then reply NO_REPLY.

In practice, the startup run reads the state correctly, but no Telegram message is delivered.

Environment

  • OpenClaw version: current installed build on 2026-03-20 UTC
  • Channel: Telegram DM
  • Agent model: openai-codex/gpt-5.4
  • Hook: bundled boot-md
  • Internal hooks: enabled

Expected behavior

After a gateway restart:

  1. boot-md runs.
  2. BOOT.md reads persisted state (for example runtime/restart-state.json).
  3. If the state indicates a post-restart notification is needed, the startup run sends the outbound message to the same Telegram DM.
  4. Then it clears the restart-state file.

Actual behavior

  • boot-md does run.
  • BOOT.md does read the persisted state.
  • The state file is then cleared back to idle.
  • But no outbound Telegram message reaches the chat.

So the startup logic executes, but delivery does not happen.

Reproduction

1) Enable bundled boot-md

Internal hooks are enabled and boot-md is enabled.

2) Use a BOOT.md like this

# BOOT.md

Objetivo: manejar solo reanudaciones explícitas después de un reinicio del gateway.

1. Leer `runtime/restart-state.json`.
2. Si `status` es `idle`, responder `NO_REPLY`.
3. Si `status` es `pending_resume`:
   - leer el contenido completo
   - no continuar automáticamente
   - si la tarea ya terminó, mandar un mensaje breve avisando que terminó
   - si no terminó, mandar un mensaje breve preguntando si querés que continúe
4. Después de mandar el mensaje, limpiar `runtime/restart-state.json` a `idle`.

3) Write restart state before restarting the gateway

Example persisted state:

{
  "status": "pending_resume",
  "task": "Prueba de continuidad tras reinicio del gateway",
  "reason": "Validar que BOOT.md envíe un mensaje automático después del reinicio",
  "progress": [
    "Se implementó BOOT.md para leer runtime/restart-state.json al iniciar"
  ],
  "nextStep": "Enviar mensaje post-restart",
  "postRestartState": "done",
  "askToContinue": false,
  "chatTarget": "telegram:8509262173",
  "createdAt": "2026-03-20T00:33:20Z",
  "updatedAt": "2026-03-20T00:33:20Z"
}

4) Restart the gateway

openclaw gateway restart

Evidence observed

From the startup run transcript, boot-md clearly injects this prompt:

If BOOT.md asks you to send a message, use the message tool (action=send with channel + target).

The boot run then reads the restart-state JSON successfully.

However, no Telegram message is delivered, and the state file is written back to:

{
  "status": "idle"
}

Additional notes

  • We also attempted to work around this by storing a session key and steering delivery that way, but the bundled boot prompt appears hardwired to the message tool path.
  • So this may be either:
    • a boot-md/runtime limitation not documented,
    • or a bug/regression in startup-time message delivery.

Relevant docs/code references

  • docs/automation/hooks.md
  • docs/reference/templates/BOOT.md
  • dist/bundled/boot-md/handler.js
  • CHANGELOG.md entry mentioning boot-md startup-hook regression coverage and per-agent session-key resolution

Question

Is post-restart outbound delivery from bundled boot-md to an existing Telegram DM supposed to work today?

If yes, this looks like a bug/regression.
If not, the docs for boot-md probably need to clarify that startup runs cannot reliably deliver outbound messages to chats/channels in this context.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions