Repository navigation
refactor(transcripts): move durable mirror corrections to workers - #165541
Conversation
Read correction snapshots through the retained history owner and commit exact rows through the canonical agent writer. Preserve source-tail restrictions, indexed generation refusals, unrelated later appends, and shared-store identity. Release-note context: durable delivery-mirror and media corrections no longer perform their transcript SQL on the Gateway thread. Stored formats and SDK entrypoints remain unchanged. Locked mirror appends and feedback remain separate.
|
🦞👀 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. |
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
|
Codex review: needs maintainer review before merge. Reviewed October 5, 2026, 10:59 AM ET / 14:59 UTC (Revision 9). ClawSweeper reviewWhat this changesMoves saved reply and media corrections into existing transcript workers, preserves their selection and concurrency checks, and disables background heartbeat in the upgrade fixture. Merge readiness✅ Ready for maintainer review This remains useful work: current main still performs these corrections through synchronous transcript access. No introduced correctness or security defect was found, and the recorded final-head upgrade run resolves the previous review’s shutdown and cleanup blocker. Priority: P2 Review scores
Verification
How this fits togetherThe Gateway updates saved assistant replies after delivery and media preparation. Transcript readers supply the original records, and the agent database writer commits corrections before updated history is published. flowchart TD
A[Prepared reply or media] --> B[Select saved reply]
B --> C[Retained transcript reader]
C --> D[Prepare corrected display]
D --> E[Check current authority and original rows]
E --> F[Agent database writer]
F --> G[Publish updated history]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource +247, Tests +433, Docs +11, Other +1. Total +692 across 12 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep durable corrections under the existing transcript reader and agent writer, preserving current authority, exact-row refusal, and shutdown settlement. Do we have a high-confidence way to reproduce the issue? Not applicable as a new bug report; current-main source confirms synchronous correction access, and the recorded paired entry-point measurements demonstrate the intended worker cutover. Is this the best way to solve the issue? Yes. Reusing the existing reader, writer, byte codec, and admission checks is a focused way to move durable SQL off the Gateway thread. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against bb3a8a9ac304. 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
HistoryReview history (8 earlier review cycles)
|
Merge main to resolve the shared worker-test routing conflict while preserving both routing additions. Follow the canonical transcript mutation conflict error owner extracted on main.\n\nValidation: 27 correction, lifecycle, runtime build-graph, and import-closure checks passed in 539.68s; independent P2 review is scoped-clean. Published-driver qualification remains a pre-merge gate.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Remove the stale Gateway database-worker entry after moving the suite to the isolated core owner. Both ownership assertions failed in five runs on the prior head and passed in five runs on the merge base. The repaired planner and watch suites pass all 124 cases; P2 review is scoped-clean.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Merge main after its deferred-migration read-registry cycle fix landed, preserving the correction implementation and unique worker test routing. The focused correction, lifecycle, build-graph and import suite passed all 27 tests; Madge reports zero cycles and the fresh P2 review is scoped-clean. Published-driver qualification remains required before merge.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
The RPC-only update fixture left default heartbeat enabled, and a real run reached cleanup with unrelated cron and session work active. Use the existing disabled cadence already used by neighboring update fixtures. Keep every assertion and deadline unchanged. Syntax, the disabled-monitor contract, and P2 review pass; the exact cron job identity was not captured.
|
@clawsweeper re-review |
|
🦞👀 Re-review progress:
|
Integrate the main fix for the independently reproduced RPC exporter fixture error. Preserve the correction-only worker cutover and stacked branch ancestry.
|
@clawsweeper re-review The prior candidate's published-driver cell passed fully, including cleanup. Main has since fixed the independently reproduced RPC-exporter type error; merge commit 05984c5 incorporates that fix without conflicts or correction changes. Fresh P2 review is clean and the repaired typecheck passes. Runtime/import proof and the new SDK report are refreshing; a full published-driver cell for this integrated candidate is running because imported shutdown and incognito inputs changed. |
|
🦞👀 Re-review progress:
|
|
Merged via squash.
|
…enclaw#165541) * refactor(transcripts): move durable mirror corrections to workers Read correction snapshots through the retained history owner and commit exact rows through the canonical agent writer. Preserve source-tail restrictions, indexed generation refusals, unrelated later appends, and shared-store identity. Release-note context: durable delivery-mirror and media corrections no longer perform their transcript SQL on the Gateway thread. Stored formats and SDK entrypoints remain unchanged. Locked mirror appends and feedback remain separate. * test(transcripts): satisfy mirror fixture lint * fix(test): give commentary media one worker route Remove the stale Gateway database-worker entry after moving the suite to the isolated core owner. Both ownership assertions failed in five runs on the prior head and passed in five runs on the merge base. The repaired planner and watch suites pass all 124 cases; P2 review is scoped-clean. * fix(test): disable heartbeat in published-driver fixture The RPC-only update fixture left default heartbeat enabled, and a real run reached cleanup with unrelated cron and session work active. Use the existing disabled cadence already used by neighboring update fixtures. Keep every assertion and deadline unchanged. Syntax, the disabled-monitor contract, and P2 review pass; the exact cron job identity was not captured.
What Problem This Solves
Delivery-mirror and media corrections still scanned and rewrote durable transcripts with SQLite on the Gateway thread.
User Impact
Saved reply corrections keep their existing selection, refusal, and concurrency behavior while durable database work runs in workers. Schemas, retention, durability, configuration, and released SDK call shapes are unchanged.
This is the correction-only part of W4-01. Locked mirror appends, SDK callback adapters, and feedback persistence remain in the stacked follow-up; full W4-01 is not complete. Native maintenance and incognito adapters remain, and P7 remains inactive.
Why This Change Was Made
Reuse the existing transcript history reader and canonical agent writer. Retain the captured physical source through preparation, exact-row commit, and cleanup, separately from logical session identity. The writer checks generation and original stored bytes; tail-selected corrections also check the full version, while indexed-media corrections allow unrelated later appends. Transaction and commit grants recheck current authority, and accepted corrections settle before Gateway database shutdown.
Production delta: +300 / -53 / net +247, seven production files. 0 new
OPENCLAW_*names. The original pinned-base inventory remains T1 883 → 883 because shared native/SDK kernels remain counted.Overlap: #162433 (session ownership), #165401 (transcript hydration), and #165028 (session authority). Integration with #165490 uses the canonical extracted transcript-conflict error owner. Hunks remain within correction callers and their existing owners.
Evidence
05984c525627f694092dbbc36b842a6fe97b1c44. Main was integrated with merge commits, preserving ancestry.e78e965a55e2: keyed correction 55 → 0, source-mirror correction 59 → 0, indexed-media correction 45 → 0. These measure the correction entry points, not whole-chat throughput.05984c525627f: 27 tests passed. The 13-case correction shard took 146.58 s; graph/import shards took 9.62 s and 16.34 s. The prior full command measured 940.56 s wall on the loaded development host and covers physical ownership, generation/byte refusal, exact media selection, tail refusal, intervening rewrite/revocation, unrelated appends, and real Gateway close settlement. Commands usenode scripts/run-vitest.mjs ... --maxWorkers=1; isolated CI timing for these focused runtime cases is not claimed.21901766c534. Fresh independent Codex review through P2: scoped-clean.eventJson?,afterSeq?, andincludeEventJson?fields, with no new entrypoints or direct exports. Existing sync/async signatures remain accepted, so no deprecation adapter is needed. The refreshed local report against integrated main completed successfully: no added/removed entrypoints or direct signatures; JSON SHA2561e026d9bf215163daafe2e6c29510ca1cc7076af76868099f4bb256208defc57(acknowledgemente3e9c76e).05984c525627f: full cell passed, using published driver 2026.9.8, Node 24.21.0 and pnpm 12.5.1. Cell exit 0 in 492.271 s, update in 407.718 s; durable update finished successfully, readyz 200, exact candidate build running, durable history retained, incognito history cleared. Final stop exited 0 in 628 ms, within the unchanged 5000 ms limit. The proof uses synthetic state and preserves cleanup assertions. This proves upgrade compatibility without a schema, retention, or serialized-format change. Candidate tarball SHA256:ef30d3ff071f17ed0f6a8ad20fcf726b564a86c99dd5500651cf1a61620d48ef.0mcadence was independently observed. The exact earlier cron job ID was not captured.05984c525627fat 2026-10-05 14:36 UTC found no introduced correctness/security defect. Its two remaining proof requests—complete published-driver cleanup and upgrade compatibility—are satisfied by the passed cell above.3c9a7900bea7had 50 successful jobs and one root type error plus the aggregate gate: an untouched RPC exporter fixture assigned input descriptors without requiredprofileAccess. The exact error independently reproduced on mainbfe92816. Main subsequently fixed it inb9f2ea649750; that fix is integrated in merge commit05984c525627f. The exact failing type stripe now passes locally (21.2 s). Current-head CI passed: 52 successful jobs, 23 skipped, no failures or cancellations, including security-fast and openclaw/ci-gate. The final published-driver cell also passed; no admin exception is needed. Fresh complete-delta P2 review is scoped-clean.Earlier failures were addressed at their owners: a stale conflict-error import after main integration, duplicate commentary-media test routing, and an independently reproduced main Madge cycle. The first two were repaired here; main’s cycle fix was merged before the final green run. The later inherited RPC-exporter type error was resolved by taking main’s fix.