Repository navigation
fix(cron): reject ambiguous multi-channel announce jobs - #118272
Conversation
|
Codex review: needs real behavior proof before merge. Reviewed August 2, 2026, 7:19 PM ET / 23:19 UTC. ClawSweeper reviewWhat this changesThe PR moves multi-channel isolated announce-job validation into CronService create, update, and declarative mutation paths, then documents when operators must choose an explicit channel. Merge readiness⛔ Blocked until real behavior proof is added - 7 items remain Keep this PR open: its service-level validation still accepts generic or unknown colon-prefixed targets that cannot select a channel, so the original delayed delivery failure remains possible. The prior P1 finding is unchanged at the new head, and the PR still needs inspectable after-fix runtime proof. Priority: P1 Review scores
Verification
How this fits togetherCron jobs enter through CLI, Gateway, or declarative configuration and are validated by CronService before being persisted for later scheduling. Announce delivery then needs a deterministic channel from explicit delivery settings, a plugin-owned target prefix, session routing, or the configured channel set. flowchart LR
A[CLI, Gateway, or declarative job request] --> B[CronService mutation boundary]
B --> C[Resolve delivery plan]
G[Configured message channels] --> D{Deterministic channel available?}
C --> D
D -->|Yes| E[Persist and schedule job]
D -->|No| F[Return actionable invalid request]
Before merge
Findings
Agent review detailsSecurityNone. PR surfaceSource +80, Tests +116, Docs +2. Total +198 across 11 files. View PR surface stats
Review metricsNone. Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Base the exemption solely on the delivery plan’s actual plugin-resolved channel, add regression cases for generic and unknown prefixes, and attach a redacted CLI or Gateway transcript showing both rejection and a valid provider-prefixed alternative. Do we have a high-confidence way to reproduce the issue? Yes, from source: creating an isolated announce job on a multi-channel host with Is this the best way to solve the issue? No. The PR already computes the delivery plan through the canonical plugin-backed resolver, but then adds a weaker any-prefix heuristic that contradicts that resolver’s generic-prefix contract. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 15560382a2ad. LabelsLabel changes:
Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (1 earlier review cycle)
|
|
Merged via squash.
|
) * fix(cron): reject ambiguous announce delivery (openclaw#118236) * test(cron): move implicit announce ambiguity coverage to the service owner
Fixes #118236
What Problem This Solves
Fixes an issue where operators could persist isolated announce automations whose fallback delivery could never choose among multiple configured channels. The agent run would complete, but every delivery would fail later because no deterministic channel existed.
Why This Change Was Made
CronService now owns a static create/update/declarative validation gate. Gateway supplies only the current configured channel IDs, keeping cron core plugin-agnostic. The gate rejects only isolated announce jobs with an implicit
lastchannel, no preserved session route, no provider-prefixed target, nobestEffortopt-in, and at least two configured channels. Discovery failures accept the mutation so this check cannot create false rejections.PATCH validation runs only when delivery resolution can change (
delivery,sessionTarget,agentId, orsessionKey). Existing ambiguous jobs can still be disabled or renamed. The current service type has no independent top-levelchannelpatch field;delivery.channelis covered by thedeliverygate.The issue says creation was accepted at the cited production SHA, but that source already had a Gateway-only missing-channel preflight. That preflight was broader than the requested contract, did not exempt best-effort/session-backed cases, and did not protect direct CronService or declarative callers. This change narrows Gateway to explicit-channel validation and makes the service mutation boundary canonical.
The production delta is +85 net lines, covering the injected channel-list fact, three mutation paths, PATCH compatibility ownership, Gateway delegation, and invalid-request classification. No legacy path or duplicate service policy remains.
User Impact
On multi-channel hosts, statically ambiguous isolated announce jobs now fail immediately with configured channel IDs and actionable fixes: set
--channel <id>or opt into--best-effort-deliver. Explicit channels, one-channel hosts, provider-prefixed targets, preserved session routes, and best-effort jobs continue to work.The automation docs now explain
--channelfor create/edit and clarify that--best-effort-deliverpermits delivery failure but does not choose a channel.Evidence
pnpm install— passed (pnpm v11.15.1)pnpm docs:list— passed;docs/automation/cron-jobs.mdreviewed before editingOPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/run-vitest.mjs src/cron/service.jobs.test.ts src/gateway/server-cron.test.ts src/gateway/server-methods/cron-error-classification.test.ts— passed, 177 tests across 3 files / 2 shardsOPENCLAW_CHECK_CHANGED_REMOTE_CHILD=1 OPENCLAW_HEAVY_CHECK_LOCK_SCOPE=worktree node scripts/check-changed.mjs— passed all selected core, core-test, and docs gates, including production/test typecheck, lint, max-lines, import cycles, boundaries, and dead exportsgit diff --check— passed--mode local --engine codex --model gpt-5.6-sol --thinking high) — clean; no accepted/actionable findings, overall correctness 0.98The first
node scripts/check-changed.mjsattempt could not start Blacksmith/Testbox because the installed Crabbox client did not meet the broker version requirement and no authenticated cloud fallback was ready. Per repository trusted-source fallback policy, the same changed gate then ran locally and passed. A proposed direct-RPC test was not retained because that cheap harness does not load configured channel plugins; the real service mutation helpers and Gateway invalid-request classifier provide the relevant boundary proof without a registry mock.Maintainer live proof (dist build, ephemeral gateway :19875, isolated state dir, telegram+slack configured)
Also: the pre-existing method-layer tests asserting implicit-announce rejection at the RPC boundary were moved to the new service owner in 64ee87a (the method layer keeps explicit-channel/prefix validation; the service validates the merged job where session-backed/best-effort shapes are visible). On the merge-risk note about accept-when-in-doubt bypasses (session-backed, provider-prefixed, best-effort): intentional static-only scope — those shapes can resolve legitimately at run time, and a false creation-time rejection is worse than a recorded late failure; the bypass predicates are each covered by tests.