惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

IT之家
IT之家
The GitHub Blog
The GitHub Blog
F
Fortinet All Blogs
Last Week in AI
Last Week in AI
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
L
LangChain Blog
爱范儿
爱范儿
博客园_首页
Stack Overflow Blog
Stack Overflow Blog
MongoDB | Blog
MongoDB | Blog
博客园 - 三生石上(FineUI控件)
大猫的无限游戏
大猫的无限游戏
宝玉的分享
宝玉的分享
GbyAI
GbyAI
H
Help Net Security
A
About on SuperTechFans
Recent Announcements
Recent Announcements
Hugging Face - Blog
Hugging Face - Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
雷峰网
雷峰网
D
Docker
博客园 - Franky
有赞技术团队
有赞技术团队
G
Google Developers Blog

Recent Commits to openclaw:main

test: merge chat side-result checks · openclaw/openclaw@ddd2c2a test: merge cron history checks · openclaw/openclaw@f7eb746 test: merge responsive navigation shell checks · openclaw/openclaw@c2e4b47 docs(changelog): add codex oauth fixes · openclaw/openclaw@628e6cd test: merge navigation routing cases · openclaw/openclaw@5d8cecb Tests: mock channel registry bundled fallback · openclaw/openclaw@2b08233 Secrets: avoid broad web search discovery for single plugin config · openclaw/openclaw@a464f59 test: merge config view browser checks · openclaw/openclaw@20cf511 fix(status): align oauth health with runtime · openclaw/openclaw@eed7116 feat: add macOS screen snapshots for monitor preview (#67954) thanks … · openclaw/openclaw@f377db1 fix: report shared auth scopes in hello-ok (#67810) thanks @BunsDev · openclaw/openclaw@0b6c39b Auto-reply: avoid eager bundled route fallback · openclaw/openclaw@3ea1bf4 Tests: narrow session binding contract setup · openclaw/openclaw@54e4e16 fix(macOS): enable undo/redo in webchat composer text input (#34962) · openclaw/openclaw@00951dc Tests: speed up channel setup promotion · openclaw/openclaw@82b529a Docs: refresh agent instructions · openclaw/openclaw@5775fe2 fix(auth): serialize OAuth refresh across agents to fix #26322 (#67876) · openclaw/openclaw@8e79080 test: allow ollama public surface boundary test · openclaw/openclaw@7d4f1a6 Docs: add test performance guardrails · openclaw/openclaw@89706d3 Tests: restore context-engine usage proof · openclaw/openclaw@e4c4f95 Tests: slim context engine runtime coverage · openclaw/openclaw@74c198f ci: retry failed custom checkouts · openclaw/openclaw@0ee5baf test: trim duplicate provider auth onboarding cases · openclaw/openclaw@1ffc02e matrix: fix sessions_spawn --thread subagent session spawning (#67643) · openclaw/openclaw@1ce2596 test: reduce auth choice fixture churn · openclaw/openclaw@857b9cd test: mock health status config boundaries · openclaw/openclaw@9d5ab4a test: mock onboard config io boundary · openclaw/openclaw@299694d test: mock legacy state plugin boundaries · openclaw/openclaw@2713089 test: mock channel install boundaries · openclaw/openclaw@b945248 test: mock doctor preview channel boundaries · openclaw/openclaw@b1a3ad4
fix(auto-reply): enforce word boundary in slash command p...
infracore · 2026-05-23 · via Recent Commits to openclaw:main

@@ -0,0 +1,53 @@

1+

import { describe, expect, it } from "vitest";

2+3+

import { parseSlashCommandOrNull } from "./commands-slash-parse.js";

4+5+

describe("parseSlashCommandOrNull", () => {

6+

const opts = { invalidMessage: "invalid" };

7+8+

it("returns null when the input doesn't start with the slash prefix", () => {

9+

expect(parseSlashCommandOrNull("hello world", "/config", opts)).toBeNull();

10+

});

11+12+

it("parses action + args when the input has a clean word boundary", () => {

13+

const result = parseSlashCommandOrNull("/config show enabled", "/config", opts);

14+

expect(result).toEqual({ ok: true, action: "show", args: "enabled" });

15+

});

16+17+

it("returns the default action on an empty body", () => {

18+

const result = parseSlashCommandOrNull("/config", "/config", { ...opts, defaultAction: "show" });

19+

expect(result).toEqual({ ok: true, action: "show", args: "" });

20+

});

21+22+

describe("regression: #84572 — prefix match must require a word boundary", () => {

23+

// Previously, `/config-check <args>` matched the `/config` handler

24+

// via a naive `startsWith` and surfaced as an invalid action, blocking

25+

// any skill whose name shared a prefix with a built-in command.

26+

it("does not match a longer command name with a hyphen tail (`/config-check`)", () => {

27+

expect(parseSlashCommandOrNull("/config-check arg1 arg2", "/config", opts)).toBeNull();

28+

});

29+30+

it("does not match a longer command name with no whitespace after prefix", () => {

31+

expect(parseSlashCommandOrNull("/configfoo", "/config", opts)).toBeNull();

32+

});

33+34+

it("does not match when prefix sits in the middle of a longer word", () => {

35+

// /modelsy should not be captured by /models

36+

expect(parseSlashCommandOrNull("/modelsy", "/models", opts)).toBeNull();

37+

});

38+39+

it("still matches when the boundary is a colon (`/config:json`)", () => {

40+

// Some clients allow `cmd:subkey` to pass through to the action parser

41+

// when there's no whitespace — the boundary character is still a

42+

// separator and not an alpha continuation.

43+

const result = parseSlashCommandOrNull("/config:json", "/config", opts);

44+

expect(result).not.toBeNull();

45+

expect(result?.ok).toBe(true);

46+

});

47+48+

it("still matches the exact prefix with leading whitespace", () => {

49+

const result = parseSlashCommandOrNull(" /config show ", "/config", opts);

50+

expect(result).toEqual({ ok: true, action: "show", args: "" });

51+

});

52+

});

53+

});