Skip to content

feat(commands): add /name to rename the current session from chat#88581

Merged
vincentkoc merged 5 commits into
openclaw:mainfrom
BSG2000:feature/chat-name-command
Jun 19, 2026
Merged

feat(commands): add /name to rename the current session from chat#88581
vincentkoc merged 5 commits into
openclaw:mainfrom
BSG2000:feature/chat-name-command

Conversation

@BSG2000

@BSG2000 BSG2000 commented May 31, 2026

Copy link
Copy Markdown
Contributor

Summary

Adds a /name <title> chat slash command so users can name or rename the current session directly from any chat channel, instead of only through the web/admin session manager. This makes it easy to keep parallel sessions thematically distinct from within the chat flow.

This is the command-side follow-up to the web in-chat rename work (#88479) and continues the chat-native session-naming feature discussed in #54397. It builds on the session manager rename shipped for #85502 (where a maintainer noted that an additional in-chat shortcut "should be a separate polish request") ├ö├ç├ this PR is that shortcut for text channels.

Behaviour

  • /name <title> sets the current session's label. It reuses the canonical parseSessionLabel validation (trim, non-empty, max 512 chars) and the same cross-store uniqueness rule enforced by the web sessions.patch path. The label then surfaces everywhere sessions.list is shown (TUI, web, CLI, MCP).
  • /name (no argument) shows the current name plus a locally derived deriveSessionTitle suggestion without mutating anything (no LLM call). Apply it with /name <suggestion>.
  • Only authorized senders can rename (rejectUnauthorizedCommand), matching /goal.

Implementation notes

  • The handler resolves the session via resolveSessionStoreEntry inside the store mutator, so a rename lands on the canonical entry even when the store still holds a legacy/case-folded key alias, and excludes those aliases from the uniqueness scan to avoid false conflicts. Failed renames (invalid/duplicate label, no active session) skip the store write.
  • It intentionally does not reuse applySessionsPatchToStore (which performs cfg-heavy model resolution); writing the label inside updateSessionStore keeps the handler cfg-independent and unit-testable.

Known limitation ├ö├ç├ session-change notification (review note)

ClawSweeper/Codex correctly flagged that, unlike the web sessions.patch RPC, this command writes the label directly and does not emit a sessions.changed event, so already-open session lists refresh on their next sessions.list reload rather than via a live push. This matches the behaviour of peer in-chat session commands such as /goal, because the command-handler pipeline (HandleCommandsParams) has no gateway broadcast context. Emitting sessions.changed from the command path requires threading a broadcast signal up to the gateway chat layer; I'll address that as a dedicated follow-up so this command PR stays small and reviewable. The behaviour is documented in docs/tools/slash-commands.md.

Testing

  • Unit tests (commands-name.test.ts): rename + persistence, no-arg suggestion (no mutation), duplicate-label rejection, unauthorized sender, disabled text commands, persisted-name re-read when params.sessionEntry is absent.
  • Local quality gates: tsgo:core, tsgo:test:src, oxlint, oxfmt, the registry tests, and the slash-commands doc test (the command is documented).
  • Branch-local command-path proof captured below; live-channel transcript remains listed under proof limitations.

Scope

Out of scope here (planned follow-ups): sessions.changed notification parity, /new --name <title>, a /sessions list command, and an optional LLM-based name suggestion.

Co-authored-by: Copilot 223556219+Copilot@users.noreply.github.com

Real behavior proof

Behavior or issue addressed: /name <title> renames the current chat session by writing the validated label to the session store, returns a non-continuing command reply, and synchronizes params.sessionEntry so downstream command handling sees the renamed session.

Real environment tested: Branch-local OpenClaw checkout on pr88581 (999a154f237025277256bf48ec1c59469ad7bab3) on Windows, using pnpm 11.2.2/tsx against OpenClaw's real session-store implementation and a temporary on-disk sessions.json store. This uses the PR command handler path directly with authorized web-chat command params; no mocks were used for the store write/read.

Exact steps or command run after this patch:

cd <local-openclaw-checkout>
npm exec --yes pnpm@11.2.2 -- exec tsx <local-proof-script>

Evidence after fix: Terminal output from the branch-local command-path proof:

OpenClaw PR #88581 /name proof
checkout: pr88581
storePath: <temp-session-store>\\sessions.json
command: /name PR 88581 real proof
reply: Session renamed to "PR 88581 real proof".
shouldContinue: false
before.label: <unset>
after.label: PR 88581 real proof
params.sessionEntry.label: PR 88581 real proof

Observed result after fix: The /name command returned a rename reply, stopped further command processing (shouldContinue: false), persisted label: "PR 88581 real proof" to the on-disk session store, and refreshed params.sessionEntry.label to the same value.

What was not tested: I did not capture an end-to-end live WhatsApp/Telegram/Discord transcript for this PR. Live sessions.changed push notification parity is intentionally left to #88690 and the remaining review thread rather than adding a divergent emitter in this PR.

Proof limitations or environment constraints: This is real branch-local terminal evidence against OpenClaw's actual session-store code path, not a live external-channel screenshot. A maintainer can add Mantis/live-channel proof if required before merge.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: M triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. labels May 31, 2026
@clawsweeper

clawsweeper Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 18, 2026, 9:59 PM ET / 01:59 UTC.

Summary
Adds a /name <title> text/native chat command that validates and persists the current session label, emits command-session metadata changes, registers and documents the command, and adds focused tests.

PR surface: Source +177, Tests +257, Docs +1. Total +435 across 5 files.

Reproducibility: not applicable. this is a feature PR rather than a bug report. Source and tests show the intended command path, while the remaining gap is current-head real behavior proof.

Review metrics: 2 noteworthy metrics.

  • Built-in command surface: 1 added. The PR exposes a new text/native /name command, which is user-facing product surface.
  • Persistent session metadata writer: 1 added. The command writes session labels directly and relies on command metadata notifications, so session-state ownership matters before merge.

Stored data model
Persistent data-model change detected: vector/embedding metadata: src/auto-reply/reply/commands-name.test.ts, vector/embedding metadata: src/auto-reply/reply/commands-name.ts. Confirm migration or upgrade compatibility proof before merge.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add current-head proof showing /name <title> persists and subscribed session lists refresh.
  • Get maintainer acceptance of /name versus the overlapping /label or displayName direction.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: Older terminal and Mantis proof exist, but they predate the current head and do not show the latest /name metadata-refresh/session-list behavior. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Mantis proof suggestion
A current-head Telegram Desktop recording would show the visible /name reply and the session-list refresh path that older proof does not cover. A maintainer can ask Mantis to capture proof by posting this exact PR comment:

@openclaw-mantis telegram desktop proof: verify /name renames the active session and subscribed session lists refresh with the new label on the current head.

Risk before merge

Maintainer options:

  1. Refresh proof and accept the command boundary (recommended)
    Before merge, capture current-head proof for /name <title> persistence and session-list refresh, then have maintainers accept the built-in command and direct label-write path.
  2. Accept maintainer validation as the proof substitute
    Maintainers with write access can explicitly treat their current-head tests/checks as enough for this external PR, while owning the missing live proof gap.
  3. Pause for naming-contract alignment
    If maintainers prefer /label, displayName, or /new <name> as the permanent command contract, pause this PR and route the work through that canonical naming decision.

Next step before merge

  • [P1] The remaining blockers are current-head real behavior proof and maintainer product/session-state acceptance, not a narrow automated code repair.

Security
Cleared: The diff does not change CI, dependencies, scripts, permissions, secrets, or supply-chain surfaces, and the new label write reuses existing validation.

Review details

Best possible solution:

Merge only after current-head proof shows /name persistence plus subscribed session-list refresh, and maintainers accept /name as the built-in command surface for this slice of session naming.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this is a feature PR rather than a bug report. Source and tests show the intended command path, while the remaining gap is current-head real behavior proof.

Is this the best way to solve the issue?

Unclear until maintainer product review: the implementation is narrow and reuses label validation plus the command-metadata seam, but it adds a built-in command and another label-write path.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 20dd2be0f25e.

Label changes

Label justifications:

  • P2: This is a normal-priority user-facing session-management feature with limited blast radius.
  • merge-risk: 🚨 session-state: The PR changes persistent session labels and command-driven session metadata refresh behavior, which can affect visible session state across clients.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: Older terminal and Mantis proof exist, but they predate the current head and do not show the latest /name metadata-refresh/session-list behavior. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • proof: 🎥 video: Contributor real behavior proof includes video or recording evidence. Older terminal and Mantis proof exist, but they predate the current head and do not show the latest /name metadata-refresh/session-list behavior.
  • mantis: telegram-visible-proof: Mantis should capture Telegram visible proof. The PR changes visible native/chat command behavior that a short Telegram Desktop recording can demonstrate.
Evidence reviewed

PR surface:

Source +177, Tests +257, Docs +1. Total +435 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 177 0 +177
Tests 1 257 0 +257
Docs 1 1 0 +1
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 435 0 +435

What I checked:

  • Repository policy read: Root AGENTS.md and docs/AGENTS.md were read fully; their proof, docs, full-surface review, and session-state merge-risk guidance apply to this PR. (AGENTS.md:1, 20dd2be0f25e)
  • Current main lacks the command: Searching current main found no built-in name command, handleNameCommand, or /name docs entry, so the PR is not obsolete on main. (src/auto-reply/commands-registry.shared.ts, 20dd2be0f25e)
  • PR handler implementation: At PR head, handleNameCommand parses /name, checks authorization, validates labels, writes via updateSessionStore, syncs params.sessionEntry, and marks command metadata changed after successful writes. (src/auto-reply/reply/commands-name.ts:60, 37a67b81f4bb)
  • PR regression coverage: The PR head test covers registration, persistence, no-arg suggestion, duplicate rejection, native-session seeding, canonical alias persistence, authorization, disabled text commands, and metadata markers. (src/auto-reply/reply/commands-name.test.ts:77, 37a67b81f4bb)
  • Current metadata seam: Current main forwards command-session metadata changes from chat.send to emitSessionsChanged, which is the seam this PR uses for subscribed session-list refresh. (src/gateway/server-methods/chat.ts:3914, 20dd2be0f25e)
  • Sibling command pattern: Current main /goal marks command session metadata after store-mutating goal actions, giving a sibling implementation pattern for this PR. (src/auto-reply/reply/commands-goal.ts:194, 20dd2be0f25e)

Likely related people:

  • vincentkoc: Introduced the command-session metadata seam and recently validated this PR branch in maintainer comments. (role: recent area contributor; confidence: high; commits: c68291980880; files: src/auto-reply/reply/command-session-metadata.ts, src/auto-reply/reply/commands-goal.ts, src/gateway/server-methods/chat.ts)
  • steipete: Merged or authored session label helper/history around the label contract this PR reuses. (role: session label/API history contributor; confidence: medium; commits: c892fd174eb1, 7d518e336e92; files: src/sessions/session-label.ts, src/gateway/sessions-patch.ts, src/gateway/server-methods/sessions.ts)
  • azade-c: Authored the original PR that exposed session labels and label lookup, which is the storage/API primitive behind this feature. (role: backend label contract contributor; confidence: medium; commits: d77dee50c94c, 7d518e336e92; files: src/gateway/server-methods/sessions.ts, src/gateway/session-utils.ts, src/agents/tools/sessions-send-tool.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. mantis: telegram-visible-proof Mantis should capture Telegram visible proof. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. labels May 31, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 10e1499272

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment thread src/auto-reply/reply/commands-name.ts Outdated
Comment thread src/auto-reply/reply/commands-name.ts Outdated
Comment thread src/auto-reply/reply/commands-name.ts
@clawsweeper clawsweeper Bot temporarily deployed to qa-live-shared May 31, 2026 10:05 Inactive
@openclaw-mantis

Copy link
Copy Markdown
Contributor

Mantis Telegram Desktop Proof

Summary: Mantis captured native Telegram Desktop before/after GIFs for the /name chat command.

Main screenshot This PR screenshot
Baseline native Telegram Desktop screenshot Candidate native Telegram Desktop screenshot
Main This PR
Baseline native Telegram Desktop proof GIF Candidate native Telegram Desktop proof GIF

Motion-trimmed clips:

Raw QA files: https://artifacts.openclaw.ai/mantis/telegram-desktop/pr-88581/run-26709617380-1/index.json

BSG2000 added a commit to BSG2000/openclaw that referenced this pull request May 31, 2026
Document that /name writes the session label directly (matching peer
chat commands like /goal), so already-open session lists pick up the new
label on their next sessions.list reload rather than via a live push.

Addresses ClawSweeper/Codex review note about session-change
notification parity on PR openclaw#88581.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels May 31, 2026
@openclaw-barnacle openclaw-barnacle Bot added triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. and removed triage: needs-real-behavior-proof Candidate: external PR needs after-fix proof from a real setup. proof: sufficient ClawSweeper judged the real behavior proof convincing. labels May 31, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label May 31, 2026
@BSG2000

BSG2000 commented May 31, 2026

Copy link
Copy Markdown
Contributor Author

The Codex P2 finding (no sessions.changed emit on metadata change) is a shared architectural limitation with the peer command /goal, not a regression introduced here. The clean fix is a cross-layer gateway change — the command reply pipeline and the gateway broadcast context don't meet at a single call site. I've split it out into a dedicated, maintainer-alignable follow-up: #88598.

This PR documents the current refresh-on-reload behavior honestly in docs/tools/slash-commands.md.

@BSG2000

BSG2000 commented Jun 1, 2026

Copy link
Copy Markdown
Contributor Author

Follow-up from reviewing #88690 / #88598: the missing live sessions.changed behavior called out here is now being implemented at the shared command-metadata seam in #88690.

That means this /name PR should not treat the reload-only behavior as final if #88690 lands first. The likely follow-up here is to rebase onto #88690 and route successful /name mutations through the same command metadata notification path so /name gets the same subscribed-client refresh semantics as /goal.

#88479 is less directly affected because it already uses the existing sessions.patch path; this PR is the one that intersects the new command-only metadata event path.

@openclaw-barnacle openclaw-barnacle Bot removed the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 3, 2026
@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jun 3, 2026
@clawsweeper clawsweeper Bot added status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. and removed status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 19, 2026
vincentkoc pushed a commit to BSG2000/openclaw that referenced this pull request Jun 19, 2026
Address Codex review on PR openclaw#88581:
- Fall back to the in-memory params.sessionEntry when the store has no row
  yet, so a brand-new native slash session can be named from its first
  /name command instead of failing with 'no active session to name'.
- Persist the rename through resolved.normalizedKey and drop legacy/
  case-folded alias keys (mirroring persistResolvedSessionEntry) so the
  canonical entry is updated and sessions.list stops surfacing the stale
  alias row.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vincentkoc vincentkoc force-pushed the feature/chat-name-command branch from 09f23a8 to d94210b Compare June 19, 2026 01:39
@openclaw-barnacle openclaw-barnacle Bot added the docs Improvements or additions to documentation label Jun 19, 2026
BSG2000 and others added 5 commits June 19, 2026 01:47
Adds a `/name <title>` slash command so users can name or rename the
current session directly from any chat channel, instead of only through
the web/admin session manager. This keeps parallel sessions easy to tell
apart from within the chat flow.

Behaviour:
- `/name <title>` sets the session label, reusing the canonical
  `parseSessionLabel` validation (trim, non-empty, max 512 chars) and the
  same cross-store uniqueness rule enforced by the web `sessions.patch`
  path, so chat naming behaves identically to the session manager.
- `/name` with no argument shows the current name plus a locally derived
  `deriveSessionTitle` suggestion without mutating anything (no LLM).
- Only authorized senders can rename (rejectUnauthorizedCommand), matching
  /goal. The label surfaces everywhere sessions.list is shown (TUI, web,
  CLI, MCP).

The handler resolves the session via resolveSessionStoreEntry so renames
land on the canonical entry even when the store still holds a legacy or
case-folded key alias, and excludes those aliases from the uniqueness scan
to avoid false conflicts. Failed renames skip the store write.

Registers the command in commands-registry.shared.ts and the handler in
loadCommandHandlers, documents it in docs/tools/slash-commands.md, and adds
unit tests covering rename, no-arg suggestion, duplicate-label rejection,
unauthorized senders, disabled text commands, and persisted-name re-read.

Part of the chat-native session naming feature (follows the web in-chat
rename PR). Relates to openclaw#85502 and openclaw#54397.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Address Codex review on PR openclaw#88581:
- Fall back to the in-memory params.sessionEntry when the store has no row
  yet, so a brand-new native slash session can be named from its first
  /name command instead of failing with 'no active session to name'.
- Persist the rename through resolved.normalizedKey and drop legacy/
  case-folded alias keys (mirroring persistResolvedSessionEntry) so the
  canonical entry is updated and sessions.list stops surfacing the stale
  alias row.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Route successful /name renames through the shared command session metadata seam so subscribed session lists receive sessions.changed like /goal.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@vincentkoc

Copy link
Copy Markdown
Member

Clownfish 🐠 reef update

Thanks for the work on this. Clownfish could write to this branch, so it kept the fix in the original PR instead of making a new one.

Source PR: #88581
Validation: node scripts/run-vitest.mjs src/docs/slash-commands-doc.test.ts src/auto-reply/reply/commands-name.test.ts; pnpm check:changed
Credit stays anchored to this PR. Clownfish is just moving the fix along, not stealing the shiny bits.

fish notes: model gpt-5.5, reasoning medium; reviewed against 37a67b8.

@vincentkoc vincentkoc force-pushed the feature/chat-name-command branch from 3a64046 to 37a67b8 Compare June 19, 2026 01:47
@clawsweeper clawsweeper Bot added the proof: 🎥 video Contributor real behavior proof includes video or recording evidence. label Jun 19, 2026
@vincentkoc vincentkoc merged commit b48238a into openclaw:main Jun 19, 2026
175 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jun 19, 2026
…enclaw#88581)

* Add /name chat command to rename the current session

Adds a `/name <title>` slash command so users can name or rename the
current session directly from any chat channel, instead of only through
the web/admin session manager. This keeps parallel sessions easy to tell
apart from within the chat flow.

Behaviour:
- `/name <title>` sets the session label, reusing the canonical
  `parseSessionLabel` validation (trim, non-empty, max 512 chars) and the
  same cross-store uniqueness rule enforced by the web `sessions.patch`
  path, so chat naming behaves identically to the session manager.
- `/name` with no argument shows the current name plus a locally derived
  `deriveSessionTitle` suggestion without mutating anything (no LLM).
- Only authorized senders can rename (rejectUnauthorizedCommand), matching
  /goal. The label surfaces everywhere sessions.list is shown (TUI, web,
  CLI, MCP).

The handler resolves the session via resolveSessionStoreEntry so renames
land on the canonical entry even when the store still holds a legacy or
case-folded key alias, and excludes those aliases from the uniqueness scan
to avoid false conflicts. Failed renames skip the store write.

Registers the command in commands-registry.shared.ts and the handler in
loadCommandHandlers, documents it in docs/tools/slash-commands.md, and adds
unit tests covering rename, no-arg suggestion, duplicate-label rejection,
unauthorized senders, disabled text commands, and persisted-name re-read.

Part of the chat-native session naming feature (follows the web in-chat
rename PR). Relates to openclaw#85502 and openclaw#54397.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(name): seed native sessions and persist renames via canonical key

Address Codex review on PR openclaw#88581:
- Fall back to the in-memory params.sessionEntry when the store has no row
  yet, so a brand-new native slash session can be named from its first
  /name command instead of failing with 'no active session to name'.
- Persist the rename through resolved.normalizedKey and drop legacy/
  case-folded alias keys (mirroring persistResolvedSessionEntry) so the
  canonical entry is updated and sessions.list stops surfacing the stale
  alias row.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(name): emit session metadata changes

Route successful /name renames through the shared command session metadata seam so subscribed session lists receive sessions.changed like /goal.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(commands): add /name to rename the current session from chat

* fix(docs): document the /name slash command

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Agent <agent@example.com>
Co-authored-by: openclaw-clownfish[bot] <280122609+openclaw-clownfish[bot]@users.noreply.github.com>
@BSG2000 BSG2000 deleted the feature/chat-name-command branch June 19, 2026 06:32
cxbAsDev pushed a commit to cxbAsDev/openclaw that referenced this pull request Jun 23, 2026
…enclaw#88581)

* Add /name chat command to rename the current session

Adds a `/name <title>` slash command so users can name or rename the
current session directly from any chat channel, instead of only through
the web/admin session manager. This keeps parallel sessions easy to tell
apart from within the chat flow.

Behaviour:
- `/name <title>` sets the session label, reusing the canonical
  `parseSessionLabel` validation (trim, non-empty, max 512 chars) and the
  same cross-store uniqueness rule enforced by the web `sessions.patch`
  path, so chat naming behaves identically to the session manager.
- `/name` with no argument shows the current name plus a locally derived
  `deriveSessionTitle` suggestion without mutating anything (no LLM).
- Only authorized senders can rename (rejectUnauthorizedCommand), matching
  /goal. The label surfaces everywhere sessions.list is shown (TUI, web,
  CLI, MCP).

The handler resolves the session via resolveSessionStoreEntry so renames
land on the canonical entry even when the store still holds a legacy or
case-folded key alias, and excludes those aliases from the uniqueness scan
to avoid false conflicts. Failed renames skip the store write.

Registers the command in commands-registry.shared.ts and the handler in
loadCommandHandlers, documents it in docs/tools/slash-commands.md, and adds
unit tests covering rename, no-arg suggestion, duplicate-label rejection,
unauthorized senders, disabled text commands, and persisted-name re-read.

Part of the chat-native session naming feature (follows the web in-chat
rename PR). Relates to openclaw#85502 and openclaw#54397.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(name): seed native sessions and persist renames via canonical key

Address Codex review on PR openclaw#88581:
- Fall back to the in-memory params.sessionEntry when the store has no row
  yet, so a brand-new native slash session can be named from its first
  /name command instead of failing with 'no active session to name'.
- Persist the rename through resolved.normalizedKey and drop legacy/
  case-folded alias keys (mirroring persistResolvedSessionEntry) so the
  canonical entry is updated and sessions.list stops surfacing the stale
  alias row.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* fix(name): emit session metadata changes

Route successful /name renames through the shared command session metadata seam so subscribed session lists receive sessions.changed like /goal.

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>

* feat(commands): add /name to rename the current session from chat

* fix(docs): document the /name slash command

---------

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Co-authored-by: Agent <agent@example.com>
Co-authored-by: openclaw-clownfish[bot] <280122609+openclaw-clownfish[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation mantis: telegram-visible-proof Mantis should capture Telegram visible proof. merge-risk: 🚨 session-state 🚨 May lose, corrupt, stale, or mis-associate session, agent, or context state. P2 Normal backlog priority with limited blast radius. proof: supplied External PR includes structured after-fix real behavior proof. proof: 🎥 video Contributor real behavior proof includes video or recording evidence. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: M status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants