Skip to content

feat(cron): event triggers — polled condition-watcher scripts via code mode#101195

Merged
steipete merged 9 commits into
mainfrom
claude/quirky-dirac-3eeaff
Jul 7, 2026
Merged

feat(cron): event triggers — polled condition-watcher scripts via code mode#101195
steipete merged 9 commits into
mainfrom
claude/quirky-dirac-3eeaff

Conversation

@steipete

@steipete steipete commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Closes #101194

What Problem This Solves

Watching external state ("wake me when CI on PR 123 changes status") currently requires heartbeat- or cron-waking the full agent so the model can poll — every check burns tokens and adds latency even when nothing changed. Cron had no general event-shaped trigger beyond the on-exit process watcher.

Why This Change Was Made

Cron jobs gain an optional trigger: { script, once? } on every/cron schedules: a JavaScript condition script evaluated headlessly in the existing code-mode QuickJS sandbox on each due tick, with the owning agent's tool policy (tools.call) and persisted trigger.state for change detection. The script returns { fire, message?, state? }; only fire: true runs the payload through the normal cron pipeline (wake modes, delivery, run logs, retry/backoff, failure alerts). Poll-over-push keeps per-source core wiring at zero — anything a tool can reach becomes a trigger source — and the contract leaves room for push sources (webhooks/hook bus) to feed the same scripts later.

Key decisions:

  • Headless driver (runCodeModeScriptHeadless): loops exec → settle bridge tool calls → resume to completion in one call; never stores snapshots, never creates a session, bypasses the agent exec/wait machinery. Zero changes to the QuickJS worker; trigger.state injects via the existing namespace-descriptor path (deep-frozen; scripts return new state).
  • Reliability: fired-run state persists only when the payload run succeeds, so a failed wake re-detects the change and fires again instead of silently losing the event. Quiet ticks reset error counters, keep per-job cron staggering, and write no cron_run_logs rows.
  • Safety: gated by cron.triggers.enabled (default off; enabling means agent-authored scripts run unattended with that agent's full tool policy, including exec — docs carry a loud warning). Per-eval budgets: 30s wall clock, 5 tool calls, 16KB state, 30s min poll interval (configurable floor), max 3 concurrent evals, before-tool-call hooks still wrap script-initiated calls.
  • Storage: script/once stored as columns on cron_jobs (additive ensureColumn migration, no schema version bump); eval counters/state ride the existing state_json.
  • Surfaces: gateway RPC (cron.add/update + protocol schemas), agent cron tool, CLI (--trigger-script <path|->, --trigger-once, --clear-trigger, list/get display), triggerFired on run-log entries. Force-runs bypass evaluation; once disarms after the first successful fired payload.

User Impact

Agents and operators can set up zero-token watchers: "check CI every 30s, wake me only on change." Existing cron jobs and configs are unaffected; the feature is off by default and trigger-bearing jobs validate against the enabled gate at create/patch time. Docs: docs/automation/cron-jobs.md gains an "Event triggers (condition watchers)" section.

Evidence

  • New tests: src/agents/code-mode-headless.test.ts (10 — multi-round tool calls with no snapshot leakage, frozen state injection, budget/timeout/abort/failure taxonomy, override clamps), src/cron/trigger-script.test.ts (11 — result parsing, state cap, semaphore busy, single-flight cache, abort cancellation), src/cron/service.trigger-eval.test.ts (10 — quiet ticks leave no run history + counters persist, fired runs append message + mark triggerFired, evaluator errors ride backoff, busy skip, once disarm vs errored-fire retry, missing-evaluator error, force-run bypass, stagger preservation, state kept on failed fired payload), plus store codec round-trip, persisted-shape, normalize, protocol validator, zod config, CLI flag, and RPC gate coverage.
  • Remote gate: full pnpm check:changed green on Blacksmith Testbox (all lanes incl. typechecks, lint, kysely drift): https://github.com/openclaw/openclaw/actions/runs/28817511044
  • Structured autoreview (Codex, gpt-5.5) over the full branch diff: clean on final run; two earlier review rounds surfaced and fixed real bugs (startup catch-up dropping triggerEval; quiet ticks bypassing cron staggering).
  • pnpm db:kysely:check clean after regen; branch rebased onto latest origin/main with focused tests re-run post-rebase.

Release-note context: feat(cron): event triggers — polled condition-watcher scripts run headlessly via code mode; payload fires only when the watched condition changes. Requested by @steipete.

@steipete
steipete requested a review from a team as a code owner July 6, 2026 21:30
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes agents Agent runtime and tooling size: XL maintainer Maintainer-authored PR labels Jul 6, 2026

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 1b1c33a6c3

ℹ️ 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".

Comment thread src/cron/service/jobs.ts
if (patch.trigger === null || patch.trigger === undefined) {
delete job.trigger;
} else {
job.trigger = structuredClone(patch.trigger);

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Reset stale trigger state when replacing scripts

When an existing trigger is edited (or cleared and later re-added), this only swaps job.trigger and leaves job.state.triggerState/last trigger metadata intact. In the common watcher pattern documented for comparing current status to trigger.state, changing a job from watching one resource to another can compare the new script against the old script's state and either suppress the first real event or fire for the wrong previous value. Clear the stored trigger state/counters when the trigger script changes or is removed, while preserving state for once-only edits.

Useful? React with 👍 / 👎.

@clawsweeper

clawsweeper Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Codex review: found issues before merge. Reviewed July 7, 2026, 2:06 PM ET / 18:06 UTC.

Summary
The PR adds default-off cron trigger scripts evaluated through headless Code Mode, with CLI/RPC/config/SQLite/protocol/Swift/docs/test coverage.

PR surface: Source +1367, Tests +1318, Docs +40, Generated +4, Other +12. Total +2741 across 53 files.

Reproducibility: not applicable. as a user bug repro; this is a feature PR. The remaining review blockers are source-reproducible on the current PR head from the trigger patch, timer, and config schema paths.

Review metrics: 3 noteworthy metrics.

  • Config Surface: 2 keys added. cron.triggers.enabled and cron.triggers.minIntervalMs are operator-visible settings for a security-sensitive default-off feature.
  • Persistent Cron Schema: 2 columns added. trigger_script and trigger_once extend stored cron jobs, so upgrade and generated-schema consistency matter before merge.
  • Cron Public API: 3 CLI flags plus 1 trigger object added. --trigger-script, --trigger-once, --clear-trigger, and the cron RPC trigger shape become user-facing cron command/API contract.

Stored data model
Persistent data-model change detected: serialized state: src/cli/cron-cli/trigger-options.test.ts, serialized state: src/cli/cron-cli/trigger-options.ts, serialized state: src/cron/persisted-shape.trigger.test.ts, serialized state: src/cron/service/state.ts, serialized state: src/state/openclaw-state-db.generated.d.ts, unknown-data-model-change: packages/gateway-protocol/src/schema/cron.ts, and 1 more. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #101194
Summary: This PR is the active candidate implementation for the linked cron condition-watcher feature request.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦐 gold shrimp
Proof: 🦞 diamond lobster
Patch quality: 🦐 gold shrimp
Result: needs maintainer review before merge.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P2] Fix the stale trigger-state reset, quiet-tick artifact, and config metadata findings.
  • Refresh the branch and rerun relevant exact-head checks after the fixes.
  • Get explicit maintainer acceptance for the default-off unattended trigger-script boundary.

Risk before merge

  • [P1] Merging adds cron config keys, protocol fields, CLI flags, Swift bindings, and SQLite columns, so operator-facing metadata and upgrade behavior need to be consistent before release.
  • [P1] When enabled, trigger scripts run unattended with the owning agent's tool policy, including exec when allowed; maintainers need to explicitly accept that security boundary.
  • [P1] The branch is behind current main, so it should be refreshed and rechecked after the source blockers are fixed.

Maintainer options:

  1. Fix Blockers Before Security Signoff (recommended)
    Fix quiet-tick artifacts, stale trigger state, and config metadata before asking for final maintainer acceptance of the unattended trigger boundary.
  2. Accept The Boundary Explicitly
    A maintainer may accept the default-off script execution model after reviewing inherited tools, budgets, docs warnings, and audit behavior.
  3. Pause For A Smaller Design
    If the compatibility or security surface is too broad, pause this PR and keep the linked issue open for a narrower design.

Next step before merge

  • [P2] The PR needs contributor fixes for concrete blockers and maintainer acceptance of the protected compatibility/security boundary before merge; it is not a safe autonomous repair lane while that decision is pending.

Maintainer decision needed

  • Question: Should OpenClaw accept default-off cron trigger scripts that run headlessly with the owning agent's tool policy, including exec when that policy allows it?
  • Rationale: The PR creates a new core cron/config/protocol/storage capability and a new unattended code-execution path, so automation can find defects but cannot decide the permanent product and security boundary.
  • Likely owner: steipete — steipete has the strongest merged cron/code-mode history among the likely owners and opened the paired feature work.
  • Options:
    • Accept After Blockers Are Fixed (recommended): Land the feature after the three P2 blockers are fixed, the branch is refreshed, and the default-off gate plus operator warnings remain explicit.
    • Narrow The First Version: Keep the PR open while maintainers decide stricter tool limits, audit behavior, or a smaller trigger contract before implementation proceeds.
    • Defer Core Support: Pause or close the paired work if maintainers decide condition watching should wait for a plugin, webhook, or hook-bus design instead of core cron scripts.

Security
Needs attention: The diff intentionally adds a default-off unattended script execution path with inherited agent tools, so maintainer security acceptance is still required.

Review findings

  • [P2] Clear trigger state when replacing scripts — src/cron/service/jobs.ts:983-989
  • [P2] Avoid run artifacts for quiet trigger polls — src/cron/service/timer.ts:1379-1381
  • [P2] Document trigger config in schema metadata — src/config/zod-schema.ts:924-930
Review details

Best possible solution:

Land only after quiet polls create no run/task artifacts, trigger state resets on script replacement or removal, config metadata warns operators, and a maintainer accepts the default-off security boundary.

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

Not applicable as a user bug repro; this is a feature PR. The remaining review blockers are source-reproducible on the current PR head from the trigger patch, timer, and config schema paths.

Is this the best way to solve the issue?

Not yet; the cron/code-mode owner boundary is plausible, but this head is not the best mergeable solution until quiet ticks are artifact-free, replacement scripts clear stale state, and config metadata carries the security warning.

Full review comments:

  • [P2] Clear trigger state when replacing scripts — src/cron/service/jobs.ts:983-989
    The prior blocker remains: replacing or clearing a trigger only updates job.trigger and leaves job.state.triggerState plus trigger counters/timestamps intact. The documented compare-to-trigger.state watcher can inherit a previous resource's state and either suppress the first real event or report the wrong previous value; clear trigger evaluation state when the script changes or is removed, while preserving it for once-only edits.
    Confidence: 0.92
  • [P2] Avoid run artifacts for quiet trigger polls — src/cron/service/timer.ts:1379-1381
    The prior blocker remains: scheduled due jobs emit started and create a cron task run before trigger evaluation. A fire:false result later skips the payload and finished/run-log path, but quiet watchers can still produce started broadcasts and task artifacts; evaluate the trigger before creating run artifacts or fully suppress those artifacts for no-fire ticks.
    Confidence: 0.9
  • [P2] Document trigger config in schema metadata — src/config/zod-schema.ts:924-930
    The prior blocker remains: these new public config keys are added to the Zod schema, but FIELD_HELP and FIELD_LABELS still have no cron.triggers* entries even though schema-base and schema.hints populate public JSON schema and Control UI hints from those maps. Add labels/help so the security-sensitive opt-in carries warning/default/min-interval guidance.
    Confidence: 0.87

Overall correctness: patch is incorrect
Overall confidence: 0.9

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 21f251220fc0.

Label changes

Label justifications:

  • P2: This is a broad default-off feature PR with concrete correctness blockers and limited immediate blast radius.
  • merge-risk: 🚨 compatibility: The diff adds cron config, gateway protocol, CLI, Swift model, and SQLite storage surfaces that affect operator workflows and upgrades.
  • merge-risk: 🚨 security-boundary: The feature runs unattended trigger scripts with inherited agent tool policy, including exec when allowed, so the sandbox/tool boundary needs explicit maintainer acceptance.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🦐 gold shrimp.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action. Sufficient (live_output): Sufficient live-output proof is present: the PR comment describes a fresh gateway profile, real model/API run, quiet polling, one fired payload, triggerFired run-log output, and once disarm.
  • proof: sufficient: Contributor real behavior proof is sufficient. Sufficient live-output proof is present: the PR comment describes a fresh gateway profile, real model/API run, quiet polling, one fired payload, triggerFired run-log output, and once disarm.
Evidence reviewed

PR surface:

Source +1367, Tests +1318, Docs +40, Generated +4, Other +12. Total +2741 across 53 files.

View PR surface stats
Area Files Added Removed Net
Source 30 1437 70 +1367
Tests 18 1333 15 +1318
Docs 2 40 0 +40
Config 0 0 0 0
Generated 2 4 0 +4
Other 1 12 0 +12
Total 53 2826 85 +2741

Security concerns:

  • [medium] Review unattended tool-capable trigger scripts — src/cron/trigger-script.ts:148
    Trigger evaluation constructs the agent coding-tool catalog and runs scripts headlessly; when enabled, this can call tools such as exec under the owning agent policy, so maintainers need to accept the gate, budgets, logging, docs warning, and audit behavior before merge.
    Confidence: 0.87

What I checked:

  • Repository policy read and applied: Root AGENTS.md and scoped docs, agents, agent tools, gateway, gateway methods, and test guides were read; protected-label, config-surface, storage, security-boundary, and whole-surface PR review guidance affected the verdict. (AGENTS.md:1, 21f251220fc0)
  • Current main lacks the requested trigger shape: Current main has on-exit as the only event-shaped cron schedule and no cron trigger script field, so the PR is not obsolete or implemented on main. (src/cron/types.ts:9, 21f251220fc0)
  • Trigger replacement still preserves stale state: The PR head replaces or deletes job.trigger without clearing triggerState, triggerEvalCount, or trigger timestamps, so a new watcher can inherit state from a previous script. (src/cron/service/jobs.ts:983, 1481b609b2a3)
  • Quiet trigger polls still create run artifacts first: The timer emits a started event and creates a cron task run before executeJobCoreWithTimeout can evaluate the trigger and return fire:false. (src/cron/service/timer.ts:1379, 1481b609b2a3)
  • Config metadata is incomplete: The PR adds cron.triggers.enabled and cron.triggers.minIntervalMs to the Zod schema, but schema.help.ts and schema.labels.ts still have no matching entries used by public schema and UI hints. (src/config/zod-schema.ts:924, 1481b609b2a3)
  • Security-sensitive execution path: The trigger evaluator builds the agent coding-tool catalog and runs scripts headlessly with the owning agent context, including exec when that policy allows it. (src/cron/trigger-script.ts:148, 1481b609b2a3)

Likely related people:

  • steipete: Authored recent merged declarative cron job work and code-mode namespace/API work in the same boundary this PR extends, and opened the linked feature issue and PR. (role: feature proposer and recent cron/code-mode contributor; confidence: high; commits: fdc9aa82d785, 287687da2098, 4150c6ff8258; files: src/cron/service/jobs.ts, packages/gateway-protocol/src/schema/cron.ts, src/agents/code-mode.ts)
  • anagnorisis2peripeteia: Authored the merged on-exit cron schedule feature, the closest current-main event-trigger behavior that this PR generalizes beyond watched process exits. (role: existing event-shaped cron schedule contributor; confidence: medium; commits: 68bfa42b9bfc, 9aea104cc88a; files: src/cron/types.ts, src/gateway/cron-exit-watchers.ts, packages/gateway-protocol/src/schema/cron.ts)
  • obviyus: Authored recent merged cron tool-policy work that overlaps this PR's inherited tool policy boundary for agentTurn cron payloads. (role: adjacent cron tool-policy contributor; confidence: medium; commits: 17066f2d7c01, cfdc2b3ff908; files: src/cron/service/jobs.ts, src/cron/types.ts, src/agents/tools/cron-tool.ts)
  • vincentkoc: Authored recent code-mode refactors and is present in coauthor/review history for related cron fixes, making this person relevant to the headless code-mode/tool-policy review surface. (role: agent/code-mode and cron-adjacent contributor; confidence: medium; commits: 2e44610ba237, b63acf54f964, efbefceb0e2e; files: src/agents/code-mode.ts, src/cron/service/timer.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

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
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.
Review history (4 earlier review cycles)
  • reviewed 2026-07-06T21:52:45.698Z sha 1b1c33a :: needs real behavior proof before merge. :: [P2] Clear trigger state when replacing scripts
  • reviewed 2026-07-07T09:43:08.030Z sha 3359f18 :: found issues before merge. :: [P2] Clear trigger state when replacing scripts | [P2] Avoid run artifacts for quiet trigger polls
  • reviewed 2026-07-07T16:27:47.681Z sha c07162e :: found issues before merge. :: [P2] Clear trigger state when replacing scripts | [P2] Avoid run artifacts for quiet trigger polls | [P2] Document trigger config in schema metadata
  • reviewed 2026-07-07T17:58:04.924Z sha 7249f38 :: found issues before merge. :: [P2] Clear trigger state when replacing scripts | [P2] Avoid run artifacts for quiet trigger polls | [P2] Document trigger config in schema metadata

@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. labels Jul 6, 2026
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Real behavior proof — live end-to-end run (2026-07-06, isolated gateway on macOS)

Setup: fresh OPENCLAW_STATE_DIR profile, gateway from this branch on :19801, cron: { triggers: { enabled: true, minIntervalMs: 5000 } }, model openai/gpt-5.5 (real OpenAI API key), no channels.

1. Agent authored the watcher itself via the cron tool from a natural-language instruction — created job 41623b71-8bc9-460b-9f3f-4a91af215406 with schedule: every 5s, once: true, and a trigger script that tools.call('exec')-reads a signal file and fires only when content differs from trigger.state.last.

2. Quiet polling (the whole point): gateway evaluated the script headlessly every 5s — observed triggerEvalCount: 8, persisted triggerState: { last: "pending" }, payload never ran, and cron runs stayed empty (no run-history rows for quiet ticks).

3. Trip → fire: changed the signal file pending → green. Within one tick the trigger fired, an isolated gpt-5.5 turn woke and executed the payload (wrote the expected file, replied DONE). Run log then contained exactly one entry:

{ "action": "finished", "status": "ok", "summary": "DONE", "triggerFired": true }

4. once disarm: job auto-disabled after the successful fired payload; openclaw cron list --all shows signal-watcher every 5s+trigger … disabled.

Hosted gates: full pnpm check:changed green on Blacksmith Testbox — https://github.com/openclaw/openclaw/actions/runs/28817511044

Security note for reviewers: the run exercised the exact boundary flagged — agent-authored script executing unattended with the agent's tool policy — behind the default-off cron.triggers.enabled gate; the docs warning shipped in this PR covers it.

steipete added a commit that referenced this pull request Jul 7, 2026
…e cycle for trigger types

CI fixes for #101195: trigger evaluator result types move to the cron
types leaf (madge cycle), cron tool schema inventory gains trigger,
Swift protocol bindings + docs map + Linux prompt snapshots regenerated.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 3359f18461

ℹ️ 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".

Comment thread src/cron/service/timer.ts
Comment on lines +1134 to +1137
if (result.status === "ok" && result.triggerEval && !result.triggerEval.fired) {
// Quiet trigger ticks intentionally emit no finished event: run history,
// plugin hooks, and completion notifications represent payload runs only.
applyTriggerNoFireResult(state, job, {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid run artifacts for quiet trigger polls

When a trigger returns fire: false, this branch runs only after runDueJob has already emitted the started cron event and created a task-ledger run; returning here suppresses the matching finished/run-log entry, so a quiet 30s watcher can produce endless started-only broadcasts/cron_changed hooks and completed task rows even though no payload ran. Evaluate the trigger before emitting/creating run artifacts, or suppress those artifacts for no-fire ticks.

Useful? React with 👍 / 👎.

@clawsweeper clawsweeper Bot added the proof: sufficient ClawSweeper judged the real behavior proof convincing. label Jul 7, 2026
steipete added a commit that referenced this pull request Jul 7, 2026
…e cycle for trigger types

CI fixes for #101195: trigger evaluator result types move to the cron
types leaf (madge cycle), cron tool schema inventory gains trigger,
Swift protocol bindings + docs map + Linux prompt snapshots regenerated.
@steipete
steipete force-pushed the claude/quirky-dirac-3eeaff branch from 3359f18 to c07162e Compare July 7, 2026 16:06

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: c07162eaf5

ℹ️ 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".

Comment thread src/config/zod-schema.ts
Comment on lines +924 to +928
triggers: z
.object({
enabled: z.boolean().optional(),
minIntervalMs: z.number().int().positive().optional(),
})

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Document trigger config in schema metadata

This adds new public config keys (cron.triggers.enabled / minIntervalMs) but only the docs page was updated; src/config/schema-base.ts and src/config/schema.hints.ts populate public JSON schema/UI hints from FIELD_HELP and FIELD_LABELS, and those maps still have no cron.triggers* entries. In the config schema/Control UI, the security-sensitive opt-in for unattended headless tool execution is therefore exposed without the warning/default/min-interval guidance, making it easy for operators to enable or tune incorrectly; add labels/help alongside the schema keys.

Useful? React with 👍 / 👎.

steipete added 7 commits July 7, 2026 10:58
Part A of cron event triggers: runCodeModeScriptHeadless runs a script
to completion (exec/settle/resume, no snapshots, no session), plus the
cron-facing evaluator with per-job tool catalog cache, semaphore, 16KB
state cap, and closed failure taxonomy.
Part B: trigger field on cron jobs gated by cron.triggers.enabled;
timer evaluates the script each due tick, quiet ticks leave no run
history, fired runs append the script message to the payload; once
semantics, min-interval floor, SQLite columns, RPC/CLI/agent-tool
surfaces, and docs.
…e cycle for trigger types

CI fixes for #101195: trigger evaluator result types move to the cron
types leaf (madge cycle), cron tool schema inventory gains trigger,
Swift protocol bindings + docs map + Linux prompt snapshots regenerated.
steipete added 2 commits July 7, 2026 10:58
…symbol localization

Upstream #101831 made registerToolSearchCatalog module-private; fold the
headless ref-only catalog registration into one public seam.
@steipete
steipete force-pushed the claude/quirky-dirac-3eeaff branch from 7249f38 to 1481b60 Compare July 7, 2026 18:00
@steipete
steipete merged commit a6768d9 into main Jul 7, 2026
102 checks passed
@steipete
steipete deleted the claude/quirky-dirac-3eeaff branch July 7, 2026 18:12
@steipete

steipete commented Jul 7, 2026

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Jul 8, 2026
…e mode (openclaw#101195)

* feat(cron): add headless code-mode driver and trigger-script evaluator

Part A of cron event triggers: runCodeModeScriptHeadless runs a script
to completion (exec/settle/resume, no snapshots, no session), plus the
cron-facing evaluator with per-job tool catalog cache, semaphore, 16KB
state cap, and closed failure taxonomy.

* fix(cron): correct trigger-script bootstrap flags and cache narrowing

* feat(cron): add event triggers (polled condition-watcher scripts)

Part B: trigger field on cron jobs gated by cron.triggers.enabled;
timer evaluates the script each due tick, quiet ticks leave no run
history, fired runs append the script message to the payload; once
semantics, min-interval floor, SQLite columns, RPC/CLI/agent-tool
surfaces, and docs.

* fix(cron): propagate triggerEval through startup catch-up outcomes

* fix(cron): honor cron staggering on quiet trigger ticks; fix trigger test types

* fix(cron): reject with Error reason in trigger-script abort test

* fix(cron): regenerate protocol/docs/snapshot artifacts and break madge cycle for trigger types

CI fixes for openclaw#101195: trigger evaluator result types move to the cron
types leaf (madge cycle), cron tool schema inventory gains trigger,
Swift protocol bindings + docs map + Linux prompt snapshots regenerated.

* fix(cron): drop underscore-dangle names in trigger code sync assert

* fix(cron): adopt registerHeadlessToolSearchCatalog after tool-search symbol localization

Upstream openclaw#101831 made registerToolSearchCatalog module-private; fold the
headless ref-only catalog registration into one public seam.
giodl73-repo pushed a commit to giodl73-repo/openclaw that referenced this pull request Jul 8, 2026
…e mode (openclaw#101195)

* feat(cron): add headless code-mode driver and trigger-script evaluator

Part A of cron event triggers: runCodeModeScriptHeadless runs a script
to completion (exec/settle/resume, no snapshots, no session), plus the
cron-facing evaluator with per-job tool catalog cache, semaphore, 16KB
state cap, and closed failure taxonomy.

* fix(cron): correct trigger-script bootstrap flags and cache narrowing

* feat(cron): add event triggers (polled condition-watcher scripts)

Part B: trigger field on cron jobs gated by cron.triggers.enabled;
timer evaluates the script each due tick, quiet ticks leave no run
history, fired runs append the script message to the payload; once
semantics, min-interval floor, SQLite columns, RPC/CLI/agent-tool
surfaces, and docs.

* fix(cron): propagate triggerEval through startup catch-up outcomes

* fix(cron): honor cron staggering on quiet trigger ticks; fix trigger test types

* fix(cron): reject with Error reason in trigger-script abort test

* fix(cron): regenerate protocol/docs/snapshot artifacts and break madge cycle for trigger types

CI fixes for openclaw#101195: trigger evaluator result types move to the cron
types leaf (madge cycle), cron tool schema inventory gains trigger,
Swift protocol bindings + docs map + Linux prompt snapshots regenerated.

* fix(cron): drop underscore-dangle names in trigger code sync assert

* fix(cron): adopt registerHeadlessToolSearchCatalog after tool-search symbol localization

Upstream openclaw#101831 made registerToolSearchCatalog module-private; fold the
headless ref-only catalog registration into one public seam.
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 docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. merge-risk: 🚨 security-boundary 🚨 May affect sandboxing, authorization, credentials, or sensitive data. P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. size: XL status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

feat(cron): event triggers — polled condition-watcher scripts via code mode

1 participant