Repository navigation
refactor: centralize small helper owners and core callers - #174859
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 centralizes small normalization, hashing, text, shell-quoting, and HTTP helpers and migrates core and bundled-plugin callers. Example: The Gateway sends an HTTP 401 Unauthorized JSON response.
Review scores
ProductKind: Refactor · Worth it: Yes · Fix scope: Complete Merge readiness✅ Ready for maintainer review The previous owner-cutover findings are fixed, and no additional actionable code defect was found. Keep this maintainer-authored PR open while exact-head CI remains unresolved. Priority: P3 Before mergeNone. FindingsNone. Agent review detailsHow this fits togetherCore callers and bundled plugins use these helpers to admit input, derive stable identities, prepare text, and serialize HTTP responses. flowchart TD
A[Core callers] --> C[Normalization core]
B[Bundled plugins] --> D[Private SDK facades]
D --> C
A --> E[Shared text and HTTP helpers]
D --> E
C --> F[Admitted values and stable hashes]
E --> G[Quoted text and JSON responses]
Technical reviewBest possible solution: Keep the canonical helper owners and existing caller contracts, including byte-identical identity hashes and HTTP serialization behavior. Do we have a high-confidence way to reproduce the issue? This PR claims a behavior-preserving refactor, not a user-facing bug; the review inspected source and supplied evidence without executing target code. Is this the best way to solve the issue? The approved owner-first scope appropriately reuses foundational helpers and narrow bundled facades while preserving the distinct caller policies. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 9dd47e67ded4. Provenance checked
TestingProof path: in-process harness. SecurityNone. EvidenceWhat I checked:
Likely related people:
PR surfaceSource -61, Tests +211, Docs +2, Config +14, Other +4. Total +170 across 71 files. Added test files: 3. 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 HistoryReview history (3 earlier review cycles)
Reviewed October 16, 2026, 10:45 PM ET / October 17, 2026, 02:45 UTC (Revision 4). |
|
@clawsweeper re-review The repair head is 016763a. It shrinks the assertion baseline and consolidates ensureRecord in the existing normalization record owner, preserving the legacy config export and protected wrapper import closure. The seven-file repair received a fresh isolated scoped-clean review; all five focused files passed (33 tests). The PR body records the measured area size and remaining exact-head CI attribution. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review The final owner-first area is now 70 paths at b349034. The body records the complete canonical guard repair, frozen independent review, focused proof and incomplete local tooling cases, and attributed prior-head failures. The 23 Gateway/infra caller paths are preserved for their separate area. |
|
🦞👀 Re-review progress:
|
|
@clawsweeper re-review The owner-first area is now 71 paths at e7cc471. The one-file repair replaces Gateway's duplicate sendJson body with a direct canonical reexport; its function body, signature, serialization timing and header commitment are unchanged. Fresh independent P0-P2 review found no actionable issue. Mandatory lint-suppressions passed 3/3 again; focused Gateway proof is in progress, with unchanged HTTP owner socket proof retained separately. The body distinguishes prior-head CI attribution from the repaired head. Twenty-two deferred Gateway/infra callers remain preserved for their separate area. |
|
🦞👀 Re-review progress:
|
|
Landing evidence for exact reviewed/prepared head Native review validation and preparation completed without changing the head. Exact-head CI 38995261929, attempt 1 completed all 200 jobs: 177 successful, 18 skipped, four failed root jobs and their aggregate gate. The inspected checkout was
Builds, caller types, PostgreSQL conformance, source contracts, architecture guards, guards and Two consecutive native admission attempts on the unchanged exact head both passed The coordinator authorized the supported exact-head guarded REST squash fallback after those two native infrastructure/startup-deadline failures. Remote reconciliation still showed OPEN, exact head, no auto-merge or prior merge intent/outcome. Current effective policy requires GitHub Actions |
#174744 and #174859 landed together; the consolidated lstatIfExists helper is always bigint and takes one argument, so tsgo failed on main. Co-authored-by: steipete <[email protected]>
…74859) * refactor: centralize small helper owners and core callers * refactor: give nested record coercion one canonical owner * refactor(helpers): finish canonical record helper cutover * refactor(shared): finish canonical coercion owners and split caller areas * refactor(http): finish canonical Gateway JSON writer cutover
What Problem This Solves
Private copies of coercion, collection, text, hashing, shell-quoting, and JSON response helpers repeat across core and bundled plugins. This is the owner-first area of the coordinator-authorized split of the parked helper family. Later area PRs migrate callers without repeating SDK registration.
What changed
Reuse existing normalization record and number owners for string-array admission, conditional record creation, ordinary integer admission, and positive-number flooring. Remove exact named private copies required by the strict declaration guard; retain differently named nonblank and bounded-array domain policies. The string-array primitive lives in the foundational package, not in core above its package consumers.
Reuse existing SHA and content-block owners, retire the memory-host hash forwarding file while preserving exported signatures, and introduce narrow bundled-only collection and HTTP response facades. Preserve sparse arrays, conditional assignment and record identity, unsafe integers, signed zero, sub-one flooring, hash preimages, two POSIX quote spellings, and distinct HTTP framing/header/serialization contracts.
The candidate is trimmed to 71 paths. Twenty-two Gateway/infra callers are preserved for their later area, not dropped for a CI failure. Gateway's exported JSON writer stays in this first area so the new canonical writer does not land beside an exported duplicate. Phase E standalone session-memory backend, factory, registry, expiry, federation, and tests are untouched. No config key, protocol shape, dependency, persisted schema, security authority, or durability change is included. SDK budgets and lint suppressions are not relaxed.
Best-effort tradeoffs accepted
Size
Against base b7cbaf1: 71 total paths, +507/-337. Runtime/tooling source excluding tests/support is 58 paths, +254/-320: 66 net source lines removed. Charging documentation, SDK metadata, and registration overhead gives 65 non-test paths, +283/-324: 41 conservative net production lines removed. Six test/support paths add 211 net lines and do not count as production savings. The floor is waived for this owner-first reconstruction; later area migrations carry the corresponding reductions.
Evidence
Existing component evidence is retained only where source identity matches: collection 13/13; HTTP 6/6 plus expanded real Node GET/HEAD/serialization matrix 10/10; shell/numeric 40/40; ten pure-leaf typechecks. Serial repair proof previously passed collection, wrapper closure, coercion declaration fixtures, lint suppressions, and legacy config: 33 tests. Independent isolated P0-P2 reviews cover the original components and conditional ensureRecord repair.
The 70-path owner candidate passed fresh independent isolated P0-P2 review (confidence 0.90), with no actionable findings. All 70 source identities and patch SHA-256 d559ea3a41beaa2c87945fdaff4e9a9053d4ec53e3b034a1f04798b7fb49a898 match that frozen review. The subsequent one-file Gateway JSON writer cutover passed fresh independent P0-P2 review (confidence 0.99); the canonical function body, public signature, header commitment and serialization ordering are unchanged. Fresh focused serial proof passed collection 13/13, all 11 selected numeric-policy cases, mandatory lint suppressions 3/3, and two wrapper-closure cases before the 600-second outer budget stopped the tooling project. The remaining closure case and coercion fixtures are incomplete, not failed assertions; prior component results are retained separately. Broad caller types, builds, SDK API/surface, and architecture checks remain exact-head hosted-CI proof. No retries, timeout increases, skips, or budget weakening were used.
On repaired head e7cc471, another isolated serial focused attempt passed mandatory lint suppressions 3/3. Gateway http-common produced no assertion results before the unchanged 600-second outer budget stopped cold compiled-subprocess preparation (collector exit124, child143). All owned children drained. This is incomplete local preparation, not a failed product assertion; the unchanged writer's 10-case real Node HTTP boundary matrix and direct-equivalence review remain the scoped contract evidence. No local retry or broad build was used.
Exact head b349034 completed CI run 38992254476 attempt 1: 179 successful jobs, 17 skipped, three substantive failures and the aggregate gate. The source-contract failure was PR-caused: Gateway's still-private-area sendJson implementation collided with the new owner. The repair restores only its direct canonical reexport to this first area, without a guard exception. The fast mock-export failure exactly matches scheduled main run 38991549274/job117275051710 at src/cli/update-cli/update-command-service-maintenance-native.test-support.ts:52 for update-command-database-context.js. All five quiet-child restart cases again match the serial head/base missing-original-operator-source diagnosis below. These are prior-head observations, not passing proof for the repaired head.
Current exact-head CI and inherited-failure qualification
Head e7cc471 completed CI run 38995261929, attempt 1: 177 successful jobs, 18 skipped, four nonaggregate failures and their aggregate gate. Build artifacts, caller types, source contracts, architecture guards, security-fast, and PostgreSQL conformance passed. The hosted checkout was merge 0f7aad424aed91d0bb129faf9f5f0beb63bb9c02, with ordered parents aec89e4 and the exact PR head.
The complete exact-head check inventory was also inspected, not just ci.yml. Six separate CodeQL Security High boundary jobs, the precise scan's SARIF upload, and the Critical Quality selector failed with individually verified GitHub installation API-rate-limit errors. They are infrastructure failures, not asserted security findings or successful coverage. Current dependency-review and security-sensitive-review status projections are successful; the combined CI gate remains failed. Native landing still revalidates the actual enforced reviews, security authority, and effective required checks. No CI rerun, repush for green, timeout increase, skip, or weakened assertion was used.
Attributed prior-head CI
These observations belong to prior exact head 016763a, run 38985939338 attempt 1; they are not evidence for the next head.
Serial diagnostic run: https://github.com/openclaw/openclaw/actions/runs/38987871909 . Each revision had its own clean worktree/install and isolated runtime directories. The collector exited successfully but the selected tests failed as described; collector success is not passing proof. Its task-owned Testbox lease is stopped and settlement reconciled. The older metadata-observation failure also matched scheduled main run 38981593815, job 117243595187, at ece4639 with identical test bytes; retained as historical evidence, not substituted for current-head attribution.