Repository navigation
refactor(packages): deslop shared packages fourth pass - #161002
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: blocked before merge. Reviewed September 29, 2026, 2:18 AM ET / 06:18 UTC (Revision 2). ClawSweeper reviewWhat this changesThe branch consolidates repeated internal logic across shared agent, provider, Gateway, memory, Markdown, and terminal packages while retaining their existing public contracts. Merge readiness⛔ Blocked before merge - 1 item remains Keep open: current main still lacks this fourth cleanup, and the three merged earlier passes cover distinct work. The prior review’s storage compatibility blocker is not supported by the introduced changes. Priority: P3 Review scores
Verification
How this fits togetherShared packages process agent turns, provider responses, Gateway messages, and session data for the rest of OpenClaw. They produce model requests, streamed events, validated client messages, and memory or terminal output. flowchart LR
A[Agent and client inputs] --> B[Shared packages]
B --> C{Validate and route}
C --> D[Provider requests and events]
C --> E[Gateway messages]
B --> F[Memory and terminal output]
Before merge
Agent review detailsSecurityNone. PR surfaceSource -679, Other -2. Total -681 across 71 files. View PR surface stats
Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep one local owner for each repeated package flow while preserving the established wire, API, and stored-state contracts. Do we have a high-confidence way to reproduce the issue? Not applicable: the PR addresses internal duplication rather than a reported failing user flow. Is this the best way to solve the issue? Yes for the inspected paths: the branch consolidates local implementations through existing owners without adding a competing public contract. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against d812797ec244. 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
HistoryReview history (1 earlier review cycle)
|
|
What Problem This Solves
The fourth shared-packages pass removes repeated internal flows and forwarding code left after the previous three passes.
User Impact
No user-visible behavior change. Package exports, public API shapes, Gateway schemas, error text, replay bytes, and stream ordering are preserved. No configuration, migration, dependency, or release change.
Why This Change Was Made
The earlier passes already removed the largest duplicate owners. This pass accumulates smaller simplifications across the remaining files:
psexecution and procfs field parsing; signal authority and process-instance checks remain in their existing owners.The assertion ratchet shrinks only for casts removed by this change. No tests were added or removed. No bug or flaky-test repair was identified during discovery.
Evidence
Measured change: 679 net production lines removed (599 added / 1,278 deleted), plus a two-line shrink in the existing assertion ratchet. No tests or export maps changed. The committed tree exactly matches the remotely validated source tree.
Linux/Node 24 proof used the repository Crabbox wrapper with Blacksmith Testbox (execution workflow):
node scripts/run-vitest.mjsacross the shared package suitespnpm buildpnpm plugin-sdk:api:diff --base origin/main --head HEAD --require-acknowledgementpnpm protocol:checkProtocolSchemasJSON byte comparisonnode scripts/check-changed.mjsThe final Blacksmith Testbox proof lease was
tbx_01m3nne5f2fx6702n9ekb6nraf; the eight trailing guards usedtbx_01m3ntrfx6h752fsyzpryzp2qq(guard workflow). Both were stopped after completion, and all earlier task-owned leases are also stopped/completed.The sole blocking core-lint diagnostic is pre-existing:
src/cron/run-history.test.ts:65:5,oxc(no-map-spread). Scheduled main CI reports the identical error. The file blob is identical on that main run and this PR's base (f89d5260f9d157ca7b827db31b9805281ac7ac6a); this syntax-only lint diagnostic does not depend on any changed package. No coordinator-owned main-CI fix is included here.Hosted CI on exact head
71113f080df244465dcb4ea20edc78cae44e6676(run 36529713199) completed with 87 successful jobs, 20 skipped jobs, 46 fail-fast cancellations, and two failures: the originatingchecks-node-compact-small-18plus its aggregate CI gate. The originating job failed onlyci-node-worker-owner-boundary.test.tscasesmodern-corruptandmodern-unshared:ERR_MODULE_NOT_FOUNDfor the copied fixture'sscripts/lib/vitest-build-prerequisites.mts. The aggregate log explicitly identifies that job as the reason remaining jobs were cancelled; cancelled coverage is not claimed as passing.Independent qualification: the same job on another PR's current head,
1cf36117d51ac85f19f6e366fdb2db0fd4b65840, fails both identical cases with the same missing-module error. That PR changes core/channel code, not packages or these runner fixtures. The fixture blob4fb84c1edc2cd5e0191b5536a8da50558f566c12and runner blobb5fd136d596caa802873825bbb18acb96164f75bmatch this head, that independent head, and fetched main4ee8770db67df7fdd9c69393d05825d9068b0ad6. The copied runner inherits prebuilt mode and imports the absent relative helper before reaching the intended damaged-owner/fallback assertions. None of this PR's changed files participates in that failure path; its importednormalization-core/record-coerceleaf is unchanged. This qualifies the maintainer's explicit inherited-failure merge exception. The coordinator owns the main tooling repair; no duplicate fix is included here.The automated review's remaining data-model compatibility checkbox is rejected as a path-based false positive. Its own source assessment found no stored-format or migration change: schema edits preserve exact protocol JSON; session edits share existing path and ownership projections; the JSONL edit consolidates identical malformed-record handling for an output artifact; SQLite switches from a private forwarding module to the same retained owner. The package suites, byte comparison, unchanged export maps, and zero SDK API delta above validate those contracts. No migration or upgrade contract was introduced.
Independent Codex review completed. Findings were checked against the full source and none were accepted: the existing refusal branch already projected text deltas; the removed SQLite forwarding module is outside the private package's explicit exports and its only caller now imports the retained owner directly; Google lifecycle callers create empty output and its block constructors never assign the removed scratch index. Existing package tests and the exact API check cover those retained contracts.
The merged package history since 2026-09-20 was inspected first, including #158571, #159279, and #159933. The complete coverage log below accounts for every production source file over 200 lines, sorted by original size; smaller modules were also swept. A read-only integration refresh after moving onto current main found no uncovered production file over 200 lines and preserved the new upstream provider and continuation behavior.
Production-file coverage (164 files over 200 lines)
Lane l155 packages fourth-pass coverage
Read coverage uses original fresh-main file sizes. Prior merged package changes since 2026-09-20 were inspected before editing. Each row records a complete production-file read and its change or retention rationale. All package families also received a smaller-file sweep.
packages/tool-call-repair/src/stream-normalizer.tspackages/ai/src/providers/openai-chatgpt-responses.tspackages/agent-core/src/agent-loop.tspackages/markdown-core/src/ir.tspackages/gateway-client/src/client.tspackages/gateway-protocol/src/schema/agents-models-skills.tspackages/agent-core/src/harness/compaction/compaction.tspackages/ai/src/providers/mistral.tspackages/memory-host-sdk/src/host/session-files.tspackages/gateway-protocol/src/schema/plugins.tspackages/gateway-protocol/src/schema/sessions.tspackages/gateway-protocol/src/schema/channels.tspackages/gateway-protocol/src/schema/worker-admission.tspackages/gateway-client/src/session-projection.tspackages/gateway-protocol/src/schema/cron.tspackages/llm-core/src/types.tspackages/ai/src/transports/openai-responses-stream-internal.tspackages/memory-host-sdk/src/host/query-expansion.tspackages/model-catalog-core/src/model-catalog-normalize.tspackages/memory-host-sdk/src/host/memory-schema.tspackages/agent-core/src/agent.tspackages/markdown-core/src/reasoning-tag-parser.tspackages/ai/src/transports/openai-responses-client.tspackages/ai/src/transports/anthropic-payload-policy.tspackages/sdk/src/client.tspackages/ai/src/transports/openai-responses-websocket.tspackages/ai/src/transports/openai-completions-stream.tspackages/gateway-client/src/protocol-client.tspackages/gateway-protocol/src/public-schema.tspackages/agent-core/src/types.tspackages/ai/src/providers/anthropic.tspackages/agent-core/src/harness/env/kill-tree.tspackages/ai/src/transports/anthropic-transport-stream.tspackages/gateway-protocol/src/schema/audit-activity.tspackages/gateway-protocol/src/connect-error-details.tspackages/ai/src/transports/anthropic-stream-reducer.tspackages/ai/src/transports/openai-responses-replay-messages-internal.tspackages/tool-call-repair/src/payload.tspackages/memory-host-sdk/src/host/session-transcript-corpus.tspackages/terminal-core/src/table.tspackages/ai/src/transports/openai-completions-params.tspackages/gateway-protocol/src/validator-registry.tspackages/ai/src/transports/transport-stream-shared.tspackages/markdown-core/src/reasoning-tags.tspackages/gateway-client/src/session-subscriptions.tspackages/sdk/src/run-event-replay.tspackages/ai/src/transports/openai-responses-debug.tspackages/ai/src/providers/agent-tools-parameter-schema.tspackages/ai/src/providers/google-interactions-shared.tspackages/memory-host-sdk/src/host/internal.tspackages/gateway-protocol/src/schema/logs-chat.tspackages/ai/src/transports/openai-transport-shared.tspackages/net-policy/src/redact-sensitive-url.tspackages/gateway-protocol/src/schema/openclaw.tspackages/gateway-protocol/src/schema/session-placement.tspackages/ai/src/providers/clean-for-gemini.tspackages/llm-core/src/validation.tspackages/ai/src/transports/anthropic-messages.tspackages/gateway-protocol/src/schema/worker-inference.tspackages/memory-host-sdk/src/host/memory-schema-storage-migration.tspackages/gateway-protocol/src/schema/users.tspackages/memory-host-sdk/src/host/types.tspackages/gateway-protocol/src/schema/agent.tspackages/ai/src/transports/openai-transport-params.tspackages/agent-core/src/harness/session/tool-result-pairing.tspackages/net-policy/src/ip.tspackages/gateway-protocol/src/schema/approvals.tspackages/agent-core/src/agent-stream-response.tspackages/markdown-core/src/render-aware-chunking.tspackages/markdown-core/src/render.tspackages/workboard-contract/src/index.tspackages/ai/src/providers/google-stream.tspackages/acp-core/src/structured-auth-redaction.tspackages/gateway-protocol/src/theme.tspackages/ai/src/transports/openai-responses-payload-policy.tspackages/ai/src/transports/openai-responses-stream-terminal-internal.tspackages/ai/src/utils/credential-redaction.tspackages/gateway-protocol/src/schema/exec-approvals.tspackages/sdk/src/types.tspackages/normalization-core/src/number-coercion.tspackages/gateway-protocol/src/schema/board.tspackages/mermaid-renderer/src/renderer.tspackages/retry/src/index.tspackages/ai/src/transports/openai-responses-compaction-replay.tspackages/tool-call-repair/src/grammar.tspackages/agent-core/src/harness/compaction/utils.tspackages/agent-core/src/harness/utils/truncate.tspackages/ai/src/transports/openai-completions-compat.tspackages/ai/src/providers/google-shared.tsindexdeletion: neither Google stream producer creates this property, and both runtime callers create empty assistant output. Kept adaptive compatibility and model-specific thinking decisions. Internal model-family predicates are stricter than these provider predicates, so replacing them would change behavior.packages/ai/src/openai-completions-messages.tspackages/gateway-protocol/src/schema/audit-run.tspackages/normalization-core/src/json-schema.tspackages/markdown-core/src/assistant-transcript.tspackages/gateway-protocol/src/schema/environments.tspackages/normalization-core/src/error-coercion.tspackages/ai/src/providers/anthropic-model-contract.tspackages/gateway-protocol/src/schema/config.tspackages/ai/src/host.tspackages/ai/src/transports/openai-completions-dsml.tspackages/ai/src/transports/openai-responses-replay-internal.tspackages/ai/src/transports/openai-responses-params-internal.tspackages/memory-host-sdk/src/host/memory-schema-fts.tspackages/model-catalog-core/src/remote-catalog-bundle.tspackages/ai/src/transports/openai-completions-transport.tspackages/media-core/src/mime.tspackages/terminal-core/src/ansi-sequences.tspackages/sdk/src/transport.tspackages/terminal-core/src/ansi.tspackages/ai/src/transports/openai-completions-replay.tspackages/ai/src/transports/simple-completion-transport.tspackages/ai/src/providers/openai-completions-tool-calls.tspackages/ai/src/providers/google-interactions-request.tspackages/gateway-protocol/src/schema/update-runs.tspackages/model-catalog-core/src/model-catalog-types.tspackages/gateway-client/src/pending-request.tspackages/ai/src/providers/tool-schema-refs.tspackages/ai/src/providers/openai-responses-shared.tspackages/ai/src/transports/provider-compaction-replay.tspackages/ai/src/providers/google-messages.tspackages/agent-core/src/harness/compaction/branch-summarization.tspackages/acp-core/src/runtime/types.tspackages/gateway-protocol/src/schema/nodes.tspackages/markdown-core/src/frontmatter.tspackages/gateway-protocol/src/schema/sessions-row.tspackages/ai/src/providers/openai-tool-projection.tspackages/markdown-core/src/html-scanner.tspackages/gateway-client/src/session-projection-final-identity.tspackages/ai/src/transports/openai-responses-continuation.tspackages/ai/src/providers/anthropic-tool-projection.tspackages/model-catalog-core/src/model-catalog-pricing.tspackages/ai/src/providers/openai-completions.tspackages/memory-host-sdk/src/host/memory-recall-metadata.tspackages/gateway-protocol/src/gateway-error-details.tspackages/session-url-contract/src/focus.tspackages/gateway-protocol/src/schema/snapshot.tspackages/gateway-protocol/src/schema/devices.tspackages/ai/src/transports/anthropic-compaction-replay.tspackages/ai/src/transports/openai-responses-stream-slots-internal.tspackages/ai/src/providers/anthropic-usage.tspackages/ai/src/env-api-keys.tspackages/ai/src/internal/retry-after.tspackages/memory-host-sdk/src/host/markdown-chunks.tspackages/gateway-protocol/src/schema/frames.tspackages/normalization-core/src/agent-run-terminal-outcome.tspackages/ai/src/providers/tool-result-text.tspackages/gateway-protocol/src/schema/protocol-schema-selection.tspackages/ai/src/transcript-transform.tspackages/gateway-protocol/src/schema/sessions-catalog.tspackages/memory-host-sdk/src/host/config-utils.tspackages/gateway-client/src/session-projection-message-identity.tspackages/ai/src/transports/openai-responses-contracts.tspackages/model-catalog-core/src/provider-model-id-normalization.tspackages/ai/src/providers/openai-reasoning-effort.tspackages/agent-core/src/internal-hooks.tspackages/ai/src/providers/openai-tool-schema.tspackages/acp-core/src/runtime/session-identity.tspackages/llm-core/src/utils/event-stream.tspackages/ai/src/providers/azure-openai-responses.tspackages/tool-call-repair/src/promote.tspackages/memory-host-sdk/src/host/batch-runner.tspackages/llm-core/src/model-contracts/anthropic.tspackages/gateway-client/src/websocket-transport.tspackages/ai/src/transports/openai-responses-compaction-window.tspackages/ai/src/providers/openai-tool-schema-compat.ts