Repository navigation
fix(cron): reject disabled delivery accounts when scheduling - #116899
Conversation
Scheduling an automation against a channel account the operator has turned off succeeded. The job was stored and scheduled against a route its owner had already disabled, and nothing reported that until it fired. `assertValidCronFailureAlert` in this file already applies the rule to the channel on the same route: an explicit unknown channel must not be "stored and only fails later as `channel_not_found`". The account had no equivalent check. Reject a `delivery.accountId` whose `accounts.<id>.enabled` is `false`, beside the existing channel checks. The check is scoped to that account entry and nothing else, because the wider signals all have false positives here: - Cron delivery ids are not always operator-typed - `delivery-context.ts` copies the current context account into inferred jobs. - Channel `isEnabled` adapters report unlisted or credential-suppressed accounts as not enabled (twitch resolves any unlisted id to `enabled: false`). - A top-level `channels.<id>.enabled: false` is not uniformly channel-wide - twitch resolves named accounts from `accounts` alone. Only the account entry itself is an unambiguous statement about this route, so only that blocks a mutation. No channel plugin is resolved on this path. Both cron mutation paths share this validator and the update caller is already gated on `"delivery" in patch`, so edits that do not touch routing stay unblocked by an id stored before this validation existed. `cron-error-classification.ts` learns the field name so the precondition recheck inside `updateWithPrecondition` still classifies it as `INVALID_REQUEST`. `delivery.failureDestination.accountId` is intentionally out of scope: its effective route layers over the global failure-destination config, so it needs route resolution before validation rather than a raw check on the partial override.
|
Codex review: needs maintainer review before merge. Reviewed July 31, 2026, 12:52 PM ET / 16:52 UTC. ClawSweeper reviewWhat this changesReject cron creation and delivery-routing updates that select a configured channel account explicitly marked Merge readinessKeep this PR open for maintainer review. Its supplied real-Gateway proof and successful checks are promising, but this read-only checkout cannot hydrate the three PR-head file blobs because the promisor remote cannot resolve; that prevents the required source-level correctness and best-fix audit. Priority: P2 Review scores
Verification
How this fits togetherCron mutations enter through Gateway RPC and validate a job’s announce-delivery route before it is stored or updated. That route later drives channel delivery, so rejecting an explicitly disabled configured account prevents a scheduled job from silently targeting a route its operator turned off. flowchart LR
A[Automation CLI or RPC] --> B[Gateway cron mutation]
B --> C[Delivery route validation]
C --> D[Configured channel account lookup]
D --> E{Explicitly disabled?}
E -->|Yes| F[Invalid request; no job mutation]
E -->|No| G[Store or update cron job]
G --> H[Scheduled channel delivery]
Before merge
Agent review detailsSecurityNone. PR surfaceSource +51, Tests +273. Total +324 across 3 files. View PR surface stats
Review metricsNone. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Restore access to the PR-head blobs, audit the exact validator and focused tests against both create and preconditioned-update paths, then merge only if the rejection remains limited to a matching configured account entry with Do we have a high-confidence way to reproduce the issue? No independent high-confidence reproduction was completed in this review because the checkout cannot hydrate the PR source or run it. Current main’s validator visibly omits account enablement, and the PR supplies a concrete before/after real-Gateway CLI transcript. Is this the best way to solve the issue? Unclear. The proposed config-only lookup appears to be the narrow owner-boundary fix and avoids channel-plugin loading, but the PR-head implementation and all tests could not be read from this partial checkout. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 5332641ed3ba. LabelsLabel justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
|
@clawsweeper re-review The last two reviews here both aborted before reading the repository — |
|
🦞🧹 I asked ClawSweeper to review this item again. Re-review progress:
|
|
Maintainer verification for head
ClawSweeper rank-up disposition: satisfied. The prior 3/6 patch rating was solely the worker checkout hydration failure, not a code finding. Final landing refresh: live |
* origin/main: (217 commits) fix(messages): reply actions leak citation markers and reply/poll answers draw the no-reply fallback (openclaw#116909) fix(slack): let durable ingress retry transient thread lookups (openclaw#117135) refactor(doctor): consolidate shipped state migration ownership (openclaw#117142) fix(ai): Codex stream shows internal parser text on a malformed frame (openclaw#116966) fix: guard every migrated session accessor path (openclaw#117140) fix(terminal): measure unicode display width consistently (openclaw#117062) fix(openai): clear ChatGPT SSE fallback per session (openclaw#117123) fix(mistral): reject incomplete streamed tool terminals (openclaw#117137) fix(ai): preserve structured chat content and refusals (openclaw#117136) fix(doctor): persist normalized agent roster (openclaw#117115) fix(signal): avoid replay after ambiguous quote delivery errors (openclaw#117134) fix(cron): reject disabled delivery accounts when scheduling (openclaw#116899) fix(gateway): honor HTTP If-Modified-Since media validators (openclaw#117133) fix(config): delete one array element per config patch delete (openclaw#116463) fix(plugins): report installed dependency health authoritatively (openclaw#117029) fix(ui): recover moving sessions across paged gateway rosters (openclaw#117016) fix(ui): clear hidden session selection before bulk deletion (openclaw#117015) fix(discord): avoid replaying ambiguous voice deliveries (openclaw#117127) fix(ui): scope Gateway reconnect lineage to its target (openclaw#117125) fix(models): expose runtime provider catalogs in browse views (openclaw#116857) ...
* commit 'c41f033b87545b658215a9c3bbe03f88fbaa867d': (347 commits) refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146) fix(messages): reply actions leak citation markers and reply/poll answers draw the no-reply fallback (openclaw#116909) fix(slack): let durable ingress retry transient thread lookups (openclaw#117135) refactor(doctor): consolidate shipped state migration ownership (openclaw#117142) fix(ai): Codex stream shows internal parser text on a malformed frame (openclaw#116966) fix: guard every migrated session accessor path (openclaw#117140) fix(terminal): measure unicode display width consistently (openclaw#117062) fix(openai): clear ChatGPT SSE fallback per session (openclaw#117123) fix(mistral): reject incomplete streamed tool terminals (openclaw#117137) fix(ai): preserve structured chat content and refusals (openclaw#117136) fix(doctor): persist normalized agent roster (openclaw#117115) fix(signal): avoid replay after ambiguous quote delivery errors (openclaw#117134) fix(cron): reject disabled delivery accounts when scheduling (openclaw#116899) fix(gateway): honor HTTP If-Modified-Since media validators (openclaw#117133) fix(config): delete one array element per config patch delete (openclaw#116463) fix(plugins): report installed dependency health authoritatively (openclaw#117029) fix(ui): recover moving sessions across paged gateway rosters (openclaw#117016) fix(ui): clear hidden session selection before bulk deletion (openclaw#117015) fix(discord): avoid replaying ambiguous voice deliveries (openclaw#117127) fix(ui): scope Gateway reconnect lineage to its target (openclaw#117125) ...
* origin/main: (3706 commits) refactor(ui): unify filtered session list ownership (openclaw#117158) refactor(agents): consolidate context budgets and compaction recovery (openclaw#117149) fix(net-policy): redact sig and x-* auth params in URLs and bodies (openclaw#116957) refactor(agents): remove duplicate generated-media delivery fallbacks (openclaw#117150) refactor(reply): unify turn lifecycle state ownership (openclaw#117145) fix(ui): preserve emoji agent avatar initials (openclaw#104912) refactor(auto-reply): unify command and directive ownership (openclaw#117143) refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146) fix(messages): reply actions leak citation markers and reply/poll answers draw the no-reply fallback (openclaw#116909) fix(slack): let durable ingress retry transient thread lookups (openclaw#117135) refactor(doctor): consolidate shipped state migration ownership (openclaw#117142) fix(ai): Codex stream shows internal parser text on a malformed frame (openclaw#116966) fix: guard every migrated session accessor path (openclaw#117140) fix(terminal): measure unicode display width consistently (openclaw#117062) fix(openai): clear ChatGPT SSE fallback per session (openclaw#117123) fix(mistral): reject incomplete streamed tool terminals (openclaw#117137) fix(ai): preserve structured chat content and refusals (openclaw#117136) fix(doctor): persist normalized agent roster (openclaw#117115) fix(signal): avoid replay after ambiguous quote delivery errors (openclaw#117134) fix(cron): reject disabled delivery accounts when scheduling (openclaw#116899) ...
…w#116899) Scheduling an automation against a channel account the operator has turned off succeeded. The job was stored and scheduled against a route its owner had already disabled, and nothing reported that until it fired. `assertValidCronFailureAlert` in this file already applies the rule to the channel on the same route: an explicit unknown channel must not be "stored and only fails later as `channel_not_found`". The account had no equivalent check. Reject a `delivery.accountId` whose `accounts.<id>.enabled` is `false`, beside the existing channel checks. The check is scoped to that account entry and nothing else, because the wider signals all have false positives here: - Cron delivery ids are not always operator-typed - `delivery-context.ts` copies the current context account into inferred jobs. - Channel `isEnabled` adapters report unlisted or credential-suppressed accounts as not enabled (twitch resolves any unlisted id to `enabled: false`). - A top-level `channels.<id>.enabled: false` is not uniformly channel-wide - twitch resolves named accounts from `accounts` alone. Only the account entry itself is an unambiguous statement about this route, so only that blocks a mutation. No channel plugin is resolved on this path. Both cron mutation paths share this validator and the update caller is already gated on `"delivery" in patch`, so edits that do not touch routing stay unblocked by an id stored before this validation existed. `cron-error-classification.ts` learns the field name so the precondition recheck inside `updateWithPrecondition` still classifies it as `INVALID_REQUEST`. `delivery.failureDestination.accountId` is intentionally out of scope: its effective route layers over the global failure-destination config, so it needs route resolution before validation rather than a raw check on the partial override.
* commit '31f24547a94a8bd74a32e42cde1783591c5804d9': (347 commits) refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146) fix(messages): reply actions leak citation markers and reply/poll answers draw the no-reply fallback (openclaw#116909) fix(slack): let durable ingress retry transient thread lookups (openclaw#117135) refactor(doctor): consolidate shipped state migration ownership (openclaw#117142) fix(ai): Codex stream shows internal parser text on a malformed frame (openclaw#116966) fix: guard every migrated session accessor path (openclaw#117140) fix(terminal): measure unicode display width consistently (openclaw#117062) fix(openai): clear ChatGPT SSE fallback per session (openclaw#117123) fix(mistral): reject incomplete streamed tool terminals (openclaw#117137) fix(ai): preserve structured chat content and refusals (openclaw#117136) fix(doctor): persist normalized agent roster (openclaw#117115) fix(signal): avoid replay after ambiguous quote delivery errors (openclaw#117134) fix(cron): reject disabled delivery accounts when scheduling (openclaw#116899) fix(gateway): honor HTTP If-Modified-Since media validators (openclaw#117133) fix(config): delete one array element per config patch delete (openclaw#116463) fix(plugins): report installed dependency health authoritatively (openclaw#117029) fix(ui): recover moving sessions across paged gateway rosters (openclaw#117016) fix(ui): clear hidden session selection before bulk deletion (openclaw#117015) fix(discord): avoid replaying ambiguous voice deliveries (openclaw#117127) fix(ui): scope Gateway reconnect lineage to its target (openclaw#117125) ...
* origin/main: (3706 commits) refactor(ui): unify filtered session list ownership (openclaw#117158) refactor(agents): consolidate context budgets and compaction recovery (openclaw#117149) fix(net-policy): redact sig and x-* auth params in URLs and bodies (openclaw#116957) refactor(agents): remove duplicate generated-media delivery fallbacks (openclaw#117150) refactor(reply): unify turn lifecycle state ownership (openclaw#117145) fix(ui): preserve emoji agent avatar initials (openclaw#104912) refactor(auto-reply): unify command and directive ownership (openclaw#117143) refactor(plugins): consolidate descriptor and startup ownership (openclaw#117146) fix(messages): reply actions leak citation markers and reply/poll answers draw the no-reply fallback (openclaw#116909) fix(slack): let durable ingress retry transient thread lookups (openclaw#117135) refactor(doctor): consolidate shipped state migration ownership (openclaw#117142) fix(ai): Codex stream shows internal parser text on a malformed frame (openclaw#116966) fix: guard every migrated session accessor path (openclaw#117140) fix(terminal): measure unicode display width consistently (openclaw#117062) fix(openai): clear ChatGPT SSE fallback per session (openclaw#117123) fix(mistral): reject incomplete streamed tool terminals (openclaw#117137) fix(ai): preserve structured chat content and refusals (openclaw#117136) fix(doctor): persist normalized agent roster (openclaw#117115) fix(signal): avoid replay after ambiguous quote delivery errors (openclaw#117134) fix(cron): reject disabled delivery accounts when scheduling (openclaw#116899) ...
What Problem This Solves
Scheduling an automation against a channel account the operator has turned off succeeds. The job is stored and scheduled against a route its owner already disabled, and nothing says so until it fires.
With
channels.telegram.accounts.retired.enabled = false, that job is created and appears inautomations listwith a next run time.cron.addandcron.updatevalidated the delivery block's channel and target, butdelivery.accountIdwas normalized as a string and persisted verbatim.Why This Change Was Made
src/cron/delivery-channel-validation.tsalready applies this rule to the channel on the same route. The comment onassertValidCronFailureAlertexplains why an explicit unknown channel is rejected at mutation time rather than at run time: otherwise it is stored and only fails later aschannel_not_found. The account had no equivalent check.assertEnabledAnnounceAccountnow runs beside the existing channel checks inassertValidCronAnnounceDelivery. It canonicalizes the resolved announce channel, looks the request's account up in that channel'saccountsmap using canonical account-id matching, and rejects only when that entry carriesenabled: false.The predicate is deliberately that narrow, because every wider signal has a false positive here:
src/cron/delivery-context.tscopies the current delivery context's account into inferred jobs.isEnabledadapters report unlisted or credential-suppressed accounts as not enabled.extensions/twitch/src/config.tsresolves any unlisted id toenabled: false, andextensions/discord/src/accounts.tstreats duplicate-token suppression the same way.channels.<id>.enabled: falseis not uniformly channel-wide — twitch resolves named accounts fromaccountsalone, so a disabled root block does not make those accounts unschedulable.Only the account entry itself is an unambiguous statement about this route, so only that blocks a mutation. No channel plugin is resolved on this path, which keeps the gateway mutation off the bundled-plugin loading path that
src/gateway/AGENTS.mdwarns about.Both cron mutation paths share this validator and the update caller is already gated on
"delivery" in patch, so edits that do not touch routing — togglingbestEffort, disabling a job — stay unblocked by an id stored before this validation existed.cron-error-classification.tslearns the field name so the precondition recheck insideupdateWithPreconditionstill classifies it asINVALID_REQUESTinstead of escaping unclassified.Known limits, stated rather than hidden: this is a create/update-time check and does not revalidate at run time, does not migrate already-stored jobs, and cannot see disablement a channel expresses outside its
accountsentry.delivery.failureDestination.accountIdis out of scope because its effective route layers over the global failure-destination config (src/cron/delivery-plan.ts), so it needs route resolution before validation rather than a raw check on the partial override.User Impact
An operator who points an automation at an account they have disabled finds out when they create or edit the job, instead of discovering a schedule that quietly cannot deliver. Jobs that omit
accountId, name an enabled account, or carry a binding-derived id are unaffected.Evidence
Real-behavior proof below: packaged CLI (
node openclaw.mjs) against a real Gateway on an isolated state dir and port, with the real bundled telegram plugin.Focused tests: 10 added to
src/gateway/server-methods/cron.validation.test.ts(179 passing in that file), covering a disabled delivery account, an enabled account, an omitted account, an unlisted binding-derived id, a channel whoseisEnabledreports everything disabled, a named account under a disabled top-level channel block, a non-canonical disabled account key, a disabled account reached through a channel alias, a disabled-account update patch, and a non-routing patch over a legacy-invalid stored id.src/cronplussrc/gateway/server-methods/cron= 160 files / 1893 tests green. Neutralising the check fails exactly the rejection tests and nothing else; each normalization test also fails individually when its normalization step is reverted.tsgo:core,oxfmt, andoxlintclean.Response on each mutation path
Confirming the intended
INVALID_REQUESTbehaviour on the three paths this touches, each pinned by a focused test insrc/gateway/server-methods/cron.validation.test.ts:cron.addwith a configured-disabled accountINVALID_REQUEST, no job row createdrejects an announce accountId whose account is explicitly disabledcron.updatewhose patch changes delivery routing to a disabled accountINVALID_REQUEST, no mutationrejects a delivery patch that introduces a disabled accountIdcron.updatethat does not touch routing, over a job whose stored account is already disabledkeeps a non-routing patch unblocked by a legacy-invalid stored accountIdThe third row is the upgrade case: a job stored before this validation existed stays editable, because the update caller only reaches this check when the patch contains
delivery.cron-error-classification.tscarriesdelivery.accountIdso the precondition recheck insideupdateWithPreconditionclassifies it the same way as the first-pass check rather than escaping unclassified.Branch state: this head is
MERGEABLEagainst currentmain, and no upstream commit since the base touchessrc/cron/delivery-channel-validation.ts,src/gateway/server-methods/cron.ts,cron-error-classification.ts, or the routing helpers it calls. I have not rebased purely to advance the SHA, because the captured proof above is pinned to this head and a rebase would invalidate it; happy to refresh on request.Real behavior proof
Behavior addressed:
cron.addaccepted and persisted adelivery.accountIdnaming an account the operator had disabled in config. The job was stored and scheduled against a route its owner had already turned off, and nothing reported that until it fired.Real environment tested: Linux (Node 24.18.0), packaged CLI (
node openclaw.mjs, dist-backed — not a source transpile) driving a real OpenClaw Gateway started withopenclaw gateway runon an isolatedOPENCLAW_STATE_DIRand port 18899, with the real bundled telegram channel plugin loaded.cron.addwas invoked over the gateway websocket RPC by the realopenclaw automations addcommand. Config declares two telegram accounts:primaryandretired(enabled: false). Nothing on the cron or account-resolution path is mocked; the only placeholder is the bot token value, which is never contacted because validation runs before any delivery.Exact steps or command run after this patch: captured at head
90b426b23cc(basec75e435e30b). Each of the three accounts below was run as a separateautomations add, then the stored jobs were listed.Before evidence:
Identical commands at the same base, with this patch's production change reverted and the dist rebuilt (
grep -c 'is disabled for channel' dist/= 0).Evidence after fix:
Same commands at head
90b426b23cc, dist rebuilt with the patch (grep -c 'is disabled for channel' dist/= 1).Observed result after fix: the disabled account is rejected at
cron.addand no job row is created for it — before the patch the identical command returned a job id and left a scheduled job behind. The unlistedghostand the enabledprimaryare both still accepted, which is the intended scope: only a config-declaredenabled: falseblocks a mutation, so binding-derived ids that resolve against a sole channel token keep working.What was not tested: the runtime delivery path (this is a create/update-time check and does not revalidate at run time);
cron.updateis covered by focused tests rather than the CLI, since both mutation paths call the same validator; non-telegram channels — the check reads config only and is channel-agnostic, and the alias, non-canonical-key,isEnabled-hostile, and disabled-root cases are covered by focused tests, but only telegram was driven live.Proof limitations or environment constraints: the telegram bot tokens in the proof config are placeholders; they are never used because rejection happens during
cron.add. The gateway ran with an isolatedOPENCLAW_STATE_DIRand its own port, so no live gateway was touched. The check cannot see disablement a channel expresses outside itsaccountsentry — that is a deliberate scope limit, not an oversight, and the reasoning is in the PR body.