Repository navigation
refactor(packages): deslop shared packages second pass - #159279
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 28, 2026, 5:33 PM ET / 21:33 UTC (Revision 44). ClawSweeper reviewWhat this changesThe branch consolidates shared package parsing, streaming, schema, and projection code and makes the SDK bundle its private session URL source for packed consumers. Merge readiness⛔ Blocked before merge - 1 item remains Current main lacks this PR’s distinct package work, and the merged third pass explicitly left these paths to this branch. The prior review’s requested exact-head integration refresh is reported complete; this review found no discrete blocking defect. Priority: P3 Review scores
Verification
How this fits togetherShared packages sit beneath OpenClaw’s agents, Gateway, clients, and plugins. They turn provider responses and client inputs into protocol records, rendered content, and SDK results. flowchart LR
A[Provider responses] --> B[Shared package helpers]
C[Client requests] --> B
B --> D[Gateway protocol]
B --> E[Rendered content]
B --> F[Packed SDK]
D --> G[Agents and clients]
E --> G
F --> G
Before merge
Agent review detailsSecurityNone. PR surfaceSource -747, Config +2, Other -3. Total -748 across 80 files. View PR surface stats
Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Keep one owner for each consolidated package behavior while preserving protocol and public SDK contracts, with the private SDK source included in packed output. Do we have a high-confidence way to reproduce the issue? Not applicable to the cleanup as a whole. For the SDK packaging defect, the existing packed-consumer entry point and the captured before-and-after Testbox results give a focused reproduction path. Is this the best way to solve the issue? Yes. The change uses existing package owners and the standalone builder without adding a parallel public API; the recorded schema and API comparisons support its compatibility aim. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against a46cde88785d. 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 (43 earlier review cycles; latest 8 shown)
|
3a7aa3c to
27ae346
Compare
|
27ae346 to
485a3ea
Compare
485a3ea to
ab417e1
Compare
ab417e1 to
8c37d5b
Compare
fc8b2ed to
b14c5ad
Compare
b14c5ad to
6835dfa
Compare
63ea2ed to
6eae049
Compare
cfdd94b to
be0eea7
Compare
Consolidate remaining stream, parser, schema projection and normalization paths while preserving public exports, wire shapes and runtime semantics. Retain the prior package cleanup owners and shrink assertion ratchets for removed casts.
The private session URL contract exports TypeScript source and has no standalone package build. Keep it as a build-time dependency so the existing package builder bundles it into the SDK. The unchanged external-consumer E2E reproduced the missing build-script failure before this repair.
Refresh the PR merge ref after #160024 repaired the trusted harness inventory and ordinary child-process jsdom preload. Package source and the reviewed tree are unchanged.
Refresh the PR merge ref after #160124 repaired the inherited placement fence synchronization and cleanup race. The reviewed and Testbox-proven package tree remains unchanged.
Refresh the PR merge ref after #160290 separated per-group scheduling from shared compiler inputs. The package tree and active Testbox source hashes are unchanged.
be0eea7 to
4c02d61
Compare
* refactor(packages): deslop shared packages second pass Consolidate remaining stream, parser, schema projection and normalization paths while preserving public exports, wire shapes and runtime semantics. Retain the prior package cleanup owners and shrink assertion ratchets for removed casts. * refactor(packages): preserve schema declarations and finish type cleanup * refactor(packages): preserve explicit guards and import ordering * refactor(packages): retain distinct plugin result declarations * fix(sdk): bundle private session URL dependency The private session URL contract exports TypeScript source and has no standalone package build. Keep it as a build-time dependency so the existing package builder bundles it into the SDK. The unchanged external-consumer E2E reproduced the missing build-script failure before this repair. * ci: refresh packages proof after inherited fixture repairs Refresh the PR merge ref after openclaw#160024 repaired the trusted harness inventory and ordinary child-process jsdom preload. Package source and the reviewed tree are unchanged. * ci: refresh packages proof after placement fixture repair Refresh the PR merge ref after openclaw#160124 repaired the inherited placement fence synchronization and cleanup race. The reviewed and Testbox-proven package tree remains unchanged. * ci: refresh packages after compiler scheduling repair Refresh the PR merge ref after openclaw#160290 separated per-group scheduling from shared compiler inputs. The package tree and active Testbox source hashes are unchanged. * ci: refresh packages after lazy import guard repair
What Problem This Solves
Shared packages still repeat stream handling, schema construction, parsing, and result projection after #158571. This is the requested second deslop pass.
User Impact
No intended runtime, wire-schema, error-message, export-map, or published API change. The existing SDK packaging defect described below is repaired through its existing bundling owner. No dependency version, configuration, protocol, storage, retention, or migration contract changes are introduced.
Why This Change Was Made
The package delta removes 745 net production lines (+690/-1,435) across 78 files, including the SDK manifest repair. TypeScript-only cleanup removes 747 net lines across 77 files; the assertion baseline separately shrinks by 19 casts. No tests are added, deleted, or weakened. The full subtree was read; the attached coverage table records every one of the 165 production files over 200 lines. Upstream consolidations and deliberate Tasks retirement are retained and excluded from this lane's reduction.
Simplifications and rationale
Fixes found along the way
The unchanged external SDK consumer E2E exposed a packaging regression from #158587: the SDK declared the private TypeScript-only session URL contract as an external runtime dependency, although it has no standalone build or published artifact. Moving it to devDependencies makes the existing standalone builder bundle it. The original test failed with
ERR_PNPM_RECURSIVE_RUN_NO_SCRIPTin 21.24s; the repaired test passed on Linux Testbox in 27.01s. Export maps and fixture assertions remain unchanged.A separate package-directory test-selector defect is fixed in #160653. The package campaign below enumerated exact test files, so that discovery did not omit specialized runners from this proof.
Evidence
Final candidate:
4c02d61ce39aeaa36e4c94f94d551a640344a901, rebased onto audited mainc8a045a4f35e063f951130619e5e1cf4bb0de349. All nine commits replayed patch-identically. No changed package path overlaps the final upstream delta; the new capability constant and plugin SDKconvertToLlmexport are preserved. Duplicate searches and source comparison found no replacement for this cleanup or its SDK packaging repair. Independent managed review has no accepted actionable findings through P2; mechanical rebases preserve that reviewed patch.The retained complete campaign at
c4e2cc28837c8998ff736823cebc0996446001f0(base5362ba0ca317aa632e063c40373d91e398517681) passed on Blacksmith Testboxtbx_01m3kj5qwwbxamzf24yhkgp4dz: frozen install;pnpm build(744s); every non-live test in all 16 touched packages plus affected consumers and import boundaries (6,927 passed, two existing skips, 453 files, 14 shards, 986s); schema equivalence; SDK exports/surface and API comparison (zero API changes, 390s); npm-lock, extension types, runtime cycles; andnode scripts/check-changed.mjsover all 78 source/baseline inputs (1,790s). Aggregate exit 0, 1h11m1.058s. No primary test was added, removed, or weakened. This stopped lease's proof is retained with its actual revision attribution.At
be0eea72a7e3a25c36b6d824a1ea364bd6e2fefc, the canonical provider-continuation repair received Linux ARM integration proof on Blacksmith Testboxtbx_01m3mra39qvz9cwpbknjme9dn5(hosting run):packages/tsconfig.jsonand timed out preparing unrelated extension declarations. Its aggregate exited 1 and is not reported as green. The corrected canonical source command,node scripts/run-oxlint.mjs --tsconfig config/tsconfig/oxlint.core.json <all 77 changed package TS files>, passed separately: 0 warnings, 0 errors, 263 rules, 26.47s command. No rules, timeouts, or preparation guards changed.That lease is stopped. The final SDK/capability integration refresh at
4c02d61ce39aeaa36e4c94f94d551a640344a901passed on Blacksmith Testboxtbx_01m3mx1vqht7h4dtwcjb1ejhhk(hosting run): message/frame guards plus all 19 import boundaries, 108 tests in 21 files across 11 shards (254s); complete schema equality (3s); SDK exports (1s), surface (7s), and API comparison (zero changes, 393s). Aggregate exit 0, 18m17.014s. This lease is stopped. The unchanged full package/build/changed-check campaign remains attributed above.Hosted CI and inherited repairs
The previous hosted run at
be0eea72…failed in Bun Canary1.4.3-canary.1, revision6b9148b17: native SIGSEGV/exit 139 at address0x2, 581ms into Gateway-client startup, before any Bun test result. The same row's Node subset passed 255 tests in 16 files. The exact binary/environment/original four-group order passed once against clean CI main parent89c0030e…(289s); this did not reproduce the failure and does not establish a fix. The exact tested-merge comparison atbc57e771a0ee6904a462756198ddbdd6a28201e7also passed once with the same artifact, original four groups, five Node/Bun invocations, environment, and ordering (353s). The native panic remains unreproduced; neither passing comparison is claimed as a fix or proof of a transient cause. Clean-parent control used owned leasetbx_01m3mvzhegqwf445sqh48zmh1r; candidate control usedtbx_01m3mxfkm3zjdz3wtkhgdmafsh. No pin, deadline, assertion, or runtime flag was changed. Both control leases are stopped. Final exact-head CI at4c02d61ce39aeaa36e4c94f94d551a640344a901passed: 140 successful jobs, 19 skipped, zero failures. The prior panic remains recorded; the final green run is not presented as a diagnosed fix.Inherited CI repair attribution
This lane landed broadcast fixture repair #160005 after independent review, 20 repetitions (120 passes), three original CI envelopes, build, and changed checks. It also completed supplemental 20-repeat/negative-control Testbox proof for the existing placement owner #160124 and landed that owner's repair. Duplicate #160125 was closed.
Existing owners landed #159964, #160024, #160187, #160290, #160368, #160408, #160458, #160531, #160517, and #160558; overlapping candidates here were dropped, and duplicate PRs #160255 and #160507 were closed. Their changes do not count toward this package reduction. Main's environment-name correction
6e0d8aa1…, provider-review repairefd9b981…, scheduler fixture correction4bd105408cc, and compact planner packing correctiondf582a401…are retained. The provider repair above received fresh canonical Testbox proof; superseded candidate measurements are not attributed to it.Coverage
BELOW-THRESHOLD-PR-READY: 745 net production lines removed. Required package proof, final SDK integration, and independent review are complete; final exact-head hosted CI is green. This PR remains unmerged with auto-merge off.
Every production file over 200 lines: READ coverage
Shared packages second-pass coverage
Fresh source census at pinned main
c8a045a4f35e063f951130619e5e1cf4bb0de349: all 165 production files over 200 lines, sorted by base size, containing 76,724 baseline production lines. Every qualifying file is marked READ with an applied simplification or retained contract. Test fixtures/support and generated output are excluded. Smaller modules retain the full sweep coverage; all newly changed production modules were reread.Upstream #159409 owns several canonical helper consolidations; they are retained and excluded from this lane's reduction. The skipped-tool distinction is retained. Markdown
ir-slice.ts(194 lines) andir-metadata.ts(169 lines) were reread and preserve canonical list metadata copying. Upstream #159179 retired the 204-lineschema/tasks.tsand Task-specific SDK/protocol surfaces; those removals remain intact and are not counted as this lane's cleanup. Task Suggestions, session task input, and scheduled-task failure remain separate contracts. Smaller changed schemas for artifact scope, suspension, push, and session activity pulse were also read. The later two optional heap-diagnostics GC flags were read and retained unchanged.The later browser-focus, users.merge, embedding credential routing, and fs-safe dependency inputs were read; their upstream additions are retained and excluded from this lane reduction. Both changed embedding owner modules remain below 200 lines.
The latest TLS/WebSocket, widget-limit, skill-library retainFiles, and pending-input schema changes were read and retained. The OpenAI SDK 7.19.0 and proxyline export patch are upstream dependency inputs, not this lane's changes. The shipped public WebSocket constructor facade remains intact.
Upstream third-pass #159933 and the dependency refresh were read and retained. The three overlapping files have independent hunks; no primary cleanup is duplicated. Preserve canonical schema keyword traversal, the operator access-denial code, session-owner-count schema/type re-exports, and heap diagnostics. The response replay-context wrapper remains retired.
assistant-transcript-headers.ts(178 lines) andprotection-fast-path.ts(189 lines) were reread and are now below this table’s threshold. The fast path preserves conservative fence ownership, bare-CR deferral, and linear incremental scanning.Upstream narration subscriptions were reread and retained: stable observer IDs, independent agent scopes, serialized full/narration mode and approval changes, and bounded narration schemas/exports. The new
normalization-core/uuidpublic subpath, TypeScript/UI aliases, and secure UUID generation owner (33 lines, below this table threshold) remain intact. No new production file exceeds 200 lines; the three existing qualifying owners grew by 111 lines in total.Final base
4902e4ae49a669702b92a1df3aeb01b167ec6715adds only the optionalhealth.childRuntimesnapshot field within packages since the narration audit. The complete snapshot owner was reread; its 257-to-265-line increase introduces no new qualifying file. All prior simplifications and upstream public package exports remain preserved.Provider-binding integration base
28340c41f8b88ae6d11488e523808315319747b5retains canonical acknowledged-input identity binding and runtime-context tails, the existing public AI internal/openai subpath export, and optional plugin capability browse categories. The replay owner grew 596 to 619 lines and the plugin schema owner 783 to 785. No new production file exceeds 200 lines; the new 13-line package lint tsconfig is validation metadata. The previous 4902 census is retained separately.Final cutoff
c8a045a4f35e063f951130619e5e1cf4bb0de349adds only theNODE_WORKER_STATUS_WAITcapability in the 26-line server capability owner within packages. The complete owner was reread and preserved. The new plugin SDKconvertToLlmexport forwards the existing untouched message conversion owner. No qualifying production file or size changed; all 165 READ rows remain current.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/channels.tsthenhelper is retained for the configured no-thenable lint contract.packages/gateway-protocol/src/schema/sessions.tspackages/gateway-protocol/src/schema/plugins.ts.propertieskept runtime schema bytes identical but collapsed compiler type identity and triggered UIno-duplicate-type-constituents; the attempted simplification was reverted, and this file matches the base. Other catalog/consent/install shapes differ contractually. Preserve upstream optional unique capabilityCategories browse metadata; no primary edit to this schema owner.packages/gateway-protocol/src/schema/worker-admission.tspackages/gateway-protocol/src/schema/cron.tspackages/gateway-client/src/session-projection.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/sdk/src/client.tspackages/markdown-core/src/reasoning-tag-parser.tspackages/ai/src/transports/anthropic-payload-policy.tspackages/ai/src/transports/openai-responses-client.tspackages/ai/src/transports/openai-completions-stream.tspackages/ai/src/transports/openai-responses-websocket.tspackages/gateway-client/src/protocol-client.tspackages/ai/src/transports/anthropic-stream-reducer.tspackages/gateway-protocol/src/public-schema.tspackages/gateway-protocol/src/schema/audit-activity.tspackages/agent-core/src/harness/env/kill-tree.tspackages/agent-core/src/types.tspackages/ai/src/providers/anthropic.tspackages/ai/src/transports/anthropic-transport-stream.tspackages/gateway-protocol/src/connect-error-details.tspackages/ai/src/transports/openai-responses-replay-messages-internal.tspackages/tool-call-repair/src/payload.tspackages/ai/src/transports/openai-completions-params.tspackages/memory-host-sdk/src/host/session-transcript-corpus.tspackages/terminal-core/src/table.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/google-interactions-shared.tspackages/ai/src/providers/agent-tools-parameter-schema.tspackages/memory-host-sdk/src/host/internal.tspackages/gateway-protocol/src/schema/logs-chat.tspackages/net-policy/src/redact-sensitive-url.tspackages/ai/src/transports/openai-transport-shared.tspackages/gateway-protocol/src/schema/openclaw.tspackages/gateway-protocol/src/schema/session-placement.tspackages/ai/src/providers/clean-for-gemini.tspackages/ai/src/transports/anthropic-messages.tspackages/llm-core/src/validation.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/markdown-core/src/render.tspackages/agent-core/src/harness/session/tool-result-pairing.tspackages/net-policy/src/ip.tspackages/agent-core/src/agent-stream-response.tspackages/gateway-protocol/src/schema/approvals.tspackages/markdown-core/src/render-aware-chunking.tspackages/ai/src/providers/google-stream.tspackages/workboard-contract/src/index.tspackages/acp-core/src/structured-auth-redaction.tspackages/gateway-protocol/src/theme.tspackages/ai/src/transports/openai-responses-payload-policy.tspackages/gateway-protocol/src/schema/exec-approvals.tspackages/ai/src/transports/openai-responses-stream-terminal-internal.tspackages/ai/src/utils/credential-redaction.tspackages/sdk/src/types.tspackages/normalization-core/src/number-coercion.tspackages/gateway-protocol/src/schema/board.tspackages/agent-core/src/harness/utils/truncate.tspackages/mermaid-renderer/src/renderer.tspackages/ai/src/transports/openai-responses-compaction-replay.tspackages/gateway-protocol/src/schema/audit-run.tspackages/retry/src/index.tspackages/tool-call-repair/src/grammar.tspackages/agent-core/src/harness/compaction/utils.tspackages/ai/src/openai-completions-messages.tspackages/ai/src/transports/openai-completions-compat.tspackages/ai/src/providers/google-shared.tspackages/gateway-protocol/src/schema/environments.tspackages/ai/src/transports/openai-completions-dsml.tspackages/markdown-core/src/assistant-transcript.tspackages/normalization-core/src/json-schema.tspackages/normalization-core/src/error-coercion.tspackages/ai/src/providers/anthropic-model-contract.tspackages/gateway-protocol/src/schema/config.tspackages/ai/src/transports/simple-completion-transport.tspackages/media-core/src/mime.tspackages/ai/src/host.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/ai/src/transports/openai-completions-transport.tspackages/model-catalog-core/src/remote-catalog-bundle.tspackages/terminal-core/src/ansi-sequences.tspackages/sdk/src/transport.tspackages/ai/src/transports/openai-completions-replay.tspackages/terminal-core/src/ansi.tspackages/ai/src/providers/tool-schema-refs.tspackages/ai/src/providers/openai-responses-shared.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/agent-core/src/harness/compaction/branch-summarization.tspackages/ai/src/providers/google-messages.tspackages/ai/src/transports/provider-compaction-replay.tspackages/gateway-client/src/session-projection-final-identity.tspackages/acp-core/src/runtime/types.tspackages/gateway-protocol/src/schema/nodes.tspackages/markdown-core/src/frontmatter.tspackages/markdown-core/src/html-scanner.tspackages/gateway-protocol/src/schema/sessions-row.tspackages/ai/src/providers/openai-tool-projection.tspackages/ai/src/providers/anthropic-tool-projection.tspackages/ai/src/transports/openai-responses-continuation.tspackages/session-url-contract/src/focus.tspackages/ai/src/providers/openai-completions.tspackages/model-catalog-core/src/model-catalog-pricing.tspackages/gateway-protocol/src/gateway-error-details.tspackages/memory-host-sdk/src/host/memory-recall-metadata.tspackages/ai/src/env-api-keys.tspackages/gateway-protocol/src/schema/snapshot.tspackages/ai/src/providers/anthropic-usage.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/openai-tool-schema.tspackages/ai/src/internal/retry-after.tspackages/ai/src/providers/azure-openai-responses.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/ai/src/transcript-transform.tspackages/gateway-protocol/src/schema/protocol-schema-selection.tspackages/model-catalog-core/src/provider-model-id-normalization.tspackages/gateway-protocol/src/schema/sessions-catalog.tspackages/ai/src/transports/openai-responses-contracts.tspackages/gateway-client/src/session-projection-message-identity.tspackages/memory-host-sdk/src/host/config-utils.tspackages/ai/src/providers/openai-reasoning-effort.tspackages/agent-core/src/internal-hooks.tspackages/acp-core/src/runtime/session-identity.tspackages/llm-core/src/utils/event-stream.tspackages/memory-host-sdk/src/host/batch-runner.tspackages/tool-call-repair/src/promote.tspackages/llm-core/src/model-contracts/anthropic.tspackages/ai/src/providers/tool-schema-json-projection.tspackages/ai/src/transports/openai-responses-compaction-window.tspackages/gateway-client/src/websocket-transport.tspackages/ai/src/providers/openai-tool-schema-compat.ts