Skip to content

feat: prepare bounded transcript pages for plugin history - #169241

Closed
SweetSophia wants to merge 13 commits into
openclaw:mainfrom
SweetSophia:feat/transcript-page-current-main
Closed

SweetSophia wants to merge 13 commits into
openclaw:mainfrom
SweetSophia:feat/transcript-page-current-main

Conversation

@SweetSophia

@SweetSophia SweetSophia commented Oct 11, 2026 •

Copy link
Copy Markdown

What Problem This Solves

A future plugin history reader needs bounded source pages without entering transcript restoration or writable projection paths.

User Impact

This is an internal foundation with no production caller or public SDK export. Existing readers retain their request kinds, timeout defaults and successful read paths; no schema or dependency changes are introduced.

Why This Change Was Made

The new page operation reuses the session-history lane and retained database owner. It uses native read-only primary scopes, preserves upstream's read-only quarantine admission and a page frontier across appends, and bounds kernel source work to 50 returned records, 1,000 scanned entries and 16 MiB of UTF-8 source. SQLite-owned WAL/SHM coordination is permitted; writer fallback, missing-store creation, migration and cold restoration are prohibited.

One captured deadline of at most five seconds bounds the response across queueing and execution. Settlement separately joins the owned task and cleanup. Late pages cannot replace an interrupted response. Lost accounting rejects settlement and retains failed admission until the existing database owner recovers it; there is no automatic replay. A failed claim also prevents shared-lane idle retirement until recovery.

Remaining acceptance limits: kernel accounting does not yet qualify every schema/quarantine admission SQL query, and the post-snapshot archive/rewrite publication fence still needs proof. Schema refusal is qualified at first admission; warm reads preserve upstream's published schema facts and do not add a version fence for later untracked header edits. This contribution does not provide a complete public session-read contract.

Evidence

Source baseline: captured upstream main bb6818fd172e35956189a56c3f71dd1133c3c1d2 (2026.10.2 source), current candidate 6426296c6aef7f2aef3f01089c5e4665e57f89be. This latest correction changes only the page-runtime test fixture relative to dc8101b7; production source is unchanged. Three conflicts against each of b9439454 and 037aa311 justified two earlier source merges. A later probe against bb6818fd found only a generated-inventory conflict; source and request types merged cleanly. Earlier checkpoint proof remains historical evidence. This contribution does not modify or depend on the public cold-restoration opt-out wrappers in #165710. No installed-gateway claim is made.

  • On the prior dc8101b7 snapshot, 170 tests across thirteen files pass locally through the normal router (129.95 seconds of router-reported wall time; shard durations 30.28, 63.95 and 26.73 seconds). A preceding affected native worker/quarantine/packaging run passed 42 tests across four files (47.16 seconds). The broader regression was rerun because main also changed the shared query layer. Earlier 172-test and 171-test counts remain qualified only for their earlier snapshots. These are not new full-run results for the test-only correction; fresh hosted timing is not available.
  • On the same prior dc8101b7 source, core type checking passes (70.82 seconds); the affected test-type graph test/tsconfig/tsconfig.core.test.agents-sessions.json also passes (70.67 seconds).
  • That prior verification records passing type-aware lint on all 17 changed code files with matching core/scripts configs and formatting on all 19 supported files; the plain-text inventory and remaining contribution pass git diff --check.
  • Its assertion-safety, database-worker, line-cap, timeout-race, mock-export and generated worker-inventory checks pass, as do config-doc and plugin-inventory checks. Fresh checks for the test-only correction are reported separately below.
  • On dc8101b7, the full corepack pnpm build passes (exit 0, 395.24 seconds). Its receipt binds that source SHA-256 a93a39737f681958a522b3745d4b0a07b0c4676b56aaf9b7669cd2d860452b29 to every check, including the failed dialect gate; it does not report all checks passing. No new full build is claimed for the test-only correction.
  • The database dialect ratchet fails with three new json-projection constructs (design: 0 -> 3). This is an intentional increase requiring maintainer review, not a passing or inherited check. See the owner and backend contract below; no baseline or guard was relaxed.

The 172-to-170 difference comes from upstream 4dea82441409284fde36419b7a9f034e75b0dac1 (#169898), which removed the two it.each(["initialized", "empty"]) quarantine observation cases. Both contribution-added read-only/missing-store regressions remain present and pass in both local runs. The current receipt is verification-post-push-refresh-2026-10-12.json; its broader-regression entry was appended after the verification script completed and is backed by the unchanged source hash and post-push-full-regression-2026-10-12.log.

Hosted CI associated with dc8101b7 is not green (run 38275479757, 2026-10-12): five distinct checks fail. These are checks-fast-baseline-ratchets (the disclosed dialect increase), checks-node-changed-compact-small-3 (7 page-runtime failures, including three 120-second timeouts), checks-node-changed-compact-large-32 (2 quarantine-cache test failures), checks-node-changed-compact-large-10 (1 gateway history-worker lifecycle failure), and the openclaw/ci-gate rollup.

The checkout log shows that this run executed generated merge 42ac1c657eba0b4ce54ef344df6fc14ae30e82ba, combining upstream ea0e2099e059522703cb65db2b3eb4c7be73830a with dc8101b7. It did not execute the contribution head's tree on its captured bb6818fd base. The bounded comparison therefore pins the actual merge and its first parent, without another main refresh. Frozen installs, the hosted binary version Node 24.19.0, original file cohorts/configurations and normal test timeouts are used on the local host.

  • Quarantine: the upstream four-file cohort fails the same two cache/schema assertions (74 pass / 2 fail; 81.84 seconds), and the merge does too (76 pass / 2 fail; 82.59 seconds). Both contribution-added regressions pass. Gateway: both two-file cohorts fail the same worker-identity assertion (18 pass / 1 fail; 77.98 and 81.19 seconds). These three failures reproduce without the contribution; their inheritance is established by the paired runs, not file equality. This does not judge whether upstream behavior is correct.
  • Our page-runtime fixture is a separate confirmed defect. Upstream 19eddcf75194e9fca33b146b3b820a0a00831576 (fix: prevent Code Mode worker OOM after databases close #169956) retires admission facts after the last native close. The fixture closes its writer, so the existing read owner selects targetDiscoveryLane; seven controlled tests incorrectly spy on historyLane.pool and are bypassed. The original wrong-result case reproduces on the unmodified CI merge (one failure / twelve skipped; 32.91 router seconds).
  • 6426296c6 selects the fixture pool from real schema-admission state after writer close and uses it for the execution/rotation mocks. No production owner, assertion, deadline, test timeout or ratchet changes. Independent source review found no confirmed defect. pnpm test src/config/sessions/session-transcript-page-read.runtime.test.ts --maxWorkers=1 passes all 13 tests on the contribution source (39.07 seconds wall time) and on the actual CI merge with the identical patch (39.63 seconds). The original 11-file runtime cohort also passes on the patched merge: 81 tests, 86.60 seconds wall time, 82.15 seconds in Vitest.
  • Affected test types, type-aware lint, formatting, line-cap and timeout-race checks pass. Receipt verification-ci-attribution-2026-10-12.json binds the new committed tree and contribution source SHA-256 01d49eb3203d0f09348f6bcfaed7d44c7d5ca1dca3e1e8cc8a5982cf69ced1f5 to the unchanged tested file; raw logs and paired receipts are preserved. allChecksPassed remains false. These results do not qualify a new full build or clear fresh hosted CI.

The initial older-base runtime diagnostic lowered its timeout to ten seconds: all 13 page tests passed, but one archive test exceeded that diagnostic limit. It is preserved separately, does not reproduce the hosted failure and is not classified as a contribution regression. Final merge reproduction uses normal timeouts.

The first published head had real CI defects: seven nullable/indexed test-type accesses, three kernel type assertions, and an omitted identity module in the wrapper runtime inventory exposed by two suites. b9eb1bf3 repairs those; cca5302fa records the kernel's worker-only caller and regenerates the SQL inventory. This refresh preserves main's transcript statistics, prepared anchor facts, entry/snapshot modes, current-entry worker types, harness-mode forwarding and failed-retirement custody. Both sides of the type/document conflicts are retained; the inventory is regenerated. Two unchanged preview/title request shapes move to the existing request-types module, preserving the existing preview import. The unchanged page contract is placed beside session operations rather than migration notes appended at the end. The first merge repaired an inherited duplicate anchor manifest entry; after newer main removed the opposite copy, existing closure tests caught the combined deletion. The final manifest preserves main's single required anchor entry and adds only the page-identity module relative to this baseline. Fresh independent review found no remaining integration defect. No guard or test expectation was weakened.

Newer main caches quarantine decisions published by the writer. The two read-only/missing-store fixtures now clear their setup's admission cache to exercise ordinary cold lookup; they do not request the explicit repair read lane or change runtime caching. The deletion race also asserts one opener call, so a cached answer cannot falsely pass the non-creating-open regression. The original missing-store assertions remain intact, and scoped independent review confirmed the setup change. Main's optional database-engine capabilities are preserved; this contribution does not add backend support.

Before Merge

The upstream review at #169241 (comment) (revision 6, reviewed dc8101b7 at 2026-10-12 16:23 UTC) reports Findings: None, patch quality 3/6 and readiness/proof 1/6. Its three before-merge items are accepted-consumer behavior proof, attribution of the hosted CI failures, and the session-owner decision. The paired comparisons and fixture correction above address attribution locally; fresh hosted CI and upstream acceptance of the evidence remain required. The fabricated built-worker fixtures qualify the internal boundary; they are not a shipped-consumer artifact or a complete public SDK flow. The comment is edited in place; the local task ledger preserves the fetched revision-6 comment separately from later revisions. Dialect classification remains open; this contribution is not merge-ready.

The intended consuming feature is an Ikati-only agent/session chooser and cross-device visible chat history. It must use an ordinary registered plugin's public, registration-scoped read contract; no plugin import of private storage helpers or transcript-file parser is proposed. Before that consumer can be qualified, aggregate admission SQL and the post-snapshot publication fence need proof, followed by the public facade and redacted consumer evidence for paging, append continuation and interrupted settlement. Existing remote catalog-paging consumers do not consume this SQLite operation. Approval of the consuming contract and retained-failure policy remains an upstream owner decision; no accepted shipped consumer is claimed here.

The dialect ratchet's three occurrences are two json_object calls and one json_extract in session-transcript-page-read.kernel.ts. The owning operation is transcript-page-read, dispatched only by session-history-read-operation.worker.ts; direct kernel callers outside that worker are test fixtures. These project lifecycle identity and event-size metadata, allowing UTF-8 source measurement before returning the projected payload or decompressing an event, without fetching full private entry JSON. A future backend must implement equivalent bounded projection and pre-fetch byte measurement at the session-history store owner, preserving the identity, snapshot and source-accounting tests, or refuse this operation as unsupported. No backend, stored format or migration is added. The worker-access guide records the same contract. Scoped dialect classification still needs maintainer review.

Watched regressions first reproduced queued response deadline failures, unresolved expiry before timer service, settlement accepting non-final accounting, missing response rejection handling and unregistered failed task-close recovery. Independent review verified the repaired ownership paths. All fixtures use fabricated local state; no live transcripts, provider turns, gateway changes or deployment. The full repository test suite was not run.

Focused test command
corepack pnpm test \
  src/config/sessions/session-transcript-page-read.kernel.test.ts \
  src/config/sessions/session-transcript-page-read.worker.test.ts \
  src/config/sessions/session-transcript-page-read.runtime.test.ts \
  src/config/sessions/session-transcript-page-read.identity.test.ts \
  src/state/openclaw-quarantine-store.test.ts \
  src/config/sessions/session-transcript-events.worker.test.ts \
  src/config/sessions/session-transcript.worker.schema-freshness.test.ts \
  src/config/sessions/session-history-worker-errors.test.ts \
  src/config/sessions/session-transcript-worker-lanes.test.ts \
  src/infra/session-cost-usage-cache.cleanup.test.ts \
  src/infra/session-cost-usage-cache.admission.test.ts \
  test/scripts/pr-wrapper-source-closure.test.ts \
  test/scripts/eager-import-closure.test.ts \
  --maxWorkers=1

Local checkpoint only: bounded query, worker paging and identity refusal tests
are preserved for the strict SQLite admission prerequisite.

Focused checks: 62 pass; the actual-worker absent-WAL/SHM preservation test
still fails. Core types, focused lint and formatting pass. Deadline/retirement,
remaining lifecycle coverage and safe native admission are incomplete.

Not ready for publication, merge, SDK registration or live deployment.
@clawsweeper

clawsweeper Bot commented Oct 11, 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.

@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ⚠️ Failed 2026-10-11T17:42:29.544152Z cd01001 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to 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" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation size: XL labels Oct 11, 2026
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. labels Oct 11, 2026
@clawsweeper

clawsweeper Bot commented Oct 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge.

What this changes

Adds an internal read-only transcript-page operation with bounded source accounting, pagination, deadlines, and separately tracked settlement.

Review scores

Measure Result What it means
Overall readiness 🧂 unranked krab (1/6) The patch contains coherent internal groundwork without a confirmed introduced defect, but it is not merge-ready.
Proof confidence 🧂 unranked krab (1/6) Real behavior proof is necessary before merge. See Before merge.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Product

Kind: Feature · Worth it: Needs a maintainer decision
User problem: The intended plugin needs a history-reading contract that guarantees read-only admission, bounded source work, and interruption settlement.
Reason: The implementation has distinct technical value, but its single proposed consumer is not accepted and its lifecycle policy adds ongoing core complexity.

Merge readiness

⛔ Blocked before merge - 3 items remain

Keep open: this PR contains meaningful, distinct reader groundwork, but accepting its inactive contract and lifecycle policy requires session-owner judgment.

Priority: P3
Reviewed head: 6426296c6aef7f2aef3f01089c5e4665e57f89be
Owner decision: Required. See Decision needed.

Decision needed

  • Question: Should core accept this inactive page primitive, its failed-settlement admission policy, and SQLite-specific bounded projections for the proposed plugin-history consumer?
  • Recommendation: Approve a narrowly defined consumer contract: Define the generic consumer requirement, accept or simplify the failure-retention policy, and settle the three JSON-projection classifications before proceeding.
  • Why: No recorded owner approval accepts this contract, and recent owner-led simplification explicitly favored ordinary read completion over speculative lifetime machinery.

Before merge

  • Add real behavior proof - The actual history worker and native SQLite kernel are exercised through fabricated fixtures, while interruption and cleanup controls substitute pool responses; the full body and discussion supply no accepted-consumer runtime artifact for paging, append continuation, and interrupted settlement. Provide redacted terminal output or logs covering those scenarios, removing IPs, API keys, phone numbers, and non-public endpoints. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
  • Complete next step - Resolve GitHub's reported conflict with main and validate the affected integration.
  • Resolve maintainer decision - Resolve the maintainer decision shown above before merge.

Findings

None.

Tests

  • Missing end-to-end proof: Provide an accepted-consumer runtime artifact covering paging, append continuation, and interrupted settlement; fabricated native-worker tests do not establish that shipped flow.
Agent review details

How this fits together

The session-history worker reads per-agent SQLite transcripts; the proposed operation accepts captured session identity and limits and returns source records, continuation positions, and accounting.

flowchart LR
 A[Future plugin consumer] --> B[Internal page operation]
 B --> C[Existing history worker]
 C --> D[Read-only database owner]
 D --> E[Agent SQLite transcript]
 E --> F[Page and accounting]
 F --> B
Loading

Technical review

Best possible solution:

Agree on a minimal generic plugin-history contract at the existing history owner before qualifying this foundation through its intended consumer.

Do we have a high-confidence way to reproduce the issue?

This is a proposed capability rather than a reported bug; source confirms the new operation has no production consumer, and no target code was executed during this read-only review.

Is this the best way to solve the issue?

Reusing the existing history worker and read-only database owner is appropriate, but the consumer contract and additional failure-retention machinery need owner acceptance before this becomes the preferred implementation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 21f043cf86f5.

Provenance checked

  • Shared history-reader lifecycle changes intended behavior with a stated reason (7872bfb: Simplify speculative read-lifetime protocols while preserving current effect authority, bounded workers, native cleanup, and accepted-write settlement.)
  • Combined read and cleanup diagnostics keeps the original intent (9cec3c1: Preserve both failures instead of allowing cleanup errors to hide the original read failure.)
  • Worker request type ownership keeps the original intent (4dcc499: Share transcript worker request types; the PR moves unchanged preview and title request shapes into that existing owner while preserving the preview export.)

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

PR surface

Source +885, Tests +1536, Docs +54, Other +2. Total +2477 across 20 files. Added test files: 4.

View PR surface stats
Area Files Added Removed Net
Source 10 922 37 +885
Tests 6 1536 0 +1536
Docs 2 81 27 +54
Config 0 0 0 0
Generated 0 0 0 0
Other 2 2 0 +2
Total 20 2541 64 +2477

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is inactive groundwork for a future plugin feature, with no current production workflow changed.
  • rating: 🧂 unranked krab: Overall readiness is 🧂 unranked krab; proof is 🧂 unranked krab and patch quality is 🦐 gold shrimp.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (7 earlier review cycles)
  • reviewed 2026-10-11T17:35:24.769Z sha cd01001 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T09:22:04.463Z sha cca5302 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T10:40:45.825Z sha cca5302 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T13:04:49.301Z sha cca5302 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T15:41:06.575Z sha a9b71c4 :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T16:23:56.632Z sha dc8101b :: needs real behavior proof before merge. :: none
  • reviewed 2026-10-12T17:37:38.875Z sha dc8101b :: needs real behavior proof before merge. :: none

Reviewed October 12, 2026, 4:49 PM ET / 20:49 UTC (Revision 8).

@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Oct 12, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 12, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Oct 12, 2026
@SweetSophia

Copy link
Copy Markdown
Author

The bounded CI investigation is complete. Pushed test-only correction 6426296c6aef7f2aef3f01089c5e4665e57f89be; production source is unchanged from dc8101b7.

The key source distinction is in the checkout log: failed run 38275479757 executed generated merge 42ac1c657eba0b4ce54ef344df6fc14ae30e82ba, whose first parent is upstream ea0e2099e059522703cb65db2b3eb4c7be73830a, rather than the contribution head's tree on captured bb6818fd.

Confirmed contribution defect and correction: upstream 19eddcf75 (#169956) retires admission facts after the last native connection closes. In src/config/sessions/session-transcript-page-read.runtime.test.ts, withPageFixture closes its writer before reading. The actual CI tree therefore takes cold admission, and existing withSessionHistoryReadAdmission (src/config/sessions/session-transcript-worker-read-admission.ts:44–45) dispatches to targetDiscoveryLane. Seven controlled tests spy on historyLane.pool instead, bypassing the intended failure/deadline gates. The unmodified CI merge reproduces the wrong-result failure in rejects settlement when execution loss leaves source accounting unverified (one failure / twelve skipped).

The correction selects the fixture's pool from actual schema-admission state after writer close and targets both execution and rotation spies at that pool. Assertions, production handling, deadlines and timeouts are unchanged. Independent source review found no confirmed defect in this correction.

Local verification using Node 24.19.0 (the binary version printed in the hosted job), frozen installs and normal timeouts:

Scope Result Wall time
pnpm test src/config/sessions/session-transcript-page-read.runtime.test.ts --maxWorkers=1, contribution source 13 pass 39.07s
Same file, identical correction on actual CI merge 13 pass 39.63s
Original 11-file runtime cohort/configuration, corrected CI merge 81 pass 86.60s
Affected test-type graph Pass 12.54s

Type-aware lint, formatting, line-cap and timeout-race checks also pass. These timings are local; fresh hosted timing is not yet available.

Confirmed inherited failures: paired executions of the original failed cohorts on upstream ea0e2099 and merge 42ac1c65 fail the same named assertions:

  • src/state/openclaw-quarantine-store.test.ts: loads quarantine once and publishes record and clear without another read; validates a replaced quarantine store once without repeating its installation DDL. Upstream: 74 pass / 2 fail, 81.84s; merge: 76 pass / 2 fail, 82.59s. Both contribution-added regressions pass.
  • src/gateway/session-history-worker-lifecycle.test.ts: settles cancelled message reads before reuse and closes their database handles. Both cohorts: 18 pass / 1 fail; 77.98s upstream and 81.19s merge.

This establishes that those three failures occur without this contribution; it does not assert that upstream behavior is correct. No unrelated owner change or main refresh is included. The initial older-base diagnostic's shortened ten-second archive timeout is preserved separately and is not classified as the hosted failure.

The PR description now distinguishes the actual executed tree, paired attribution and fresh test-only proof from the prior 170-test/build receipt. Command/selector, source/hash and raw-log receipts are preserved in verification-ci-attribution-2026-10-12.json and its referenced records. No new full build or repository-wide suite pass is claimed. Fresh hosted CI, acceptance of this attribution, the disclosed 0 → 3 dialect classification, the session-owner decision and accepted-consumer proof remain open; this is not a green/merge-ready claim.

steipete added a commit that referenced this pull request Oct 25, 2026
An explicit cron run reads its authorized job definition and private scratch separately inside a SQLite read transaction. Read both in one dialect-layer LEFT JOIN so they share a statement snapshot, removing three SQL statements per SQLite run without another worker request.

The job reader keeps its all-column authorization relation, ordered narrow projection, exact returned-ID check, existing decoder/config revision and legacy creation fallback. Missing scratch still reports revision 0; deletion keeps its revision tombstone. The standalone maintenance reader remains. No schema, cache, write, receipt, claim-before-effect, delivery authority, FIFO or 64-receipt retention change.

PostgreSQL retains the shared reader's outer read-only transaction and rollback: its exact-job read is 4→3 SQL, not 4→1. SQLite exact-job is 4→1, heartbeat 3→1; PostgreSQL heartbeat remains 3→3. Accepted noncontract edges: an absent/malformed job can now require scratch SELECT privilege, and malformed job plus unsafe numeric scratch can reject the numeric data first. These do not remove the existing caller/source/cancellation checks.

The production delta is +3 lines: one joined query replaces the transaction and duplicate read while sharing NULL handling with heartbeat. Existing test files cover read-after-write, tombstones, missing jobs/monitors and both database engines. No new suite or runner is added.

Acceptance was registered before measurement: the committed `scripts/bench-cron-run.mts` drives signed WebSocket `cron.run` against an isolated synthetic Gateway/provider, once cold and twice warm. Each run must produce one start, one finish, one Responses request and exact-run history verification. Compare execution, history verification and settlement separately and together, plus shutdown and the entire invocation. The scratch owner must fall from 4→1 SQL with 1 request and 0 MAIN throughout; no cost may be deferred outside the run. Keep cold/warm separate and report median/p95/range. Three same-platform alternating pairs when calm, or one pair plus source attribution under campaign load. Counts and profiles make no latency/CPU-speed claim; timing claims require the timing lock, load below 24 and ≥5 alternating samples per arm. A 20% user-facing regression stops acceptance. Delivery mode none does not claim an external-send proof.

The same-platform explicit comparison (baseline 814e732, candidate 93a6c4) gives:

| SQL / requests / MAIN | Baseline | Candidate |
| --- | --- | --- |
| Cold execution + verification + settlement | 257 / 80 / 0 | 254 / 78 / 0 |
| Warm 1 | 247 / 64 / 0 | 235 / 60 / 0 |
| Warm 2 | 252 / 61 / 0 | 245 / 65 / 0 |
| Warm median | 249.5 / 62.5 / 0 | 240 / 62.5 / 0 |
| Warm descriptive p95 | 252 / 64 / 0 | 245 / 65 / 0 |
| Warm range | 247–252 / 61–64 / 0 | 235–245 / 60–65 / 0 |
| Shutdown | 22 / 6 / 5 | 40 / 10 / 5 |
| Whole invocation | 1383 / 356 / 58 | 1369 / 352 / 58 |

Each of the three runs completed one start, finish, Responses request and exact history verification. The scratch owner is exactly 4/1/0 → 1/1/0 in every run, all in its execution phase, with no extra or deferred scratch requests. All execution/verification/settlement phases are SQL-error-free and runtime MAIN remains zero. The count comparison is diagnostic, not an error-free full invocation: the frozen analyzer rejects two failed shutdown `state_leases` DELETEs (`database is locked`). Shutdown exceeds the 20% stop threshold; it was stopped and explicitly accepted by the coordinator as inherited after an independent main shutdown-lock reproduction. The separate SHUTDOWNLOCK lane owns that repair. The scratch join changes no lease code or writes. No latency or CPU-speed claim is made.

The frozen 3.1.5 standard workload is a different scheduled `cron.add` flow: three valid baselines gave 06.cron 231/62/0, 235/65/0, 233/63/0 (median 233/63/0), versus ordinary warm 45/12/0. The descriptive excess is 188 SQL/51 requests, not causal subtraction. One extra standard setup aborted before any Gateway; it supplies no performance evidence. The existing scratch source is identical across that baseline and the explicit baseline. Full current-standard delta is deferred to the next census.

Validation: count regression red on baseline (2 SELECTs and BEGIN/COMMIT), all 17 scratch-store tests green on the candidate; two isolated Codex P0–P2 reviews scoped-clean. The existing two-engine conformance test passed on actual SQLite and PostgreSQL 17, with catalog/trigger parity and cleanup verified. Test cost: scratch cases totaled 6.528 s (125.95 s file duration, mostly transform); the two engine cases totaled 1.846 s (260.62 s file duration, mostly transform). The candidate build and official source-freshness check passed at measured runtime head 93a6c4d; the three-sample invocation completed with the shutdown limitation above. Exact-head CI run 40176443806 completed successfully: 39 successful jobs, 26 skipped, no failures, including all three actual PostgreSQL shards, production/test types, lint, source contracts, Madge, and worker/T1/dialect ratchets. The earlier run passed types, lint and source contracts but found a worker-inventory omission: the new direct query was conservatively labeled T1. Head a187ecf corrects only inventory metadata and regenerates its snapshot: the worker snapshot and its private heartbeat helper are W, while the native Doctor reader stays T3. No runtime or SQL change is involved. The generated snapshot also catches up existing main classifications; targeted script lint and formatting pass. The two production reviews remain valid; this tooling-only correction adds no production review round. PG review approved the semantics at 68c24c4, and the coordinator explicitly carried REVIEW-OK to 93a6c4d because only benchmark TypeScript annotations changed. Candidate counts and the inherited-shutdown disposition are recorded; the corrected head’s CI and all three PG shards passed. The test-only import relocation avoids another open PR's adjacent import change; production bytes remain identical to both isolated reviews and database proof. The benchmark annotations fix CI TS7022 without changing emitted behavior.

Final-head overlap at a187ecf: complete shared-index base-versus-candidate merge-tree comparison covers 21 peers (#183410, #183285, #181057, #180871, #180286, #180139, #169241, #168956, #168615, #167546, #167471, #165039, #161997, #157922, #157693, #156613, #141004, #137788, #136476, #129388, #121204). No new source conflict paths, regions or messages. Six peers (#181057, #180871, #180139, #169241, #129388, #121204) have added or changed conflicts confined to the fully generated worker inventory. The coordinator explicitly accepted this class because main's snapshot was stale and generated outputs must be regenerated, not hand-edited. The same exact-head disposition carries PG REVIEW-OK because runtime bytes are unchanged. Exact-head CI and all three PostgreSQL shards passed.

PG checklist: (1) read-only; existing writer transaction/advisory-lock, DML/conflict and cross-store commit ordering unchanged. (2) At most one joined row via the existing composite primary keys, original job fields plus four scratch fields, unchanged 256 KiB scratch write bound. (3) No cache/generation or invalidation change; one statement snapshot, existing outer PG read transaction retained. (4) No schema/admission/identity/retry/probe change. (5) Same worker owner, one request, no MAIN expansion; target 4→1 SQL in all three real Gateway runs, with the inherited shutdown failure disclosed above. (6) Actual PostgreSQL 17 and SQLite owner conformance passed; all three final-head PostgreSQL CI shards and the other selected static checks passed.

Knip was run separately because ordinary PR CI excludes it. The canonical candidate export scan failed with 26 script, 20 production and 16 full-tree findings; none is in a changed file. All 62 occurrences (52 unique file/symbol pairs), scanner/config/compiler inputs and package inputs are unchanged from merge-base dada70f. The only removed imports, runSqliteReadSnapshotSync and loadCronRows, both retain multiple real production consumers. Current-main diagnostic sections reported 14 script and 7 production findings; main has already repaired 40 candidate occurrences in unrelated changes. Its separate full-tree scan was intentionally stopped after the coordinator accepted the source-attributed inherited findings; it is not a passing full-main scan. No ignored exports, baselines or unrelated code were changed. The failed candidate scan is explicitly accepted as inherited; all branch changes and selected CI static checks pass.

Pre-merge shared-index refresh retains 17 open peers from that audit. Only #180871 moved (f140f16); its fresh base-versus-candidate comparison still adds conflicts solely in the generated worker inventory, within the coordinator-accepted class. No new source conflicts.

Co-authored-by: Peter Steinberger <[email protected]>
@openclaw-barnacle

Copy link
Copy Markdown

This pull request has been automatically marked as stale after 7 days without qualifying human activity.
Without new human activity, Barnacle may close it as not planned 7 days after this message was posted. This is administrative inactivity cleanup, not a claim that the problem is fixed.
A human update restarts the inactivity clock; a new PR head also restarts it. A maintainer can add no-stale for a durable hold, or bad-barnacle to suppress Barnacle. Remove the hold when work can resume.

@openclaw-barnacle openclaw-barnacle Bot added the stale Marked as stale due to inactivity label Oct 26, 2026
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 26, 2026
An explicit cron run reads its authorized job definition and private scratch separately inside a SQLite read transaction. Read both in one dialect-layer LEFT JOIN so they share a statement snapshot, removing three SQL statements per SQLite run without another worker request.

The job reader keeps its all-column authorization relation, ordered narrow projection, exact returned-ID check, existing decoder/config revision and legacy creation fallback. Missing scratch still reports revision 0; deletion keeps its revision tombstone. The standalone maintenance reader remains. No schema, cache, write, receipt, claim-before-effect, delivery authority, FIFO or 64-receipt retention change.

PostgreSQL retains the shared reader's outer read-only transaction and rollback: its exact-job read is 4→3 SQL, not 4→1. SQLite exact-job is 4→1, heartbeat 3→1; PostgreSQL heartbeat remains 3→3. Accepted noncontract edges: an absent/malformed job can now require scratch SELECT privilege, and malformed job plus unsafe numeric scratch can reject the numeric data first. These do not remove the existing caller/source/cancellation checks.

The production delta is +3 lines: one joined query replaces the transaction and duplicate read while sharing NULL handling with heartbeat. Existing test files cover read-after-write, tombstones, missing jobs/monitors and both database engines. No new suite or runner is added.

Acceptance was registered before measurement: the committed `scripts/bench-cron-run.mts` drives signed WebSocket `cron.run` against an isolated synthetic Gateway/provider, once cold and twice warm. Each run must produce one start, one finish, one Responses request and exact-run history verification. Compare execution, history verification and settlement separately and together, plus shutdown and the entire invocation. The scratch owner must fall from 4→1 SQL with 1 request and 0 MAIN throughout; no cost may be deferred outside the run. Keep cold/warm separate and report median/p95/range. Three same-platform alternating pairs when calm, or one pair plus source attribution under campaign load. Counts and profiles make no latency/CPU-speed claim; timing claims require the timing lock, load below 24 and ≥5 alternating samples per arm. A 20% user-facing regression stops acceptance. Delivery mode none does not claim an external-send proof.

The same-platform explicit comparison (baseline 814e732, candidate 93a6c4) gives:

| SQL / requests / MAIN | Baseline | Candidate |
| --- | --- | --- |
| Cold execution + verification + settlement | 257 / 80 / 0 | 254 / 78 / 0 |
| Warm 1 | 247 / 64 / 0 | 235 / 60 / 0 |
| Warm 2 | 252 / 61 / 0 | 245 / 65 / 0 |
| Warm median | 249.5 / 62.5 / 0 | 240 / 62.5 / 0 |
| Warm descriptive p95 | 252 / 64 / 0 | 245 / 65 / 0 |
| Warm range | 247–252 / 61–64 / 0 | 235–245 / 60–65 / 0 |
| Shutdown | 22 / 6 / 5 | 40 / 10 / 5 |
| Whole invocation | 1383 / 356 / 58 | 1369 / 352 / 58 |

Each of the three runs completed one start, finish, Responses request and exact history verification. The scratch owner is exactly 4/1/0 → 1/1/0 in every run, all in its execution phase, with no extra or deferred scratch requests. All execution/verification/settlement phases are SQL-error-free and runtime MAIN remains zero. The count comparison is diagnostic, not an error-free full invocation: the frozen analyzer rejects two failed shutdown `state_leases` DELETEs (`database is locked`). Shutdown exceeds the 20% stop threshold; it was stopped and explicitly accepted by the coordinator as inherited after an independent main shutdown-lock reproduction. The separate SHUTDOWNLOCK lane owns that repair. The scratch join changes no lease code or writes. No latency or CPU-speed claim is made.

The frozen 3.1.5 standard workload is a different scheduled `cron.add` flow: three valid baselines gave 06.cron 231/62/0, 235/65/0, 233/63/0 (median 233/63/0), versus ordinary warm 45/12/0. The descriptive excess is 188 SQL/51 requests, not causal subtraction. One extra standard setup aborted before any Gateway; it supplies no performance evidence. The existing scratch source is identical across that baseline and the explicit baseline. Full current-standard delta is deferred to the next census.

Validation: count regression red on baseline (2 SELECTs and BEGIN/COMMIT), all 17 scratch-store tests green on the candidate; two isolated Codex P0–P2 reviews scoped-clean. The existing two-engine conformance test passed on actual SQLite and PostgreSQL 17, with catalog/trigger parity and cleanup verified. Test cost: scratch cases totaled 6.528 s (125.95 s file duration, mostly transform); the two engine cases totaled 1.846 s (260.62 s file duration, mostly transform). The candidate build and official source-freshness check passed at measured runtime head 93a6c4d; the three-sample invocation completed with the shutdown limitation above. Exact-head CI run 40176443806 completed successfully: 39 successful jobs, 26 skipped, no failures, including all three actual PostgreSQL shards, production/test types, lint, source contracts, Madge, and worker/T1/dialect ratchets. The earlier run passed types, lint and source contracts but found a worker-inventory omission: the new direct query was conservatively labeled T1. Head a187ecf corrects only inventory metadata and regenerates its snapshot: the worker snapshot and its private heartbeat helper are W, while the native Doctor reader stays T3. No runtime or SQL change is involved. The generated snapshot also catches up existing main classifications; targeted script lint and formatting pass. The two production reviews remain valid; this tooling-only correction adds no production review round. PG review approved the semantics at 68c24c4, and the coordinator explicitly carried REVIEW-OK to 93a6c4d because only benchmark TypeScript annotations changed. Candidate counts and the inherited-shutdown disposition are recorded; the corrected head’s CI and all three PG shards passed. The test-only import relocation avoids another open PR's adjacent import change; production bytes remain identical to both isolated reviews and database proof. The benchmark annotations fix CI TS7022 without changing emitted behavior.

Final-head overlap at a187ecf: complete shared-index base-versus-candidate merge-tree comparison covers 21 peers (openclaw#183410, openclaw#183285, openclaw#181057, openclaw#180871, openclaw#180286, openclaw#180139, openclaw#169241, openclaw#168956, openclaw#168615, openclaw#167546, openclaw#167471, openclaw#165039, openclaw#161997, openclaw#157922, openclaw#157693, openclaw#156613, openclaw#141004, openclaw#137788, openclaw#136476, openclaw#129388, openclaw#121204). No new source conflict paths, regions or messages. Six peers (openclaw#181057, openclaw#180871, openclaw#180139, openclaw#169241, openclaw#129388, openclaw#121204) have added or changed conflicts confined to the fully generated worker inventory. The coordinator explicitly accepted this class because main's snapshot was stale and generated outputs must be regenerated, not hand-edited. The same exact-head disposition carries PG REVIEW-OK because runtime bytes are unchanged. Exact-head CI and all three PostgreSQL shards passed.

PG checklist: (1) read-only; existing writer transaction/advisory-lock, DML/conflict and cross-store commit ordering unchanged. (2) At most one joined row via the existing composite primary keys, original job fields plus four scratch fields, unchanged 256 KiB scratch write bound. (3) No cache/generation or invalidation change; one statement snapshot, existing outer PG read transaction retained. (4) No schema/admission/identity/retry/probe change. (5) Same worker owner, one request, no MAIN expansion; target 4→1 SQL in all three real Gateway runs, with the inherited shutdown failure disclosed above. (6) Actual PostgreSQL 17 and SQLite owner conformance passed; all three final-head PostgreSQL CI shards and the other selected static checks passed.

Knip was run separately because ordinary PR CI excludes it. The canonical candidate export scan failed with 26 script, 20 production and 16 full-tree findings; none is in a changed file. All 62 occurrences (52 unique file/symbol pairs), scanner/config/compiler inputs and package inputs are unchanged from merge-base 71bc695. The only removed imports, runSqliteReadSnapshotSync and loadCronRows, both retain multiple real production consumers. Current-main diagnostic sections reported 14 script and 7 production findings; main has already repaired 40 candidate occurrences in unrelated changes. Its separate full-tree scan was intentionally stopped after the coordinator accepted the source-attributed inherited findings; it is not a passing full-main scan. No ignored exports, baselines or unrelated code were changed. The failed candidate scan is explicitly accepted as inherited; all branch changes and selected CI static checks pass.

Pre-merge shared-index refresh retains 17 open peers from that audit. Only openclaw#180871 moved (f140f16); its fresh base-versus-candidate comparison still adds conflicts solely in the generated worker inventory, within the coordinator-accepted class. No new source conflicts.

Co-authored-by: Peter Steinberger <[email protected]>
@openclaw-barnacle

Copy link
Copy Markdown

Closing due to inactivity.
If you believe this PR should be revived, post in #clawtributors on Discord to talk to a maintainer.
That channel is the escape hatch for high-quality PRs that get auto-closed.

@openclaw-barnacle openclaw-barnacle Bot closed this Nov 9, 2026
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 P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. scripts Repository scripts size: XL stale Marked as stale due to inactivity status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant