Repository navigation
fix(cron): keep legacy repair in Doctor - #160448
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review in progressClawSweeper is reviewing this revision. This supersedes any previous blocked status. |
|
Codex review: needs real behavior proof before merge. Reviewed October 1, 2026, 2:10 PM ET / 18:10 UTC (Revision 31). ClawSweeper reviewWhat this changesMoves legacy cron ownership and delivery repairs into backed-up Doctor migrations, preserves authored definitions during runtime writes, makes agent-deletion cleanup atomic, and requires an explicit delivery choice in the editor. Merge readiness⛔ Blocked before merge - 4 items remain Keep open: current main still performs legacy cron normalization at runtime, so this work remains useful. Migration and editor evidence are substantial, but the previously requested final-effect authority proof remains incomplete. Priority: P2 Review scores
Verification
How this fits togetherCron turns saved automation jobs into scheduled agent work, watched commands, and deliveries. Doctor repairs older stored jobs before the Gateway consumes their canonical ownership and delivery settings. flowchart TD
A[Existing automation jobs] --> B[Doctor inspection]
B --> C[Verified backup and repair]
C --> D[Canonical SQLite jobs]
D --> E[Gateway authority and delivery checks]
E --> F[Execute work and deliver results]
E --> G[Refuse unrepaired or unauthorized work]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Keep Doctor as the sole legacy-repair owner, retain the published request adapter and verified upgrade path, and establish that repaired ownership cannot revive stale execution or delivery authority. Do we have a high-confidence way to reproduce the issue? Yes, source establishes the existing runtime normalization path, and the body records failing original-code controls. This read-only review did not execute target code. Is this the best way to solve the issue? Yes, separating backed-up repair from runtime state transitions follows the existing owners; merge confidence still requires the scoped authority evidence. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against c6e6380c5ed8. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (30 earlier review cycles; latest 8 shown)
|
fb1c3c2 to
49a706e
Compare
cecc6d4 to
5963ef6
Compare
The upgrade-survivor candidate identity check surfaced a raw node:fs read error instead of the identity messages when the candidate payload was missing or unreadable (test/scripts/upgrade-survivor-candidate-identity red on main since #160448 narrowed the contract). The generic baseline contract is restored (the captured baseline stays mandatory for cron-owner-doctor; generic scenarios use baselineCommit), and both filesystem error boundaries now produce the contextual identity error with the original cause retained. Refs #160448
Runtime preserves authored cron definitions and consumes canonical ownership, delivery, and schedules. Doctor performs supported repairs with verified backups, while update rehearsals retain live legacy sources for the live import. Preserve durable receipts, explicit scope boundaries, and deletion fences. Published 2026.9.7 updater acceptance passed on Testbox. The separately matched native published-driver CI timeout also fails on clean main; the PR records that inherited failure and its limits.
…w#162976) The upgrade-survivor candidate identity check surfaced a raw node:fs read error instead of the identity messages when the candidate payload was missing or unreadable (test/scripts/upgrade-survivor-candidate-identity red on main since openclaw#160448 narrowed the contract). The generic baseline contract is restored (the captured baseline stays mandatory for cron-owner-doctor; generic scenarios use baselineCommit), and both filesystem error boundaries now produce the contextual identity error with the original cause retained. Refs openclaw#160448
Publish committed name metadata through both cron mutation owners and refresh Gateway display projections at asynchronous boundaries. Retain physical generation fences and reject unprepared or invalidated lookups instead of reading SQLite on the caller thread. Preserve rename/delete labels, including hidden SSE prefix refreshes and malformed peer metadata. Builds on #160448. No schema, retention, durability, configuration, or update contract changes. Native name reads retain the Doctor transaction-hook contract.
Publish committed name metadata through both cron mutation owners and refresh Gateway display projections at asynchronous boundaries. Retain physical generation fences and reject unprepared or invalidated lookups instead of reading SQLite on the caller thread. Preserve rename/delete labels, including hidden SSE prefix refreshes and malformed peer metadata. Builds on openclaw#160448. No schema, retention, durability, configuration, or update contract changes. Native name reads retain the Doctor transaction-hook contract.
What Problem This Solves
Legacy cron jobs could change ownership, delivery behavior, or authored schedules during ordinary Gateway work instead of a backed-up Doctor migration.
User Impact
openclaw doctor --fixrepairs supported legacy ownership and delivery settings before retiring their config markers. The normalopenclaw updateDoctor phase performs the same repair. Published clients may still senddelivery.mode="deliver"tocron.addorcron.update; the request adapter persistsannounce, while stored aliases remain Doctor-owned. After a direct binary replacement, run Doctor before using unrepaired jobs; unknown delivery modes require an explicit operator choice.Jobs with unresolved legacy ownership or a noncanonical delivery mode cannot run or launch their watched commands. A due one-shot keeps its enablement and pending occurrence until ownership is repaired, without recording a completed run. The editor requires an explicit delivery mode instead of silently selecting
noneduring an unrelated edit. Ordinary job updates author a missing interval anchor only when the schedule is explicitly edited; Doctor repairs older missing anchors.Operators with unrestricted session access can inspect unrepaired jobs. Restricted profile and agent views wait for Doctor when ownership is unresolved; canonical creator and agent-qualified session ownership retain their existing sharing checks. Runtime never infers additional access from a legacy SQL owner or default marker.
Why This Change Was Made
The published-driver update cell exposed a second migration defect: canary Doctor imported an absolute live
cron.storeinto disposable SQLite and archived the live JSON before live Doctor could import it. The update reported success while the live database lacked the imported job. The candidate now reuses the existing rehearsal-path owner to retain external legacy sources and symlinked companions while allowing normalization in the private database. Deferred archival leavesremoved_source=0; live Doctor performs the final import and archival. This works with the environment contract already emitted by published updaters.The runtime still normalized legacy input while reading jobs and used full-definition upserts for scheduling, reservation, recovery, and completion. Those writes could persist inferred defaults or replace independent SQL ownership. Doctor now owns normalization and ownership materialization; runtime transitions update their state columns and only explicitly intended enablement changes. Receipts, live-authority checks, catch-up, and settlement stay with the existing worker owners. The async receipt-currentness path carries a canonical-delivery fact from its read worker.
Doctor preserves explicit job/session ownership and gives an existing SQL owner precedence over the historical default. All repairs of existing persisted rows now use the shared verified SQLite snapshot helper. Delivery-only repair takes one snapshot; combined import/normalization and ownership repair retains two snapshots, including the original durable rows and the later imported state. Rows, file digests, and maintenance authority are rechecked after awaited backup and before committing. Grant generations advance beyond both the current row and retained grant generations. Unsupported definitions remain intact while healthy siblings are saved. Session maintenance also carries the caller's environment into the existing lifecycle owner. No database schema or stored-data retention change is introduced.
Agent deletion holds its existing deletion fence and cron lock across the roster commit, then atomically removes cron jobs and scratch and revokes standing grants in the existing write worker. A rejected roster write leaves cron data and grants untouched. A rolled-back cleanup leaves complete rows for retry; a committed cleanup cannot leave orphan scratch. Cleanup failures preserve the deletion fence for retry, including uncertain roster outcomes. Revoked grants are never restored. This replaces the speculative deletion/rollback and separate scratch-pruning paths.
The six-month migration policy uses
v2026.3.1as the current retirement cutoff. These cron formats remain supported: the released job creator, row codec, and schema import can still write ownerless/mode-less jobs or preserve null,deliver, and mixed-case delivery modes. The audited tag isv2026.9.7(c074824a27c96d3983043f9eeb33823cd1772d8c). The legacy JSON/state/quarantine writers also exist in stablev2026.5.28, and JSON run-log writes exist inv2026.3.1. History traces the job-JSON cutover to005da57957cand state/quarantine cutover to87d412d557e; both are after the retention cutoff. No cron format is retired, so no retired-format detector is added here.Related integration: #161703 deleted the old synchronous
runtime-store.ts, but did not eliminate the legacy-repair problem; this PR preserves that worker-write migration and does not restore the file. It also preserves #161935's async receipt reads, #162091's worker-backed quarantine observations, and #162021's serving-owner observations. Inspected overlaps with #159873's one-shot delivery-attempt tracking and #161105's scheduled-tool policy changes concern separate responsibilities and hunks.Production changes (
src/**andextensions/**, excluding tests and test support): +1360 / -875 / net +485. Separately, the UI helper extraction and canonical-parser cleanup total net -2 lines. The additions move supported repairs into Doctor and make runtime refusal and persistence boundaries explicit. Superseded persister APIs and test-only state-publication branches are removed. Oversized files are split by responsibility without raising their ratchets or dropping assertions. Canonical model suggestions use the existing shared parser; nested selector aliases that every supported schema rejects no longer appear as suggestions. The audited repair and inventory implementations now live under the existing Doctor owner; the old store modules are deleted, all callers are migrated, and the read worker remains off-thread. No SQLite scanner exception or baseline increase is introduced.Significant extraction overlaps: #158844's pending-action behavior stays in the original UI functions; #135889's model-budget assertions must follow their moved test if it lands first. #162192's independent quarantine-only await and Doctor fixture extraction remain with that PR's owner.
Evidence
Candidate
5963ef617460e0a4ca81150370a653f717a8b89dis based on17f7eb7b21486e4720bd64a410d988d80717250b. Component, integrated, conflict-resolution, and incremental Codex reviews are clean through P2, including the rehearsal repair. The full selected native checks passed atbd1a6cb316a5fd3f2126336e8f86db7714b6e275; range-diff confirms the latest rebase preserves those production patches. Main's complete startup-fixture drain repaird1fcbda9fb8is retained verbatim. The rehearsal guard passed its regressions, full selected changed checks, package build, and published-driver cell at production commit2ece77687fbd9e260f5f4d228e6d8bbd43a86519. The final head additionally retains main's equivalent shared JSON/number helpers and routes the native SDK regression to its existing forked Node owner. Those integration boundaries passed 52 tests (137.77 s); the local alias uses the same shared function and keeps the file under its existing 700-line limit. Direct lint passed (5.36 s), and changed-test types passed (67.33 s). All 40 completed ordered fixture invocations passed atcecc6d4f2d43dac941da0e52e2f42d0cd57048ddagainst clean main18154cae312943e32491b9d788ad3b6e3bb1ff11: ten per group and revision (2,317.34 s aggregate command wall time). Formatting, whitespace checks, and normal commit hooks passed. No local tests or builds ran.The final conflict repair preserves #162683's own-conversation wait behavior and #161871's suite-owned session cleanup byte-for-byte from main. The conflict was the import union in two files; the SDK regression's preparation, historical seed, assertions, and executor release remain unchanged. The fresh P2 integration review is clean. On Testbox
tbx_01m3w4qw5rwezt1xay9svb7ffj, final-head integration passed all ten selected cron wait/outcome cases (27.99 s), all four SDK maintenance cases (26.71 s), and direct lint (3.70 s), after a clean frozen install (5.25 s). The completed shard matrix and package/update cell are retained at their actual tested revisions.The local-selection remote type command stopped before compilation at the global
agents-otherroot budget (724 versus 720, 0.93 s). Its agents source tree and complete shard configuration tree are byte-identical between base and candidate, as are the boundary checker and planner. The existing check-limits owner reports this limit as advisory in GitHub Actions but blocks outside Actions. Final-head CI run36903958676separately passed all five core test-type jobs, the remaining test types, production types, and guards. The cron validation and SDK maintenance roots belong to stripes 2 and 4 respectively; that compiler evidence is retained without changing the unrelated graph guard or its environment.cron.addwithINVALID_REQUEST(22.46 s). The dedicated frozen-request alias test passed (23.69 s), and the remaining validation file passed 256 tests (22.08 s). Both add and update persist canonical rows.ENOENTafter live-source consumption (34.60 s). The corrected repair file passed 15 tests (41.09 s wall; real SQLite, filesystem, and live-after-rehearsal boundaries). Archive/import siblings passed 20 tests (23.93 s). The complete selected changed-check plan passed (613.75 s).03137c1d729change.2ece77687fbd9e260f5f4d228e6d8bbd43a86519: package build and tarball integrity passed (547.96 s); latest published2026.9.7→ candidate cell passed (221.04 s). It verifies the published updater and candidate process identities, source preservation until live Doctor, all 11 repaired jobs, both verified snapshots, repeat-Doctor idempotence, installed Gateway execution, and synthetic session continuity. Supervisor restart is manual. The subsequent final-head changes are test routing and equivalent shared helper substitutions; this is retained production proof, not a claim that the package was built from the final Git head.Evidence spans Testbox leases
tbx_01m3syhh4njmz1ks32442pstbb,tbx_01m3t5ncs3tfhsme9s8h4m4f8e,tbx_01m3tdpbh6kczy80kxden8jwcf,tbx_01m3tsmefyxcv7bgwvrftbp499,tbx_01m3v1znnp65d6yqf8a5jbypz9, andtbx_01m3v8phpa3pdtrkecpcfg636b. Provider-ended and unstarted commands are not passes. Earlier results are retained for unchanged inputs, not relabeled as exact-head CI. The final hosted result and any independently attributed inherited failures will be recorded before landing.Current CI fixture diagnosis: the original 50-file Gateway group reproduced three
database is lockedstartup failures in 111.52 s, with 49 files passing. The fixture touched raw SQLite before asynchronous worker retirement settled; main's canonical drain repair is included verbatim. Its standalone original control also failed (69.05 s). The SDK fixture assumed a lazy native executor had already acquired file identity; its original five-file Bun group and standalone control both reproduced that failure (18.48 s and 14.83 s). Preparing the executor then exposed a deterministic routing defect in run36859714624: the test ran in Bun threads, where host-only admission correctly refuses. The final candidate moves the file into the existing forked Node database-worker inventory, preserving its watch classification and all assertions. That CI run had one originating failed job plus its aggregate gate, 89 successes, 16 skips, and no cancellations.Final ordered fixture proof uses the original 50-file Gateway group and the latest exact one-file SDK selection on clean main and candidate; only the candidate SDK owner changes to its canonical Node configuration. All ten repetitions per group/revision passed. Main Gateway: 1,000.36 s total; main SDK: 150.44 s; candidate Gateway: 968.82 s; candidate SDK: 197.72 s. Seven completed passes came from Testbox
tbx_01m3vwagqhp16c1m12zktjca7j; its next SDK attempt was interrupted by runner communication loss and is not counted as a pass. The remaining 33 completed passes ran ontbx_01m3w4qw5rwezt1xay9svb7ffj(run 36892289624). The fixed iteration list was resumed, not rerun for green. Final routing checks passed in 168.21 s. This remains separate from the historical 45-second Doctor timeout, whose root cause is unproven.The successful rehearsal/package/cell proof used Testbox
tbx_01m3vn60852g76e596h7026d5w(run); the provider ended that lease after the commands and successful completion receipt. The full captured command log is retained. A pnpm tool-manager-only environment-document rewrite was isolated; Corepack verified the declared pin, runtime dependencies stayed byte-identical, and the package source passed exact cleanliness checks before and after build.The final SDK regression now reaches the original product boundary: removing only cleanup's explicit environment forwarding produces
Agent database execution belongs to another shared-state database(41.57 s). The fixed file passes all four cases (31.76 s). Its historical rows use the existing exact fixture seeding API; freshpatchSessionEntrycreations correctly receive current activity timestamps and were invalid inputs for the fixture's synthetic old cleanup clock. The fresh Gateway standalone passed all 12 cases (103.47 s). No runtime guard, assertion, retry count, or test timeout was weakened.Inherited CI failure
Prior-head CI run 36887840867, at
cecc6d4f2d43dac941da0e52e2f42d0cd57048dd, has one originating failure: published-driver update job110459141115, plus its aggregate gate. Security, dependency, code, and test checks passed. The same native published-driver job fails on clean main atfffdd92f45036e49093292cf48f5fa10c75204b3in run 36885234851, job110452503643. That main commit is an ancestor of tested merge parente42c52b7d83ede656c778337b46c0a25cb279625; the Doctor merge was5fdf957ec8d6d595964311b1772cded3076ac4fe.Both runs installed 9.7, reached readiness, completed canary cleanup, stopped the previous Gateway cleanly, then exhausted the outer cell deadline during
update(exit 124), with no update-result JSON or candidate restart. The relevant workflow, harness, service shim, updater, and daemon sources are unchanged across the comparison. The internal wait after service shutdown remains unexplained; this is evidence of a pre-existing failure, not a claimed infrastructure root cause. The separate cron-owner published-driver cell passed fully as recorded above. The failed prior-head CI job remains recorded as failed.Final-head CI 36903958676 completed successfully at
5963ef617460e0a4ca81150370a653f717a8b89d, with no failed jobs. Exact-head squash auto-merge completed asd89da7595d0d6c51f4e17b5631114023e49f931b; no admin failure exception was needed for this head. A later passing invocation does not establish the cause of the earlier timeout.