
























@@ -130,6 +130,86 @@ describe("getReplyFromConfig fast test bootstrap", () => {
130130expect(vi.mocked(runPreparedReplyMock)).toHaveBeenCalledOnce();
131131});
132132133+it("handles native /status before workspace bootstrap", async () => {
134+const home = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-native-status-fast-"));
135+const targetSessionKey = "agent:main:telegram:123";
136+const cfg = markCompleteReplyConfig({
137+agents: {
138+defaults: {
139+model: "openai/gpt-5.5",
140+workspace: path.join(home, "workspace"),
141+},
142+},
143+session: { store: path.join(home, "sessions.json") },
144+} as OpenClawConfig);
145+146+const reply = await getReplyFromConfig(
147+buildGetReplyCtx({
148+Body: "/status",
149+BodyForAgent: "/status",
150+RawBody: "/status",
151+CommandBody: "/status",
152+CommandSource: "native",
153+CommandAuthorized: true,
154+SessionKey: "telegram:slash:123",
155+CommandTargetSessionKey: targetSessionKey,
156+}),
157+undefined,
158+cfg,
159+);
160+161+expect(reply).toEqual(expect.objectContaining({ text: expect.stringContaining("OpenClaw") }));
162+expect(mocks.ensureAgentWorkspace).not.toHaveBeenCalled();
163+expect(mocks.initSessionState).not.toHaveBeenCalled();
164+expect(mocks.resolveReplyDirectives).not.toHaveBeenCalled();
165+expect(vi.mocked(runPreparedReplyMock)).not.toHaveBeenCalled();
166+});
167+168+it("handles native slash directives before workspace bootstrap", async () => {
169+const home = await fs.mkdtemp(path.join(os.tmpdir(), "openclaw-native-slash-fast-"));
170+const targetSessionKey = "agent:main:telegram:123";
171+const cfg = markCompleteReplyConfig({
172+agents: {
173+defaults: {
174+model: "anthropic/claude-opus-4-6",
175+workspace: path.join(home, "workspace"),
176+},
177+},
178+session: { store: path.join(home, "sessions.json") },
179+} as OpenClawConfig);
180+mocks.resolveReplyDirectives.mockResolvedValueOnce({
181+kind: "reply",
182+reply: { text: "model status" },
183+});
184+185+await expect(
186+getReplyFromConfig(
187+buildGetReplyCtx({
188+Body: "/model status",
189+BodyForAgent: "/model status",
190+RawBody: "/model status",
191+CommandBody: "/model status",
192+CommandSource: "native",
193+CommandAuthorized: true,
194+SessionKey: "telegram:slash:123",
195+CommandTargetSessionKey: targetSessionKey,
196+}),
197+undefined,
198+cfg,
199+),
200+).resolves.toEqual({ text: "model status" });
201+202+expect(mocks.ensureAgentWorkspace).not.toHaveBeenCalled();
203+expect(mocks.initSessionState).not.toHaveBeenCalled();
204+expect(vi.mocked(runPreparedReplyMock)).not.toHaveBeenCalled();
205+expect(mocks.resolveReplyDirectives).toHaveBeenCalledWith(
206+expect.objectContaining({
207+sessionKey: targetSessionKey,
208+workspaceDir: expect.any(String),
209+}),
210+);
211+});
212+133213it("uses native command target session keys during fast bootstrap", () => {
134214const result = initFastReplySessionState({
135215ctx: buildGetReplyCtx({
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。