Skip to content

refactor(packages): deslop shared packages third pass - #159933

Merged
steipete merged 4 commits into
mainfrom
deslop/l129-packages3
Sep 28, 2026
Merged

steipete merged 4 commits into
mainfrom
deslop/l129-packages3

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

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.

  • AI tool-choice reconciliation shares one flow with separate Responses/Completions wire shapes. Schema walkers share their container vocabulary; replay calls its canonical context owner; Anthropic's HTTP adapter drops a fake SDK-shaped forwarding object; Google builds one request config.
  • Transcript conversion, tool-result coercion, and deadline notifications remove repeated projection paths without moving storage responsibilities.
  • Markdown transcript headers share role parsing and projection. Frontmatter failure handling, JSON-schema map normalization, table borders, and tool-call classification use existing owners and descriptors.
  • Gateway/SDK cleanup removes duplicated callback/error routing and a private receipt forwarder. Model/media aliases share explicit maps; ACP redaction merges and renders sorted ranges in one pass.
  • Hand-owned facade headers and other comments that only restated their filenames or syntax are removed. Public facades and exports remain intact.

Fixes found along the way

A failed nested build can retain the distribution lock because an imported build entry calls process.exit before 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, including openclaw/ci-gate.

The final Blacksmith Testbox gate run verified source 2afbf7fc361658b6c1b48e398ca835056f7736af and 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 full node scripts/check-changed.mjs gate (1,290s), including all selected typegraphs and guards. The wrapper completed with exit 0 and zero failed gates. After the rebase, git range-diff confirms 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 b403cb7bdf5a310f0399ab2da0ee31124da1e93d recorded 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 is packages/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=1 in 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
Base lines Production file Coverage
1880 packages/tool-call-repair/src/stream-normalizer.ts READ — KEEP: pending-state type/tail and suppressor consolidation already owned by open packages2 PR #159279; remaining state distinguishes streaming admission, caps, partial projection and terminal snapshots.
1717 packages/ai/src/providers/openai-chatgpt-responses.ts READ — Raw WebSocket cache, sticky SSE fallback and dispatch ambiguity differ from SDK transport.
1562 packages/agent-core/src/agent-loop.ts READ — KEEP: #158571 already centralized tool groups; remaining checkpoints preserve source-start admission, steering and settlement ordering.
1511 packages/markdown-core/src/ir.ts READ — KEEP: table/render-target consolidation already owned by #159279; source offsets, non-enumerable provenance, list containers and parser cache each retain distinct contracts.
1308 packages/gateway-client/src/client.ts READ — Retained private stop allocator because its member appears in the public class declaration baseline; preserved auth, retry, and authority boundaries.
1211 packages/gateway-protocol/src/schema/agents-models-skills.ts READ — Public agent, model, skill and GitHub DTO graph; proposals and authorization variants differ in optionality, order and metadata; retain independently inferred API types.
1050 packages/agent-core/src/harness/compaction/compaction.ts READ — KEEP: open packages2 #159279 owns this file; foreground budgets, split-turn history and output caps retain distinct contracts.
951 packages/ai/src/providers/mistral.ts READ — packages2 owns remaining stream cleanup; omitted-index SDK identity matching is intentional.
906 packages/memory-host-sdk/src/host/session-files.ts READ — KEEP: worker/offline projections preserve reset, redaction and provenance contracts; previous packages pass already centralized the shared flow.
802 packages/gateway-protocol/src/schema/channels.ts READ — Talk and channel wire descriptors retained; audio-format and result reuse opportunities are already owned by open packages2 PR 159279.
783 packages/gateway-protocol/src/schema/plugins.ts READ — Install and enable result objects intentionally remain distinct: packages2 demonstrated shared properties collapse compiler identities used by UI unions.
783 packages/gateway-protocol/src/schema/sessions.ts READ — Public session lifecycle and usage contracts retained; repeated session selectors and file-result simplifications are already owned by open packages2 PR 159279.
766 packages/gateway-protocol/src/schema/worker-admission.ts READ — Worker live payload wrappers preserve const-generic readonly inference unlike closedObject; removing them drifts public declarations; frame-specific contracts remain explicit.
761 packages/gateway-protocol/src/schema/cron.ts READ — Public schedules, patches, diagnostic-only fields and deprecated metadata differ deliberately; shared cron shape work already owned by open packages2 PR 159279.
753 packages/gateway-client/src/session-projection.ts READ — Retained durable/imported/pending identity and snapshot promotion distinctions; separate observable reconciliation contracts.
748 packages/sdk/src/client.ts READ — Public namespaces retained; duplicated iterator/timeout cleanup already belongs to open #159279.
746 packages/llm-core/src/types.ts READ — Public declarations, augmentation and documented defaults are locked API contracts.
735 packages/ai/src/transports/openai-responses-stream-internal.ts READ — Active-slot admission and complete sibling validation cannot be merged into one generic event state.
731 packages/memory-host-sdk/src/host/query-expansion.ts READ — KEEP: size is predominantly multilingual vocabulary; recent #159076 owns mixed Chinese/ASCII segmentation.
730 packages/model-catalog-core/src/model-catalog-normalize.ts READ — Existing field normalizers have distinct omission/null/empty contracts; first pass already consolidated common loops and further generic policy would obscure those contracts.
726 packages/memory-host-sdk/src/host/memory-schema.ts READ — KEEP: frozen legacy migration validation and DDL sequencing; schema and recovery edits are outside this lane authorization.
724 packages/agent-core/src/agent.ts READ — KEEP: #158571 already canonicalized pending queues; remaining public adapters bind state ownership and queue semantics.
717 packages/markdown-core/src/reasoning-tag-parser.ts READ — KEEP: previous #158571 consolidated the parser; Markdown source capture and recovery modes retain different provenance and private-content contracts.
716 packages/ai/src/transports/anthropic-payload-policy.ts READ — packages2 owns cache marker allocation; compaction/tool-clearing beta policies differ.
716 packages/ai/src/transports/openai-responses-client.ts READ — Existing executor shares HTTP/WebSocket/Azure flow; continuation, compaction and retry boundaries differ.
694 packages/ai/src/transports/openai-completions-stream.ts READ — packages2 owns stream cleanup; direct/managed timing and DSML fallback retain distinct contracts.
691 packages/ai/src/transports/openai-responses-websocket.ts READ — Cached lease, steering continuation and post-dispatch ambiguity retain separate lifecycle responsibilities.
683 packages/gateway-protocol/src/public-schema.ts READ — Explicit selective re-export list is the public npm API; replacing with broad barrels expands exports and deletion breaks the hard API contract.
676 packages/gateway-client/src/protocol-client.ts READ — Retained socket-generation, handshake, callback reentrancy, and reconnect state-machine owners.
672 packages/ai/src/transports/anthropic-stream-reducer.ts READ — packages2 already consolidates text/thinking sidecars and terminal cleanup.
664 packages/gateway-protocol/src/schema/audit-activity.ts READ — Correlated allOf schemas and explicit wire types enforce cross-field terminal invariants; duplicated actor and decision schema reuse already owned by PR 159279.
654 packages/agent-core/src/harness/env/kill-tree.ts READ — KEEP: open packages2 #159279 owns this file; platform-specific identity and escalation ordering remain necessary.
653 packages/ai/src/transports/anthropic-transport-stream.ts READ — CHANGED: configured request function replaces fake SDK messages.stream wrapper and redundant client interface.
652 packages/agent-core/src/types.ts READ — KEEP: public SDK surface and documented callback/lifecycle contracts are frozen by the task.
647 packages/ai/src/providers/anthropic.ts READ — SDK client injection, browser-safe SSE repair and provider defaults differ from managed HTTP.
633 packages/gateway-protocol/src/connect-error-details.ts READ — Untrusted input normalization and exact legacy errors remain required; recovery normalization cleanup already owned by PR 159279; broader builder sharing would alter typed/untrusted distinctions.
628 packages/tool-call-repair/src/payload.ts READ — APPLIED: consume canonical JSON/XML scan union and remove unused classification value, deleting parallel structural type declarations.
623 packages/terminal-core/src/table.ts READ — APPLIED: represent each border row with ordered glyphs; wrapping and ANSI closing/reopening stay unchanged.
605 packages/ai/src/transports/openai-completions-params.ts READ — packages2 owns token-estimate/payload cleanup; direct/managed defaults and capacity rules differ.
605 packages/memory-host-sdk/src/host/session-transcript-corpus.ts READ — Retained original active/retained projections: consolidation orphaned a type facade, and its removal or relocation changes the strict public declaration closure.
594 packages/ai/src/transports/openai-responses-replay-messages-internal.ts READ — CHANGED: callers use provider replay context owner directly instead of forwarding alias.
580 packages/gateway-protocol/src/validator-registry.ts READ — Named lazy validator exports are public API and preserve independent error state; mapping them dynamically would weaken inferred type guards or change declarations.
567 packages/ai/src/transports/transport-stream-shared.ts READ — Lifecycle, terminal validation and diagnostics already have shared owners; public exports locked.
564 packages/markdown-core/src/reasoning-tags.ts READ — KEEP: incremental buffering and full parser paths serve different stability/performance contracts; recent #158571 owns earlier consolidation.
557 packages/sdk/src/run-event-replay.ts READ — Removed epoch-only forwarding reader; consume canonical event receipt. Retained recovery lifecycle and bounded replay contracts.
549 packages/ai/src/transports/openai-responses-debug.ts READ — Payload, failure and error diagnostics require differing redaction, coercion and bounds.
537 packages/ai/src/providers/google-interactions-shared.ts READ — packages2 owns start-block consolidation; Interactions protocol differs from GenerateContent.
535 packages/ai/src/providers/agent-tools-parameter-schema.ts READ — Earlier sweep consolidated array normalization; compact refs and malformed-input modes differ.
526 packages/memory-host-sdk/src/host/internal.ts READ — KEEP: open packages2 #159279 overlaps; enumeration, root authority and multimodal hashing protect distinct filesystem contracts.
509 packages/gateway-protocol/src/schema/logs-chat.ts READ — Distinct stream states, pending-input receipts and permissive attachments preserve wire semantics; error projection already uses canonical record/truncation owners.
503 packages/net-policy/src/redact-sensitive-url.ts READ — Recursive URL forms preserve distinct parsing and opaque-scheme fail-closed rules; packages2 already owns the sound local reductions here.
499 packages/ai/src/transports/openai-transport-shared.ts READ — Usage/model attestation and structured reasoning owners already shared; identity and billing contracts differ.
491 packages/gateway-protocol/src/schema/openclaw.ts READ — Typed wizard/setup state and activation dialects retained; detected-kind reuse is already owned by PR 159279.
467 packages/gateway-protocol/src/schema/session-placement.ts READ — Placement lifecycle already shares timing, identity and terminal properties; const-generic helpers retain discriminated public types and exact correlation branches.
466 packages/ai/src/providers/clean-for-gemini.ts READ — Gemini definition shadowing, ref resolution and union fallback differ from generic schema walkers.
464 packages/gateway-client/src/session-subscriptions.ts READ — Retained canonical identity admission and capability upgrade/release ownership; recent retry repair already landed.
460 packages/ai/src/transports/anthropic-messages.ts READ — packages2 owns content/parameter cleanup; provider/managed image and fallback semantics differ.
456 packages/llm-core/src/validation.ts READ — Schema scope, nullable coercion and TypeBox fallback ordering are distinct validation contracts.
440 packages/gateway-protocol/src/schema/worker-inference.ts READ — Const-generic constructor preserves public readonly inference; JSON precheck already shared by recent PR 159409; distinct stream and terminal variants are protocol contracts.
433 packages/memory-host-sdk/src/host/memory-schema-storage-migration.ts READ — KEEP: legacy binary conversion validates dependents and renews migration authority; schema and recovery changes are out of scope.
427 packages/agent-core/src/harness/session/tool-result-pairing.ts READ — CHANGED: use canonical object-record coercion and one normalized tool-name projection; remove redundant result casts.
426 packages/memory-host-sdk/src/host/types.ts READ — KEEP: public host contracts are frozen; diagnostic branches carry distinct operator repair and staleness messages.
425 packages/gateway-protocol/src/schema/agent.ts READ — Agent continuation, source routing and channel action DTO fields carry distinct authorization meanings; conversation-reference reuse already owned by PR 159279.
417 packages/ai/src/transports/openai-transport-params.ts READ — Own-property code-mode admission differs from diagnostic reads; header/timeout policy already shared.
417 packages/gateway-protocol/src/schema/users.ts READ — User identity, OAuth and preference DTOs already reuse canonical wizard/GitHub models; separate result identities and nullable semantics are public contract.
413 packages/markdown-core/src/render.ts READ — KEEP: marker-loop/link projection simplifications already owned by #159279; structural ordering and collapsed links need distinct handling.
409 packages/net-policy/src/ip.ts READ — Canonical/loose parsing and IPv6 transition classifications have different SSRF contracts; prior pass consolidated mapped-address handling.
406 packages/agent-core/src/agent-stream-response.ts READ — KEEP: #159409 changed shared usage owner; async fragment durability, provider failure and drain checkpoints cannot be collapsed.
406 packages/gateway-protocol/src/schema/approvals.ts READ — Shared record/resolution fields already centralized; allowed, denied, expired and cancelled branches intentionally carry distinct decision/reason correlations.
405 packages/markdown-core/src/render-aware-chunking.ts READ — KEEP: candidate/queue simplifications already owned by #159279; whitespace coalescing preserves source gaps and code boundaries.
402 packages/acp-core/src/structured-auth-redaction.ts READ — Merge sorted overlapping ranges while rendering replacements; remove the redundant cloned merged-range array and second traversal.
395 packages/workboard-contract/src/index.ts READ — Removed narrating module header; remaining declarations are public workboard contracts and discriminated lifecycle states.
393 packages/ai/src/providers/google-stream.ts READ — Existing shared reducer retains SDK signed-Part identity versus managed delta timing.
391 packages/gateway-protocol/src/theme.ts READ — Theme validation protects text, CSS, font and artwork contracts with exact field-specific errors; consolidating heterogeneous validation adds policy machinery rather than simplifying.
390 packages/ai/src/transports/openai-responses-payload-policy.ts READ — Endpoint capabilities, storage and instructions rules differ by route and caller policy.
390 packages/gateway-protocol/src/schema/exec-approvals.ts READ — File-backed/native owner oneOf branches and policy snapshots have required exclusivity; repeated security/ask vocabulary cleanup already owned by PR 159279.
389 packages/ai/src/transports/openai-responses-stream-terminal-internal.ts READ — Terminal recovery validates ordering before executable tool events and only backfills admitted reasoning.
389 packages/sdk/src/types.ts READ — Public SDK projections, compatibility type names and exported type graph are hard contracts.
383 packages/ai/src/utils/credential-redaction.ts READ — Bounded descriptor traversal and contextual binary/prose redaction enforce distinct confidentiality contracts.
374 packages/normalization-core/src/number-coercion.ts READ — KEEP: exported coercion wrappers are public contracts; strict numeric parsing, Date validity, timer bounds and expiration policies differ intentionally.
371 packages/agent-core/src/harness/utils/truncate.ts READ — KEEP: open packages2 #159279 owns this file; byte/line and surrogate-retention edge contracts remain distinct.
371 packages/gateway-protocol/src/schema/board.ts READ — Board operations and view-ticket capabilities are distinct public discriminated DTOs; existing canonical widget/placement schemas already shared.
368 packages/ai/src/transports/openai-responses-compaction-replay.ts READ — CHANGED: private context forwarder removed; existing provider context owner serves callers.
368 packages/mermaid-renderer/src/renderer.ts READ — Sandbox transport, sanitization and serialized lifecycle each enforce separate documented security/native contracts; no removable competing owner.
363 packages/ai/src/providers/google-shared.ts READ — CHANGED: assemble one generation config directly with preserved field order.
362 packages/gateway-protocol/src/schema/audit-run.ts READ — Execution identity and display projections retain distinct privacy/selection contracts; decision and unknown-state schema reuse already owned by PR 159279.
360 packages/retry/src/index.ts READ — Numeric and options retry overloads differ in zero-delay scheduling and limits; packages2 owns the redundant normalization reductions.
359 packages/tool-call-repair/src/grammar.ts READ — KEEP: previous #158571 consolidated structural scanning; ASCII/XML naming, whitespace and partial-marker semantics are intentionally distinct.
358 packages/agent-core/src/harness/compaction/utils.ts READ — KEEP: shared summary serializer already owns files, sender provenance and bounded non-text omissions; specialized contracts remain required.
356 packages/ai/src/openai-completions-messages.ts READ — packages2 owns assistant/result cleanup; tool pairing and system relocation preserve prompt bytes.
356 packages/ai/src/transports/openai-completions-compat.ts READ — Native/proxy compatibility flags are exact model/endpoint contracts; public resolved shape locked.
354 packages/normalization-core/src/json-schema.ts READ — APPLIED: share schema-map traversal for dependency maps while preserving string-array dependency identity.
353 packages/gateway-protocol/src/schema/environments.ts READ — Fresh summary factories preserve nominal identity for individual response schemas; factory cleanup already owned by PR 159279.
351 packages/ai/src/transports/openai-completions-dsml.ts READ — packages2 owns token helpers; incremental byte bounds and wrapper identity retain parser-specific state.
349 packages/markdown-core/src/assistant-transcript.ts READ — KEEP: token splitting, image-alt offsets, raw-code exclusions and link suppression retain different provenance and ownership contracts.
348 packages/normalization-core/src/error-coercion.ts READ — KEEP: previous #158571 owns graph traversal; formatter wrappers differ in redaction, hostile getter, cause and realm behavior.
347 packages/ai/src/providers/anthropic-model-contract.ts READ — Shared native model identity remains distinct from API-bound request and cross-model replay policy.
347 packages/gateway-protocol/src/schema/config.ts READ — Config apply, patch and update DTO optionality/metadata differs intentionally; config property owner simplification already owned by PR 159279.
342 packages/ai/src/transports/simple-completion-transport.ts READ — packages2 owns preparation flow; plugin/config identity and managed state remain host-owned.
341 packages/media-core/src/mime.ts READ — KEEP: image-format projection simplification already owned by #159279; MIME sniff precedence and aliases are compatibility contracts.
339 packages/ai/src/host.ts READ — Public host ports and deferred registration lifecycle are intentional ownership boundaries.
337 packages/ai/src/transports/openai-responses-replay-internal.ts READ — Reasoning, compaction and previous-response rejection retain separate retry transitions and acceptance timing.
335 packages/ai/src/transports/openai-responses-params-internal.ts READ — Instructions/system replay and native sanitation preserve exact wire and error contracts.
333 packages/memory-host-sdk/src/host/memory-schema-fts.ts READ — KEEP: body/path FTS columns and triggers differ; migration savepoints and frozen schema contracts must remain intact.
329 packages/ai/src/providers/openai-tool-projection.ts READ — CHANGED: one typed tool-choice reconciliation flow preserves Responses and Completions wire forms and errors.
329 packages/ai/src/transports/openai-completions-transport.ts READ — Raw DONE detector and Azure URL/header handling protect transport boundary independently of SDK provider.
329 packages/model-catalog-core/src/remote-catalog-bundle.ts READ — Schema/error behavior remains intact; retained manual compaction because #135091 explicitly optimized sanitizer allocation.
325 packages/sdk/src/transport.ts READ — Removed private epoch-only receipt forwarder after checking all importers and public barrels; connection/event receipt lifecycle retained.
322 packages/terminal-core/src/ansi-sequences.ts READ — KEEP: incremental constant-size sanitizer and complete-input scanner differ in incomplete CSI/OSC and compatibility grammar ownership.
319 packages/ai/src/transports/openai-completions-replay.ts READ — Google signatures, OpenRouter details and DeepSeek reasoning have distinct replay contracts.
319 packages/terminal-core/src/ansi.ts READ — KEEP: byte-level ANSI ownership and grapheme-budget truncation preserve independent controls and trailing resets; public strip variants differ intentionally.
318 packages/ai/src/providers/tool-schema-refs.ts READ — packages2 owns walker write consolidation; root refs and scoped definition semantics remain distinct.
314 packages/ai/src/providers/openai-responses-shared.ts READ — packages2 owns lifecycle option cleanup; shared retry and pricing owners already used.
313 packages/ai/src/providers/openai-completions-tool-calls.ts READ — Legacy/modern identity admission and bounded following-delta buffers guard distinct contracts.
311 packages/ai/src/providers/google-interactions-request.ts READ — Step-oriented request projection cannot substitute GenerateContent parts without wire drift.
308 packages/gateway-client/src/pending-request.ts READ — Timing callback errors now use existing invoke owner; preserved request admission, correlation, suspension replay and settlement.
308 packages/gateway-protocol/src/schema/update-runs.ts READ — Bounded update ledger facts and success/refusal/rollback union branches are serialized public contract; vocabulary/locations already canonicalized.
308 packages/model-catalog-core/src/model-catalog-types.ts READ — Removed narrating module header; shared primitives already come from model-data and remaining types define public catalog metadata.
304 packages/markdown-core/src/frontmatter.ts READ — APPLIED: centralize failed YAML attempt projection and remove reassertion of an already narrowed record.
301 packages/agent-core/src/harness/compaction/branch-summarization.ts READ — Retained original completion flow: consolidation changes the emitted type-import form; keeping the inline-only form violates lint. Preserve the strict declaration baseline without dummy imports.
301 packages/ai/src/providers/google-messages.ts READ — Existing owner preserves differing signed-parts and managed signature/media/ID replay contracts.
301 packages/ai/src/transports/provider-compaction-replay.ts READ — Generic window and pressure estimation already dispatch to provider checkpoint owners.
300 packages/gateway-client/src/session-projection-final-identity.ts READ — Prior/open pass owns shared terminal-position predicate; retained display/persistence/sequence differences.
299 packages/acp-core/src/runtime/types.ts READ — Removed narrating module header; remaining unions and optional legacy adapter methods preserve the public ACP runtime contract.
293 packages/gateway-protocol/src/schema/nodes.ts READ — Node command envelopes intentionally distinguish id/invokeId and JSON/raw payloads; refinement checks protect paired disk values and resource totals.
289 packages/markdown-core/src/html-scanner.ts READ — KEEP: self-closing scan simplification already owned by #159279; render and visibility modes preserve different malformed-input contracts.
286 packages/ai/src/providers/anthropic-tool-projection.ts READ — CHANGED: reuse shared schema map-key owner; tuple conversion and OAuth wire naming remain distinct.
286 packages/gateway-protocol/src/schema/sessions-row.ts READ — Session projection fields have per-field omission/null meanings and live ancestor revisions; snapshot shape is deliberately open and public.
279 packages/ai/src/transports/openai-responses-continuation.ts READ — Ready/claimed ownership, fingerprints and cold restoration carry distinct lifecycle facts.
278 packages/ai/src/providers/openai-completions.ts READ — Direct provider balances end events and preserves first ID unlike managed stream; reducer already shared.
278 packages/model-catalog-core/src/model-catalog-pricing.ts READ — Native and upstream pricing share rate/tier normalization already; qualifications, source precedence and partial rates remain distinct contracts.
276 packages/gateway-protocol/src/gateway-error-details.ts READ — Exact untrusted error readers and fallback messages retained; redundant GatewayErrorLike cast removal already owned by PR 159279.
276 packages/memory-host-sdk/src/host/memory-recall-metadata.ts READ — KEEP: provenance decoding and keyset/project-prefilter queries protect scoped recall; no safe pure refactor avoids storage owner changes.
266 packages/ai/src/env-api-keys.ts READ — packages2 owns provider environment lookup; Node/Bun/browser fallbacks retain named platform contracts.
264 packages/ai/src/providers/anthropic-usage.ts READ — packages2 owns usage mapping; absent/invalid iteration and context/billing semantics remain distinct.
262 packages/gateway-protocol/src/schema/devices.ts READ — Pairing/rotation branches encode token-delivery and stable-tag compatibility; setup metadata optionality is a named shipped contract.
257 packages/ai/src/transports/anthropic-compaction-replay.ts READ — Streaming capture and durable suppression differ from OpenAI encrypted-window checkpoints.
257 packages/gateway-protocol/src/schema/snapshot.ts READ — Hello snapshot deliberately allows empty pre-health state and owner-specific unknown channel bags; optional projection fields remain public contract.
255 packages/ai/src/transports/openai-responses-stream-slots-internal.ts READ — Positional slots and output identity own admission and completed-output state respectively.
252 packages/tool-call-repair/src/protection-fast-path.ts READ — APPLIED: remove duplicate line cursor and unreachable EOF guard; condense repetitive explanation while retaining conservative fallback and linear-work contracts.
245 packages/ai/src/providers/openai-tool-schema.ts READ — packages2 owns recursive walker cleanup; strict compatibility and dialect diagnostics differ.
242 packages/ai/src/internal/retry-after.ts READ — HTTP-date forms, leap-second ordering and descriptor-only timing reads retain RFC/platform contracts.
241 packages/ai/src/providers/azure-openai-responses.ts READ — packages2 owns client setup; endpoint/API-version/deployment contracts remain specific.
240 packages/memory-host-sdk/src/host/markdown-chunks.ts READ — KEEP: entry scopes, weighted overlap and surrogate-safe segmentation each preserve independently tested chunk identities.
239 packages/markdown-core/src/assistant-transcript-headers.ts READ — APPLIED: one role-header parser shares role recognition and span projection for three forms; bounded delimiter scan returns directly.
238 packages/gateway-protocol/src/schema/frames.ts READ — Handshake, authentication and frame-envelope declarations define public transport; lightweight frame guards remain separately necessary for TypeBox-free clients.
235 packages/normalization-core/src/agent-run-terminal-outcome.ts READ — KEEP: lifecycle and wait projections apply different cancellation precedence and auth-revoked semantics to the canonical fact resolver.
234 packages/ai/src/providers/tool-result-text.ts READ — Existing shared text/media owner preserves whitespace and bounded structured output semantics.
232 packages/ai/src/transcript-transform.ts READ — Async result relocation, failed-turn markers and tool pairing retain separate transcript invariants.
232 packages/model-catalog-core/src/provider-model-id-normalization.ts READ — Manifest policy and built-in aliases have different normalization and precedence rules; packages2 owns the unused prefix wrapper reduction.
231 packages/gateway-protocol/src/schema/sessions-catalog.ts READ — Public catalog DTOs retain source IDs and separate terminal result identity; terminal shape reuse already owned by PR 159279.
230 packages/gateway-protocol/src/schema/protocol-schema-selection.ts READ — Exclusion list is the explicit generated-protocol boundary; derivation already centralized and checked against actual exports.
229 packages/session-url-contract/src/focus.ts READ — URL construction, base-path inference and parsing preserve different invalid-input contracts; packages2 owns descriptor-result consolidation.
228 packages/ai/src/transports/openai-responses-contracts.ts READ — Shared errors, constants and request/replay declarations retain public identities.
228 packages/gateway-client/src/session-projection-message-identity.ts READ — Imported/native/transient identity and send/run ownership intentionally have distinct comparison contracts.
228 packages/memory-host-sdk/src/host/config-utils.ts READ — KEEP: narrow public config accepts legacy list/default-agent workspace inheritance; core runtime resolver is not equivalent.
226 packages/ai/src/providers/openai-reasoning-effort.ts READ — Exact model effort/sampling maps and provider-native casing are locked behavior.
226 packages/ai/src/providers/openai-tool-schema-compat.ts READ — CHANGED: shared schema container definitions preserve exact violation iteration order.
224 packages/agent-core/src/internal-hooks.ts READ — KEEP: private WeakMaps preserve distinct admission, steering, result persistence and provenance lifecycles without widening public tools.
222 packages/acp-core/src/runtime/session-identity.ts READ — Identity producer already shared by ensure/event/status; persisted normalization and merge rules preserve source-specific stable-id precedence.
219 packages/llm-core/src/utils/event-stream.ts READ — Producer settlement and thinking append lifetimes remain distinct from consumer queue ownership.
216 packages/memory-host-sdk/src/host/batch-runner.ts READ — KEEP: #158571 centralized compatible batch runs; provider callback and recursive split contracts are already separated.
216 packages/tool-call-repair/src/promote.ts READ — KEEP: string content and mixed block promotion differ in retention/index mapping; prior #158571 consolidated shared call construction.
214 packages/ai/src/providers/tool-schema-json-projection.ts READ — CHANGED: reuse shared schema map-key owner; serialization/getter/finite-value boundary retained.
210 packages/llm-core/src/model-contracts/anthropic.ts READ — packages2 owns family matcher consolidation; effort and replay capability sets differ.
204 packages/gateway-protocol/src/schema/tasks.ts READ — Task lifecycle, transcript pagination and recovery schemas are distinct public contracts; shared task/timestamp/status owners already exist.
202 packages/ai/src/transports/openai-responses-compaction-window.ts READ — Bounded JSON and canonical payload checks guard checkpoint validity before storage/replay.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

ClawSweeper finished reviewing this revision. The review result is being finalized.

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 27, 2026 22:34
@github-actions

github-actions Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components. This comment is informational because the PR author has repository Maintain or Admin access.

  • Current SHA: 740b1e42ae1065045cd07ac3ceeee2836ab8f691
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • packages/acp-core/src/structured-auth-redaction.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • packages/plugin-sdk/src/exec-approvals-runtime.ts: Controls sandbox containment or tool execution authority. Check filesystem and network isolation, approval scope, and command allowlists.
  • packages/plugin-sdk/src/secret-input.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.
  • packages/plugin-sdk/src/secret-ref-runtime.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 27, 2026, 11:30 PM ET / September 28, 2026, 03:30 UTC (Revision 7).

ClawSweeper review

What this changes

This 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
Reviewed head: 740b1e42ae1065045cd07ac3ceeee2836ab8f691

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch has substantial focused validation and no confirmed finding, with breadth limiting review certainty.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The repository-verified admin author's internal refactor is exempt from the external-contributor proof gate. The body supplies differential transcript comparisons, focused package tests, build and API checks, and exact-head CI; no stored-data contract change was found.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository-verified admin author's internal refactor is exempt from the external-contributor proof gate. The body supplies differential transcript comparisons, focused package tests, build and API checks, and exact-head CI; no stored-data contract change was found.
Evidence reviewed 8 items Current main retains the old provider path: Current main still has separate tool-choice reconciliation functions; the branch's shared reconciliation is distinct work.
Introduced provider refactor: The pinned introduced diff combines the Responses and Chat Completions reconciliation flow while retaining their separate exported functions and wire shapes.
Credential redaction boundary: The one-pass renderer advances across sorted overlapping credential ranges and emits one replacement for each merged span; existing logging tests cover structured authorization output.
Findings None None.
Security None None.

How this fits together

Shared 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]
Loading

Before merge

  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

None.

Stored data model

Persistent data-model change detected: unknown-data-model-change: packages/ai/src/providers/schema-keyword-strip.ts, unknown-truncated-pull-files, vector/embedding metadata: packages/memory-host-sdk/src/host/read-retry.ts. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best 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.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is an internal simplification with no intended user-visible behavior change.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The repository-verified admin author's internal refactor is exempt from the external-contributor proof gate. The body supplies differential transcript comparisons, focused package tests, build and API checks, and exact-head CI; no stored-data contract change was found.

Evidence

What I checked:

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • ooiuuii: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • snowzlmbot: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

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 (6 earlier review cycles)
  • reviewed 2026-09-27T22:41:17.054Z sha b403cb7bdf5a310f0399ab2da0ee31124da1e93d :: blocked before merge. :: none
  • reviewed 2026-09-27T23:33:35.495Z sha 15d0303 :: blocked before merge. :: none
  • reviewed 2026-09-27T23:56:13.852Z sha 3bee839 :: blocked before merge. :: none
  • reviewed 2026-09-28T01:12:47.462Z sha 2afbf7f :: blocked before merge. :: none
  • reviewed 2026-09-28T02:34:58.412Z sha 740b1e4 :: blocked before merge. :: none
  • reviewed 2026-09-28T03:22:03.191Z sha 740b1e4 :: blocked before merge. :: none

@steipete
steipete force-pushed the deslop/l129-packages3 branch from 5b75cbd to 15d0303 Compare September 27, 2026 23:20
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 27, 2026
@steipete
steipete force-pushed the deslop/l129-packages3 branch from 3bee839 to 2afbf7f Compare September 28, 2026 01:04
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.
@steipete
steipete force-pushed the deslop/l129-packages3 branch from 2afbf7f to 740b1e4 Compare September 28, 2026 02:27
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. labels Sep 28, 2026
@clawsweeper clawsweeper Bot added rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. labels Sep 28, 2026
@steipete
steipete merged commit 81b7324 into main Sep 28, 2026
220 checks passed
@steipete
steipete deleted the deslop/l129-packages3 branch September 28, 2026 03:53
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
* 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
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. security-sensitive-changed 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