Repository navigation
feat(cron): declarative jobs with owner attribution and richer status - #100480
Conversation
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 53ee8646e1
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (job.sessionTarget === "main" && job.delivery?.mode === "webhook") { | ||
| throw new Error("main-session cron jobs do not support webhook delivery"); |
There was a problem hiding this comment.
Keep main-session webhook cron creation working
When a caller creates a main-session systemEvent job with delivery.mode="webhook", this new guard rejects it before the cron service sees the request. That breaks the existing Gateway/CLI path: addWebhookCronJob defaults sessionTarget to main in src/gateway/server.cron.test.ts:312, and the webhook delivery test creates exactly that shape at src/gateway/server.cron.test.ts:1486; the service contract still preserves main-session webhook jobs in src/cron/service.get-job.test.ts:49. Since webhook delivery is standalone and does not require an isolated chat target, keep validating the URL/channel fields without rejecting sessionTarget: "main".
Useful? React with 👍 / 👎.
|
Codex review: needs real behavior proof before merge. Reviewed July 5, 2026, 10:28 PM ET / 02:28 UTC. Summary PR surface: Source +619, Tests +767, Generated +8, Other +105. Total +1499 across 43 files. Reproducibility: not applicable. as a feature PR; the relevant behavior is source-testable through the new service/gateway tests and should be validated through exact-head cron add/convergence scenarios. Review metrics: 2 noteworthy metrics.
Stored data model Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review detailsBest possible solution: Land the cron-native declarative job surface only after maintainers accept the protocol/data-model contract and exact-head validation proves fresh-install and upgrade behavior. Do we have a high-confidence way to reproduce the issue? Not applicable as a feature PR; the relevant behavior is source-testable through the new service/gateway tests and should be validated through exact-head cron add/convergence scenarios. Is this the best way to solve the issue? The cron-native approach appears better than the superseded routines registry because it keeps one scheduler/store/RPC noun, but final API and upgrade acceptance is a maintainer product decision. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 9d9661e47375. Label changesLabel changes:
Label justifications:
Evidence reviewedPR surface: Source +619, Tests +767, Generated +8, Other +105. Total +1499 across 43 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)
|
53ee864 to
f43f44e
Compare
|
Repaired the three red checks on head f43f44e90e:
Local |
7a9ba26 to
9f507a4
Compare
Adds scope-local declaration-key convergence, immutable owner attribution, richer status projection, and delivery validation to canonical cron jobs. Supersedes the #98727 routines registry approach; no parallel registry, RPC namespace, or CLI noun.
9f507a4 to
c871157
Compare
…openclaw#100480) Adds scope-local declaration-key convergence, immutable owner attribution, richer status projection, and delivery validation to canonical cron jobs. Supersedes the openclaw#98727 routines registry approach; no parallel registry, RPC namespace, or CLI noun.
Summary
Extends canonical cron jobs with the capabilities #98727 built as a separate "routines" registry — as plain additive cron features, per the product decision that a routine is not a new concept. No new table, service, RPC namespace, or CLI noun.
cron.addgains optionaldeclarationKey. Re-declaring the same key converges the existing job (schedule/payload/delivery/displayName, enablement only when explicitly set) in one store lock + write transaction —{created:false, updated:true|false}— preserving job id, run history, and current enablement. No staged-write state machines, no drift model: with one store there is nothing to drift from. Identity-adjacent fields (name, target, routing, owner) are deliberately outside convergence.agentRuntimeIdentity(structural, not marker-based) and getownerstamped automatically; operators may pass explicit owner. Owner is immutable attribution.declarationKey,displayName,owner,nextRunAtMs,lastRunAtMs/Status/Error, last delivery and failure-notification outcomes — derived from existing job/run/delivery state only.cron-caller-scope.tsandcron-error-classification.tsextractions (gatewaycron.tsnet −169),delivery-channel-validation.tswired into add/converge (main-session jobs reject webhook delivery), update preconditions, and blank/duplicate-id validation.cron_jobscolumns via the existingensureColumnpattern; protocol schemas extended additively with regenerated JSON schema + Swift models (defaulted initializers keep source compat);openclaw cron addgains--declaration-key/--display-name; the cron agent tool extended in place.36 files, +1,784/−411 — replacing #98727's +6,539/−406 (51 files) for the same operator capability, minus the second concept.
Proof
pnpm tsgoclean (verified twice: implementation run + independent review run).pnpm protocol:gen && protocol:gen:swift— regeneration byte-identical post-commit.Non-goals
Trigger-kind generalization (repository events, webhooks, channel-watch) is the intended follow-up on this same surface — a job's trigger becomes a kind,
schedulebeing the first. No UI changes.Supersedes #98727.
Implemented by Codex (gpt-5.6-sol, high reasoning) from a frozen spec; reviewed and independently verified by Claude.