Repository navigation
refactor(cron): prepare display names in workers - #163797
Conversation
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.
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed October 2, 2026, 7:39 PM ET / 23:39 UTC (Revision 4). ClawSweeper reviewWhat this changesThe PR prepares automation display names in existing database workers and keeps chat labels current after job renames, deletions, and uncertain mutations. Merge readiness⛔ Blocked before merge - 1 item remains This PR remains useful because current main still retains synchronous cron-name reads. No actionable introduced defect was found, and the earlier migration blocker is unsupported by the actual runtime-only changes. Priority: P2 Review scores
Verification
How this fits togetherCron stores scheduled automation jobs and their names in shared SQLite state. Gateway history and live-message projections use those names to label forwarded automation results. flowchart TD
A[Scheduled jobs in SQLite] --> B[Shared-state read worker]
C[Committed job mutations] --> D[Name publication and invalidation]
B --> E[Prepared display names]
D --> E
A --> F[History worker]
E --> G[History and live message labels]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource +230, Tests +167, Docs +14, Other +2. Total +413 across 28 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep display-name reads in the existing workers, with committed-name publication and physical-generation invalidation owned by cron. Do we have a high-confidence way to reproduce the issue? Not applicable as a new bug report; current-main source establishes the synchronous name-query path, and the supplied regressions exercise the cutover without reviewer-side execution. Is this the best way to solve the issue? Yes. Reusing existing read and mutation workers preserves one owner, and the RPC path retains worker-side response encoding. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 3059a884501a. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
History |
Preserve transferred RPC history bytes by reading cron names inside the admitted history worker through the shared query kernel. Keep local history preparation asynchronous and remove the synchronous lazy resolver. Retain read-only legacy-state fallback through admitted schema facts. Resolve default cron partitions from each worker request's captured environment. The legacy regression failed with no such table before the fix; the combined sequence also exposed and now covers worker-environment reuse. Validation: focused history integration, cron name and mutation settlement, and PR wrapper inventory tests passed. Independent P2 autoreview is clean. Test cost: job-name.test.ts with --maxWorkers=1 took 84s wall including compiled-worker preparation; 3 tests passed. CI timing follows the new head.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Merged via explicitly authorized admin squash with attributed pre-existing CI failures.
|
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
Forwarded automation labels lazily queried SQLite on the Gateway main thread. Moving those reads also requires names to stay current after renames, deletions, delayed reads, and uncertain mutation outcomes.
Solution
Prepare names in the existing shared-state and history workers. Both cron mutation paths publish acknowledged name postimages through the existing mutation owner before notifications. Retained resolvers stay bound to their physical database generation; uncertain outcomes and stale-family cleanup invalidate them.
RPC history resolves labels inside its admitted history worker and preserves transferred response bytes. Local history, SSE, deltas, message lookup, live events, and diagnostics prepare names at their asynchronous boundaries. Text-only consumers omit unused labels. The synchronous lazy resolver is removed. This builds on the cron Doctor repair in #160448.
Read-only legacy state without a cron table keeps the “Automation” fallback through admitted schema facts, without repairing stored state. Reused workers resolve the default cron partition from the current request environment.
Impact
Existing labels and deleted-job presentation are preserved. Unprepared or invalidated lookups request a refresh instead of silently reusing stale names. There are no schema, configuration, retention, durability, or update changes, and no new worker service or persistent cache. 0 new
OPENCLAW_*names.Released SDK surface checked against
v2026.9.7: the removed name resolver and changed projection helpers are internal. The releasedcron-store-runtimeload/path/save signatures remain unchanged; no compatibility adapter or deprecation record is needed.Evidence
no such table: cron_jobsbefore the fix. It now reads absent metadata without caller-thread SQL or changing database bytes. The ordered suite also exposed and now covers stale worker-environment selection.ba8c26cae03fc24577f58084edf9ec776ce71f0a: core and test types, lint, SDK/worker guards, zero import cycles, and env-name count 477/477.New regression file cost:
node scripts/run-vitest.mjs src/cron/store/job-name.test.ts --maxWorkers=1passed all 3 tests in 84s wall, including compiled-worker preparation; test execution stayed below 5s. Exact-head CI ran these three cases in 257ms, 754ms, and 364ms (1.375s total test execution) in run37078079911; the new missing-table regression took 0.257s. Existing SQLite-backed history and settlement coverage protects worker admission and lost-reply behavior that mocks alone cannot establish.CI attribution and main integration
Earlier CI run
37067056195failed outside the introduced cron behavior. Source tracing and repeated real-file comparisons established:0356bacb8c66; writes moved into workers ind6929f854d2e92ef9f40ee6f78is includedasset-manifest.json2d1011a9a4161is includedspawnSyncThe sharing transaction-admission assertion initially did not reproduce in 15 file runs. A diagnostic trace showed that its global admission spy also observes unrelated automatic-maintenance commits. Scheduled main CI run 37077835919, job 111071892832, at
56a17f9c950321d89dedbae78e43892c65b59e82, then independently reproduced both sharing failures, including the exact line-409commitRequestedassertion (falseexpected,truereceived). The sharing flow does not reach cron mutation or name preparation. One earlier scoped rerun was diagnostic, not a claimed code fix; the current head was not rerun.The Doctor comparison used Testbox run 37070843000. Cron name preparation does not retain agent database leases: the fixture already starts asynchronous resource retirement and immediately blocks its parent in
spawnSync. Existing shared-state readers register and join their cleanup. The task-owned Testbox was stopped after collecting evidence.Main was incorporated in merge commit
222fa6627c7e8e2a92ea7398ef4522ce85c4403e, preserving its transferred-byte RPC history and both upstream CI fixes. ClawSweeper completed this exact head at 2026-10-02 23:39:07 UTC with no actionable code or security findings. Its inventory-script migration checkbox is a classification false positive; the review explicitly resolves the migration concern.Current CI run 37078079911, attempt 1, finished with exactly two failed root jobs: sharing
111072685376and Doctor111072685466. The aggregate gate failed downstream; no jobs were cancelled, andsecurity-fastpassed. All four failing cases are independently inherited. Their fixture and owning-source blobs are unchanged between the tested main baselineb5d9eea790c5909e244fc5721b26fadc68544b98and actual tested merge0167714eb575eef88a1a105561dd7adf56ee09b8. No newer relevant fix was found through observed mainb0072ac3c36eaeeed2f03834f279d4df268c8e5f. The explicitly authorized native admin exception retains this failed CI result and complete qualification evidence; it does not claim green CI or waive security/review requirements.Landed as
7dd7675080455732c234cfcae5eaa2e6725d9ccathrough the native admin route. Main advanced during final admission; the retained native parent audit records that race. The landed parent already includes sharing-fixture fixc2e33c235aad7eb14cdba659cce4cda17c358110, which scopes observations to the target transaction and removes the obsolete host-handle assumption. Doctor remains an inherited failure; the historical failed CI attempt above is unchanged.