Repository navigation
refactor(packages): deslop packages - #164707
Conversation
Simplify private package plumbing, reuse canonical span and validation owners, and consolidate repeated memory and pricing construction without changing public contracts. Preserve lifecycle and security boundaries. Remove 285 net production lines after complete package coverage; retain exported SDK inheritance and multimodal fallback.
|
🦞👀 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: blocked before merge. Reviewed October 3, 2026, 11:27 PM ET / October 4, 2026, 03:27 UTC (Revision 3). ClawSweeper reviewWhat this changesSimplify shared package helpers, repeated transformations, and private bookkeeping while preserving public interfaces and existing runtime behavior. Warning SQLite table change This PR modifies persisted SQLite tables in Merge readiness⛔ Blocked before merge - 1 item remains Keep open: this remains a distinct, coherent maintainer-authored cleanup. The introduced diff contains no actionable correctness finding or concrete security regression. Priority: P3 Review scores
Verification
How this fits togetherOpenClaw's shared packages process agent execution, conversation events, Markdown, memory requests, and network diagnostics. Their outputs feed Gateway clients, plugins, providers, and terminal presentation. flowchart TD
A[Agent and client requests] --> B[Shared package owners]
C[Provider responses and transcripts] --> B
B --> D[Validation and normalization]
D --> E[Session and memory processing]
D --> F[Markdown and diagnostic rendering]
E --> G[Gateway and plugin consumers]
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource -285, Tests -3, Other 0. Total -288 across 40 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep the existing package owners and supported contracts while adopting the smaller private implementation. Do we have a high-confidence way to reproduce the issue? Not applicable: the PR proposes behavior-preserving cleanup and reports no independently verified product bug. Is this the best way to solve the issue? Yes: the diff reuses existing owners and removes private indirection without introducing competing implementations or changing supported contracts. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 47206579b8e2. 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
History |
Simplify private package plumbing and repeated transformations while preserving public APIs, protocol shapes, lifecycle ordering and security behavior. Reuse canonical Markdown spans and llm validation; reduce memory byte/token/trigger boilerplate, internal aliases and private forwarding helpers. Coverage-exhausted batch: 285 net production lines removed; the PR contains a READ log for all 114 production files over 200 lines. Blacksmith Testbox passed 1,343 tests in 65 files and both cycle checks reported zero. Independent review completed; the original multimodal fallback and SDK protected API were retained. Shrink the affected assertion baseline from 3 to 1. Exact-head hosted CI owns the final gate. Land under the explicitly authorized inherited-failure exception. Final-head CI run 37172814274 has only the mock-export ratchet git ENOBUFS failure and the type-suppression inventory 18-versus-16 mismatch. Unrelated PR openclaw#164726 current run 37172830533 reproduces both exact failures in unchanged tooling/SDK test files. All remaining CI jobs passed or were intentionally skipped; Security Review reports only the same failed CI aggregate. The CJK lint correction passed independent review, AWS focused tests and lint, and both zero-cycle guards.
What Problem This Solves
Shared packages still contain private forwarding layers, repeated transformations, and unused internal bookkeeping after earlier cleanup passes.
User Impact
No intended user-visible change. Public package exports and APIs, protocol/config shapes, persisted data, error text, model-facing output, and lifecycle/security decisions stay unchanged. No migration or dependency change is required.
Why This Change Was Made
This second package pass keeps existing owners and removes structure that contributes no behavior:
The SDK namespace inheritance candidate was retained because its protected method can be used by external subclasses. The multimodal indexing fallback was also retained after review.
BELOW-1000: 285 net production LOC removed, plus 3 test lines. The prior l327 branches changed scripts, not packages; later package passes had already removed the larger redundant owners. This is one coverage-exhausted batch. The complete size-sorted READ log for all 114 production files over 200 lines, with the earlier l327 file lists, is attached below.
Fixes found along the way
No independently verified bug or flaky test was identified. The virtual-boundary test still exercises successful parsing; only its removed private telemetry assertion disappeared.
Evidence
tbx_01m429pdfap7qcfxw4rqwv2q45(run):pnpm install --frozen-lockfile, then focusednode scripts/run-vitest.mjsowner/sibling selection: 65 files / 1,343 tests passed, seven shards in 68.62 seconds.node --import ./scripts/tsx.mjs scripts/check-madge-import-cycles.ts: 0 cycles.node --import ./scripts/tsx.mjs scripts/check-import-cycles.ts: 0 runtime value cycles.node scripts/check-changed.mjs --base fd69a4eedd301350a14ba8dffcdfc621b1493131passed conflict markers and line/max-line ratchets, then requested assertion baseline shrinksession-reset-recall.ts: 3 -> 1; that exact maintenance update is included. Its rerun could not start because the lease expired during source-capsule preparation. Remaining full gates are delegated to exact-head hosted CI; the standalone test timing was completed on AWS below.cbx_20ddda3eeb9e: the CJK correction passednode scripts/run-vitest.mjs packages/memory-host-sdk/src/host/query-expansion.test.ts(29 tests) and targeted Oxlint (0 warnings/errors). Both cycle checks were rerun and reported 0.pnpm test packages/tool-call-repair/src/payload.test.ts --maxWorkers=1passed 27 tests in 3.76 seconds wall time (Vitest 1.95 seconds); no test cases were added, so there is no added CI test cost.37170875928failedcheck-lint-core-1ontypescript(no-misused-spread)in CJK token emission. The correction restores explicitArray.from(part)code-point iteration, passed fresh independent review and the AWS checks above, and does not add a suppression.git diff --checkand touched-file formatting passed. Public barrels/manifests and removed-symbol references were checked across source, plugins, packages, UI, apps, scripts and tests.tbx_01m428dt5qj3f1wmnv0ypj5naeexpired before tests began. The replacement passed the focused checks above, then also expired before the gate rerun. Both Testboxes were confirmed stopped. The task-owned AWS lease was stopped after its successful proof; no unrelated lease or protected staging was removed.The final head is
f230198cba4fd062829aeb51c99daf4d87a01186. Its hosted run has two inherited failures, verified independently on the current headda987fc619889e24c014685f2bc036ef1c4c5af3of unrelated PR #164726 (only two DuckDuckGo files changed):checks-fast-baseline-ratchetsscripts/check-test-mock-exports.mts:spawnSync git ENOBUFSchecks-node-compact-small-11-2test/scripts/type-suppression-inventory.test.ts: expected 16 entries, received 18; both additional entries are insrc/plugin-sdk/plugin-config-runtime.test.tsThe offending tools, test inventory and SDK test are unchanged by this PR. The exact hosted base
cc740dfaf528fa92d36af5eba2e97c15708c3c4falready contains both SDK negative type assertions but lacks their inventory entries. The lane adds no@ts-expect-erroror mock factory. The package proof passed independently; these main/tooling failures remain with the CI coordinator. Merged asb72a95e3f75cb6143847265fe83cc2362b57eea2using the explicitly authorized inherited-failure exception, pinned to the reviewed head above. All remaining CI jobs passed or were intentionally skipped. The Security Review workflow completed successfully and its combined gate cited only the same failed CI aggregate. Merge ancestry and the landed 285-line production reduction were verified onorigin/main.Complete package coverage and l327 merged files
l366 packages second-pass coverage
Scope: packages/** excluding packages/ai. Baseline: fd69a4e.
All production source was read largest-first across disjoint owner lanes, including smaller files, package manifests, exports and main consumers. Every production source file over 200 lines is listed below, sorted by baseline size. Existing lifecycle, schema, transport, redaction and public API contracts were retained. Recent history and open deslop overlap were checked; #164269 overlap and audit/cron closure were excluded from edits.
Previous l327 merged files
The l327 branches merged as #163894 and #164009; neither changed packages. Later package passes #159279, #161002 and #161210 explain why most remaining code already belongs to narrow concrete owners.
164009 — refactor(scripts): deslop CI and release tooling
config/knip.scripts-exports.config.tsscripts/check-openclaw-package-tarball.mtsscripts/ci-build-manifest.mjsscripts/ci-run-timings.mjsscripts/control-ui-i18n.tsscripts/docs-i18n/doc_chunked_raw.goscripts/docs-i18n/localized_links.goscripts/e2e/lib/release-user-journey/write-clickclack-plugin.mjsscripts/frv-publication-status.mtsscripts/frv.d.mtsscripts/frv.mjsscripts/full-release-validation-policy.d.mtsscripts/full-release-validation-policy.mjsscripts/full-release-validation-state.mjsscripts/generate-npm-package-lock.mtsscripts/github/release-validation-campaign.mjsscripts/lib/actions-artifact-archive.mjsscripts/lib/ci-changed-node-test-plan.mtsscripts/lib/ci-extension-test-shards.mtsscripts/lib/ci-node-test-plan.mtsscripts/lib/cross-os-release-checks/config.tsscripts/lib/cross-os-release-checks/install.tsscripts/lib/docker-e2e-plan.mtsscripts/lib/docker-e2e-scenarios.mtsscripts/lib/plugin-npm-package-manifest.mtsscripts/lib/release-beta-verifier.tsscripts/lib/release-postpublish-diagnostic-schema.mtsscripts/protocol-gen-swift.tsscripts/release-ci-summary.mjsscripts/render-github-release-notes.mtsscripts/test-docker-all.mtstest/plugin-clawhub-metadata.test.tstest/plugin-npm-package-manifest.test.tstest/scripts/ci-changed-node-test-plan.config-fallback.test.tstest/scripts/ci-changed-node-test-plan.integration.test.tstest/scripts/ci-changed-node-test-plan.policy.test.tstest/scripts/ci-changed-node-test-plan.source-owners.test.tstest/scripts/ci-changed-node-test-plan.test-support.tstest/scripts/ci-extension-preparation.test.tstest/scripts/ci-node-test-plan.test.tstest/scripts/ci-workflow-pr-control.test.tstest/scripts/extension-test-plan.test.tstest/scripts/generate-npm-package-lock.test.tstest/scripts/npm-runner.test.tstest/scripts/openclaw-cross-os-release-checks.test.tstest/scripts/release-priority.test.tstest/vitest-pr-exempt-retention.test.ts163894 — refactor(ci): deslop browser test ownership inventory
scripts/lib/ci-ui-e2e-owner-inventory.mtsProduction file coverage
packages/tool-call-repair/src/stream-normalizer.tspackages/markdown-core/src/ir.tspackages/agent-core/src/agent-loop.tspackages/gateway-client/src/client.tspackages/gateway-protocol/src/schema/agents-models-skills.tspackages/agent-core/src/harness/compaction/compaction.tspackages/memory-host-sdk/src/host/session-files.tspackages/llm-core/src/types.tspackages/gateway-protocol/src/schema/sessions.tspackages/gateway-protocol/src/schema/plugins.tspackages/agent-core/src/agent.tspackages/gateway-client/src/session-projection.tspackages/worker-runtime/src/worker-task-pool-core.tspackages/gateway-protocol/src/schema/cron.tspackages/gateway-protocol/src/schema/channels.tspackages/memory-host-sdk/src/host/query-expansion.tspackages/markdown-core/src/reasoning-tag-parser.tspackages/model-catalog-core/src/model-catalog-normalize.tspackages/sdk/src/client.tspackages/gateway-protocol/src/public-schema.tspackages/gateway-client/src/protocol-client.tspackages/agent-core/src/types.tspackages/tool-call-repair/src/payload.tspackages/gateway-protocol/src/validator-registry.tspackages/terminal-core/src/table.tspackages/gateway-protocol/src/schema/audit-activity.tspackages/memory-host-sdk/src/host/session-transcript-corpus.tspackages/gateway-client/src/session-subscriptions.tspackages/sdk/src/run-event-replay.tspackages/markdown-core/src/reasoning-tags.tspackages/gateway-protocol/src/connect-error-details.tspackages/agent-core/src/harness/env/kill-tree.tspackages/memory-host-sdk/src/host/memory-schema-storage-migration.tspackages/gateway-protocol/src/schema/logs-chat.tspackages/gateway-protocol/src/schema/worker-admission.tspackages/memory-host-sdk/src/host/internal.tspackages/net-policy/src/redact-sensitive-url.tspackages/gateway-protocol/src/schema/openclaw.tspackages/gateway-protocol/src/schema/session-placement.tspackages/gateway-protocol/src/schema/users.tspackages/agent-core/src/agent-stream-response.tspackages/llm-core/src/validation.tspackages/retry/src/index.tspackages/gateway-protocol/src/schema/agent.tspackages/memory-host-sdk/src/host/memory-schema.tspackages/memory-host-sdk/src/host/types.tspackages/net-policy/src/ip.tspackages/workboard-contract/src/index.tspackages/gateway-protocol/src/schema/config.tspackages/agent-core/src/harness/session/tool-result-pairing.tspackages/markdown-core/src/render.tspackages/gateway-protocol/src/schema/approvals.tspackages/gateway-protocol/src/theme.tspackages/markdown-core/src/render-aware-chunking.tspackages/gateway-protocol/src/schema/exec-approvals.tspackages/acp-core/src/structured-auth-redaction.tspackages/mermaid-renderer/src/renderer.tspackages/normalization-core/src/json-schema.tspackages/normalization-core/src/number-coercion.tspackages/gateway-protocol/src/schema/board.tspackages/sdk/src/types.tspackages/gateway-protocol/src/schema/environments.tspackages/tool-call-repair/src/grammar.tspackages/agent-core/src/harness/utils/truncate.tspackages/agent-core/src/harness/compaction/utils.tspackages/gateway-protocol/src/schema/audit-run.tspackages/markdown-core/src/assistant-transcript.tspackages/normalization-core/src/error-coercion.tspackages/worker-runtime/src/worker-task-pool-retirement.tspackages/memory-host-sdk/src/host/memory-schema-fts.tspackages/model-catalog-core/src/remote-catalog-bundle.tspackages/media-core/src/mime.tspackages/sdk/src/transport.tspackages/gateway-protocol/src/schema/update-runs.tspackages/terminal-core/src/ansi-sequences.tspackages/gateway-protocol/src/schema/worker-inference.tspackages/model-catalog-core/src/model-catalog-types.tspackages/gateway-client/src/pending-request.tspackages/terminal-core/src/ansi.tspackages/gateway-protocol/src/schema/sessions-row.tspackages/agent-core/src/harness/compaction/branch-summarization.tspackages/gateway-protocol/src/schema/nodes.tspackages/acp-core/src/runtime/types.tspackages/markdown-core/src/frontmatter.tspackages/gateway-protocol/src/schema/worker-protocol-primitives.tspackages/workboard-contract/src/sessions-board.tspackages/worker-runtime/src/worker-task-pool-owned.tspackages/markdown-core/src/html-scanner.tspackages/gateway-client/src/session-projection-final-identity.tspackages/model-catalog-core/src/model-catalog-pricing.tspackages/memory-host-sdk/src/host/memory-recall-metadata.tspackages/gateway-protocol/src/gateway-error-details.tspackages/gateway-protocol/src/schema/snapshot.tspackages/session-url-contract/src/focus.tspackages/llm-core/src/utils/event-stream.tspackages/gateway-protocol/src/schema/sessions-catalog.tspackages/llm-core/src/model-contracts/anthropic.tspackages/memory-host-sdk/src/host/markdown-chunks.tspackages/gateway-protocol/src/schema/devices.tspackages/gateway-protocol/src/schema/frames.tspackages/gateway-protocol/src/schema/protocol-schema-selection.tspackages/normalization-core/src/agent-run-terminal-outcome.tspackages/worker-runtime/src/worker-task-server.tspackages/agent-core/src/internal-hooks.tspackages/gateway-client/src/session-projection-message-identity.tspackages/model-catalog-core/src/provider-model-id-normalization.tspackages/acp-core/src/runtime/session-identity.tspackages/gateway-protocol/src/schema/questions.tspackages/agent-core/src/harness/messages.tspackages/memory-host-sdk/src/host/batch-runner.tspackages/memory-host-sdk/src/host/config-utils.tspackages/worker-runtime/src/retained-operation.tspackages/tool-call-repair/src/promote.tspackages/worker-runtime/src/worker-task-pool-resources.tsThe SDK namespace inheritance candidate was rejected: its protected method can be used by external subclasses. No schema, retention, durability, policy, dependency or protocol change is included. No bugs or flaky tests were identified. This is one coverage-exhausted batch below 1,000 net production lines, not a completed 1,000-line batch.