Skip to content

feat(cron): configurable default delivery and failure destinations - #185848

Merged
VACInc merged 15 commits into
openclaw:mainfrom
VACInc:feat/cron-default-destinations
Nov 5, 2026
Merged

VACInc merged 15 commits into
openclaw:mainfrom
VACInc:feat/cron-default-destinations

Conversation

@VACInc

@VACInc VACInc commented Oct 27, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Operators otherwise repeat automation result and failure destinations for every job. Failure destinations also lacked the optional thread field available to primary destinations.

User Impact

Adds optional Gateway, owning-agent and creator-profile defaults. Explicit job routes still win. Without new defaults, route-less jobs keep the creating conversation/current route; stored routes and explicit none/webhook modes stay unchanged.

Failure routes accept threadId directly, including the CLI edit option. Existing Telegram to: "-100…:topic:N" destinations continue working. No migration is required.

Why This Change Was Made

Resolution remains job → creator profile → owning agent → Gateway → existing behavior. Each selected default owns its complete route. Changing the channel, recipient, account or mode clears an inherited failure thread unless an explicit thread is supplied.

Evidence

Current correction and reusable runtime evidence

Current candidate: 89440c04a1c892425677c2972aa4a1fb99baf954. Its only change from 72b36c53ebcc835b0acc727014cc985344f996c9 is reducing the test-line allocation from 736 to the actual 733 added lines. No product code, tests, dependencies or runtime configuration changed.

  • Exact ratchet regression: the previous allocation fails (736 > 733); the corrected candidate passes with 6,494,420 test lines, a 6,494,424 ceiling and four lines of slack. git diff --check also passes.
  • The 181-test, typecheck, independent P3 and final-send evidence below was captured at 72b36c5 and is reused for the unchanged runtime, not relabeled as a new execution at 89440c0.
  • Exact-current-head hosted CI and ClawSweeper clearance remain required before landing.

Runtime-tested rebase verification

The runtime-tested rebase candidate is 72b36c53ebcc835b0acc727014cc985344f996c9, integrating main 5492b763a42ab355453afaa577bb512ea1a95050. The native signed baseline-successor workflow preserved the reviewed product delta. Its two Doctor conflicts were resolved by keeping main’s asynchronous plugin-preparation checks and retaining the new scoped-default destination warnings.

  • Independent Codex review through P3: no actionable findings in the full selected product diff and supplied source context. This was a static review; it did not execute project code.

  • On an isolated AWS worker with exact candidate HEAD and tree verified: 181 tests passed across 9 files / 4 shards (126.79s). Coverage includes Doctor warnings, config/delivery defaults, failure-thread persistence, failure alert/repair paths, and Gateway completion/notifications.

  • Production core typecheck, services-cron test typecheck, Doctor formatting, and git diff --check: passed.

  • Current-head GitHub CI and hosted ClawSweeper re-review remain landing gates. Earlier-head CI and review results below are historical, not substitutes for this head.

  • Fresh signed-creator-to-final-HTTP proof: 4 cases / 8 correctly isolated sends passed, covering both creator profiles under operator.cron and operator.write. The exercised fixture also rejects forged-owner creation and creation after revocation. No live Telegram-cloud or browser-authentication claim.

Historical pre-refresh validation

  • Native baseline refresh includes main 84097d630e263848e57a3aa98d47f789606a970d.
  • Red/green: 8 new cases failed on unchanged 657a56c. The corrected runtime passes 527 cases across 17 focused files / 7 Vitest shards (350.43s).
  • Coverage includes authenticated creation and revoked-authority rejection before persistence; confirmed completion and destination transcript; failure dispatch; legacy stored jobs; restart delivery; explicit routes, disabled modes and no-new-config fallback.
  • Production core typecheck passes. Generated Gateway predicates and protocol/config metadata are updated. Relevant baseline ratchets pass.
  • Removed two redundant helper tests. Scoped 736-line test allocation equals net growth over this main snapshot and covers defaults, isolation, compatibility and thread routing.
  • The independent P3 review identified a thread-only alert intent defect; its regression failed before the fix, then all 38 failure-repair cases and 34 affected alert/fallback cases passed. Production core types pass.
  • Full independent P3 review of runtime commit 72d3ea3ead9b6df9f19ba561667649c1039ac2eb found no actionable defects. The follow-up test-only correction 29187ef66e9e14a893669e3b5e6db7788a458f63 also passes independent P3 review, the exact services-cron test typecheck, and all 16 failure-thread cases. It supplies the required merge mode and narrows optional results without changing runtime behavior.
  • Exact-head final-send proof: four cases pass (two creator profiles, each with signed operator.cron and operator.write requester grants). The production creation/persistence, completion and failure-delivery paths use the real Telegram outbound adapter against a controlled HTTP API. Profile A sends primary/failure messages only to chat 123, threads 11/12; profile B only to chat 456, threads 21/22. All eight HTTP sends match. Attempts to submit a forged createdActor, mutate another owner's job, or create after requester revocation are rejected; failed creation leaves stored jobs unchanged.
  • Reproducibility: the existing cron-creator-transports integration fixture was extended in an isolated, exact-head checkout with causal requester origin and the repository Telegram HTTP fixture. Evidence and the temporary harness are retained in the linked work session (final-wire-result.json and final-wire-causal.sh). This proves signed in-process Gateway request dispatch through the final adapter HTTP boundary; it does not claim browser authentication or live Telegram-cloud delivery.
  • Pre-refresh CI on 29187ef: the services-cron test typecheck, Android 16-KiB lane and Control UI performance lane now pass. The remaining failed leaf is check-lint-core-4: exactly two no-promise-executor-return errors at ui/src/e2e/chat-mcp-app-fullscreen.e2e.test.ts:26,29, inherited from main commit f05f838 (PR fix: MCP apps stay in a thin strip when expanded #193069). Aggregate CI gates also reflect that failure; they are not represented as green. The PR owner authorized landing with independently attributed unrelated failures, subject to the remaining review gates.
  • Latest-published compatibility proof passed on this exact head: the repository published-upgrade-survivor Docker lane installed openclaw@latest (resolved version 2026.10.10), seeded its baseline configuration and persisted state, then updated through the real updater to the exact-head candidate tarball (also versioned 2026.10.10). Automatic migration, post-doctor configuration validation, persisted-state survival, Gateway startup and health/readiness probes all passed. The lane finished on its first attempt in 790 seconds. Evidence: upgrade-survivor-witness.json, upgrade-summary.json and published-upgrade-lane.log in the linked work session. This is the standard base scenario, not a claim of live-provider or every optional upgrade scenario coverage. The final exact-head ClawSweeper review reports Before merge: None and Findings: None (completed 2026-11-05 02:22 UTC). The PR remains unmerged.
  • No production credentials were exposed to PR code, and no Control UI behavior changed.
Independently inspectable exact-head proof: redacted traces, witness and reproducer

The following evidence is embedded here so review does not require access to the protected Work session. All identities and chat IDs are synthetic. HTTP requests went to the repository-controlled Telegram fixture, not Telegram cloud; signed requests used in-process Gateway dispatch, not browser login. No credentials, grant tokens, cookies, full config or private conversation contents are included.

Unchanged-runtime final outbound request trace (72b36c5)

Synthetic destinations; actual captured adapter calls from the exact refreshed head.

{
  "head": "72b36c53ebcc835b0acc727014cc985344f996c9",
  "tree": "b1c12203aca8acbe2259b825c7898d70a7b9a18f",
  "base": "5492b763a42ab355453afaa577bb512ea1a95050",
  "testedGrantScopes": [
    "operator.cron",
    "operator.write"
  ],
  "caseCount": 4,
  "sendCount": 8,
  "harnessSha256": "970934578e9250bfa2a96b6e55e9fb3f015dcd7a30230288a0ba5950b850ccb8",
  "traces": [
    {
      "creator": "wire-alpha",
      "sent": [
        {
          "chat": "123",
          "thread": 11,
          "text": "Primary route proof"
        },
        {
          "chat": "123",
          "thread": 12,
          "text": "Failure route proof"
        }
      ],
      "boundary": "production signed-grant dispatch to controlled Telegram HTTP API; not live Telegram cloud"
    },
    {
      "creator": "wire-alpha",
      "sent": [
        {
          "chat": "123",
          "thread": 11,
          "text": "Primary route proof"
        },
        {
          "chat": "123",
          "thread": 12,
          "text": "Failure route proof"
        }
      ],
      "boundary": "production signed-grant dispatch to controlled Telegram HTTP API; not live Telegram cloud"
    },
    {
      "creator": "wire-beta",
      "sent": [
        {
          "chat": "456",
          "thread": 21,
          "text": "Primary route proof"
        },
        {
          "chat": "456",
          "thread": 22,
          "text": "Failure route proof"
        }
      ],
      "boundary": "production signed-grant dispatch to controlled Telegram HTTP API; not live Telegram cloud"
    },
    {
      "creator": "wire-beta",
      "sent": [
        {
          "chat": "456",
          "thread": 21,
          "text": "Primary route proof"
        },
        {
          "chat": "456",
          "thread": 22,
          "text": "Failure route proof"
        }
      ],
      "boundary": "production signed-grant dispatch to controlled Telegram HTTP API; not live Telegram cloud"
    }
  ],
  "boundary": "Signed in-process Gateway dispatch through final Telegram HTTP fixture; not browser authentication or live Telegram cloud."
}

Prior-head published-upgrade witness

Redacted from the completed published-upgrade-survivor summary. The baseline and candidate share a package version but the candidate is built from the exact PR commit. Configuration command values and local runtime paths are omitted. This is the standard base scenario, not all optional upgrade scenarios.

{
  "head": "29187ef66e9e14a893669e3b5e6db7788a458f63",
  "status": "passed",
  "baseline": {
    "spec": "openclaw@latest",
    "version": "2026.10.10"
  },
  "candidate": {
    "kind": "tarball",
    "version": "2026.10.10"
  },
  "installedVersion": "2026.10.10",
  "scenario": "base",
  "candidateInstallMode": "updater",
  "updateRestartMode": "manual",
  "updateOutcome": "success",
  "timings": {
    "startupSeconds": 33,
    "updateRestartSeconds": null,
    "idempotenceSeconds": null,
    "idempotenceBudgetSeconds": null,
    "healthzSeconds": 1,
    "readyzSeconds": 1,
    "statusSeconds": 2
  },
  "failure": null,
  "configRecipe": {
    "source": "baseline-cli-command-recipe",
    "recipe": "upgrade-survivor-v1",
    "baselineVersion": "2026.10.10",
    "successfulSteps": 15,
    "totalSteps": 15
  },
  "passedPhases": [
    "storage-preflight",
    "validate-update-restart-mode",
    "validate-worker-cell",
    "reset-run-state",
    "install-baseline",
    "initialize-state",
    "apply-baseline-config-recipe",
    "missing-load-path-seed",
    "validate-baseline-config",
    "missing-load-path-baseline-start",
    "missing-load-path-baseline-ready",
    "missing-load-path-baseline-stop",
    "resolve-candidate",
    "resolve-candidate-install-mode",
    "candidate-package-identity",
    "configure-clawhub-fixture",
    "prepare-update-restart-probe",
    "bootstrap-mobile-pairing",
    "seed-state",
    "install-baseline-plugin-dependencies",
    "seed-legacy-plugin-dependency-debris",
    "assert-legacy-plugin-dependency-debris",
    "seed-source-only-plugin-shadow",
    "assert-baseline",
    "seed-legacy-runtime-deps-symlink",
    "configure-plugin-registry",
    "missing-load-path-unavailable",
    "update-candidate",
    "installed-package-identity",
    "missing-load-path-post-update",
    "assert-automatic-migration",
    "mobile-pairing-candidate-first",
    "mobile-pairing-candidate-restart",
    "assert-prepublish-requests",
    "root-managed-vps-cli-usable",
    "assert-package-local-dependency-cleanup",
    "doctor",
    "assert-legacy-plugin-dependency-debris-cleaned",
    "assert-legacy-runtime-deps-symlink-repaired",
    "validate-post-doctor-config",
    "missing-load-path-doctor-lint",
    "missing-load-path-post-doctor",
    "assert-survival",
    "assert-prepublish-recovery-requests",
    "fixture-plugin-consent",
    "gateway-start",
    "gateway-probes",
    "gateway-status",
    "missing-load-path-ready"
  ],
  "laneAttempts": [
    {
      "attempt": 1,
      "elapsedSeconds": 790,
      "finishedAt": "2026-11-05T01:45:01.355Z",
      "noOutputTimedOut": false,
      "startedAt": "2026-11-05T01:31:51.048Z",
      "status": 0,
      "timedOut": false
    }
  ],
  "rawWitnessSha256": "83a4efdba9b16f0a2443e70eb64e78ec3af8cdad6279872e458ceccd4f040b2a"
}

Runtime-tested-head wire reproducer (72b36c5)

Uses the checked-in creator transport suite and Telegram HTTP fixture. The SHA-256 digest above corresponds to the following recorded 72b36c5 harness. The base suite retains cross-owner mutation and revoked-creator denial checks; this extension adds forged-creator denial and final outbound isolation. Run in a disposable checkout because it creates a temporary integration-test file.

#!/usr/bin/env bash
set -euo pipefail
# Run from the current candidate checkout.
test "$(git rev-parse HEAD)" = 72b36c53ebcc835b0acc727014cc985344f996c9
python3 - <<'PY'
from pathlib import Path
p=Path('src/gateway/server-methods/cron-creator-transports.integration.test.ts')
s=p.read_text().replace('  CREATOR,','  CREATOR as ORIGINAL_CREATOR,')
s=s.replace('installRequesterCronAuthorityTestHooks();', 'const CREATOR = { ...ORIGINAL_CREATOR, id: process.env.WIRE_CREATOR ?? "wire-alpha" };\ninstallRequesterCronAuthorityTestHooks(CREATOR);')
# CREATOR must initialize before ownedJob; move its declaration before that initializer.
s=s.replace('const CREATOR = { ...ORIGINAL_CREATOR, id: process.env.WIRE_CREATOR ?? "wire-alpha" };\ninstallRequester', 'installRequester')
s=s.replace('const ownedJob = {','const CREATOR = { ...ORIGINAL_CREATOR, id: process.env.WIRE_CREATOR ?? "wire-alpha" };\nconst ownedJob = {')
s='''import { useTelegramHttpFixture } from "../../../extensions/telegram/src/send.telegram-http.test-support.js";
import { captureActivePluginRegistrySnapshot, restoreActivePluginRegistrySnapshot, setActivePluginRegistry } from "../../plugins/runtime.js";
import { createChannelTestPluginBase, createTestRegistry } from "../../test-utils/channel-plugins.js";
import { finalizeCronCompletionAnnouncement } from "../server-cron-completion.js";
import { sendGatewayCronFailureAlert } from "../server-cron-notifications.js";
import { resolveFailureAlert } from "../../cron/service/failure-alerts.js";
import type { CronStoredJob } from "../../cron/types.js";
const wire = useTelegramHttpFixture();
'''+s
# Register both defaults; run real creator grant/persistence/revocation cases once for each creator.
needle='    const client = createOperatorClient({ profileName: "scoped-cron", scopes: [scope] });'
replacement='''    config.channels = wire.cfg.channels;
    config.cron = { creators: {
      "wire-alpha": { delivery: { channel: "telegram", to: "123", threadId: 11 }, failureAlert: { channel: "telegram", to: "123", threadId: 12 } },
      "wire-beta": { delivery: { channel: "telegram", to: "456", threadId: 21 }, failureAlert: { channel: "telegram", to: "456", threadId: 22 } },
    } };
'''+needle
assert s.count(needle)==1
s=s.replace(needle,replacement)
start=s.index('"persists only owned jobs')
a,b=s[:start],s[start:]
b=b.replace('delivery: { mode: "none" as const },','delivery: { mode: "announce" as const },',1)
needle='          expect(jobs).toMatchObject([{ name: job.name, ...ownedJob }]);'
assert b.count(needle)==1
b=b.replace(needle,needle+'''
          const countBeforeForgery = (await fixture.read()).length;
          await expect(request("cron.add", { ...job, createdActor: { ...CREATOR, id: CREATOR.id === "wire-alpha" ? "wire-beta" : "wire-alpha" } })).rejects.toThrow();
          expect((await fixture.read()).length).toBe(countBeforeForgery);
          await assertFinalWire(jobs[0] as CronStoredJob);
''')
s=a+b
s+='''
async function assertFinalWire(job: CronStoredJob) {
  const registry = captureActivePluginRegistrySnapshot();
  setActivePluginRegistry(createTestRegistry([{ pluginId: "telegram", source: "wire-proof", plugin: {
    ...createChannelTestPluginBase({ id: "telegram", config: { listAccountIds: () => ["default"] } }),
    outbound: wire.telegramOutbound,
  } }]), { reason: "cron-wire-proof" });
  try {
    const alpha = CREATOR.id === "wire-alpha";
    const expectedChat = alpha ? "123" : "456";
    const logger = { warn() {}, info() {}, debug() {}, error() {} } as never;
    const resolveCronAgent = () => ({ agentId: "main", cfg: config });
    await finalizeCronCompletionAnnouncement({ job, text: "Primary route proof", runStartedAtMs: Date.now(), deliveryAttemptFence: null, deps: {}, resolveCronAgent, logger, label: "wire-proof" });
    const route = resolveFailureAlert({ deps: { cronConfig: config.cron, defaultAgentId: "main" } }, job);
    console.log("WIRE_ROUTE_INPUT", JSON.stringify({ actor: job.createdActor, owner: job.owner, config: config.cron, route }));
    expect(route).toMatchObject({channel: "telegram", to: expectedChat, threadId: alpha ? 12 : 22});
    const settled = vi.fn();
    await sendGatewayCronFailureAlert({ ...route!, job, deps: {}, resolveCronAgent, logger, routing: { defaultAgentId: "main" }, payload: { text: "Failure route proof" }, onDeliverySettled: settled });
    const sent = wire.requests.filter(request => request.method === "sendMessage").map(request => ({ chat: String(request.fields.chat_id), thread: Number(request.fields.message_thread_id), text: String(request.fields.text) }));
    expect(sent).toEqual([
      { chat: expectedChat, thread: alpha ? 11 : 21, text: "Primary route proof" },
      { chat: expectedChat, thread: alpha ? 12 : 22, text: "Failure route proof" },
    ]);
    expect(settled).toHaveBeenCalledWith(expect.objectContaining({ delivered: true }));
    console.log("FINAL_WIRE_PROOF", JSON.stringify({ creator: CREATOR.id, sent, boundary: "production signed-grant dispatch to controlled Telegram HTTP API; not live Telegram cloud" }));
  } finally { restoreActivePluginRegistrySnapshot(registry); }
}
'''
start=s.index('"persists only owned jobs')
end=s.index('it.each([', start)
a,b,c=s[:start],s[start:end],s[end:]
b=b.replace('profileName: "scoped-cron"', 'profileId: CREATOR.id')
b=b.replace('operationalRunInstance: identity.operationalRunInstance,', 'operationalRunInstance: identity.operationalRunInstance,\n              requesterOrigin: identity.requesterOrigin,')
b=b.replace('        }),\n      );', '        }),\n        undefined,\n        { sessionKey: SESSION, operatorProfileId: CREATOR.id, delegatedCreatorProfileId: CREATOR.id },\n      );')
s=a+b+c
Path('src/gateway/server-methods/cron-defaults-wire-proof.integration.test.ts').write_text(s)
PY
for creator in wire-alpha wire-beta; do
  WIRE_CREATOR="$creator" pnpm test src/gateway/server-methods/cron-defaults-wire-proof.integration.test.ts --maxWorkers=1 -t 'persists only owned jobs'
done

Upgrade reproduction: the retained upgrade witness above is pinned to pre-refresh head 29187ef, not the new head. To run that lane from a clean checkout, use pnpm test:docker:published-upgrade-survivor with Docker available. Its default baseline is openclaw@latest; the recorded run resolved it to 2026.10.10.

Original implementation by @VACInc. Delivery-owner repair and additional verification by RoboClaw.

Work sessions

Original design contract and author-reported verification

Summary

High Level TLDR

Today every automation either names its own chat route or follows the conversation that created it. An operator who wants all results in one place (for example topic 1 of a Telegram forum) has to pin channel/to/threadId on every job, and agent-created jobs pin whatever chat they were made in. Failure alerts have a Gateway-wide route but no per-agent or per-person one.

This adds configurable default destinations at three layers, for both primary results and failure alerts:

  • cron.delivery (and the existing cron.failureAlert): Gateway-wide defaults.
  • cron.agents.<agentId>.delivery and .failureAlert: defaults for the agent that owns the job.
  • cron.creators.<profileId>.delivery and .failureAlert: defaults for the human who created the job, keyed by Gateway profile id.

Defaults resolve at run time. Stored jobs are never rewritten, and a job that names its own route keeps it.

{
  cron: {
    delivery: { channel: "telegram", to: "-100123456789", threadId: 1 },
    failureAlert: { channel: "telegram", to: "-100123456789:topic:1" },
    agents: {
      ops: { delivery: { channel: "slack", to: "channel:C123" } },
    },
    creators: {
      "profile-id": {
        delivery: { channel: "telegram", to: "-100123456789", threadId: 2 },
        failureAlert: { channel: "telegram", to: "-100123456789:topic:2" },
      },
    },
  },
}

Contract

  • Owner. The job's agentId, else the agent in its session key, else the default agent.
  • Creator. The trusted creation seam already stamps createdActor on every job it stores (cron-creator-session.ts, cron-input-validation.ts), and run-time execution context already reads its profile id. The creator layer reads the same stamp through the canonical sessionCreatorProfileId helper. It applies when the creator is a human with a Gateway profile, or a human profile that delegated creation to an agent (delegatedBy). Legacy jobs with no createdActor, and channel-only, unknown, agent-without-a-human, and system creators have no creator default. Profile keys match exactly; they are opaque ids, so they are not case-folded like agent ids.
  • One shared helper. resolveCronDeliveryDefaultsScope derives both the owner and the creator for every path: preview, isolated run delivery, command/script completion, run-queue check, failure alerts, and create/update validation. cron.add passes the stamped creator into its validation and preview so the add result already shows the creator default.
  • Precedence. The job's own route, then the creator-profile default, then the owner-agent default, then the Gateway-wide default, then today's behavior. "Own route" means a channel other than last, to, threadId, accountId, or target: "owner".
  • Why this order.
    • The job's own route is explicit intent for that one job, so nothing overrides it.
    • The creator is the person who set the job up, the most specific "who". Their chosen inbox should follow them across whichever agent they used.
    • An agent is a shared runtime that can serve several people, so its default is broader than one person's.
    • The Gateway default is the catch-all, and with nothing configured behavior is unchanged. "Routing fields" means a channel other than last, to, threadId, accountId, or target: "owner".
  • Most specific default wins whole. No field merging, because recipient, thread, and account belong to the channel that supplied them.
  • Eligibility. Only a resolved announce mode with no routing field gets a default. This holds for every session target, including current and main, where the default replaces the creating-conversation route.
  • mode: "none" and "webhook" never gain a chat destination. That includes message-tool context. Failure alerts for none jobs still use configured failure routes, as today.
  • Failure route. cron.creators.<profileId>.failureAlert and cron.agents.<id>.failureAlert set mode, channel, to, and accountId, in the same creator-then-agent order, replacing the global route fields whole. enabled, after, cooldownMs, and includeSkipped stay Gateway-wide, so cron.failureAlert.enabled: false still disables inherited alerts. Like a cron.failureAlert object, a scoped route activates the alert policy. Precedence: per-job failureAlert route, then delivery.failureDestination layered over the creator route, else the agent route, else the global route, then the primary announce route. That last step now includes a primary default, and its threadId is kept.
  • Agent-created jobs. When the cron tool creates a route-less job and a default applies to the job's agent or to the requesting human profile, it no longer pins the creating chat route. Otherwise the inferred route would become an explicit per-job route and hide the default. The tool reads the requester profile from the authenticated requester origin, the same source the Gateway uses to stamp delegatedBy.
  • Validation. Config load rejects a default whose channel names no installed channel plugin (cron.delivery and the cron.agents/cron.creators delivery and failureAlert routes; built-in aliases such as gchat pass). An unknown cron.failureAlert.channel only warns, so existing configs keep loading. cron.agents keys that resolve to the same agent id (ops and OPS) are rejected with the same check agents.entries uses. openclaw doctor's delivery-target advisory also lists defaults whose channel plugin is not active.
  • Compatibility.
    • With no defaults configured, nothing changes.
    • Existing jobs that already store a route, including routes pinned at creation by earlier releases, keep it.
    • The new keys are optional and the cron block stays strict.

Behavior matrix (tested)

Config Job delivery Result
global only announce, no route global default
agent only (owner matches) announce, no route agent default
global + agent announce, no route, owner has entry agent default, whole (no global field merge)
global + agent announce, no route, other owner global default
any names channel / to / threadId / accountId / owner target job's own route
any none / webhook unchanged
none configured, or only another agent's entry announce, no route unchanged (creating chat / remembered route)
creator + agent + global announce, no route, human profile creator creator default, whole
creator only announce, no route, human profile creator creator default
creator + agent + global announce, no route, agent creator with delegating human profile creator default
creator + agent + global announce, no route; creator legacy (no createdActor), channel-only, unknown, agent, system, other profile, or case-different id agent default (no creator default)
creator + agent + global names a route, owner target, none, webhook unchanged by the creator default
global failureAlert + agent failureAlert any agent route fields, global tuning
global + agent + creator failureAlert human profile creator creator route fields, global tuning
creator with only delivery failure alert agent failure route
global enabled: false + agent failureAlert no job failureAlert no alert
per-job failureAlert any per-job route
primary default, no failure route announce alert to primary default (thread kept)
primary default and agent failure route announce primary to default, failures to agent route, independently
owner only in session key route-less session-key agent's defaults in preview, completion, and alerts

Docs

  • docs/automation/cron-jobs/delivery.md: new "Default destinations" section with the precedence table, the none decision, the session-route decision, and failure-route layering.
  • docs/gateway/config-automation.md: cron.delivery, cron.agents, and cron.creators reference, plus the updated failure precedence.
  • Configuration reference index, schema help and labels, and the generated config baseline.

Verification

  • Typecheck:
    • pnpm tsgo:core: pass.
    • pnpm tsgo:test:src: all shards pass.
    • pnpm tsgo:extensions: pass.
  • Lint and format: oxlint and oxfmt --check on touched files are clean.
  • Schema and docs generation:
    • pnpm check:base-config-schema: ok.
    • pnpm config:docs:check: ok, after config:docs:gen.
    • pnpm format:docs:check: clean.
    • pnpm docs:check-links: 0 broken.
    • docs:check-links:anchors: 6 misses, all in pre-existing release notes and none in touched pages.
    • git diff --check: clean.
  • Focused tests (pnpm test <files>), all passing. New tests:
    • src/cron/delivery-defaults.test.ts: the matrix above, including every non-creator actor shape, legacy jobs with no createdActor, the none/webhook interaction, and failure vs primary resolved independently.
    • src/agents/tools/cron-tool.test.ts: no route pinning when a Gateway, agent, or creator default applies (requesting or delegating profile); still pins for another agent's default, another profile's default, or a requester without a profile.
    • src/cron/delivery-preview.test.ts: real resolveDeliveryTarget. A route-less current job previews to the default; an explicit to still wins; another agent's default is ignored; a human-profile creator's default beats the agent default.
    • src/gateway/server-cron-completion.test.ts: completion uses the session-key owner's default rather than the resolver fallback agent.
  • Existing suites rerun, all passing:
    • delivery-plan, failure-alerts (account routing, outcome, persistence), service failure-alert and delivery-plan;
    • isolated delivery-target, session-run, server-cron-completion;
    • gateway cron validation, request-validation, webchat-delivery, caller-scope, ownership-matrix;
    • config schema, metadata, hints, control-ui contract, zod agents and core;
    • run-recovery, run-finalization and scheduler-actor workers;
    • after the creator layer: delivery-plan, failure-alerts (account routing, outcome, persistence), gateway cron validation, request-validation, webchat-delivery, caller-scope, ownership-matrix, delegated-creator and creator-transports integration, server-cron-completion, isolated delivery-target, and config schema, help quality, hints, field metadata, control-ui contract, zod core, base generated schema (22 files, all passing).
  • Mutation checks:
    • The cron-tool tests fail against the base cron-tool.ts.
    • Creator mutants each killed by the new tests: dropping the creator from the scope, swapping creator and agent order, dropping the creator failure route, attributing any actor id as a creator, and case-folding creator keys.
    • The completion owner test fails when the session-key owner resolution is removed.
  • Independent review: three structured review passes (P0 to P2). The first raised two findings:
    • Missing defaultAgentId on finalization and skip snapshots: verified false, the snapshots already carry it.
    • Completion owner taken from job.agentId only: valid, fixed by the shared scope helper.
    • The second pass on the agent/global diff was clean.
    • The third pass on the final diff, including the creator layer, was clean. Its one open doubt (whether worker-loaded jobs carry createdActor) checks out: failure-alert workers load jobs through the same row decoder (loadedCronStoreFromRows) whose createdActor the run-time execution context already reads.
  • Validation follow-up (head after 7d661bba):
    • Lint fix: the create-time default check no longer casts raw cron tool input to CronDelivery; check:assertion-safety-ratchet (src/cron/delivery-context.ts: 2 > 1) now passes.
    • pnpm check:changed --base 5c410ef4eb5: all lanes pass except the dead-export scan, whose entries are all in files this PR does not touch (same list on the base).
    • New src/config/config.cron-default-destinations.test.ts: unknown channel rejected at each of the five default paths, global cron.failureAlert only warns, known channels and built-in aliases pass, last/webhook routes skipped, cron.agents keys differing by case rejected.
    • src/commands/doctor/cron/warnings.test.ts: defaults on inactive channels are listed; active defaults stay quiet.
    • Mutation checks: dropping the load-time issue, the cron.agents duplicate check, or the doctor default scan each fails the new tests.
  • Micro-benchmark of resolveCronDeliveryPlan. Node 24.22, 64-job mix, 20k-iteration warmup, 15 samples of 5k iterations, median ns per call, base (5c410ef4) vs head, three runs:
    • no defaults argument: about 24.5 → 30.5;
    • defaults scope with nothing configured: about 33;
    • defaults configured: about 178. That path resolves and normalizes the default route and scans agent keys.
    • Plan resolution happens a few times per run, so this is negligible next to run cost. I moved the default lookup before the eligibility normalization so unconfigured Gateways pay only the lookup.

What was not tested

  • No live channel send. Proof is through the real target resolution and completion paths with synthetic channel I/O.
  • openclaw doctor does not flag an unknown agent id under cron.agents.
  • Config-load validation checks that a default's channel plugin is installed, not that the channel is configured or the recipient exists; doctor covers inactive plugins, and a wrong recipient still surfaces at send time.
  • No Control UI changes or checks beyond the generated schema metadata.

Open questions

  • Opting a job back into creating-chat routing. Once a default is configured, a route-less job cannot return to the creating conversation, because channel: "last" is also the stored CLI default. Should there be an explicit opt-out, such as delivery.target: "source"? Today such a job must name its channel/to.
  • Failure routes have no threadId. Telegram topics use the -100…:topic:N form, matching the existing cron.failureAlert shape. Should failure routes get a threadId field for parity?

Add cron.delivery and cron.agents.<agentId>.{delivery,failureAlert} so
route-less announce jobs and failure alerts can go to a configured
Gateway-wide or per-agent destination. Explicit job routes win, the
owning agent's default replaces the Gateway default whole, and defaults
resolve at run time without rewriting stored jobs. none and webhook
delivery never gain a chat destination.
@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime agents Agent runtime and tooling size: L labels Oct 27, 2026
@github-actions

github-actions Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 89440c04a1c892425677c2972aa4a1fb99baf954
  • Maintainer: @VACInc
  • Repository role: maintain

These security sensitive changes were made:

  • src/config/zod-schema.agents.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.

Carefully review these changes before merging.

@clawsweeper clawsweeper Bot added clawsweeper:intake:feature Preliminary submission classification; full source review pending. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 message-delivery 🚨 May drop, duplicate, misroute, suppress, or wrongly target messages. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed clawsweeper:intake:feature Preliminary submission classification; full source review pending. labels Oct 27, 2026
@clawsweeper

clawsweeper Bot commented Oct 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge.

What this changes

This PR adds Gateway, agent, and creator-profile automation destinations plus explicit failure-alert threads.

Example: Creator wire-alpha has Telegram defaults for chat 123, with result thread 11 and failure thread 12.

  • Before: Each job needs its destinations configured separately.
  • After: Route-less jobs use those defaults, while explicit job destinations retain precedence.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Coherent implementation with useful production-boundary transport evidence, but latest-stable compatibility and exact-head CI are not cleared.
Proof confidence 🦐 gold shrimp (3/6) Real behavior proof is not required for maintainer- or bot-authored pull requests.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Yes · Fix scope: Complete
User problem: Operators must repeat result and failure destinations across jobs and cannot select failure threads directly.
Reason: Maintainer-authored direction provides reusable destinations while preserving explicit routes, disabled delivery modes, and unconfigured behavior.

Merge readiness

⛔ Blocked before merge - 1 item remains

Keep open: this maintainer-authored feature provides useful routing defaults, and inspection found no definite introduced defect; exact-head CI remains unresolved.

Priority: P2
Reviewed head: 89440c04a1c892425677c2972aa4a1fb99baf954

Before merge

  • Add data-model compatibility proof - The review found that existing stored data may not work after upgrade. Show that existing data still loads and works with this change.

Findings

None.

Tests

  • Missing end-to-end proof: Supply an upgrade from v2026.11.1 to the candidate showing existing configuration, stored destinations, failure settings, and restart delivery remain intact.
Agent review details

How this fits together

Cron combines stored job settings, trusted creator attribution, and operator configuration into delivery plans consumed by Gateway transports and conversation-history writers.

flowchart TD
  A[Stored cron job] --> C[Shared destination resolution]
  B[Gateway agent and creator defaults] --> C
  C --> D[Primary completion]
  C --> E[Scheduler failure policy]
  D --> F[Gateway channel transport]
  E --> F
  F --> G[Recipient and conversation history]
Loading

Technical review

Best possible solution:

Retain the shared destination resolver and existing persistence owners, then complete latest-stable upgrade validation and settle exact-head CI.

Do we have a high-confidence way to reproduce the issue?

This is a feature request; source confirms that current main lacks these scoped defaults, and supplied HTTP traces demonstrate their added behavior.

Is this the best way to solve the issue?

The implementation extends existing planning, scheduler, validation, and storage owners without adding a competing delivery mechanism.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against f24a3f03cd16.

Provenance checked

  • Implicit primary delivery and creating-conversation fallback changes intended behavior with a stated reason (8899940: Unify implicit announce behavior across isolated, current, and session targets; the later creating-conversation contract is documented in fix(cron): deliver isolated results to their creating conversation #167363.)
  • Failure-alert policy ownership keeps the original intent (177828a: Centralize notification thresholds, cooldowns, routing, recovery, and opt-outs in scheduler finalization to prevent duplicate alerts.)
  • Threaded primary versus unthreaded failure destination keeps the original intent (c637da8: Preserve explicitly unthreaded failure routes without inheriting a failed primary topic or resending through equivalent aliases.)
  • Agent-key collision validation keeps the original intent (0757afb: Reject roster keys that normalize to the same agent identity; the extraction preserves that contract and shares it with cron.agents.)
  • Explicit persisted failure-destination clears keeps the original intent (ee6373a: History names preservation of failure-destination clears, and current codecs retain null-versus-absent semantics; git show could not read an older promised blob.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

  • Pinned introduction and reusable runtime: Reviewed merge-base 5492b76 through head 89440c0; the final commit changes only the test-line allocation, supporting reuse of the 72b36c5 runtime trace. (config/test-lines-allocations/cron-default-destinations-185848.txt:2, 89440c04a1c8)
  • Current main still lacks scoped destinations: Fetched main retains implicit delivery-mode selection but lacks the creator, agent, and Gateway destination resolution introduced here. (src/cron/delivery-defaults.ts:1, f24a3f03cd16)
  • Explicit routing and policy ownership: The shared planner applies defaults only to route-less announce jobs; scheduler-owned failure policy retains tuning, disablement, and destination layering established by fix(cron): honor failure alert thresholds #126483. (src/cron/delivery-plan.ts:46, 89440c04a1c8)
  • Creator authority and final HTTP evidence: The fully retrieved PR body embeds the reproducer and captured eight final Telegram HTTP sends for two creator profiles under both grant scopes, plus forged-creator, cross-owner, and revoked-creator rejection evidence; creation retains its existing live commit guard. (src/gateway/server-methods/cron-add.ts:153, 72b36c53ebcc)
  • Upgrade witness baseline: The embedded upgrade witness starts from 2026.10.10 and targets prior head 29187ef; GitHub identifies v2026.11.1 as the latest stable release, so the witness does not establish the required latest-stable upgrade.
  • Current CI failure remains unattributed: Exact-head checks-ui-e2e (3/4) fails because the Alpha sidebar group reloads expanded instead of collapsed at ui/src/e2e/session-management.groups.e2e.test.ts:857. The corresponding base lanes were skipped; neither diff causation nor an equivalent base failure was established. (ui/src/e2e/session-management.groups.e2e.test.ts:857, 89440c04a1c8)

Likely related people:

  • Peter Steinberger: Raw commit 68771eb adds src/cron/delivery-defaults.ts:11 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 68771ebdfef1; files: src/cron/delivery-defaults.ts)
  • Vincent Koc: Raw commit 28b374a adds src/cron/delivery-plan.ts:254 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 28b374a8a7f6; files: src/cron/delivery-plan.ts)
  • cxbAsDev: Raw commit 8899940 adds src/cron/delivery-defaults.ts:7 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: medium; commits: 8899940d5ac1; files: src/cron/delivery-defaults.ts)

PR surface

Source +525, Tests +733, Docs +71, Generated 0, Other +3. Total +1332 across 55 files. Added test files: 3.

View PR surface stats
Area Files Added Removed Net
Source 36 625 100 +525
Tests 12 773 40 +733
Docs 3 77 6 +71
Config 0 0 0 0
Generated 2 3 3 0
Other 2 3 0 +3
Total 55 1481 149 +1332

Preflight source

Source unknown. Source comparison at the observed PR snapshot only. Completion is self-reported; body, policy, tests, execution, and report bytes are not verified.

Review metrics

Metric Value Why it matters
Configuration surface 3 optional configuration roots and 1 CLI flag Adds cron.delivery, cron.agents, cron.creators, and --failure-alert-thread-id; the maintainer-authored direction covers this expanded surface.

Labels

Label changes:

  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • remove proof: sufficient: Current real behavior proof status is not_applicable, not sufficient.
  • remove rating: 🐚 platinum hermit: Current PR rating is rating: 🦐 gold shrimp, so this older rating label is no longer current.
  • remove status: 👀 ready for maintainer look: Current PR status no longer selects a status label.

Label justifications:

  • P2: Useful automation configuration improvement with optional adoption and limited immediate user impact.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Provide the latest-stable upgrade evidence described above.
  • Establish the cause of the sidebar-group CI failure before applying an inherited-failure exception.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (6 earlier review cycles)
  • reviewed 2026-10-27T11:42:29.624Z sha 7fbb1a8 :: blocked before merge. :: [P2] Honor configured defaults in multi-channel job validation | [P2] Carry the effective owner into completion and failure sends
  • reviewed 2026-11-05T00:06:20.444Z sha 657a56c :: needs real behavior proof before merge. :: [P1] Include the new helper in the PR wrapper inventory | [P2] Update fallback fixtures for session-key ownership | [P3] Bring the cron tool within its enforced line cap | [P3] Account for the regression-test budget growth
  • reviewed 2026-11-05T00:57:49.602Z sha 72d3ea3 :: needs real behavior proof before merge. :: [P2] Supply the required mode and narrow the merge results
  • reviewed 2026-11-05T01:56:11.531Z sha 29187ef :: needs real behavior proof before merge. :: none
  • reviewed 2026-11-05T02:11:29.593Z sha 29187ef :: needs maintainer review before merge. :: none
  • reviewed 2026-11-05T02:20:47.048Z sha 29187ef :: needs maintainer review before merge. :: none

Reviewed November 5, 2026, 9:01 AM ET / 14:01 UTC (Revision 7).

Add cron.creators.<profileId>.delivery and .failureAlert, keyed by the
Gateway profile recorded in a job's createdActor (directly or as the
delegating human). Precedence is the job's own route, then the creator
default, then the owner-agent default, then the Gateway default. Legacy,
channel-only, unknown, agent, and system creators get no creator default.
The create-time default check cast raw cron tool input to CronDelivery,
which tripped the assertion SAFETY ratchet. Read the routing fields
structurally instead so stored jobs and raw tool input share one check.
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Nov 5, 2026
Baseline-Refresh: 6528ac64a95d2d249473aa1df1c4e1022294d878
Co-authored-by: VACInc <[email protected]>
Reduce the regression allowance to the actual 733 added test lines after refreshing the main baseline.

Co-authored-by: VACInc <[email protected]>
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Nov 5, 2026
@roboclaw-bot

Copy link
Copy Markdown
Collaborator

Existing data/upgrade compatibility proof — reused, not rerun

The remaining review checkbox asks for proof already completed and embedded in the PR description under Prior-head published-upgrade witness. Here is its exact applicability to current head 89440c04a1c892425677c2972aa4a1fb99baf954:

  • The published-upgrade-survivor base scenario passed at 29187ef66e9e14a893669e3b5e6db7788a458f63, finishing 2026-11-05 01:45 UTC in 790 seconds. It installed published OpenClaw 2026.10.10, seeded existing configuration and persisted state, upgraded through the real updater to the candidate tarball, and passed automatic migration, post-Doctor configuration validation, persisted-state survival, Gateway startup and health/readiness checks.
  • The retained witness SHA-256 is 83a4efdba9b16f0a2443e70eb64e78ec3af8cdad6279872e458ceccd4f040b2a. The redacted witness and phase list are already publicly embedded in the PR body; this is not a new execution or a claim that every optional upgrade scenario ran.
  • I compared Git blobs between that tested commit and current head: these feature-relevant storage files are byte-identical: src/cron/store/delivery-codec.ts, external-state.worker.ts, run-recovery.types.ts, run-recovery.worker.ts, runtime-worker.types.ts and scheduler-state.worker.ts (all paths under src/cron/store/).
  • The intervening change to src/cron/store/run-finalization.worker.ts is entirely the incorporated main change: the stable patch ID is identical for tested-head → current-head and old-main 84097d6 → incorporated-main 5492b76: 27fad11e78025dbdc59749fe24b00f9f0f6539d5.
  • The current PR adds an optional failure threadId and recognizes it in the delivery codec; old rows without it remain valid. No upgrade rerun is being represented as necessary merely because the branch was rebased.
  • As additional current-head evidence, all three PostgreSQL conformance shards in run 42038451085 passed. This supplements, rather than replaces, the retained real-upgrade proof.

Please reassess the data-model compatibility checkbox using this existing proof and the input comparison above. The separate UI failure is now reproduced on untouched upstream main dcafc6e1d66e91f4d72a12910db87fc43718956a (the actual base of this CI run): the same session-management.groups.e2e.test.ts assertion at line 857 expects aria-expanded to be false, receives true; 8 other tests pass. All ui/** files and dependency manifests are unchanged by this PR. This is baseline attribution, not a claim that the failed CI check is green.

@roboclaw-bot

Copy link
Copy Markdown
Collaborator

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Nov 5, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@VACInc
VACInc enabled auto-merge (squash) November 5, 2026 14:18
@VACInc
VACInc disabled auto-merge November 5, 2026 14:18
@VACInc
VACInc merged commit 87c9eb3 into openclaw:main Nov 5, 2026
163 of 166 checks passed
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Nov 6, 2026
…penclaw#185848)

* feat(cron): configurable default delivery and failure destinations

Add cron.delivery and cron.agents.<agentId>.{delivery,failureAlert} so
route-less announce jobs and failure alerts can go to a configured
Gateway-wide or per-agent destination. Explicit job routes win, the
owning agent's default replaces the Gateway default whole, and defaults
resolve at run time without rewriting stored jobs. none and webhook
delivery never gain a chat destination.

* feat(cron): add creator-profile default destinations

Add cron.creators.<profileId>.delivery and .failureAlert, keyed by the
Gateway profile recorded in a job's createdActor (directly or as the
delegating human). Precedence is the job's own route, then the creator
default, then the owner-agent default, then the Gateway default. Legacy,
channel-only, unknown, agent, and system creators get no creator default.

* fix(cron): type creation-time default check without an assertion

The create-time default check cast raw cron tool input to CronDelivery,
which tripped the assertion SAFETY ratchet. Read the routing fields
structurally instead so stored jobs and raw tool input share one check.

* feat(config): validate cron default destinations at load

Reject a default destination whose channel names no installed channel
plugin (cron.delivery and the cron.agents/cron.creators delivery and
failureAlert routes). An unknown cron.failureAlert.channel only warns so
existing configs keep loading.

Reject cron.agents keys that resolve to the same agent id, sharing the
duplicate-key check with agents.entries.

* feat(doctor): check cron default destination channels

The delivery-target advisory now also lists configured default
destinations whose channel plugin is not active.

* docs(cron): document default destination validation

* fix(cron): deliver session-owned jobs as their owner

Resolve the effective job owner before selecting the runtime agent for completion and failure-alert sends. Strengthen delivery and recipient-persistence regressions for session-only ownership.

Co-authored-by: VACInc <[email protected]>

* test(cron): cover implicit announce failure defaults

Co-authored-by: VACInc <[email protected]>

* fix(cron): support backward-compatible failure alert threads

Preserve existing routing when no new defaults are configured. Carry optional failure thread selectors through schema, storage, merge and dispatch; retain legacy Telegram topic routes and repair alert-only intent. Update generated validators and focused integration coverage.

Co-authored-by: VACInc <[email protected]>

* test(cron): fix failure thread fixture types

Keep creator attribution typed, provide the merge fallback mode, and assert optional results before checking persistence.

Co-authored-by: VACInc <[email protected]>

* fix(cron): align rebased test-line allocation

Reduce the regression allowance to the actual 733 added test lines after refreshing the main baseline.

Co-authored-by: VACInc <[email protected]>

---------

Co-authored-by: VACInc <[email protected]>
Co-authored-by: VACInc <[email protected]>
Co-authored-by: roboclaw-bot <[email protected]>
github-actions Bot pushed a commit to clawhaven/openclaw that referenced this pull request Nov 23, 2026
…penclaw#185848)

* feat(cron): configurable default delivery and failure destinations

Add cron.delivery and cron.agents.<agentId>.{delivery,failureAlert} so
route-less announce jobs and failure alerts can go to a configured
Gateway-wide or per-agent destination. Explicit job routes win, the
owning agent's default replaces the Gateway default whole, and defaults
resolve at run time without rewriting stored jobs. none and webhook
delivery never gain a chat destination.

* feat(cron): add creator-profile default destinations

Add cron.creators.<profileId>.delivery and .failureAlert, keyed by the
Gateway profile recorded in a job's createdActor (directly or as the
delegating human). Precedence is the job's own route, then the creator
default, then the owner-agent default, then the Gateway default. Legacy,
channel-only, unknown, agent, and system creators get no creator default.

* fix(cron): type creation-time default check without an assertion

The create-time default check cast raw cron tool input to CronDelivery,
which tripped the assertion SAFETY ratchet. Read the routing fields
structurally instead so stored jobs and raw tool input share one check.

* feat(config): validate cron default destinations at load

Reject a default destination whose channel names no installed channel
plugin (cron.delivery and the cron.agents/cron.creators delivery and
failureAlert routes). An unknown cron.failureAlert.channel only warns so
existing configs keep loading.

Reject cron.agents keys that resolve to the same agent id, sharing the
duplicate-key check with agents.entries.

* feat(doctor): check cron default destination channels

The delivery-target advisory now also lists configured default
destinations whose channel plugin is not active.

* docs(cron): document default destination validation

* fix(cron): deliver session-owned jobs as their owner

Resolve the effective job owner before selecting the runtime agent for completion and failure-alert sends. Strengthen delivery and recipient-persistence regressions for session-only ownership.

Co-authored-by: VACInc <[email protected]>

* test(cron): cover implicit announce failure defaults

Co-authored-by: VACInc <[email protected]>

* fix(cron): support backward-compatible failure alert threads

Preserve existing routing when no new defaults are configured. Carry optional failure thread selectors through schema, storage, merge and dispatch; retain legacy Telegram topic routes and repair alert-only intent. Update generated validators and focused integration coverage.

Co-authored-by: VACInc <[email protected]>

* test(cron): fix failure thread fixture types

Keep creator attribution typed, provide the merge fallback mode, and assert optional results before checking persistence.

Co-authored-by: VACInc <[email protected]>

* fix(cron): align rebased test-line allocation

Reduce the regression allowance to the actual 733 added test lines after refreshing the main baseline.

Co-authored-by: VACInc <[email protected]>

---------

Co-authored-by: VACInc <[email protected]>
Co-authored-by: VACInc <[email protected]>
Co-authored-by: roboclaw-bot <[email protected]>

Source: 87c9eb3

Release adaptation: Only failure-alert effective owner selection uses existing canonical explicit-agent then session-agent then default resolver. Updated existing table regression for session-owner precedence. Excluded all destination config/schema/default/thread features and all unrelated hunks. Companion script timed out 35s; pinned PR log has source only; bounded source owner reviewed. Format/diff pass; runtime setup gap retained.

Co-authored-by: RomneyDa <[email protected]>
(cherry picked from commit 9917307fe1fe6aa7521e776a1d06686574e45012)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts security-sensitive-changed size: XL

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants