openclaw - ✅(Solved) Fix [Bug]: Discord session.resetTriggers matches !new, but sessionId does not rotate, context keeps accumulating [1 pull requests, 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#55474Fetched 2026-04-08 01:39:10
View on GitHub
Comments
0
Participants
1
Timeline
5
Reactions
0
Participants
Timeline (top)
labeled ×2referenced ×2cross-referenced ×1

Slash commands on Discord don't work. I can't restart a session.

On Discord, I configured non-slash reset triggers so I could start a fresh session without relying on native slash commands.

Config includes:

session: { resetTriggers: ["/new", "/reset", "!new", "!reset"] }

However, when I send !new in my Discord channel, OpenClaw does not start a fresh session id. Instead, it treats !new like a normal user turn and continues appending to the existing session history.

Root Cause

Slash commands on Discord don't work. I can't restart a session.

On Discord, I configured non-slash reset triggers so I could start a fresh session without relying on native slash commands.

Config includes:

session: { resetTriggers: ["/new", "/reset", "!new", "!reset"] }

However, when I send !new in my Discord channel, OpenClaw does not start a fresh session id. Instead, it treats !new like a normal user turn and continues appending to the existing session history.

PR fix notes

PR #56362: fix(discord): ensure resetTriggers rotate sessionId and clear history

Description (problem / solution / changelog)

Summary

On Discord, custom resetTriggers like !new and !reset are matched by the trigger system, but the session doesn't actually reset — history continues accumulating.

Root Cause

Two issues:

  1. get-reply.ts: After a reset trigger fires, the code tried to match /^\/(new|reset)/ against the command body. Custom triggers like !new don't match this regex, so emitResetCommandHooks was never called — leaving internal hook listeners and ACP cleanup unnotified.

  2. session-reset-service.ts: resolveSessionFilePath was called with the old entry's sessionFile, which caused it to reuse the stale path instead of deriving a clean new one from the new sessionId.

Changes

  • get-reply.ts: Call emitResetCommandHooks for ALL matched reset triggers, not just /new and /reset. Default to action "new" for non-standard trigger formats.
  • session-reset-service.ts: Pass undefined instead of old sessionFile to resolveSessionFilePath so a fresh path is always generated.
  • Added tests for bang-prefix triggers (!new, !reset) on Discord sessions.

Files Changed

  • src/auto-reply/reply/get-reply.ts — emit hooks for all reset triggers
  • src/gateway/session-reset-service.ts — use fresh session file path
  • src/auto-reply/reply/session.test.ts — tests for bang-prefix triggers

Fixes #55474

Changed files

  • src/auto-reply/reply/get-reply.ts (modified, +9/-5)
  • src/auto-reply/reply/session.test.ts (modified, +105/-0)
  • src/gateway/session-reset-service.ts (modified, +28/-8)
RAW_BUFFERClick to expand / collapse

Bug type

Behavior bug (incorrect output/state without crash)

Beta release blocker

No

Summary

Slash commands on Discord don't work. I can't restart a session.

On Discord, I configured non-slash reset triggers so I could start a fresh session without relying on native slash commands.

Config includes:

session: { resetTriggers: ["/new", "/reset", "!new", "!reset"] }

However, when I send !new in my Discord channel, OpenClaw does not start a fresh session id. Instead, it treats !new like a normal user turn and continues appending to the existing session history.

Steps to reproduce

  1. I use /new in the discord chat to start a new session
  2. Discord replies with Done, but session does not refresh.

Expected behavior

Sending /new restarts the session.

Actual behavior

  1. I use /new in the discord chat to start a new session
  2. Discord replies with Done, but session does not refresh.

OpenClaw version

OpenClaw version: 2026.3.24

Operating system

Ubuntu 24.04

Install method

npm global

Model

claude opus 4.6

Provider / routing chain

openclaw - discord - fail

Additional provider/model setup details

No response

Logs, screenshots, and evidence

Impact and severity

No response

Additional information

No response

extent analysis

Fix Plan

To fix the issue with slash commands on Discord not restarting a session, we need to update the resetTriggers configuration to correctly handle the non-slash reset triggers.

Here are the steps:

  • Update the resetTriggers configuration to include the correct trigger for restarting a session.
  • Ensure that the resetTriggers are correctly handled in the OpenClaw code.

Example code:

// Update the resetTriggers configuration
const config = {
  session: {
    resetTriggers: ["/new", "/reset", "!new", "!reset", "new", "reset"] // include both slash and non-slash triggers
  }
};

// Handle resetTriggers in the OpenClaw code
if (config.session.resetTriggers.includes(message.content)) {
  // restart the session
  restartSession();
} else {
  // continue with the existing session
  continueSession();
}

Verification

To verify that the fix worked, send a message with the !new trigger in the Discord channel and check if a new session is started.

Extra Tips

  • Ensure that the resetTriggers configuration is correctly updated and handled in the OpenClaw code.
  • Test the fix with different triggers (e.g. /new, !new, new) to ensure that they all work as expected.

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…

FAQ

Expected behavior

Sending /new restarts the session.

Still need to ship something?

×6

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

Back to top recommendations

TRENDING