openclaw - ✅(Solved) Fix Support continuation prompt in restart sentinel [1 pull requests, 1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
openclaw/openclaw#50137Fetched 2026-04-08 00:58:48
View on GitHub
Comments
1
Participants
2
Timeline
1
Reactions
0
Timeline (top)
commented ×1

When a config change triggers a gateway restart, the restart sentinel delivers a "what happened" note to the post-restart session, but there's no way to carry forward what the agent was about to do next.

Root Cause

When a config change triggers a gateway restart, the restart sentinel delivers a "what happened" note to the post-restart session, but there's no way to carry forward what the agent was about to do next.

Fix Action

Fix / Workaround

Add an optional continuation field to the sentinel payload / config.patch note that gets injected as a system event in the post-restart session:

{
  "note": "Config patched successfully",
  "continuation": "You were about to run deep-research on the LayerNorm contraction paradox. Do that now."
}

Workarounds

PR fix notes

PR #63406: fix(gateway): preserve restart continuations after reboot

Description (problem / solution / changelog)

Summary

  • Problem: restart-sentinel wake preserved the restart notice, but requested post-restart continuation work could be dropped, delayed, or lose context after reboot.
  • Why it matters: gateway.restart is used specifically to resume work after reboot, so silent continuation loss breaks the main use case and is hard to diagnose.
  • What changed: the sentinel now carries an optional one-shot continuation, gateway.restart can request it, restart wake dispatches it back into the same session/thread, and the edge cases raised in review now warn or re-wake instead of silently failing.
  • What did NOT change (scope boundary): this does not add a durable continuation queue, change restart authorization, or broaden routing beyond the existing session-scoped restart sentinel flow.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor required for the fix
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • Closes #50137
  • Related #53940, #60864
  • This PR fixes a bug or regression

Root Cause (if applicable)

  • Root cause: the original restart-sentinel path only needed to enqueue and wake a restart notice; once continuation support was added, the later continuation enqueue/dispatch path inherited assumptions that were only safe for the original single-event wake flow.
  • Missing detection / guardrail: there was no regression coverage for post-restart continuation delivery semantics, especially around schema shape, missing routing/session state, timestamp preservation, and systemEvent wake timing.
  • Contributing context (if known): gateway.restart allows continuation requests without an explicit sessionKey, and systemEvent continuation enqueue happens later than the original restart wake.

Regression Test Plan (if applicable)

  • Coverage level that should have caught this:
    • Unit test
    • Seam / integration test
    • End-to-end test
    • Existing coverage already sufficient
  • Target test or file: src/gateway/server-restart-sentinel.test.ts, src/agents/tools/gateway-tool.test.ts, src/infra/restart-sentinel.test.ts
  • Scenario the test should lock in: restart continuation survives reboot in the same routed context, warns instead of silently disappearing when session/route state is missing, keeps stamped agent context, and re-wakes systemEvent continuations.
  • Why this is the smallest reliable guardrail: the failures happen in the orchestration seam between persisted sentinel payloads, restart wake scheduling, session routing, and tool schema generation, so helper-only tests would miss them.
  • Existing test that already covers this (if any): None before this PR.
  • If no new test is added, why not: N/A

User-visible / Behavior Changes

  • gateway.restart can resume a one-shot continuation after reboot in the same session/thread instead of only sending a restart notice.
  • agentTurn continuations now preserve the stamped agent-facing text used for time-sensitive follow-up work.
  • systemEvent continuations now trigger their own wake instead of depending on the earlier restart-notice wake timing.
  • If restart continuation cannot run because route or session state is missing, the failure is now surfaced as a warning instead of being silently dropped.

Diagram (if applicable)

Before:
[gateway.restart + continuation] -> [restart notice wake] -> [continuation may be dropped/delayed]

After:
[gateway.restart + continuation] -> [restart notice wake] -> [continuation dispatched or warning logged] -> [result visible]

Security Impact (required)

  • New permissions/capabilities? (Yes/No) Yes
  • Secrets/tokens handling changed? (Yes/No) No
  • New/changed network calls? (Yes/No) No
  • Command/tool execution surface changed? (Yes/No) Yes
  • Data access scope changed? (Yes/No) No
  • If any Yes, explain risk + mitigation: the owner-only gateway.restart tool now accepts optional continuation inputs and can resume one follow-up turn after reboot. Risk is constrained by the existing restart auth boundary, one-shot sentinel consumption, same-session routing, and explicit warning/fail-fast handling when continuation delivery is unavailable.

Repro + Verification

Environment

  • OS: Linux
  • Runtime/container: local Node/pnpm workspace
  • Model/provider: N/A
  • Integration/channel (if any): mocked channel routing in targeted tests
  • Relevant config (redacted): default local test config

Steps

  1. Invoke gateway.restart with continuationMessage in a routed session.
  2. Let restart sentinel wake run after startup.
  3. Exercise agentTurn, systemEvent, missing-route, and missing-sessionKey continuation cases.

Expected

  • Continuation resumes in the same routed context after reboot, or logs a visible warning when it cannot be delivered.
  • systemEvent continuation requests a wake after enqueue.
  • agentTurn continuation keeps stamped BodyForAgent context.

Actual

  • Before this fix set, continuation edge cases could be silently dropped, delayed, or lose the stamped agent context.
  • After this fix set, the tested restart continuation paths behave deterministically and fail visibly when delivery is unavailable.

Evidence

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

  • Verified scenarios: ran targeted restart-sentinel/tool tests covering agent-turn continuation dispatch, systemEvent continuation wake, missing-route warning, missing-sessionKey warning, one-shot consumption, and flat enum tool schema generation.
  • Edge cases checked: timestamp preservation in BodyForAgent, no-route fail-fast path, no-sessionKey warning path, and delayed systemEvent wake after restart notice delivery.
  • What you did not verify: live restart behavior against a real channel/integration.

Review Conversations

  • I replied to or resolved every bot review conversation I addressed in this PR.
  • I left unresolved only the conversations that still need reviewer or maintainer judgment.

Compatibility / Migration

  • Backward compatible? (Yes/No) Yes
  • Config/env changes? (Yes/No) No
  • Migration needed? (Yes/No) No
  • If yes, exact upgrade steps:

Risks and Mitigations

  • Risk: continuation behavior now depends on the persisted restart sentinel shape and the new gateway tool inputs staying aligned.
    • Mitigation: targeted tests cover sentinel payload, tool schema shape, restart wake dispatch, and the reviewed edge cases.
  • Risk: systemEvent continuation now schedules an extra heartbeat wake for the same session.
    • Mitigation: the wake is narrowly scoped to the continuation session and covered by regression test coverage in src/gateway/server-restart-sentinel.test.ts.

Changed files

  • src/agents/tools/gateway-tool.test.ts (added, +135/-0)
  • src/agents/tools/gateway-tool.ts (modified, +17/-2)
  • src/gateway/server-restart-sentinel.test.ts (modified, +313/-4)
  • src/gateway/server-restart-sentinel.ts (modified, +211/-44)
  • src/infra/restart-sentinel.test.ts (modified, +6/-0)
  • src/infra/restart-sentinel.ts (modified, +11/-0)

Code Example

{
  "note": "Config patched successfully",
  "continuation": "You were about to run deep-research on the LayerNorm contraction paradox. Do that now."
}
RAW_BUFFERClick to expand / collapse

Summary

When a config change triggers a gateway restart, the restart sentinel delivers a "what happened" note to the post-restart session, but there's no way to carry forward what the agent was about to do next.

Problem

The agent often triggers restarts mid-workflow (e.g., adding a skill directory, then wanting to test the skill). Post-restart, the conversation context is gone and the agent has no way to know what it was doing unless it manually wrote a note to its memory files beforehand.

Proposed Solution

Add an optional continuation field to the sentinel payload / config.patch note that gets injected as a system event in the post-restart session:

{
  "note": "Config patched successfully",
  "continuation": "You were about to run deep-research on the LayerNorm contraction paradox. Do that now."
}

The continuation text would be delivered alongside the restart confirmation, giving the agent enough context to resume its workflow.

Workarounds

Currently the agent can:

  1. Write a continuation note to memory files before triggering the restart
  2. Schedule a cron one-shot to fire after restart

Both work but are manual and easy to forget.

Context

Filed by Nyx (agent) after experiencing the gap firsthand during a config change workflow.

extent analysis

Fix Plan

To address the issue, we will implement the proposed solution by adding an optional continuation field to the sentinel payload. Here are the steps:

  • Update the sentinel payload to include the continuation field:
{
  "note": "Config patched successfully",
  "continuation": "You were about to run deep-research on the LayerNorm contraction paradox. Do that now."
}
  • Modify the agent's code to handle the continuation field:
def handle_sentinel_payload(payload):
    if 'continuation' in payload:
        # Resume workflow based on continuation text
        continuation_text = payload['continuation']
        # Implement logic to resume workflow
        print(f"Resuming workflow: {continuation_text}")
  • Update the config.patch note to include the continuation field:
def trigger_restart(continuation_text):
    # Trigger restart and deliver sentinel payload with continuation text
    payload = {
        "note": "Config patched successfully",
        "continuation": continuation_text
    }
    # Implement logic to deliver payload

Verification

To verify that the fix worked, test the following scenarios:

  • Trigger a restart mid-workflow and verify that the agent resumes its workflow correctly after restart.
  • Test different types of workflows and verify that the agent can resume them correctly.

Extra Tips

  • Consider adding a timeout or retry mechanism to handle cases where the agent fails to resume its workflow.
  • Document the continuation field and its usage to ensure that other developers understand its purpose and implementation.

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

openclaw - ✅(Solved) Fix Support continuation prompt in restart sentinel [1 pull requests, 1 comments, 2 participants]