refactor(cron): simplify main-summary prefix config

This commit is contained in:
Peter Steinberger
2025-12-13 11:43:18 +00:00
parent 0152e053e1
commit 32cd1175fb
3 changed files with 29 additions and 40 deletions

View File

@@ -163,11 +163,7 @@ export function registerCronCli(program: Command) {
"Do not fail the job if delivery fails",
false,
)
.option(
"--post-to-main",
"Deprecated: isolated jobs always post a summary to main; use --post-prefix to customize",
false,
)
.option("--post-to-main", "Deprecated (no-op)", false)
.option(
"--post-prefix <prefix>",
"Prefix for summary system event",
@@ -271,12 +267,16 @@ export function registerCronCli(program: Command) {
);
}
const isolation = opts.postToMain
? {
postToMain: true,
postToMainPrefix: String(opts.postPrefix ?? "Cron"),
}
: undefined;
const isolation =
payload.kind === "agentTurn"
? {
postToMainPrefix:
typeof opts.postPrefix === "string" &&
opts.postPrefix.trim()
? opts.postPrefix.trim()
: "Cron",
}
: undefined;
const params = {
name:
@@ -347,11 +347,7 @@ export function registerCronCli(program: Command) {
"Do not fail job if delivery fails",
false,
)
.option(
"--post-to-main",
"Deprecated: isolated jobs always post a summary to main; use --post-prefix to customize",
false,
)
.option("--post-to-main", "Deprecated (no-op)", false)
.option("--post-prefix <prefix>", "Prefix for summary system event")
.action(async (id, opts) => {
try {
@@ -420,11 +416,11 @@ export function registerCronCli(program: Command) {
};
}
if (opts.postToMain) {
if (typeof opts.postPrefix === "string") {
patch.isolation = {
postToMain: true,
postToMainPrefix:
typeof opts.postPrefix === "string" ? opts.postPrefix : "Cron",
postToMainPrefix: opts.postPrefix.trim()
? opts.postPrefix
: "Cron",
};
}