Issue Draft for openclaw/openclaw
Title
[Bug]: Control UI typed /new no longer fires command:new hooks after 37aebf6 — session-memory and custom hooks broken
Labels
bug, regression
Body
Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
After v2026.5.2, typing /new in the Control UI (webchat) no longer fires command:new internal hooks because commit 37aebf612b rerouted it from sendChatMessageNow(host, "/new") (which went through Gateway command dispatch → hooks) to host.onSlashAction("new-session") → createSessionAndRefresh() → sessions.create (which fires zero hooks).
This breaks:
- The bundled
session-memory hook — no memory file is written on /new
- Any custom managed/workspace hooks listening on
command:new
- The
before_reset plugin hook chain
This is the Control UI equivalent of #49918 (TUI /new hooks regression). The TUI bug was introduced in v2026.3.7 by a different commit; this one was introduced in v2026.5.2 by 37aebf612b which fixed #69599.
Steps to reproduce
- Enable the bundled
session-memory hook (openclaw hooks enable session-memory)
- Have a conversation in the Control UI webchat
- Type
/new in the chat input
- Check
<workspace>/memory/ — no new memory file is created
- Check gateway logs — no
hooks/session-memory log entries after the /new
- For comparison: type
/reset in a session — memory file IS created, hooks fire correctly
Expected behavior
Typing /new in the Control UI should fire command:new internal hooks (and before_reset plugin hooks) against the previous session before switching to the new one, consistent with documented behavior and the bundled hook contract.
From the hooks documentation:
| command:new | /new command issued |
From the bundled hooks table:
| session-memory | command:new, command:reset | Saves session context to <workspace>/memory/ |
Actual behavior
Control UI /new calls sessions.create via WebSocket, which creates a fresh session entry but does not:
- Fire the
command:new internal hook event
- Fire the
before_reset plugin hook
- Fire the
session_end plugin hook for the previous session
- Trigger the bundled
session-memory hook
The old session's transcript is never captured to memory.
Root cause
Commit 37aebf612b ("fix(control-ui): create sessions for typed /new", fixing #69599) changed the /new dispatch in ui/src/ui/app-chat.ts:
Before:
case "new":
await sendChatMessageNow(host, "/new", { refreshSessions: true, ... });
return;
After:
case "new":
if (!host.onSlashAction) {
host.lastError = "New Chat is unavailable.";
return;
}
await host.onSlashAction("new-session");
return;
onSlashAction("new-session") → createChatSessionInternal() → createSessionAndRefresh() → sessions.create WebSocket RPC, which has no hook emission.
Meanwhile /reset was intentionally preserved on the old path: sendChatMessageNow(host, "/reset") → Gateway command dispatch → hooks fire.
Suggested fix direction
Similar to the approach in PR #49945 (TUI fix): when the Control UI creates a new session with a parentSessionKey, emit before_reset/session_end/command:new hooks against the parent session before completing the create. This preserves the fresh-session UX from #69599 while restoring the hook contract.
Alternatively, sessions.create could accept an optional flag to emit lifecycle hooks against the parent session when one is provided.
OpenClaw version
2026.5.2
Operating system
Ubuntu 24.04 LTS (Linux 6.17.0)
Install method
npm link (local fork), but the regression is in upstream ui/src/ui/app-chat.ts
Provider / routing chain
webchat / Control UI
Logs, screenshots, and evidence
Gateway logs around /new (17:20:39 EDT) show sessions.create with no hook activity:
May 03 17:20:39 node[1321657]: [ws] ⇄ res ✓ sessions.create 93ms
No hooks/session-memory log entries appear. Compare with /reset which produces:
[hooks/session-memory] Hook triggered for reset/new command
[hooks/session-memory] Session content loaded
[hooks/session-memory] Memory file written successfully
Confirmed: only one memory file exists for today (from an earlier /reset), none from the /new at 17:20.
Impact and severity
Affected: All Control UI/webchat users relying on session-memory or any command:new hooks.
Severity: Medium-High — the bundled session-memory hook shipped by OpenClaw itself is silently broken for the most common webchat session-start flow.
Workaround: Use /reset instead of /new. Both produce a fresh session; /reset resets in-place while /new creates a separate session entry. /reset correctly fires all hooks.
Additional information
Related issues:
Issue Draft for openclaw/openclaw
Title
[Bug]: Control UI typed
/newno longer firescommand:newhooks after 37aebf6 — session-memory and custom hooks brokenLabels
bug, regression
Body
Bug type
Regression (worked before, now fails)
Beta release blocker
No
Summary
After v2026.5.2, typing
/newin the Control UI (webchat) no longer firescommand:newinternal hooks because commit37aebf612brerouted it fromsendChatMessageNow(host, "/new")(which went through Gateway command dispatch → hooks) tohost.onSlashAction("new-session")→createSessionAndRefresh()→sessions.create(which fires zero hooks).This breaks:
session-memoryhook — no memory file is written on/newcommand:newbefore_resetplugin hook chainThis is the Control UI equivalent of #49918 (TUI
/newhooks regression). The TUI bug was introduced in v2026.3.7 by a different commit; this one was introduced in v2026.5.2 by37aebf612bwhich fixed #69599.Steps to reproduce
session-memoryhook (openclaw hooks enable session-memory)/newin the chat input<workspace>/memory/— no new memory file is createdhooks/session-memorylog entries after the/new/resetin a session — memory file IS created, hooks fire correctlyExpected behavior
Typing
/newin the Control UI should firecommand:newinternal hooks (andbefore_resetplugin hooks) against the previous session before switching to the new one, consistent with documented behavior and the bundled hook contract.From the hooks documentation:
From the bundled hooks table:
Actual behavior
Control UI
/newcallssessions.createvia WebSocket, which creates a fresh session entry but does not:command:newinternal hook eventbefore_resetplugin hooksession_endplugin hook for the previous sessionsession-memoryhookThe old session's transcript is never captured to memory.
Root cause
Commit
37aebf612b("fix(control-ui): create sessions for typed /new", fixing #69599) changed the/newdispatch inui/src/ui/app-chat.ts:Before:
After:
onSlashAction("new-session")→createChatSessionInternal()→createSessionAndRefresh()→sessions.createWebSocket RPC, which has no hook emission.Meanwhile
/resetwas intentionally preserved on the old path:sendChatMessageNow(host, "/reset")→ Gateway command dispatch → hooks fire.Suggested fix direction
Similar to the approach in PR #49945 (TUI fix): when the Control UI creates a new session with a
parentSessionKey, emitbefore_reset/session_end/command:newhooks against the parent session before completing the create. This preserves the fresh-session UX from #69599 while restoring the hook contract.Alternatively,
sessions.createcould accept an optional flag to emit lifecycle hooks against the parent session when one is provided.OpenClaw version
2026.5.2
Operating system
Ubuntu 24.04 LTS (Linux 6.17.0)
Install method
npm link (local fork), but the regression is in upstream
ui/src/ui/app-chat.tsProvider / routing chain
webchat / Control UI
Logs, screenshots, and evidence
Gateway logs around
/new(17:20:39 EDT) showsessions.createwith no hook activity:No
hooks/session-memorylog entries appear. Compare with/resetwhich produces:Confirmed: only one memory file exists for today (from an earlier
/reset), none from the/newat 17:20.Impact and severity
Affected: All Control UI/webchat users relying on
session-memoryor anycommand:newhooks.Severity: Medium-High — the bundled
session-memoryhook shipped by OpenClaw itself is silently broken for the most common webchat session-start flow.Workaround: Use
/resetinstead of/new. Both produce a fresh session;/resetresets in-place while/newcreates a separate session entry./resetcorrectly fires all hooks.Additional information
Related issues:
/new(open, PR TUI: restore hook-visible /new resets #49945 pending)37aebf612bwas fixing (closed)/newvs/resetbehavior concerns