Repository navigation
refactor(state): remove redundant database forwarding layers - #180928
Conversation
|
🦞👀 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 SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
|
Codex review: needs maintainer review before merge. What this changesThis PR removes redundant database observation and audit forwarding layers and inlines a retired table name in its compatibility owner. Example: Persist a system-agent audit entry for config.setDefaultModel.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review Keep this maintainer-authored PR open: the cleanup preserves existing database contracts, and no actionable patch defect was found; exact-head CI remains unresolved. Priority: P3 Before mergeNone. FindingsNone. Tests
Agent review detailsHow this fits togetherDatabase callers submit commands and audit records through engine and shared-state worker owners, which retain admission, recovery, transaction settlement, and persistence responsibilities. flowchart LR
A[Database callers] --> B[Engine worker store]
B --> C[Request observation]
C --> D[Worker broker]
E[System agent audit] --> F[Existing audit writer]
F --> D
D --> G[Selected database]
Technical reviewBest possible solution: Retain this focused cleanup with recovery, admission, persistence, and compatibility decisions in their existing owners. Do we have a high-confidence way to reproduce the issue? There is no reported runtime bug to reproduce; source comparison verifies redundant forwarding and unchanged values without executing target code. Is this the best way to solve the issue? This is the smallest complete cleanup: use the existing writer directly, observe direct dispatch without an adapter, retain the necessary scoped adapter, and remove the obsolete module and inventory entry. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against d4b913d4689a. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -23, Tests -1, Other -1. Total -25 across 8 files. Added test files: 0. View PR surface stats
Review metrics
Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. LabelsLabel changes:
Label justifications:
Rating scale6/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. WorkflowClawSweeper edits this one comment on every review. Comment Reviewed October 22, 2026, 3:51 PM ET / 19:51 UTC. |
…w#180928) Remove redundant observation and audit forwarding paths and the obsolete message-tool-outcome schema module. Preserve synchronous warm dispatch, cold input capture before recovery, receiver binding, no-replay behavior, and the existing audit writer ownership. SQL, transactions, schemas, request counts, public SDK surfaces and effect-authority checks are unchanged. Production +22/-45 (net -23); total net -25. Direct commands allocate one fewer adapter and forwarding closure; no timing claim. Validation: focused schema, audit, Workboard/observation and wrapper-inventory tests; type-aware lint, types, source/architecture guards, Knip/Madge and database ratchets. All three exact-head PostgreSQL conformance shards passed. The CI owner-selection assertion introduced on newer main by openclaw#180844 reproduces identically on main d41e3f8; recorded for main repair. Independent component reviews and exact-head coordinator/PostgreSQL review approved the change. Source provenance: openclaw#170138, openclaw#165561 and openclaw#177694 (Peter Steinberger).
What Problem This Solves
Database infrastructure retains small forwarding layers that no longer own behavior: an engine observation-scope helper, an audit registration helper, and a module exporting only the retired
message_tool_run_outcomestable name.User Impact
Database behavior is unchanged. This batch removes 23 net production lines (+22/-45), one net test line, and one stale tooling-inventory line. Direct engine commands allocate one fewer adapter object and forwarding closure. Audit registration loses a forwarding call and temporary record object. No wall-clock, CPU, or memory-size improvement is claimed.
Why This Change Was Made
Keep observation at direct engine dispatch; retain the scoped adapter only where scoped operations need it. Keep synchronous warm dispatch, serialize cold inputs before awaiting recovery, preserve receiver binding and close/reopen checks, and never replay uncertain commands.
Call the existing audit writer directly, preserving a fresh writer per invocation and awaited registration. The writer still owns capture, preparation, admission, retention and settlement. The caller now captures context immediately before UUID/time argument evaluation; those synchronous expressions neither await nor change store selection.
Inline the identical retired table literal in the compatibility list and delete its one-line module. Remove its wrapper inventory entry as part of the complete cutover. SQL text and shape, transactions, schema, retention, request counts, effect-authority checks and public SDK surfaces are unchanged. Source provenance: #170138, #165561 and #177694 (Peter Steinberger).
This consolidates #180912 and #180930 into this PR. The wider inventory covered 731 production files / 129,107 lines. The larger candidates retain real migration-freshness, recovery, decoding, import-boundary or released SDK contracts; none justified a larger safe removal. The session-sharing facade removal was withdrawn because it added a modify/delete conflict with #121450. No compatibility implementation is added to meet a deletion quota.
Evidence
test/scripts/eager-import-closure.test.tspassed on the combined tree. This fixes the six failures in prior refactor(state): inline retired table name in compatibility owner #180912 run 39839214136 / job 120036306698, caused by the stale deleted-file entry.git diff --checkpassed. Earlier exact-base scans: Knip production 42→42, all exports 58→58, scripts 0→0, identical findings; Madge 0; T1 170 / compatibility 15; dialect 0/0/6 unchanged. The final batch passed fresh CI static gates, types, and all three PostgreSQL conformance shards. Local types reject the mandated external virtual-store layout before compilation, so CI supplies type proof.2d4e8deab84b80662ab765b84ed30ee9fcd2037dand candidate160263edb76cfa7bd4a7f346e79d9150d65213c9: no new conflict paths or blocks; all existing conflict blocks are byte-identical. The 12 PRs opened since the shared 2,938-PR census have no overlaps (largest file list: 22, no truncated lists). Results are below.160263edb76cfa7bd4a7f346e79d9150d65213c9. Final CI run: 39840444421.dfe0396d257from feat(plugins): keep requester command schedules across Gateway restarts #180844. Its test-selection assertion intest/scripts/ci-changed-node-test-plan.source-owners.test.tsexpectscommands-plugin.scheduled-turns.test.tsafter feat(plugins): keep requester command schedules across Gateway restarts #180844 removed that file's operator-authority import. The exact same assertion fails on maindfe0396d257(8 selected versus 9 expected), while the six focused owner-selection cases pass on this PR branch. This is an independently reproduced inherited failure; it has been reported for repair on main. All three PostgreSQL shards, type/lint lanes, source/architecture guards, build, and other test jobs passed. CI completed with only this inherited test failure and its aggregate CI-gate failure. Landing uses the campaign's authorized inherited-failure exception; CI is not being described as fully green.All 58 open-PR conflict comparisons
Each cell shows conflict-file counts before → after. Existing conflict blocks are unchanged throughout.
aa4b22416d9a0794052e2497901971131244c5ed52da84e5f80d0b2916ef5cb29d92860bc7f91fb698c4c9f464482229a36e7e15605b4191f0a41f93996ef1da381d6f2c9aa53c7f5b0c63ef5ee4a257ad3f203bc9805a2c3e8f37a244b8e046ee6003da2db0d9c110158fae6426296c6aef05eed6c8d61f59322816725f780fe85315e34ba4b4a26068b4840cdc61d8ad401930260ef5f5b80877d3d5a65a503ac60c500450cbac588af7c582875ccbb4ccb1cdc978efa59f1ce48a73e79cb25dc7ae267968c243b9d297415120627c92e01a17560c4036fc5d1d5c8370a830cba1008f8dae34392c9319efa787800f24ff19f9bda8e6ac94f213a20be3595ed00525d08f67e9694a94ab9dd156aca8f05544e2bb721c82a7d08d72643069ba2baa28783b9e29a80bdda6f99d9481f94763f4675cff003dbc14687f6bb4d6a05a0b86b0d3c9ca87eb7c6b42e60d4e272b72aeba123dc3bb06c1a1ef