Skip to content

Commit cb6f993

Browse files
openperfTakhoffman
andauthored
fix(cli): cron list Agent column shows agentId not model — add Model column (#26259) thanks @openperf
Verified: - pnpm install --frozen-lockfile - pnpm build - pnpm check - pnpm test:macmini Co-authored-by: openperf <[email protected]> Co-authored-by: Tak Hoffman <[email protected]>
1 parent 98e30dc commit cb6f993

File tree

3 files changed

+92
-2
lines changed

3 files changed

+92
-2
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,7 @@ Docs: https://docs.openclaw.ai
2020
### Fixes
2121

2222
- Web UI/Cron: include configured agent model defaults/fallbacks in cron model suggestions so scheduled-job model autocomplete reflects configured models. (#29709)
23+
- CLI/Cron: clarify `cron list` output by renaming `Agent` to `Agent ID` and adding a `Model` column for isolated agent-turn jobs. (#26259)
2324
- Cron/Delivery: disable the agent messaging tool when `delivery.mode` is `"none"` so cron output is not sent to Telegram or other channels. (#21808)
2425
- Feishu/Reply media attachments: send Feishu reply `mediaUrl`/`mediaUrls` payloads as attachments alongside text/streamed replies in the reply dispatcher, including legacy fallback when `mediaUrls` is empty. (#28959)
2526
- Feishu/Reaction notifications: add `channels.feishu.reactionNotifications` (`off | own | all`, default `own`) so operators can disable reaction ingress or allow all verified reaction events (not only bot-authored message reactions). (#28529)

src/cli/cron-cli/shared.test.ts

Lines changed: 77 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,83 @@ describe("printCronList", () => {
7575
expect(logs.some((line) => line.includes("(stagger 5m)"))).toBe(true);
7676
});
7777

78+
it("shows dash for unset agentId instead of default", () => {
79+
const { logs, runtime } = createRuntimeLogCapture();
80+
const job = createBaseJob({
81+
id: "no-agent-job",
82+
name: "No Agent",
83+
agentId: undefined,
84+
sessionTarget: "isolated",
85+
payload: { kind: "agentTurn", message: "hello", model: "sonnet" },
86+
});
87+
88+
printCronList([job], runtime);
89+
// Header should say "Agent ID" not "Agent"
90+
expect(logs[0]).toContain("Agent ID");
91+
// Data row should show "-" for missing agentId, not "default"
92+
const dataLine = logs[1] ?? "";
93+
expect(dataLine).not.toContain("default");
94+
});
95+
96+
it("shows Model column with payload.model for agentTurn jobs", () => {
97+
const { logs, runtime } = createRuntimeLogCapture();
98+
const job = createBaseJob({
99+
id: "model-job",
100+
name: "With Model",
101+
agentId: "ops",
102+
sessionTarget: "isolated",
103+
payload: { kind: "agentTurn", message: "hello", model: "sonnet" },
104+
});
105+
106+
printCronList([job], runtime);
107+
expect(logs[0]).toContain("Model");
108+
const dataLine = logs[1] ?? "";
109+
expect(dataLine).toContain("sonnet");
110+
});
111+
112+
it("shows dash in Model column for systemEvent jobs", () => {
113+
const { logs, runtime } = createRuntimeLogCapture();
114+
const job = createBaseJob({
115+
id: "sys-event-job",
116+
name: "System Event",
117+
sessionTarget: "main",
118+
payload: { kind: "systemEvent", text: "tick" },
119+
});
120+
121+
printCronList([job], runtime);
122+
expect(logs[0]).toContain("Model");
123+
});
124+
125+
it("shows dash in Model column for agentTurn jobs without model override", () => {
126+
const { logs, runtime } = createRuntimeLogCapture();
127+
const job = createBaseJob({
128+
id: "no-model-job",
129+
name: "No Model",
130+
sessionTarget: "isolated",
131+
payload: { kind: "agentTurn", message: "hello" },
132+
});
133+
134+
printCronList([job], runtime);
135+
const dataLine = logs[1] ?? "";
136+
expect(dataLine).not.toContain("undefined");
137+
});
138+
139+
it("shows explicit agentId when set", () => {
140+
const { logs, runtime } = createRuntimeLogCapture();
141+
const job = createBaseJob({
142+
id: "agent-set-job",
143+
name: "Agent Set",
144+
agentId: "ops",
145+
sessionTarget: "isolated",
146+
payload: { kind: "agentTurn", message: "hello", model: "opus" },
147+
});
148+
149+
printCronList([job], runtime);
150+
const dataLine = logs[1] ?? "";
151+
expect(dataLine).toContain("ops");
152+
expect(dataLine).toContain("opus");
153+
});
154+
78155
it("shows exact label for cron schedules with stagger disabled", () => {
79156
const { logs, runtime } = createRuntimeLogCapture();
80157
const job = createBaseJob({

src/cli/cron-cli/shared.ts

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ const CRON_LAST_PAD = 10;
8686
const CRON_STATUS_PAD = 9;
8787
const CRON_TARGET_PAD = 9;
8888
const CRON_AGENT_PAD = 10;
89+
const CRON_MODEL_PAD = 20;
8990

9091
const pad = (value: string, width: number) => value.padEnd(width);
9192

@@ -171,7 +172,8 @@ export function printCronList(jobs: CronJob[], runtime = defaultRuntime) {
171172
pad("Last", CRON_LAST_PAD),
172173
pad("Status", CRON_STATUS_PAD),
173174
pad("Target", CRON_TARGET_PAD),
174-
pad("Agent", CRON_AGENT_PAD),
175+
pad("Agent ID", CRON_AGENT_PAD),
176+
pad("Model", CRON_MODEL_PAD),
175177
].join(" ");
176178

177179
runtime.log(rich ? theme.heading(header) : header);
@@ -192,7 +194,14 @@ export function printCronList(jobs: CronJob[], runtime = defaultRuntime) {
192194
const statusRaw = formatStatus(job);
193195
const statusLabel = pad(statusRaw, CRON_STATUS_PAD);
194196
const targetLabel = pad(job.sessionTarget ?? "-", CRON_TARGET_PAD);
195-
const agentLabel = pad(truncate(job.agentId ?? "default", CRON_AGENT_PAD), CRON_AGENT_PAD);
197+
const agentLabel = pad(truncate(job.agentId ?? "-", CRON_AGENT_PAD), CRON_AGENT_PAD);
198+
const modelLabel = pad(
199+
truncate(
200+
(job.payload.kind === "agentTurn" ? job.payload.model : undefined) ?? "-",
201+
CRON_MODEL_PAD,
202+
),
203+
CRON_MODEL_PAD,
204+
);
196205

197206
const coloredStatus = (() => {
198207
if (statusRaw === "ok") {
@@ -227,6 +236,9 @@ export function printCronList(jobs: CronJob[], runtime = defaultRuntime) {
227236
coloredStatus,
228237
coloredTarget,
229238
coloredAgent,
239+
job.payload.kind === "agentTurn" && job.payload.model
240+
? colorize(rich, theme.info, modelLabel)
241+
: colorize(rich, theme.muted, modelLabel),
230242
].join(" ");
231243

232244
runtime.log(line.trimEnd());

0 commit comments

Comments
 (0)