Merge branch 'fix/import-extensions' of https://github.com/openclaw/openclaw into fix/import-extensions

This commit is contained in:
quotentiroler
2026-02-08 08:47:39 -08:00
6 changed files with 123 additions and 2 deletions

View File

@@ -10,6 +10,8 @@ Docs: https://docs.openclaw.ai
### Fixes
- Exec approvals: format forwarded command text as inline/fenced monospace for safer approval scanning across channels. (#11937)
- Thinking: allow xhigh for `github-copilot/gpt-5.2-codex` and `github-copilot/gpt-5.2`. (#11646) Thanks @seans-openclawbot.
- Discord: support forum/media `thread create` starter messages, wire `message thread create --message`, and harden thread-create routing. (#10062) Thanks @jarvis89757.
- Web UI: make chat refresh smoothly scroll to the latest messages and suppress new-messages badge flash during manual refresh.
- Cron: route text-only isolated agent announces through the shared subagent announce flow; add exponential backoff for repeated errors; preserve future `nextRunAtMs` on restart; include current-boundary schedule matches; prevent stale threadId reuse across targets; and add per-job execution timeout. (#11641) Thanks @tyler6204.

View File

@@ -154,7 +154,7 @@ describe("directive behavior", () => {
const texts = (Array.isArray(res) ? res : [res]).map((entry) => entry?.text).filter(Boolean);
expect(texts).toContain(
'Thinking level "xhigh" is only supported for openai/gpt-5.2, openai-codex/gpt-5.3-codex, openai-codex/gpt-5.2-codex or openai-codex/gpt-5.1-codex.',
'Thinking level "xhigh" is only supported for openai/gpt-5.2, openai-codex/gpt-5.3-codex, openai-codex/gpt-5.2-codex, openai-codex/gpt-5.1-codex, github-copilot/gpt-5.2-codex or github-copilot/gpt-5.2.',
);
});
});

View File

@@ -50,6 +50,11 @@ describe("listThinkingLevels", () => {
expect(listThinkingLevels("openai", "gpt-5.2")).toContain("xhigh");
});
it("includes xhigh for github-copilot gpt-5.2 refs", () => {
expect(listThinkingLevels("github-copilot", "gpt-5.2")).toContain("xhigh");
expect(listThinkingLevels("github-copilot", "gpt-5.2-codex")).toContain("xhigh");
});
it("excludes xhigh for non-codex models", () => {
expect(listThinkingLevels(undefined, "gpt-4.1-mini")).not.toContain("xhigh");
});

View File

@@ -26,6 +26,8 @@ export const XHIGH_MODEL_REFS = [
"openai-codex/gpt-5.3-codex",
"openai-codex/gpt-5.2-codex",
"openai-codex/gpt-5.1-codex",
"github-copilot/gpt-5.2-codex",
"github-copilot/gpt-5.2",
] as const;
const XHIGH_MODEL_SET = new Set(XHIGH_MODEL_REFS.map((entry) => entry.toLowerCase()));

View File

@@ -17,6 +17,13 @@ afterEach(() => {
vi.useRealTimers();
});
function getFirstDeliveryText(deliver: ReturnType<typeof vi.fn>): string {
const firstCall = deliver.mock.calls[0]?.[0] as
| { payloads?: Array<{ text?: string }> }
| undefined;
return firstCall?.payloads?.[0]?.text ?? "";
}
describe("exec approval forwarder", () => {
it("forwards to session target and resolves", async () => {
vi.useFakeTimers();
@@ -73,4 +80,91 @@ describe("exec approval forwarder", () => {
await vi.runAllTimersAsync();
expect(deliver).toHaveBeenCalledTimes(2);
});
it("formats single-line commands as inline code", async () => {
vi.useFakeTimers();
const deliver = vi.fn().mockResolvedValue([]);
const cfg = {
approvals: {
exec: {
enabled: true,
mode: "targets",
targets: [{ channel: "telegram", to: "123" }],
},
},
} as OpenClawConfig;
const forwarder = createExecApprovalForwarder({
getConfig: () => cfg,
deliver,
nowMs: () => 1000,
resolveSessionTarget: () => null,
});
await forwarder.handleRequested(baseRequest);
expect(getFirstDeliveryText(deliver)).toContain("Command: `echo hello`");
});
it("formats complex commands as fenced code blocks", async () => {
vi.useFakeTimers();
const deliver = vi.fn().mockResolvedValue([]);
const cfg = {
approvals: {
exec: {
enabled: true,
mode: "targets",
targets: [{ channel: "telegram", to: "123" }],
},
},
} as OpenClawConfig;
const forwarder = createExecApprovalForwarder({
getConfig: () => cfg,
deliver,
nowMs: () => 1000,
resolveSessionTarget: () => null,
});
await forwarder.handleRequested({
...baseRequest,
request: {
...baseRequest.request,
command: "echo `uname`\necho done",
},
});
expect(getFirstDeliveryText(deliver)).toContain("Command:\n```\necho `uname`\necho done\n```");
});
it("uses a longer fence when command already contains triple backticks", async () => {
vi.useFakeTimers();
const deliver = vi.fn().mockResolvedValue([]);
const cfg = {
approvals: {
exec: {
enabled: true,
mode: "targets",
targets: [{ channel: "telegram", to: "123" }],
},
},
} as OpenClawConfig;
const forwarder = createExecApprovalForwarder({
getConfig: () => cfg,
deliver,
nowMs: () => 1000,
resolveSessionTarget: () => null,
});
await forwarder.handleRequested({
...baseRequest,
request: {
...baseRequest.request,
command: "echo ```danger```",
},
});
expect(getFirstDeliveryText(deliver)).toContain("Command:\n````\necho ```danger```\n````");
});
});

View File

@@ -115,9 +115,27 @@ function buildTargetKey(target: ExecApprovalForwardTarget): string {
return [channel, target.to, accountId, threadId].join(":");
}
function formatApprovalCommand(command: string): { inline: boolean; text: string } {
if (!command.includes("\n") && !command.includes("`")) {
return { inline: true, text: `\`${command}\`` };
}
let fence = "```";
while (command.includes(fence)) {
fence += "`";
}
return { inline: false, text: `${fence}\n${command}\n${fence}` };
}
function buildRequestMessage(request: ExecApprovalRequest, nowMs: number) {
const lines: string[] = ["🔒 Exec approval required", `ID: ${request.id}`];
lines.push(`Command: ${request.request.command}`);
const command = formatApprovalCommand(request.request.command);
if (command.inline) {
lines.push(`Command: ${command.text}`);
} else {
lines.push("Command:");
lines.push(command.text);
}
if (request.request.cwd) {
lines.push(`CWD: ${request.request.cwd}`);
}