Repository navigation
refactor(core): consolidate runtime shape owners - #177169
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 changes before merge. What this changesThis PR consolidates repeated runtime mechanics into shared internal owners while preserving domain-specific policies. Example: MCP shutdown encounters two cleanup failures.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness⛔ Needs changes before merge - 1 item remains Keep this maintainer-authored PR open: the consolidation is useful, but its new retained-work import breaks extracted PR-wrapper execution. Priority: P2 Before merge
Findings
Agent review detailsHow this fits togetherGateway, agent, CLI, and worker owners supply domain operations to shared helpers that preserve error reporting, transaction admission, private identity propagation, and shutdown settlement. flowchart TD
A[Gateway and agent callers] --> B[Domain policy owners]
C[CLI and node callers] --> B
B --> D[Shared runtime mechanics]
D --> E[Worker transaction owner]
D --> F[Retained work scopes]
D --> G[Collected errors]
Technical reviewBest possible solution: Keep the consolidation and add its retained-work helper to the existing trusted-wrapper inventory. Do we have a high-confidence way to reproduce the issue? Exact-head CI records the missing-module failure, and source inspection confirms the imported helper is absent from the extraction inventory; no target code was executed locally. Is this the best way to solve the issue? The shared owners preserve the inspected domain contracts, and completing the wrapper inventory is the smallest repair for the confirmed regression. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against b8cf2f347f75. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceAcceptance criteria:
What I checked:
Likely related people:
PR surfaceSource -394, Tests +48. Total -346 across 71 files. Added test files: 1. View PR surface stats
Review metrics
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 19, 2026, 5:19 AM ET / 09:19 UTC. |
|
Merged via squash.
|
* refactor(core): consolidate runtime shape owners * fix(core): preserve extracted runtime owner closure
What Problem This Solves
Measured clone groups spread small copies of error aggregation, worker transaction admission, private identity propagation, retained Gateway work, record grouping, replay scanning, cache invalidation, and Claw trust-review projection across core runtime owners. Maintaining those copies separately makes their real policy differences harder to see.
What changed
Reuse existing owners for admitted writes, canonical-path cache invalidation, transcript replay scans, artifact-envelope validation, and grouping. Move repeated pure mechanics to private core owners, migrate their consumers completely, and delete the superseded node-host error module. Grouping stays in its existing plugin-record owner; error aggregation belongs to the existing policy-free internal error-graph owner. Domain-specific authority, cancellation, source validation, error messages, transaction receipts, and shutdown settlement remain with their original owners.
This is an area-sized slice of widely imported owners, with 70 production paths (71 paths including the 48-line leaf contract suite). The separate filesystem and media families are not included. Against the pinned base, production changes are 534 added / 932 removed: 398 net production lines removed. Tests add 48 lines. This is a below-500 owner/area split under the campaign's widely imported helper rule; no unrelated cuts are added to reach a quota.
No public Plugin SDK surface, CLI/config/protocol/persisted shape, dependency, schema, durability, retention, or permission change. Plugins do not import core internals. The standalone Phase E session-memory backend and its machinery/tests are untouched.
Best-effort tradeoffs accepted
No security or durability guard is removed. Invalid internal transcript-commit input may now fail normalization or JSON serialization before opening the database rather than afterward: valid callers already supply the typed prepared input, and opening a database for malformed internal data is not a supported effect. Failure remains visible and no write occurs. All transaction/commit admission, operation labels, receipt values, FIFO ordering, and write-capable shutdown settlement remain intact.
Evidence
The preceding formatted 398-net candidate was independently reviewed with no actionable P0–P2 findings. Its wrapper-inventory gate then correctly failed on two newly introduced helper paths. The repair reuses existing retained owners without changing PR tooling or expanding its inventory; four fewer net production lines are removed and the production-path count falls by nine. Fresh complete-candidate P0–P2 review is scoped-clean. Post-repair proof passed three targeted native typechecks, all five leaf error-contract cases, all five selected wrapper/inventory cases, 28 consumer cases across four files (30 pattern-filtered), all 38 grouping cases across three files, zero runtime value cycles, zero Madge cycles, and all 14 lint-suppression cases. Formatting and diff whitespace checks passed. The author simplify pass retains the distinct policy adapters rather than widening helpers to erase them.
The earlier 304-line subset passed 340 focused cases across 39 files. For the additional 94-line subset, targeted native typechecking of 24 roots passed. Separate focused selections passed 39 cleanup cases across four files (real stdio relay, transcript stop/drain, inference lifecycle), 56 cache cases across six files, eight skill/trust cases across three files, and 103 grouping cases across eight files. The skill and grouping selections filtered 23 and 115 cases respectively; no test definitions were skipped or weakened. These overlapping proof selections are reported separately, not summed into an inflated total. All execution uses isolated state,
nice -n 10, and one Vitest worker. Hosted CI on the exact published head supplies broad proof; no broad local build/typecheck/E2E was run.The dependency-free detector completed again in one low-priority process on exact published head
12ec4aa9afab224d6019d5d9ee6f1c13348af501: 23,338 production files and 4,263,172 physical lines. The measured settled-rejection groupss-87c1d2268528ands-e7c7ca8ad8cdare absent. Its remaining 1,977 exact and 67,689 structural groups include declarations, manifests, intentional mirrors and other unreviewed families; those counts are discovery inventory, not removable-line totals or an exhaustion claim.Current CI repair
The corrective published head
6fe246765d821122f9a24deb6cb4a07a3d356711completed CI 39238593580 successfully. The complete paginated exact-head inventory contains 128 successful, 49 skipped, one neutral and two cancelled checks, with none pending or failed. The cancelled runs are superseded PR-metadata dispatch/context checks; the replacement context check passed. The required CI gate, production/test typechecks, typed lint, Docker seed, PostgreSQL conformance and selected Node suites passed. This is new-head hosted proof; the earlier failed run and load-limited local provisioning attempt below remain accurately recorded, not relabeled passing.Published-head CI 39226217144 failed. The full check inventory and failed logs are retained; it is not green. Two lint jobs name this PR's identity-carrier method references and a map-spread projection. Frozen wrapper extraction also cannot find the newly introduced retained-work helper; this affects the eager import-closure and worktree-provisioning suites. Those failures are PR-caused. The corrective change marks the closure methods receiver-independent, consumes fresh review records without an extra copy, and places the unchanged retained-work class in the existing extracted async-work owner. PR tooling, inventories, tests and suppressions are not expanded or weakened.
The seven-file correction passed fresh independent P0–P2 review, formatting, an 11-root targeted native typecheck, focused type-aware lint, all 19 eager import-closure cases, 21 selected lifecycle cases across four files, and 14 selected skill/trust projection cases across three files. Lifecycle and projection selections filtered 26 and 22 other cases, respectively; no test definition changed. Runtime value cycles and Madge cycles are both zero; all 14 suppression-audit cases passed. Local native provisioning was stopped after 711,817 ms: its first case exceeded the unchanged 120-second timeout, the second passed, and the remaining cases were not completed. That load-limited attempt is retained as incomplete proof, not a defect attribution or a pass. Corrective-head hosted CI must supply broad provisioning proof.
The PR-context jobs also rejected the former generic section headings; this body now uses the required authored problem/evidence sections. The Docker seed job reached
spawn docker ENOENT, which leaves Docker proof missing rather than green. A separate update-candidate schema test failure was investigated through a serial replay of filesystem CI's exact merge and base. Both reproduce the same stale diagnostic expectation after the fixture was moved to final generation verification by #177130. The precise test-only main repair landed as 841081d after all nine schema cases, targeted native types/lint/format and independent P0–P2 review passed; the unrelated main-owned UI suppression-inventory mismatch is recorded separately. That replay does not waive any other current-head failure. All failures will be individually attributed before landing; none is waived by this note.