mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-02 23:00:20 +00:00
fix(commands): harden fast status and Telegram callbacks
This commit is contained in:
@@ -142,7 +142,7 @@ describe("directive behavior", () => {
|
||||
},
|
||||
});
|
||||
expect(fastText).toContain("Current fast mode: on (config)");
|
||||
expect(fastText).toContain("Options: on, off.");
|
||||
expect(fastText).toContain("Options: status, on, off.");
|
||||
|
||||
const verboseText = await runCommand(home, "/verbose", {
|
||||
defaults: { verboseDefault: "on" },
|
||||
@@ -200,6 +200,23 @@ describe("directive behavior", () => {
|
||||
expect(runEmbeddedPiAgentMock).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
it("treats /fast status like the no-argument status query", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
const statusText = await runCommand(home, "/fast status", {
|
||||
defaults: {
|
||||
models: {
|
||||
"anthropic/claude-opus-4-5": {
|
||||
params: { fastMode: true },
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
expect(statusText).toContain("Current fast mode: on (config)");
|
||||
expect(statusText).toContain("Options: status, on, off.");
|
||||
expect(runEmbeddedPiAgentMock).not.toHaveBeenCalled();
|
||||
});
|
||||
});
|
||||
it("persists elevated toggles across /status and /elevated", async () => {
|
||||
await withTempHome(async (home) => {
|
||||
const storePath = sessionStorePath(home);
|
||||
|
||||
@@ -200,7 +200,7 @@ export async function handleDirectiveOnly(
|
||||
};
|
||||
}
|
||||
if (directives.hasFastDirective && directives.fastMode === undefined) {
|
||||
if (!directives.rawFastMode) {
|
||||
if (!directives.rawFastMode || directives.rawFastMode.toLowerCase() === "status") {
|
||||
const sourceSuffix =
|
||||
effectiveFastModeSource === "config"
|
||||
? " (config)"
|
||||
@@ -210,12 +210,12 @@ export async function handleDirectiveOnly(
|
||||
return {
|
||||
text: withOptions(
|
||||
`Current fast mode: ${effectiveFastMode ? "on" : "off"}${sourceSuffix}.`,
|
||||
"on, off",
|
||||
"status, on, off",
|
||||
),
|
||||
};
|
||||
}
|
||||
return {
|
||||
text: `Unrecognized fast mode "${directives.rawFastMode}". Valid levels: on, off.`,
|
||||
text: `Unrecognized fast mode "${directives.rawFastMode}". Valid levels: status, on, off.`,
|
||||
};
|
||||
}
|
||||
if (directives.hasReasoningDirective && !directives.reasoningLevel) {
|
||||
|
||||
@@ -1309,7 +1309,7 @@ describe("buildHelpMessage", () => {
|
||||
});
|
||||
|
||||
it("includes /fast in help output", () => {
|
||||
expect(buildHelpMessage()).toContain("/fast on|off");
|
||||
expect(buildHelpMessage()).toContain("/fast status|on|off");
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -842,7 +842,7 @@ export function buildHelpMessage(cfg?: OpenClawConfig): string {
|
||||
lines.push(" /new | /reset | /compact [instructions] | /stop");
|
||||
lines.push("");
|
||||
|
||||
const optionParts = ["/think <level>", "/model <id>", "/fast on|off", "/verbose on|off"];
|
||||
const optionParts = ["/think <level>", "/model <id>", "/fast status|on|off", "/verbose on|off"];
|
||||
if (isCommandFlagEnabled(cfg, "config")) {
|
||||
optionParts.push("/config");
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user