Repository navigation
Manage Claw cron jobs through the gateway - #102383
Conversation
|
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
Codex review: needs real behavior proof before merge. Reviewed July 20, 2026, 5:34 PM ET / 21:34 UTC. Summary PR surface: Source +613, Tests +498, Docs +27, Generated +28. Total +1166 across 20 files. Reproducibility: yes. from source: remove an agent through ordinary Review metrics: 1 noteworthy metric.
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:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Maintainer decision needed
Security Review findings
Review detailsBest possible solution: Put scheduler-job teardown and durable retry semantics in the canonical agent-deletion lifecycle, then let Do we have a high-confidence way to reproduce the issue? Yes, from source: remove an agent through ordinary Is this the best way to solve the issue? No. The proposed Claw-only teardown is not the best durable boundary because scheduled jobs are agent-owned; canonical agent deletion should own their teardown and retry semantics, with Claw removal layered on top. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 0d3cbae6a16a. Label changesLabel justifications:
Evidence reviewedPR surface: Source +613, Tests +498, Docs +27, Generated +28. Total +1166 across 20 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 (27 earlier review cycles; latest 8 shown)
|
b3be1ee to
ed66eab
Compare
71fbfbc to
09744d1
Compare
ed66eab to
06b1e17
Compare
09744d1 to
1549403
Compare
06b1e17 to
59f8ce3
Compare
1549403 to
d8d91d4
Compare
d8d91d4 to
63334bf
Compare
Patrick-Erichsen
left a comment
There was a problem hiding this comment.
I found four blocking lifecycle issues on the current head.
Evidence map: the changed surface is src/claws/{cron,lifecycle-state}.ts; the entry point is the Claws CLI through callGatewayFromCli; the owner boundary is the Gateway cron API plus the shared state database; the relevant callees are Gateway declaration convergence/session normalization and shared-state schema ownership; sibling status/export/remove paths all consume these persisted refs.
Best-fix judgment: Gateway ownership is the right boundary, but this is not yet the best implementation. Use the canonical shared-state schema and a durable per-declaration state machine that reconciles ambiguous add/remove outcomes. Resolve or reject current before an operator-scoped Gateway call. Plain retries or feature-local DDL do not safely recover partial mutations.
Validation on 63334bfe0733f7421de9759b3ea4e72655d0e2bf: TMPDIR=/private/tmp node scripts/run-vitest.mjs src/claws/cron.test.ts src/claws/lifecycle-state.test.ts src/claws/export.test.ts src/claws/provenance.test.ts (23 passed); git diff --check passed. I also reproduced lost-response add retry failure, config-change-during-remove provenance loss, and current normalizing to isolated without a caller session.
| } | ||
| try { | ||
| await options.cronGateway.remove(cron.schedulerJobId); | ||
| deleteClawCronRef(plan.agentId, cron.manifestId, options); |
There was a problem hiding this comment.
[P1] Do not maintain a separate agent-teardown path in Claws. agents delete should be the canonical entry point for deleting an agent and all agent-scoped state, including cron jobs pinned to that agent; claws remove should call that path and then layer Claw-specific workspace, provenance, and install-ledger cleanup around it. This also fixes the existing behavior where ordinary agents delete can leave orphan cron jobs behind. Skills/plugins are shared package artifacts, so Claw removal should release only this Claw's ownership references rather than uninstalling them.
The current ordering also deletes cron ownership before the agent-config commit succeeds. I reproduced a config mutation during cronGateway.remove: the remote job and local ref were deleted, then the config CAS rejected the removal, leaving the root install record complete while status reported zero cron refs and export had lost the declaration. Make the canonical deletion operation durable/retry-safe so partial failures can resume without losing ownership or repeating a destructive remote call.
There was a problem hiding this comment.
Addressed the Claw-side drift concern on current head 102464b8810 at the shared mutation boundary rather than invoking the user-facing command wholesale. Claw removal uses the same canonical deleteAgentConfigEntry mutation as agents.delete, with expected-state validation/CAS, and reuses the canonical workspace, session, overlap, and trash helpers while layering provenance-aware cron and install cleanup. Failures retain partial/retryable Claw state instead of claiming a complete removal. We deliberately did not change ordinary agents delete behavior from this experimental feature stack; orphan-cron cleanup there remains a separate core follow-up. I am leaving this thread open in case you want that broader core change to block Claws.
59f8ce3 to
5ed626b
Compare
63334bf to
4147ee4
Compare
6820516 to
4576fbf
Compare
8156de4 to
d8fe5a5
Compare
|
CI follow-up: exact head �1c32196fbaa removes the stage-only exported cron payload helper flagged by Knip and keeps equivalent live cron fixture coverage. Scoped Oxfmt/Oxlint and max-lines checks pass; fresh CI is running. |
4576fbf to
619f8e3
Compare
e1c3219 to
efbc8a3
Compare
619f8e3 to
3b11168
Compare
efbc8a3 to
2fe8f27
Compare
3b11168 to
cc8d2df
Compare
2fe8f27 to
d593dc8
Compare
cc8d2df to
e3c88e0
Compare
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: Manage Claw cron jobs through the gateway This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: Manage Claw cron jobs through the gateway This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
ClawSweeper status: review started. I am starting a fresh review of this pull request: Manage Claw cron jobs through the gateway This is item 1/1 in the current shard. Shard 0/1. This placeholder means the worker is alive and reading the current context. I will edit this same comment with the actual review when the claws are done clicking. Crustacean status: shell secured, claws on keyboard, evidence pebbles being sorted. |
|
Merged via squash.
|
Summary - install grouped Claw cron declarations through the gateway-owned
cron.addAPI - persist pending, complete, failed, or removed ownership references keyed by final agent id and declaration id - expose cron ownership in status, round-trip complete declarations through export, and include exact cron state in remove consent - disable Claw-owned recurring work before agent config, package, or workspace cleanup - compose existing OpenClaw config, session, workspace-safety, and trash primitives without changing ordinary agent deletion behavior ## Contract - scheduler mutation stays in the gateway; Claws never write the cron store directly - declaration keys are scoped asclaw:<agent-id>:<manifest-job-id>, so package-local ids do not collide globally - response-lost retries reconcile by declaration key before issuing anothercron.add-maindeclarations targetsession:agent:<final-agent-id>:main;isolatedremains isolated, and strict v1 validation rejects other session modes - removal callscron.removebefore any agent/config mutation and records partial state if recurring work cannot be proven disabled - Claw removal uses provenance-aware cleanup around shared lower-level OpenClaw primitives; the normalagents deletecommand and gateway behavior are unchanged - the durable install record retains its last completed phase (config_committed) when cron installation fails, while the command result ispartialand includes failed cron provenance for retry/doctor ## Stack - RFC: openclaw/rfcs#27 - Depends on: #102306 grouped export - This PR: gateway-owned cron mutation, provenance, status, export, and removal - Next: #102406 validated MCP ownership All behavior remains gated byOPENCLAW_EXPERIMENTAL_CLAWS=1. ## Validation - 59 focused cron, provenance, lifecycle, and ordinary agent-delete tests passed at pre-documentation head344d024f8b5; current head739c0325aceadds only this stage's documentation after restacking - scoped Oxfmt, Oxlint, andgit diff --check: passed - emittedcron.addpayload is validated by the gateway protocol validator - fresh GitHub CI is running after correcting the stale type/test fixtures found by the preceding run ## Real behavior proof > Signing-history note (2026-07-19): signed-history head739c0325ace6is a commit-history-only rewrite of previously tested head102464b88101; both resolve to tree7cdd9df2bed9. The behavior evidence below remains source-equivalent. This note does not claim a new runtime execution. The lifecycle tests prove consent-bound add, scheduler-id provenance, response-lost reconciliation, status/export visibility, and removal ordering. A scheduler failure returns partial withagentRemoved: false; successful removal disables Claw-owned recurring work before the provenance-aware local lifecycle proceeds. ## Documentation Extends/cli/clawswith agent-bound cron declarations and their preview, provenance, status, export, and removal behavior. ## Independent review refresh (2026-07-19)Current exact head:
e1c32196fbaa309043e2dce73e7cd19e23140b37. Internalizes the stage-local cron payload builder and updates its live-job test fixture; runtime behavior is unchanged. Fresh exact-head GitHub CI is authoritative for generated-package and SQLite-backed checks.