openclaw - 💡(How to fix) Fix Control UI restores historical routed session instead of main session after reload [1 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#61661Fetched 2026-04-08 02:56:17
View on GitHub
Comments
0
Participants
1
Timeline
0
Reactions
0
Author
Participants
RAW_BUFFERClick to expand / collapse

Hi, I'm seeing what looks like a Control UI session restore issue and wanted to ask whether this is the intended behavior.

What I observe

My current inbound context is from webchat / openclaw-control-ui, and the actual heartbeat target is still the main session.

However, after reopening or reloading the Control UI, the frontend sometimes restores a historical routed session key like:

agent:main:feishu:direct:ou_xxx...

instead of returning to the main session.

This makes it look like heartbeat or replies are crossing into a Feishu-style session, but from tracing the behavior, the backend heartbeat target still appears to be the real main session.

What I verified

  • openclaw status shows Heartbeat 30m (main)
  • gateway heartbeat logs show gateway/heartbeat with intervalMs: 1800000
  • the session store shows the real main session key is agent:main:main
  • the Feishu-style key is a separate historical session, not the actual heartbeat target

So this seems more like a Control UI restore problem than a routing problem.

Suspected cause

It seems the Control UI restores session state from local persisted settings such as openclaw.control.settings.v1 / sessionsByGateway.

If the saved sessionKey or lastActiveSessionKey is a historical routed session such as:

  • agent:*:*:direct:*
  • agent:*:*:group:*

then the UI restores that value on load.

At the same time, the mainSessionKey normalization appears to handle main / agent:main:main-style aliases, but does not reset those historical routed keys.

Question

Is this restore behavior intentional?

Should Control UI restore arbitrary historical routed sessions from local state on startup, or should it prefer the real main session unless a specific session was explicitly requested?

A minimal fix seems to be: during startup restore, if the persisted sessionKey / lastActiveSessionKey matches a routed historical session like agent:*:*:(direct|group):*, fall back to the real main session by default.

extent analysis

TL;DR

The Control UI should be modified to prefer the real main session over historical routed sessions during startup restore.

Guidance

  • Verify the openclaw.control.settings.v1 / sessionsByGateway local persisted settings to confirm the saved sessionKey or lastActiveSessionKey is causing the issue.
  • Check the mainSessionKey normalization logic to ensure it handles main / agent:main:main-style aliases correctly.
  • Consider implementing a fallback to the real main session during startup restore if the persisted sessionKey / lastActiveSessionKey matches a routed historical session.
  • Review the gateway heartbeat logs and openclaw status output to confirm the backend heartbeat target is the real main session.

Example

A potential code change could involve modifying the startup restore logic to check for historical routed sessions and fallback to the main session:

if (persistedSessionKey.match(/agent:\*:\*:(direct|group):\*/)) {
  // Fallback to the real main session
  sessionKey = 'agent:main:main';
}

Notes

This fix assumes that the real main session key is always agent:main:main. If this is not the case, additional logic may be needed to determine the correct main session key.

Recommendation

Apply a workaround by modifying the Control UI to prefer the real main session over historical routed sessions during startup restore, as this seems to be the intended behavior based on the provided information.

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 - 💡(How to fix) Fix Control UI restores historical routed session instead of main session after reload [1 participants]