Repository navigation
refactor(packages): deslop shared packages third pass - #159933
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 27, 2026, 11:30 PM ET / September 28, 2026, 03:30 UTC (Revision 7). ClawSweeper reviewWhat this changesThis PR consolidates shared package handling for provider tools, schemas, transcripts, SDK events, and credential redaction while removing redundant comments. Merge readiness⛔ Blocked before merge - 2 items remain Keep open: the central cleanup is still absent from current main, remains distinct from the earlier package passes, and has no confirmed correctness finding on the pinned head. Priority: P3 Review scores
Verification
How this fits togetherShared packages sit between agent transcripts and tool definitions, provider transports, Gateway clients, and SDK consumers. They prepare requests and context, process events, and sanitize diagnostics. flowchart LR
A[Agent messages and tools] --> B[Shared parsers and projections]
B --> C[Provider requests]
C --> D[Provider responses]
D --> E[Gateway and SDK events]
D --> F[Redacted diagnostics]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Technical reviewBest possible solution: Retain one package-owned implementation for each shared projection while preserving public declarations, event behavior, and credential masking. Do we have a high-confidence way to reproduce the issue? Not applicable: this PR addresses duplicated internal code rather than a reported failing user flow. Is this the best way to solve the issue? Yes: the branch consolidates behavior at existing package owners and retains the inspected public entrypoints. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against 7b2394da7a9d. 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 (6 earlier review cycles)
|
5b75cbd to
15d0303
Compare
3bee839 to
2afbf7f
Compare
Consolidate shared package projection, schema traversal, transcript parsing, and request setup while preserving public export maps, API declarations, runtime behavior, and protocol schemas. Remove redundant facade narration and shrink the assertion baseline for removed casts.
2afbf7f to
740b1e4
Compare
* refactor(packages): deslop shared packages third pass Consolidate shared package projection, schema traversal, transcript parsing, and request setup while preserving public export maps, API declarations, runtime behavior, and protocol schemas. Remove redundant facade narration and shrink the assertion baseline for removed casts. * refactor(memory): keep transcript type at session accessor owner * refactor(packages): retain transcript declaration closure * refactor(packages): preserve declarations and sparse-array conventions
What Problem This Solves
Shared packages retain duplicated internal projection, parsing, and request setup after the first two package cleanups. This is the requested third pass, following #158571 and the still-open second pass in #159279; overlapping cleanup from those PRs is excluded.
User Impact
No intended user-visible change. Package export maps, public API baselines, error messages, runtime behavior, and Gateway protocol schemas remain unchanged. No dependency, configuration, protocol, storage, retention, or migration changes are introduced.
Why This Change Was Made
The candidate removes 585 net package production lines (+417/-1002). Each of the 167 production files over 200 lines was read; the size-sorted coverage log records the applied change or the contract that prevents further simplification. This third pass is below the requested 1,000-line target after excluding earlier/open work and retaining public contracts. One test import follows a removed private forwarder; no tests or assertions are removed or weakened.
Fixes found along the way
A failed nested build can retain the distribution lock because an imported build entry calls
process.exitbefore its child-claim cleanup runs. This tooling defect is outside the package lane and is repaired separately in #160059. It is not claimed fixed by this PR. The lane continued on replacement owned Testbox leases without weakening lock ownership or deleting another process's lock.Evidence
Current candidate:
740b1e42ae1065045cd07ac3ceeee2836ab8f691. Hosted CI run 36369898542 completed successfully at this exact head, includingopenclaw/ci-gate.The final Blacksmith Testbox gate run verified source
2afbf7fc361658b6c1b48e398ca835056f7736afand exact candidate bytes for 109 files. All selected gates passed: targeted lint, production/script/full-tree dead-export scans,pnpm build(409s), Plugin SDK API comparison (253s),pnpm protocol:check(3s), focused tests and import boundaries (77s), and the fullnode scripts/check-changed.mjsgate (1,290s), including all selected typegraphs and guards. The wrapper completed with exit 0 and zero failed gates. After the rebase,git range-diffconfirms that all four package commits are patch-identical; the Testbox result remains prior-head proof, while the hosted run above proves the current head.The earlier broad package-and-boundary run at
b403cb7bdf5a310f0399ab2da0ee31124da1e93drecorded 6,022 passed, two existing skips, and one inherited failure across 383 files in 15 wrapper shards (719s), including all 17 import-boundary files. Repeated reporter summaries are counted once. The failure ispackages/sdk/src/app-sdk-external-boundary.e2e.test.ts: its external-consumer fixture attempts to run a nonexistent build script for the private session URL contract. Still-open #159279 owns the manifest repair. This broad run is not reported as green, and no duplicate fix or weakened assertion is included.The final Plugin SDK API comparison reports no API changes after retaining the original emitted declaration forms. Protocol registry, Swift/Kotlin generation checks, and the protocol since guard passed without generated contract drift. Earlier transcript-header differential proof passed 252,600 exact span comparisons and 15,360 full IR/rendered-byte comparisons. The import-only Azure test change passed all 20 cases with
pnpm test packages/ai/src/providers/azure-openai-responses.test.ts --maxWorkers=1in 2s wall time.The final changed-file gate resolves the earlier unused-export and lint failures. The corpus projection and public type facades retain their original declaration forms. No API baseline changed; the assertion-safety baseline only shrinks for 15 removed casts. Independent isolated Codex reviews through P2, including the declaration-restoration and final completion/sparse-array changes, finished with no accepted/actionable findings in their reviewed scopes.
All tests, checks, and builds ran through the repository wrapper on Blacksmith Testbox. The final successful proof used lease
tbx_01m3js4cxrb97m2xjzgsy367gy, which has been stopped. The wrapper's later external runner-portal sync warning did not change the successful command result. The separate build-lock repair has its own completed proof and is not included in these results.Coverage: every production file over 200 lines, sorted by baseline size
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.tspackages/gateway-protocol/src/schema/plugins.tspackages/gateway-protocol/src/schema/sessions.tspackages/gateway-protocol/src/schema/worker-admission.tspackages/gateway-protocol/src/schema/cron.tspackages/gateway-client/src/session-projection.tspackages/sdk/src/client.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/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-protocol/src/public-schema.tspackages/gateway-client/src/protocol-client.tspackages/ai/src/transports/anthropic-stream-reducer.tspackages/gateway-protocol/src/schema/audit-activity.tspackages/agent-core/src/harness/env/kill-tree.tspackages/ai/src/transports/anthropic-transport-stream.tspackages/agent-core/src/types.tspackages/ai/src/providers/anthropic.tspackages/gateway-protocol/src/connect-error-details.tspackages/tool-call-repair/src/payload.tspackages/terminal-core/src/table.tspackages/ai/src/transports/openai-completions-params.tspackages/memory-host-sdk/src/host/session-transcript-corpus.tspackages/ai/src/transports/openai-responses-replay-messages-internal.tspackages/gateway-protocol/src/validator-registry.tspackages/ai/src/transports/transport-stream-shared.tspackages/markdown-core/src/reasoning-tags.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/gateway-client/src/session-subscriptions.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/agent-core/src/harness/session/tool-result-pairing.tspackages/memory-host-sdk/src/host/types.tspackages/gateway-protocol/src/schema/agent.tspackages/ai/src/transports/openai-transport-params.tspackages/gateway-protocol/src/schema/users.tspackages/markdown-core/src/render.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/acp-core/src/structured-auth-redaction.tspackages/workboard-contract/src/index.tspackages/ai/src/providers/google-stream.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/sdk/src/types.tspackages/ai/src/utils/credential-redaction.tspackages/normalization-core/src/number-coercion.tspackages/agent-core/src/harness/utils/truncate.tspackages/gateway-protocol/src/schema/board.tspackages/ai/src/transports/openai-responses-compaction-replay.tspackages/mermaid-renderer/src/renderer.tspackages/ai/src/providers/google-shared.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/normalization-core/src/json-schema.tspackages/gateway-protocol/src/schema/environments.tspackages/ai/src/transports/openai-completions-dsml.tspackages/markdown-core/src/assistant-transcript.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/providers/openai-tool-projection.tspackages/ai/src/transports/openai-completions-transport.tspackages/model-catalog-core/src/remote-catalog-bundle.tspackages/sdk/src/transport.tspackages/terminal-core/src/ansi-sequences.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-client/src/pending-request.tspackages/gateway-protocol/src/schema/update-runs.tspackages/model-catalog-core/src/model-catalog-types.tspackages/markdown-core/src/frontmatter.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/html-scanner.tspackages/ai/src/providers/anthropic-tool-projection.tspackages/gateway-protocol/src/schema/sessions-row.tspackages/ai/src/transports/openai-responses-continuation.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/ai/src/providers/anthropic-usage.tspackages/gateway-protocol/src/schema/devices.tspackages/ai/src/transports/anthropic-compaction-replay.tspackages/gateway-protocol/src/schema/snapshot.tspackages/ai/src/transports/openai-responses-stream-slots-internal.tspackages/tool-call-repair/src/protection-fast-path.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/markdown-core/src/assistant-transcript-headers.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/model-catalog-core/src/provider-model-id-normalization.tspackages/gateway-protocol/src/schema/sessions-catalog.tspackages/gateway-protocol/src/schema/protocol-schema-selection.tspackages/session-url-contract/src/focus.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/ai/src/providers/openai-tool-schema-compat.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/ai/src/providers/tool-schema-json-projection.tspackages/llm-core/src/model-contracts/anthropic.tspackages/gateway-protocol/src/schema/tasks.tspackages/ai/src/transports/openai-responses-compaction-window.ts