fix(cli): preserve explicit command intent

This commit is contained in:
Peter Steinberger
2026-05-24 01:17:50 +01:00
parent a4e95cf7b1
commit 9410eb30cf
4 changed files with 34 additions and 3 deletions

View File

@@ -55,4 +55,24 @@ describe("cron edit command", () => {
},
);
});
it("does not imply announce mode for --no-best-effort-deliver alone", async () => {
const program = createCronProgram();
await program.parseAsync(["edit", "job-1", "--no-best-effort-deliver"], { from: "user" });
expect(callGatewayFromCli).toHaveBeenCalledWith(
"cron.update",
expect.objectContaining({ bestEffortDeliver: false }),
{
id: "job-1",
patch: {
payload: { kind: "agentTurn" },
delivery: {
bestEffort: false,
},
},
},
);
});
});

View File

@@ -299,7 +299,7 @@ export function registerCronEditCommand(cron: Command) {
const delivery: Record<string, unknown> = {};
if (hasDeliveryModeFlag) {
delivery.mode = opts.announce || opts.deliver === true ? "announce" : "none";
} else if (hasBestEffort) {
} else if (opts.bestEffortDeliver === true) {
// Back-compat: toggling best-effort alone has historically implied announce mode.
delivery.mode = "announce";
}

View File

@@ -72,7 +72,7 @@ describe("update cli option collisions", () => {
},
{
name: "forwards parent-captured --json/--timeout to hidden `update finalize`",
argv: ["update", "finalize", "--json", "--timeout", "17", "--no-restart"],
argv: ["update", "finalize", "--json", "--timeout", "17"],
assert: () => {
expect(updateFinalizeCommand).toHaveBeenCalledTimes(1);
const opts = firstCallOptions(updateFinalizeCommand);
@@ -87,6 +87,17 @@ describe("update cli option collisions", () => {
).toBe(false);
},
},
{
name: "keeps hidden `update finalize --no-restart` as a no-op parity flag",
argv: ["update", "finalize", "--no-restart"],
assert: () => {
expect(updateFinalizeCommand).toHaveBeenCalledTimes(1);
const opts = firstCallOptions(updateFinalizeCommand);
expect(
(opts as { json?: boolean; timeout?: string; restart?: boolean } | undefined)?.restart,
).toBe(false);
},
},
{
name: "forwards parent-captured --timeout to `update wizard`",
argv: ["update", "wizard", "--timeout", "13"],

View File

@@ -131,7 +131,7 @@ ${theme.muted("Docs:")} ${formatDocsLink("/cli/update", "docs.openclaw.ai/cli/up
channel: opts.channel as string | undefined,
timeout: inheritedUpdateTimeout(opts, command),
yes: Boolean(opts.yes),
restart: Boolean(opts.restart),
restart: false,
});
} catch (err) {
defaultRuntime.error(String(err));