Skip to content

ui(cron): add advanced controls for run-if-due and routing#31244

Merged
Takhoffman merged 5 commits intomainfrom
task/cron-ui-cli-parity
Mar 2, 2026
Merged

ui(cron): add advanced controls for run-if-due and routing#31244
Takhoffman merged 5 commits intomainfrom
task/cron-ui-cli-parity

Conversation

@Takhoffman
Copy link
Copy Markdown
Contributor

@Takhoffman Takhoffman commented Mar 2, 2026

Summary

Describe the problem and fix in 2–5 bullets:

  • Problem: Web cron management was missing advanced controls available in CLI (session-key, delivery account, light-context, and due-only run mode).
  • Why it matters: Cron jobs configured from Web UI could not express full routing/execution intent, causing avoidable CLI-only workflows.
  • What changed: Added advanced Web UI controls and payload wiring for sessionKey, delivery accountId, lightContext, and Run if due (cron.run mode due).
  • What did NOT change (scope boundary): Did not change gateway cron semantics or add new cron API methods; this is UI/controller/type wiring only.

Change Type (select all)

  • Bug fix
  • Feature
  • Refactor
  • Docs
  • Security hardening
  • Chore/infra

Scope (select all touched areas)

  • Gateway / orchestration
  • Skills / tool execution
  • Auth / tokens
  • Memory / storage
  • Integrations
  • API / contracts
  • UI / DX
  • CI/CD / infra

Linked Issue/PR

  • None

User-visible / Behavior Changes

  • Cron job editor now exposes Advanced Session key field.
  • Cron delivery now supports Advanced Account ID input for multi-account channel routing.
  • Cron agent payload now supports Advanced Light context toggle.
  • Job rows now include Run if due, which triggers cron.run in due-only mode.

Security Impact (required)

  • New permissions/capabilities? (Yes/No): No
  • Secrets/tokens handling changed? (Yes/No): No
  • New/changed network calls? (Yes/No): No
  • Command/tool execution surface changed? (Yes/No): No
  • Data access scope changed? (Yes/No): No
  • If any Yes, explain risk + mitigation:

Repro + Verification

Environment

  • OS: macOS
  • Runtime/container: Node/pnpm workspace
  • Model/provider: N/A
  • Integration/channel (if any): Cron UI + Gateway RPC
  • Relevant config (redacted): default local dev config

Steps

  1. Open Web UI Cron tab.
  2. Create or edit an isolated agentTurn job.
  3. Set Advanced fields (Session key, Account ID, Light context) and use Run if due.

Expected

  • Fields are editable and persisted through cron.add/cron.update payloads.
  • Run if due sends cron.run with mode due.

Actual

  • Matches expected.

Evidence

Attach at least one:

  • Failing test/log before + passing after
  • Trace/log snippets
  • Screenshot/recording
  • Perf numbers (if relevant)

Human Verification (required)

What you personally verified (not just CI), and how:

  • Verified scenarios: Reviewed and validated payload wiring in controller/view paths; ran formatting checks on all touched files.
  • Edge cases checked: Edit-mode clearing semantics for sessionKey and lightContext; due-mode run wiring.
  • What you did not verify: Full browser Vitest suite in this environment (Playwright browser binary missing).

Compatibility / Migration

  • Backward compatible? (Yes/No): Yes
  • Config/env changes? (Yes/No): No
  • Migration needed? (Yes/No): No
  • If yes, exact upgrade steps:

Failure Recovery (if this breaks)

  • How to disable/revert this change quickly: Revert this PR.
  • Files/config to restore: ui/src/ui/controllers/cron.ts, ui/src/ui/views/cron.ts and associated UI type/default files.
  • Known bad symptoms reviewers should watch for: Missing/incorrect cron payload fields from Web UI edits.

Risks and Mitigations

List only real risks for this PR. Add/remove entries as needed. If none, write None.

  • Risk: Advanced fields could be misconfigured by users.
    • Mitigation: Fields are optional; existing defaults and behavior remain unchanged when unset.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui size: M maintainer Maintainer-authored PR labels Mar 2, 2026
Copy link
Copy Markdown

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

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: b7607a6ce0

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread ui/src/ui/controllers/cron.ts Outdated
? form.deliveryChannel.trim() || "last"
: undefined,
to: form.deliveryTo.trim() || undefined,
accountId: form.deliveryAccountId.trim() || undefined,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Send explicit accountId clears when editing cron jobs

When a job already has delivery.accountId, clearing the Account ID field in the UI does not remove it: form.deliveryAccountId.trim() || undefined yields undefined, and the gateway request path (ui/src/ui/gateway.ts JSON.stringify(frame)) drops undefined keys, so the cron.update patch omits accountId; on the server, mergeCronDelivery only clears the field when accountId is present in the patch. This leaves stale account routing that users cannot clear from the web editor.

Useful? React with 👍 / 👎.

@openclaw-barnacle openclaw-barnacle Bot added the gateway Gateway runtime label Mar 2, 2026
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Mar 2, 2026

Greptile Summary

This PR successfully adds advanced cron controls to the Web UI, bringing feature parity with CLI options. The implementation adds four new capabilities: sessionKey for routing, delivery accountId for multi-account channel setups, lightContext toggle for agent payloads, and "Run if due" mode.

Key changes:

  • Added type definitions for sessionKey, accountId, and lightContext across type files
  • Implemented form state management with proper defaults in app-defaults.ts
  • Added UI controls in views/cron.ts with appropriate conditional rendering (Account ID and Light context only shown for agentTurn payloads)
  • Implemented clearing semantics in controller: empty sessionKey field explicitly sends null when editing jobs that previously had values
  • Extended runCronJob function with mode parameter ("force" | "due")
  • Added comprehensive test coverage for all new features

Implementation quality:

  • Changes are well-structured and follow existing patterns
  • Backward compatible - all new fields are optional with sensible defaults
  • Test coverage includes edge cases like clearing lightContext on existing jobs
  • UI properly disabled Account ID field when delivery mode is not "announce"

Confidence Score: 5/5

  • This PR is safe to merge with minimal risk - well-tested UI additions with no breaking changes or security implications.
  • Score reflects comprehensive test coverage, careful implementation of clearing semantics, backward compatibility, and localized changes to UI layer only. No logical errors, security issues, or breaking changes identified.
  • No files require special attention - all changes are well-tested and follow existing patterns.

Last reviewed commit: cb9184b

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: bluebubbles Channel integration: bluebubbles channel: googlechat Channel integration: googlechat channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: nextcloud-talk Channel integration: nextcloud-talk channel: nostr Channel integration: nostr channel: telegram Channel integration: telegram channel: zalo Channel integration: zalo channel: zalouser Channel integration: zalouser commands Command implementations docker Docker and sandbox tooling agents Agent runtime and tooling channel: feishu Channel integration: feishu channel: irc size: XL and removed size: M labels Mar 2, 2026
@Takhoffman Takhoffman force-pushed the task/cron-ui-cli-parity branch from 386fd2c to 8b034bd Compare March 2, 2026 04:21
@openclaw-barnacle openclaw-barnacle Bot removed docs Improvements or additions to documentation channel: bluebubbles Channel integration: bluebubbles channel: googlechat Channel integration: googlechat channel: matrix Channel integration: matrix channel: mattermost Channel integration: mattermost labels Mar 2, 2026
Copy link
Copy Markdown

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

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: 8b034bda15

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

state.cronEditingJobId &&
existingLightContext !== undefined
) {
payload.lightContext = false;
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Persist lightContext changes when updating cron jobs

This change sends payload.lightContext in cron.update, but the update path currently discards that field: mergeCronPayload never applies patch.lightContext and buildPayloadFromPatch also omits it (src/cron/service/jobs.ts:554-582 and src/cron/service/jobs.ts:638-649). In practice, editing an existing job and toggling the new Light context control (especially turning it off) silently does not persist, so the UI suggests a change that the stored cron job never receives.

Useful? React with 👍 / 👎.

Copy link
Copy Markdown

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

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: d9df616fc2

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +647 to +648
accountId:
selectedDeliveryMode === "announce" ? form.deliveryAccountId.trim() : undefined,
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Use explicit clear sentinel for delivery accountId edits

When an existing cron job has delivery.accountId set, clearing the Account ID field still does not remove it: this code sends accountId as an empty string, but the cron.update path normalizes patches with normalizeCronJobPatch, which strips blank delivery.accountId values (src/cron/normalize.ts:198-204) before applyJobPatch runs (src/gateway/server-methods/cron.ts:119-123). That means the patch omits accountId entirely, so the old routing account remains persisted and cannot be cleared from the UI.

Useful? React with 👍 / 👎.

@Takhoffman Takhoffman force-pushed the task/cron-ui-cli-parity branch from d9df616 to 75f7d28 Compare March 2, 2026 13:19
@Takhoffman Takhoffman merged commit 254bb7c into main Mar 2, 2026
26 of 27 checks passed
@Takhoffman Takhoffman deleted the task/cron-ui-cli-parity branch March 2, 2026 13:24
@Takhoffman
Copy link
Copy Markdown
Contributor Author

Merged via squash at 254bb7c.

Verification run on PR head 75f7d28:

  • pnpm install --frozen-lockfile
  • pnpm build
  • pnpm check
  • pnpm test:macmini

All four commands passed in this final landing run.

Copy link
Copy Markdown

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

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: 75f7d28021

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment thread ui/src/ui/app-render.ts
...jobToSuggestions,
...accountToSuggestions,
]);
const accountSuggestions = uniquePreserveOrder(accountToSuggestions);
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Restrict account suggestions to IDs for cron delivery routing

accountSuggestions is now fed directly into the new Account ID input, but this list is built from accountToSuggestions, which also contains human-readable account.name values; when a name differs from its real ID, selecting it sends that name as delivery.accountId, and downstream account lookup resolves by account key/ID (not display name), so delivery can route to the wrong/default account or fail for multi-account setups. Keep accountSuggestions ID-only (or translate names back to IDs before submit) for this field.

Useful? React with 👍 / 👎.

hanqizheng pushed a commit to hanqizheng/openclaw that referenced this pull request Mar 2, 2026
…31244)

* ui(cron): add advanced run controls and routing fields

* ui(cron): gate delivery account id to announce mode

* ui(cron): allow clearing delivery account id in editor

* cron: persist payload lightContext updates

* tests(cron): fix payload lightContext assertion typing
Linux2010 pushed a commit to Linux2010/openclaw that referenced this pull request Mar 2, 2026
…31244)

* ui(cron): add advanced run controls and routing fields

* ui(cron): gate delivery account id to announce mode

* ui(cron): allow clearing delivery account id in editor

* cron: persist payload lightContext updates

* tests(cron): fix payload lightContext assertion typing
execute008 pushed a commit to execute008/openclaw that referenced this pull request Mar 2, 2026
…31244)

* ui(cron): add advanced run controls and routing fields

* ui(cron): gate delivery account id to announce mode

* ui(cron): allow clearing delivery account id in editor

* cron: persist payload lightContext updates

* tests(cron): fix payload lightContext assertion typing
dawi369 pushed a commit to dawi369/davis that referenced this pull request Mar 3, 2026
…31244)

* ui(cron): add advanced run controls and routing fields

* ui(cron): gate delivery account id to announce mode

* ui(cron): allow clearing delivery account id in editor

* cron: persist payload lightContext updates

* tests(cron): fix payload lightContext assertion typing
OWALabuy pushed a commit to kcinzgg/openclaw that referenced this pull request Mar 4, 2026
…31244)

* ui(cron): add advanced run controls and routing fields

* ui(cron): gate delivery account id to announce mode

* ui(cron): allow clearing delivery account id in editor

* cron: persist payload lightContext updates

* tests(cron): fix payload lightContext assertion typing
zooqueen pushed a commit to hanzoai/bot that referenced this pull request Mar 6, 2026
…31244)

* ui(cron): add advanced run controls and routing fields

* ui(cron): gate delivery account id to announce mode

* ui(cron): allow clearing delivery account id in editor

* cron: persist payload lightContext updates

* tests(cron): fix payload lightContext assertion typing
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 16, 2026
…31244)

* ui(cron): add advanced run controls and routing fields

* ui(cron): gate delivery account id to announce mode

* ui(cron): allow clearing delivery account id in editor

* cron: persist payload lightContext updates

* tests(cron): fix payload lightContext assertion typing

(cherry picked from commit 254bb7c)
alexey-pelykh pushed a commit to remoteclaw/remoteclaw that referenced this pull request Mar 16, 2026
…31244)

* ui(cron): add advanced run controls and routing fields

* ui(cron): gate delivery account id to announce mode

* ui(cron): allow clearing delivery account id in editor

* cron: persist payload lightContext updates

* tests(cron): fix payload lightContext assertion typing

(cherry picked from commit 254bb7c)
lukeg826 pushed a commit to lukeg826/openclaw that referenced this pull request Mar 26, 2026
…31244)

* ui(cron): add advanced run controls and routing fields

* ui(cron): gate delivery account id to announce mode

* ui(cron): allow clearing delivery account id in editor

* cron: persist payload lightContext updates

* tests(cron): fix payload lightContext assertion typing
lovewanwan pushed a commit to lovewanwan/openclaw that referenced this pull request Apr 28, 2026
…31244)

* ui(cron): add advanced run controls and routing fields

* ui(cron): gate delivery account id to announce mode

* ui(cron): allow clearing delivery account id in editor

* cron: persist payload lightContext updates

* tests(cron): fix payload lightContext assertion typing
ogt-redknie pushed a commit to ogt-redknie/OPENX that referenced this pull request May 2, 2026
…31244)

* ui(cron): add advanced run controls and routing fields

* ui(cron): gate delivery account id to announce mode

* ui(cron): allow clearing delivery account id in editor

* cron: persist payload lightContext updates

* tests(cron): fix payload lightContext assertion typing
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request May 9, 2026
…31244)

* ui(cron): add advanced run controls and routing fields

* ui(cron): gate delivery account id to announce mode

* ui(cron): allow clearing delivery account id in editor

* cron: persist payload lightContext updates

* tests(cron): fix payload lightContext assertion typing
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui maintainer Maintainer-authored PR size: M

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant