Skip to content

refactor(cron): prepare display names in workers - #163797

Merged
steipete merged 2 commits into
mainfrom
dbasync/cronnames3
Oct 2, 2026
Merged

steipete merged 2 commits into
mainfrom
dbasync/cronnames3

Conversation

@steipete

@steipete steipete commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

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 released cron-store-runtime load/path/save signatures remain unchanged; no compatibility adapter or deprecation record is needed.

Evidence

  • The original-production negative control performed one caller-thread cron-name query; the candidate requires and observes zero across RPC, HTTP, SSE, live projection, rename, and deletion cases.
  • New legacy-schema regression failed with no such table: cron_jobs before 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.
  • Final focused cron/name/history run: 36 tests passed, 99.46s wall. History worker and byte-transfer siblings: 40 passed, 1 skipped, 107.38s wall. PR wrapper dependency inventory passed in 12.05s.
  • Independent Codex autoreview through P2: scoped-clean, after resolving the missing-table finding and reviewing the main integration.
  • Full changed-file gate passed against 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=1 passed 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 run 37078079911; 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 37067056195 failed outside the introduced cron behavior. Source tracing and repeated real-file comparisons established:

Failure Independent evidence Disposition
Sharing fixture expects a seeded host database handle Same failure 5/5 on the PR, merge base, and main 0356bacb8c66; writes moved into workers in d6929f854d2e9 Inherited fixture defect
Session-list startup revokes an auth/profile or plugin-catalog reader Same case failed 5/5 on PR and 5/5 on merge base; also failed in scheduled main CI Main fix 2ef9f40ee6f78 is included
UI validator fixture lacks asset-manifest.json Reproduced on current main and in Linux/Windows main CI; older PR/base file runs passed 5/5 each Main fix 2d1011a9a4161 is included
Non-interactive Doctor sees live agent leases Same two refusals in 5/5 PR and 5/5 merge-base Linux Testbox file runs; interactive case always passed Inherited synchronous fixture cleanup before spawnSync

The 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-409 commitRequested assertion (false expected, true received). 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 111072685376 and Doctor 111072685466. The aggregate gate failed downstream; no jobs were cancelled, and security-fast passed. All four failing cases are independently inherited. Their fixture and owning-source blobs are unchanged between the tested main baseline b5d9eea790c5909e244fc5721b26fadc68544b98 and actual tested merge 0167714eb575eef88a1a105561dd7adf56ee09b8. No newer relevant fix was found through observed main b0072ac3c36eaeeed2f03834f279d4df268c8e5f. 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 7dd7675080455732c234cfcae5eaa2e6725d9cca through the native admin route. Main advanced during final admission; the retained native parent audit records that race. The landed parent already includes sharing-fixture fix c2e33c235aad7eb14cdba659cce4cda17c358110, 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.

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.
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation gateway Gateway runtime scripts Repository scripts size: L labels Oct 2, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Oct 2, 2026
@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed October 2, 2026, 7:39 PM ET / 23:39 UTC (Revision 4).

ClawSweeper review

What this changes

The 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
Reviewed head: 222fa6627c7e8e2a92ea7398ef4522ce85c4403e

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) A coherent worker cutover with meaningful regression coverage and no supported blocking finding.
Proof confidence 🌊 off-meta tidepool Not applicable: The ordinary contributor-proof gate is exempt for this verified repository admin. Supplied SQLite/history boundary results target the changed name owners and rename/deletion behavior but were not rerun here; the diff introduces no stored-data contract change.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The ordinary contributor-proof gate is exempt for this verified repository admin. Supplied SQLite/history boundary results target the changed name owners and rename/deletion behavior but were not rerun here; the diff introduces no stored-data contract change.
Evidence reviewed 10 items Pinned introduced change: Reviewed the merge-base-to-head delta at the supplied identities. The stale GitHub test merge was not used to infer removal of current-main behavior.
Still necessary on current main: The captured main revision still implements createCronJobNameResolver with synchronous shared-state SQLite access; the central cutover has not already landed.
Name freshness and physical generation: Prepared resolvers validate their captured database admission, accept acknowledged name maps only from the same physical generation, and refuse invalidated or unprepared lookups. Both save and guarded mutation publication paths install names before notifications.
Findings None None.
Security None None.

How this fits together

Cron 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
Loading

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source +230, Tests +167, Docs +14, Other +2. Total +413 across 28 files.

View PR surface stats
Area Files Added Removed Net
Source 23 360 130 +230
Tests 3 181 14 +167
Docs 1 14 0 +14
Config 0 0 0 0
Generated 0 0 0 0
Other 1 2 0 +2
Total 28 557 144 +413

Review metrics

Metric Value Why it matters
Production and regression growth production net +227 lines; tests net +164 lines Production growth supports worker preparation and freshness publication; regression growth protects real SQLite and history boundaries.

Stored data model

Persistent data-model change detected: migration/backfill/repair: scripts/database-worker-inventory.mjs. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best 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.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is a bounded runtime refactor that removes Gateway-thread database work while preserving automation labels.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The ordinary contributor-proof gate is exempt for this verified repository admin. Supplied SQLite/history boundary results target the changed name owners and rename/deletion behavior but were not rerun here; the diff introduces no stored-data contract change.

Evidence

What I checked:

  • Pinned introduced change: Reviewed the merge-base-to-head delta at the supplied identities. The stale GitHub test merge was not used to infer removal of current-main behavior. (222fa6627c7e)
  • Still necessary on current main: The captured main revision still implements createCronJobNameResolver with synchronous shared-state SQLite access; the central cutover has not already landed. (src/cron/store/job-name.ts:41, 3059a884501a)
  • Name freshness and physical generation: Prepared resolvers validate their captured database admission, accept acknowledged name maps only from the same physical generation, and refuse invalidated or unprepared lookups. Both save and guarded mutation publication paths install names before notifications. (src/cron/store/job-name.ts:45, 222fa6627c7e)
  • Transferred RPC response preserved: RPC history reads names inside its admitted worker using the captured shared-state path and environment, projects labels, and then encodes the response page. (src/gateway/session-history-worker-reader.ts:203, 222fa6627c7e)
  • No stored-data migration introduced: The added names map is serialized into private worker-message bytes retained for commit publication; only the existing nonce enters the native receipt. The query reads existing columns, and inventory edits only classify worker-owned modules. This resolves the previous review's migration concern. (src/cron/store/runtime-mutation.worker.ts:52, 222fa6627c7e)
  • Legacy database fallback: The query kernel uses admitted table facts to return absent metadata without repairing legacy state. The new regression checks unchanged database bytes and zero caller-thread SQL. (src/cron/store/job-name.kernel.ts:13, 222fa6627c7e)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
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.

Workflow

  • 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.

History

Review history (3 earlier review cycles)
  • reviewed 2026-10-02T21:33:14.373Z sha 4af0b30 :: blocked before merge. :: none
  • reviewed 2026-10-02T21:43:28.748Z sha 4af0b30 :: blocked before merge. :: none
  • reviewed 2026-10-02T22:23:20.302Z sha 4af0b30 :: blocked before merge. :: none

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.
@steipete

steipete commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

@clawsweeper

clawsweeper Bot commented Oct 2, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete merged commit 7dd7675 into main Oct 2, 2026
150 of 154 checks passed
@steipete
steipete deleted the dbasync/cronnames3 branch October 2, 2026 23:53
@steipete

steipete commented Oct 2, 2026

Copy link
Copy Markdown
Contributor Author

Merged via explicitly authorized admin squash with attributed pre-existing CI failures.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 3, 2026
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.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation gateway Gateway runtime P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. scripts Repository scripts size: L status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant