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

推荐订阅源

月光博客
月光博客
D
Docker
腾讯CDC
J
Java Code Geeks
大猫的无限游戏
大猫的无限游戏
The Cloudflare Blog
Martin Fowler
Martin Fowler
MongoDB | Blog
MongoDB | Blog
博客园 - Franky
博客园 - 三生石上(FineUI控件)
Recent Announcements
Recent Announcements
F
Fortinet All Blogs
IT之家
IT之家
WordPress大学
WordPress大学
M
MIT News - Artificial intelligence
爱范儿
爱范儿
Microsoft Azure Blog
Microsoft Azure Blog
Vercel News
Vercel News
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
小众软件
小众软件
N
Netflix TechBlog - Medium
T
Tailwind CSS Blog
Engineering at Meta
Engineering at Meta
博客园 - 【当耐特】

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(reply): derive explicit control command turns · openc...
amknight · 2026-05-27 · via Recent Commits to openclaw:main
11

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

2+

import type { OpenClawConfig } from "../config/types.openclaw.js";

23

import {

34

createCommandTurnContext,

45

isAuthorizedTextSlashCommandTurn,

@@ -7,6 +8,9 @@ import {

78

resolveCommandTurnContext,

89

resolveCommandTurnTargetSessionKey,

910

} from "./command-turn-context.js";

11+

import { isExplicitCommandTurnContext } from "./command-turn-detection.js";

12+13+

const emptyConfig = {} as const satisfies OpenClawConfig;

10141115

describe("resolveCommandTurnContext", () => {

1216

it("derives native command turns from legacy context fields", () => {

@@ -53,6 +57,88 @@ describe("resolveCommandTurnContext", () => {

5357

expect(isExplicitCommandTurn(commandTurn)).toBe(false);

5458

});

555960+

it("treats authorized control command bodies as explicit without legacy source tags", () => {

61+

expect(

62+

isExplicitCommandTurnContext(

63+

{

64+

CommandAuthorized: true,

65+

CommandBody: "/reset",

66+

},

67+

emptyConfig,

68+

),

69+

).toBe(true);

70+

expect(

71+

isExplicitCommandTurnContext(

72+

{

73+

CommandAuthorized: true,

74+

CommandBody: "hey can you /status please",

75+

},

76+

emptyConfig,

77+

),

78+

).toBe(false);

79+

});

80+81+

it("keeps structured normal command turns non-explicit", () => {

82+

expect(

83+

isExplicitCommandTurnContext(

84+

{

85+

CommandTurn: {

86+

kind: "normal",

87+

source: "message",

88+

authorized: false,

89+

body: "/think high through this",

90+

},

91+

CommandAuthorized: true,

92+

Body: "through this",

93+

RawBody: "through this",

94+

CommandBody: "/think high through this",

95+

},

96+

emptyConfig,

97+

),

98+

).toBe(false);

99+

});

100+101+

it("uses cleaned command bodies for command-shaped structured normal turns", () => {

102+

expect(

103+

isExplicitCommandTurnContext(

104+

{

105+

CommandTurn: {

106+

kind: "normal",

107+

source: "message",

108+

authorized: false,

109+

body: "/reset",

110+

},

111+

CommandAuthorized: true,

112+

Body: "/reset@openclaw",

113+

RawBody: "/reset@openclaw",

114+

CommandBody: "/reset",

115+

},

116+

emptyConfig,

117+

),

118+

).toBe(true);

119+

});

120+121+

it("normalizes bot-mentioned command bodies for structured normal turns", () => {

122+

expect(

123+

isExplicitCommandTurnContext(

124+

{

125+

CommandTurn: {

126+

kind: "normal",

127+

source: "message",

128+

authorized: false,

129+

body: "/reset@openclaw",

130+

},

131+

CommandAuthorized: true,

132+

Body: "/reset@openclaw",

133+

RawBody: "/reset@openclaw",

134+

CommandBody: "/reset@openclaw",

135+

BotUsername: "openclaw",

136+

},

137+

emptyConfig,

138+

),

139+

).toBe(true);

140+

});

141+56142

it("lets structured command turns override legacy command fields", () => {

57143

expect(

58144

resolveCommandTurnContext({