Skip to content

Commit a75513e

Browse files
committed
fix(cron): preserve model override for text payloads
1 parent 1451804 commit a75513e

3 files changed

Lines changed: 12 additions & 3 deletions

File tree

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ Docs: https://docs.openclaw.ai
1212

1313
### Fixes
1414

15+
- Cron: preserve model overrides when text cron payloads are promoted to isolated agent turns through nested payload and legacy top-level inputs. Carries forward #64060; refs #28905. Thanks @liaoandi.
1516
- Control UI/WebChat: keep large attachment payloads out of Lit state and optimistic chat messages, using object URL previews plus send-time payload serialization so PDF/image uploads no longer trigger `RangeError: Maximum call stack size exceeded`. Fixes #73360; refs #54378 and #63432. Thanks @hejunhui-73, @Ansub, and @christianhernandez3-afk.
1617
- Agents/models: keep per-agent primary models strict when `fallbacks` is omitted, so probe-only custom providers are not tried as hidden fallback candidates unless the agent explicitly opts in. Fixes #73332. Thanks @haumanto.
1718
- Cron/Telegram: preserve explicit `:topic:` delivery targets over stale session-derived thread IDs when isolated cron announces to Telegram forum topics. Carries forward #59069; refs #49704 and #43808. Thanks @roytong9.

src/cron/normalize.test.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -616,6 +616,7 @@ describe("normalizeCronJobCreate", () => {
616616
expect(payload.message).toBe("Run daily sync");
617617
expect(payload.model).toBe("anthropic/claude-sonnet-4-6");
618618
expect(payload).not.toHaveProperty("text");
619+
expect(validateCronAddParams(normalized)).toBe(true);
619620
});
620621

621622
it("promotes top-level text to agentTurn on create when model is present", () => {
@@ -631,6 +632,7 @@ describe("normalizeCronJobCreate", () => {
631632
expect(payload.message).toBe("Run daily sync");
632633
expect(payload.model).toBe("anthropic/claude-sonnet-4-6");
633634
expect(payload).not.toHaveProperty("text");
635+
expect(validateCronAddParams(normalized)).toBe(true);
634636
});
635637

636638
it("resolves current sessionTarget to a persistent session when context is available", () => {

src/cron/normalize.ts

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -311,20 +311,26 @@ function coerceDelivery(delivery: UnknownRecord) {
311311
function inferTopLevelPayload(next: UnknownRecord) {
312312
const message = normalizeOptionalString(next.message) ?? "";
313313
if (message) {
314-
return { kind: "agentTurn", message } satisfies UnknownRecord;
314+
const payload = { kind: "agentTurn", message } satisfies UnknownRecord;
315+
copyTopLevelAgentTurnFields(next, payload);
316+
return payload;
315317
}
316318

317319
const text = normalizeOptionalString(next.text) ?? "";
318320
if (text && hasAgentTurnPayloadHint(next)) {
319321
// text + agentTurn-only fields (e.g. model) -> promote to agentTurn, text -> message.
320-
return { kind: "agentTurn", message: text } satisfies UnknownRecord;
322+
const payload = { kind: "agentTurn", message: text } satisfies UnknownRecord;
323+
copyTopLevelAgentTurnFields(next, payload);
324+
return payload;
321325
}
322326
if (text) {
323327
return { kind: "systemEvent", text } satisfies UnknownRecord;
324328
}
325329

326330
if (hasAgentTurnPayloadHint(next)) {
327-
return { kind: "agentTurn" } satisfies UnknownRecord;
331+
const payload = { kind: "agentTurn" } satisfies UnknownRecord;
332+
copyTopLevelAgentTurnFields(next, payload);
333+
return payload;
328334
}
329335

330336
return null;

0 commit comments

Comments
 (0)