Repository navigation
fix(cron): honor configured delivery.channel instead of misrouting (#46899) - #91162
sumitaich1998 wants to merge 1 commit into
Conversation
…penclaw#46899) Co-authored-by: Cursor <[email protected]>
|
Codex review: needs real behavior proof before merge. Reviewed June 30, 2026, 3:46 PM ET / 19:46 UTC. Summary PR surface: Source +14, Tests +20. Total +34 across 2 files. Reproducibility: yes. for the source-level path: current main parses Review metrics: 1 noteworthy metric.
Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Mantis proof suggestion Risk before merge
Maintainer options:
Next step before merge
Security Review detailsBest possible solution: Rebase the parser-boundary fix onto current main, keep runtime Do we have a high-confidence way to reproduce the issue? Yes for the source-level path: current main parses Is this the best way to solve the issue? Yes for fix shape, but not for merge readiness: parser-boundary recovery is the narrow maintainable solution while keeping runtime AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 076da567f434. Label changesLabel justifications:
Evidence reviewedPR surface: Source +14, Tests +20. Total +34 across 2 files. View PR surface stats
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
Review history (1 earlier review cycle)
|
|
This pull request has been automatically marked as stale due to inactivity. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: fix(cron): honor configured delivery.channel instead of misrouting (#46899) This is item 1/1 in the current shard. Shard 17/22. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Closing per ClawSweeper review verdict |
Summary
A cron job configured with an explicit
delivery.channel(e.g. Telegram) could be silently misrouted to a different enabled channel (e.g. Feishu) using a stale/leftover recipient id, failing withInvalid ids: [-1002381931352]. This makes the configureddelivery.channelauthoritative again by preserving it through cron delivery normalization, so an explicit channel can no longer be overridden by implicit session routing.Root cause
delivery.channelis canonically a string channel id (CronMessageChannel). Cron delivery normalization parses delivery fields inparseDeliveryInput(src/cron/delivery-field-schemas.ts), wherechannelwas validated with the string-onlyLowercaseNonEmptyStringFieldSchema.When a persisted/legacy cron job carries
delivery.channelas a channel-reference object ({ id: "telegram" }) instead of a bare string, the schema rejects it andcoerceDelivery(src/cron/normalize.ts) deletes thechannelfield. The job is then persisted/hydrated with no channel, so at run timeresolveCronDeliveryPlan(src/cron/delivery-plan.ts) degrades to implicit"last"routing. With multiple channels enabled,"last"resolves to the session's last channel/recipient — e.g. Feishu with a stale leftover id-1002381931352— instead of delivering via Telegram.The fix
Recover the canonical channel id from a
{ id }channel reference during delivery normalization so the explicit channel survives instead of being dropped:src/cron/delivery-field-schemas.ts: addDeliveryChannelFieldSchema, which preprocesses a{ id: string }reference into its id before applying the existing lowercase/non-empty string validation, and use it forchannelinparseDeliveryInput.This keeps the runtime canonical (channel stays a string), normalizes the legacy/alternate shape at the ingress layer (consistent with the architecture rule that legacy shapes normalize before runtime), and preserves the legitimate "no channel configured →
last" fallback: omitted/empty/nullchannels are untouched, and genuinely unrecoverable shapes (no stringid) still drop as before.Verification
OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/cron/normalize.test.ts→ 49 passed.New regression test
recovers an object-shaped delivery.channel so cron honors the explicit channel (#46899)fails before the fix (expected undefined to be 'telegram') and passes after. It asserts both that normalization preserveschannel: "telegram"and thatresolveCronDeliveryPlan(...).channel === "telegram"(never the"last"fallback that misroutes to Feishu).src/cron/normalize.test.ts src/cron/delivery.test.ts src/cron/delivery-plan.test.ts→ 69 passed.tsgotypecheck,pnpm build, and the full suite/broad lint. The change is small and confined to cron delivery normalization (onlyparseDeliveryInput's channel field consumes the new schema).openclaw). Verification is static review plus focused unit tests only; live cron delivery (Telegram/Feishu) was not exercised.Fixes #46899