Skip to content

refactor: consolidate coercion ownership - #122692

Merged
steipete merged 3 commits into
mainfrom
steipete/coercion-helper-consolidation-round5
Aug 12, 2026
Merged

steipete merged 3 commits into
mainfrom
steipete/coercion-helper-consolidation-round5

Conversation

@steipete

@steipete steipete commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Related: #121366

What Problem This Solves

OpenClaw still had hundreds of local coercion wrappers, rename-only facades, and duplicate ownership inventories after the earlier consolidation rounds. That made primitive normalization policy easy to drift across core, the Control UI, scripts, packages, and bundled plugins.

Why This Change Was Made

This round deletes obsolete internal facades and duplicate tooling concepts, routes callers to normalization-core or the narrow Plugin SDK boundary, adds the missing JSON-coercion package subpath and agent-ID ownership coverage, and consolidates exact provider, script, and error policies without broadening their accepted inputs. Dependency-free, serialized, security-sensitive, provider-specific, and shipped compatibility contracts remain local. The extension boundary now has three strict-zero modes and coercion declarations have one exact owner each.

User Impact

No user-visible behavior change is expected. Maintainers get one smaller, enforceable normalization architecture with fewer duplicate policy points; plugin authors retain the same supported public contracts.

Evidence

  • Authorized generated-artifact conflict repair: rebased the two source commits from c2ea14c6de74717d115543d85a480d054eef721f / b99a4cfac65aca803a7e58f73bf0b82cfa415830 onto exact origin/main 28a5889e9bd0b96727e6de872feb0698498b19c6 as 0548effc0a4014a791afd985e1dabf8c39654371 / a155268c917afb54f361ddf91e000c7217e9fcb1. All 16 conflicts were generated docs/.generated/plugin-sdk-api-baseline/*.json files; the rebase kept current-main copies, then pnpm plugin-sdk:api:gen regenerated the canonical output. The resulting 16 one-line hash refreshes are isolated in 82708b8c98044ce4e981026e78c8cb2e7c3948c3, which is the pushed head.
  • Fresh generated-diff P2 autoreview on 82708b8c98044ce4e981026e78c8cb2e7c3948c3: TruffleHog clean; one complete pass; zero findings; confidence 0.98.
  • Fresh final branch P2 autoreview against origin/main 28a5889e9bd0b96727e6de872feb0698498b19c6: TruffleHog clean; two complete bounded passes; zero P0-P2 findings; confidence 0.87.
  • Post-regeneration focused proof passed: Plugin SDK API/export/surface checks, the coercion declaration guard (103 declarations), all three extension boundary modes (src-outside-plugin-sdk, relative-outside-package, normalization-core-bypass), 95 tests across four Vitest shards, and git diff --check.
  • Full changed gate passed on Blacksmith Testbox: https://github.com/openclaw/openclaw/actions/runs/31610626381, lease tbx_01kzv8870ctneprp1kynx0m84x. It passed all ratchets, formatting, package-lock checks, doctor contracts, SDK API/export/surface checks, deprecated API checks, plugin boundaries, dead exports, database/media/sidecar guards, all tsgo lanes, zero-warning oxlint for core/plugins/scripts, and zero runtime import cycles.
  • Exact-head CI run https://github.com/openclaw/openclaw/actions/runs/31613411482 exposed a stale equal-file-count assertion after test/scripts/build-identity.test.ts entered the tooling inventory. The planner contract is greedy LPT runtime weighting, so four nonempty deterministic stripes need complete, non-overlapping coverage and measured heavy-group separation—not equal file counts.
  • Correction proof passed 51/51 focused tests: node scripts/run-vitest.mjs test/scripts/ci-node-test-plan.test.ts test/scripts/build-identity.test.ts test/scripts/ci-changed-node-test-plan.test.ts. Targeted oxlint and git diff --check also passed.
  • Fresh correction P2 autoreview: TruffleHog clean; zero findings; confidence 0.92.
  • Pre-publication P2 autoreview on the exact original tree: secret scan clean; two bounded passes; zero P0-P2 findings; confidence 0.87.
  • Prior post-rebase P2 autoreview against origin/main: secret scan clean; two bounded passes; zero P0-P2 findings; final confidence 0.94.
  • Prior post-rebase focused proof passed: the coercion declaration guard (103 declarations), all three extension boundary modes (src-outside-plugin-sdk, relative-outside-package, normalization-core-bypass), Plugin SDK API/export/surface checks, and 49 tests across four Vitest shards covering normalization-core package exports, live provider-catalog primitives, build identity, coercion declaration ownership, and extension import boundaries.
  • LOC classification: production +896/-1313 (net -417), tooling/docs +353/-715 (net -362), tests/QA +363/-605 (net -242), total +1612/-2633 (net -1021).
  • Direct pinned Codex dependency inspection covered current source at 279b93242cfef379e65da97e87e44b83c5934fd7 and local tag rust-v0.147.0 (3ed6f04f6bf8b7c46299d1cb1ff99c74ce21a51d). The checked contracts were JSON-RPC error envelopes, typed turn errors, the model/list request/response dialect and raw model metadata, and mcpServerStatus/list tool maps. The codex-app-server protocol preflight could not use the sibling checkout version; the pinned local rust-v0.147.0 tag was inspected directly instead.

AI-assisted; the maintainer understands and reviewed the change.

@clawsweeper

clawsweeper Bot commented Aug 12, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

Pull request received. I will update this pull request when review starts.

@steipete
steipete marked this pull request as ready for review August 12, 2026 15:38
@steipete
steipete requested a review from a team as a code owner August 12, 2026 15:38
@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: discord Channel integration: discord channel: imessage Channel integration: imessage channel: matrix Channel integration: matrix channel: msteams Channel integration: msteams channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web app: web-ui App: web-ui gateway Gateway runtime extensions: memory-core Extension: memory-core cli CLI command changes scripts Repository scripts commands Command implementations agents Agent runtime and tooling channel: feishu Channel integration: feishu extensions: openai extensions: qa-lab extensions: codex plugin: google-meet extensions: ollama extensions: xai extensions: policy extensions: parallel fleet extensions: active-memory labels Aug 12, 2026
@clawsweeper

clawsweeper Bot commented Aug 12, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 12, 2026, 12:17 PM ET / 16:17 UTC.

ClawSweeper review

What this changes

The PR consolidates remaining coercion imports into normalization-core and Plugin SDK boundaries, including Control UI call sites and public export metadata.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep open: current main supports the consolidation direction, but the active branch still needs exact-head package and Plugin SDK compatibility validation before landing.

Priority: P2
Reviewed head: 82708b8c98044ce4e981026e78c8cb2e7c3948c3

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Current-main evidence supports the direction, but unavailable exact-head source and incomplete checks prevent a higher-confidence rating.
Proof confidence 🌊 off-meta tidepool Not applicable: This maintainer-authored internal refactor has no claimed user-visible behavior change; supplied tests are supplemental contract coverage.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This maintainer-authored internal refactor has no claimed user-visible behavior change; supplied tests are supplemental contract coverage.
Evidence reviewed 6 items Checkout and branch limitation: The checkout is clean on current main, but the supplied PR head is unavailable locally and network resolution prevents retrieving it; branch conclusions rely on supplied diff context plus current-main source.
Canonical coercion owner: Normalization-core contains the shared string coercion implementation targeted by the import migrations.
Public package-subpath gap: Current main exports JSON coercion from the source barrel but lacks its package subpath export, supporting the PR's package-boundary repair.
Findings None None.
Security None None.

How this fits together

Normalization helpers convert untyped values for core, plugins, scripts, and the Control UI. Package exports and Plugin SDK metadata determine which helpers downstream consumers can safely import.

flowchart LR
  A[Untyped input values] --> B[Normalization helpers]
  B --> C[Core and scripts]
  B --> D[Plugin SDK exports]
  B --> E[Control UI]
  D --> F[Plugins and consumers]
  C --> G[Contract checks]
Loading

Before merge

  • Resolve merge risk (P1) - Changing normalization package subpaths and Plugin SDK metadata can affect existing consumers; exact-head export and contract checks remain in progress.
  • Resolve merge risk (P1) - The exact PR head and any Codex-adapter dependency evidence were unavailable locally, so final review should inspect the resolved merge result and applicable Codex contract before claiming protocol compatibility.
  • Complete next step (P2) - No repair dispatch is appropriate: the active branch needs routine exact-head compatibility validation, not an automated replacement.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production vs test delta Not computed: exact PR head unavailable locally Repository policy requires a production-versus-test delta, but the unavailable head prevents an authoritative classification.
Public boundary surfaces 2 changed: normalization package exports and Plugin SDK metadata Both surfaces can affect external import resolution and generated declaration contracts.

Stored data model

Persistent data-model change detected: migration/backfill/repair: extensions/codex/src/migration/apply.ts, migration/backfill/repair: extensions/codex/src/migration/source.ts, serialized state: ui/src/pages/sessions/sessions-page.ts, unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Validate public package boundaries (recommended)
    Let exact-head package-export and Plugin SDK surface checks complete, then inspect the resolved merge result before landing.

Technical review

Best possible solution:

Complete exact-head package-export and Plugin SDK contract validation, then merge only if generated artifacts preserve existing imports while exposing the intended new subpaths.

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

Not applicable: this is an internal ownership and packaging refactor, not a reported runtime defect.

Is this the best way to solve the issue?

Unclear until the exact branch and generated artifacts are available; current-main source supports the consolidation and identifies a real package-subpath gap.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against f29d581ab824.

Labels

Label changes:

  • add P2: This is a broad internal cleanup with compatibility-sensitive public-boundary changes but no evidence of an active user-facing outage.
  • add merge-risk: 🚨 compatibility: Normalization subpath and Plugin SDK export changes can affect existing plugin and package consumers even when internal imports compile.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal refactor has no claimed user-visible behavior change; supplied tests are supplemental contract coverage.

Label justifications:

  • P2: This is a broad internal cleanup with compatibility-sensitive public-boundary changes but no evidence of an active user-facing outage.
  • merge-risk: 🚨 compatibility: Normalization subpath and Plugin SDK export changes can affect existing plugin and package consumers even when internal imports compile.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This maintainer-authored internal refactor has no claimed user-visible behavior change; supplied tests are supplemental contract coverage.

Evidence

Acceptance criteria:

  • [P1] Verify generated normalization package exports on the exact PR head.
  • [P1] Run Plugin SDK public-subpath contract checks on the resolved merge result.

What I checked:

Likely related people:

  • steipete: Authored the current-main coercion-consolidation commit and the supplied PR commits affecting the same normalization and SDK boundaries. (role: recent area contributor; confidence: high; commits: 964c8c84c18c, 0548effc0a40; files: packages/normalization-core/src/string-coerce.ts, src/plugin-sdk/entrypoints.ts)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Complete exact-head normalization package and Plugin SDK contract checks.
  • Inspect the resolved merge result if main advances before landing.

Rating scale

Score Internal tier Crab rank Meaning
6/6 S 🦀 challenger crab Exceptional readiness
5/6 A 🦞 diamond lobster Very strong readiness
4/6 B 🐚 platinum hermit Good normal PR; ordinary maintainer review
3/6 C 🦐 gold shrimp Useful, but confidence is limited
2/6 D 🦪 silver shellfish Proof or implementation needs work
1/6 F 🧂 unranked krab Not merge-ready
N/A NA 🌊 off-meta tidepool Rating does not apply

Overall follows the weaker of proof and patch quality.
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

Workflow

  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

History

Review history (1 earlier review cycle)
  • reviewed 2026-08-12T16:03:02.666Z sha b99a4cfac65aca803a7e58f73bf0b82cfa415830 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the steipete/coercion-helper-consolidation-round5 branch from b99a4cf to 82708b8 Compare August 12, 2026 16:09
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 12, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready proof for exact head 82708b8c98044ce4e981026e78c8cb2e7c3948c3:

  • Exact-head pull-request CI is green: https://github.com/openclaw/openclaw/actions/runs/31616193954. The watcher ignored only superseded/cancelled duplicate checks and exited GREEN with no active failures.
  • Full changed gate previously passed on Blacksmith Testbox run https://github.com/openclaw/openclaw/actions/runs/31610626381, lease tbx_01kzv8870ctneprp1kynx0m84x.
  • Focused post-regeneration proof passed: pnpm plugin-sdk:api:check, pnpm plugin-sdk:check-exports, pnpm plugin-sdk:surface:check, the 103-entry coercion declaration guard, all three strict-zero extension-boundary modes, the requested seven-file Vitest command (95 tests across four shards), and git diff --check.
  • CI previously found the weighted-shard test assumption: greedy LPT planning guarantees deterministic nonempty complete/non-overlapping coverage and heavy-group separation, not equal file counts. Commit a155268c917afb54f361ddf91e000c7217e9fcb1 preserves that correction after rebase.
  • The conflict repair rebased the two existing commits onto 28a5889e9bd0b96727e6de872feb0698498b19c6. All 16 conflicts were generated docs/.generated/plugin-sdk-api-baseline/*.json files; current-main copies were kept during replay, then pnpm plugin-sdk:api:gen regenerated all canonical hashes. The isolated refresh commit is 82708b8c98044ce4e981026e78c8cb2e7c3948c3.
  • Autoreviews are clean: pre-publication P2 (0.87), weighted-shard correction P2 (0.92), prior post-rebase P2 (0.94), fresh uncommitted generated-diff P2 (0.98), and final exact-branch P2 in two complete passes (0.87); zero P0-P2 findings throughout.
  • Known protocol-preflight gap remains accurately disclosed: the preflight could not use the sibling Codex checkout version. I directly inspected pinned tag rust-v0.147.0 (3ed6f04f6bf8b7c46299d1cb1ff99c74ce21a51d) instead, covering JSON-RPC errors (codex-rs/app-server-protocol/src/rpc.rs:74), typed turn errors (protocol/v2/thread_data.rs:291), model/list (protocol/common.rs:914, protocol/v2/model.rs:40), and mcpServerStatus/list plus tool maps (protocol/common.rs:1029, protocol/v2/mcp.rs:33).

Latest ClawSweeper review is on this exact head with no findings. Its exact-head package/SDK validation and Codex-contract items are satisfied above; its Rank-up moves: are explicitly optional.

@steipete
steipete merged commit c23d66e into main Aug 12, 2026
137 of 138 checks passed
@steipete
steipete deleted the steipete/coercion-helper-consolidation-round5 branch August 12, 2026 16:25
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: discord Channel integration: discord channel: feishu Channel integration: feishu channel: imessage Channel integration: imessage channel: matrix Channel integration: matrix channel: msteams Channel integration: msteams channel: signal Channel integration: signal channel: slack Channel integration: slack channel: telegram Channel integration: telegram channel: whatsapp-web Channel integration: whatsapp-web cli CLI command changes commands Command implementations docs Improvements or additions to documentation extensions: active-memory extensions: browser extensions: codex extensions: memory-core Extension: memory-core extensions: ollama extensions: openai extensions: parallel extensions: policy extensions: qa-lab extensions: qwen extensions: xai fleet gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: google-meet rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts size: XL status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant