Skip to content

[Bug]: Control UI /new creates empty session with no hook firing — session-memory broken, custom hooks broken, /new feels completely broken #77562

@php737

Description

@php737

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

  1. Enable the bundled session-memory hook (openclaw hooks enable session-memory)
  2. Have a conversation in the Control UI webchat
  3. Type /new in the chat input
  4. Check <workspace>/memory/ — no new memory file is created
  5. Check gateway logs — no hooks/session-memory log entries after the /new
  6. For comparison: type /reset in a session — memory file IS created, hooks fire correctly

Expected behavior

Typing /new in the Control UI should:

  1. Fire command:new internal hooks (and before_reset plugin hooks) against the previous session before switching to the new one
  2. Write the previous session's transcript to a memory file via the bundled session-memory hook
  3. Create a new empty session and switch to it
  4. Feel like starting a fresh conversation

Actual behavior

Control UI /new calls sessions.create via WebSocket, which:

  • Creates a fresh session entry but does not fire any hooks
  • The new session appears but nothing else happens
  • No memory file is written for the previous session
  • No custom hooks fire
  • No before_reset or session_end plugin hooks fire
  • User sees an empty session but the old session's context is silently discarded

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;

The old path went through sendChatMessageNow → Gateway command dispatch → command:new hooks. The new path bypasses hooks entirely and goes straight to sessions.create.

Impact and severity

  • Severity: High — Users rely on /new to start fresh conversations. When hooks don't fire:
    • Session memory is lost (previous context never saved)
    • Custom automation hooks don't run
    • The command feels "broken" — user types /new and nothing visibly happens beyond an empty session appearing
  • This is a silent data loss bug — the old session's transcript is discarded without any warning

OpenClaw version

2026.5.2 (and later)

Operating system

Linux

Install method

nonessential

Model

nonessential

Provider / routing chain

nonessential

Config file / key location

No response

Logs, screenshots, and evidence

From gateway logs — hooks/session-memory entries are missing after /new:

// After /reset — hooks fire ✅
[hooks] fired command:reset → session-memory
[session-memory] wrote memory/2026-05-05.md

// After /new — hooks fire ✅ (before regression)
[hooks] fired command:new → session-memory
[session-memory] wrote memory/2026-05-05.md

// After /new — no hooks ❌ (current behavior)
[session-memory] <completely absent>

Additional information

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