Skip to content

refactor(packages): deslop shared packages fourth pass - #161002

Merged
steipete merged 1 commit into
mainfrom
deslop/l155-packages4-final
Sep 29, 2026
Merged

steipete merged 1 commit into
mainfrom
deslop/l155-packages4-final

Conversation

@steipete

@steipete steipete commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

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:

  • Agent process inspection shares ps execution and procfs field parsing; signal authority and process-instance checks remain in their existing owners.
  • Agent loops call their implementation directly, and synthetic tool-result replacement uses the existing occurrence queue.
  • Tool-call repair uses concrete discriminants and common terminal projection paths, removing a shallow-clone forwarder.
  • AI providers share required API-key validation and text-signature encoding without adding public exports. Anthropic adaptive-thinking options and Mistral/Google block events use one common publication path.
  • Responses transports share replay-state access and text-delta dispatch, retaining Azure and refusal-specific payload shapes. Stream internals import canonical content types.
  • JSON Schema coercion and stable object serialization share repeated loops while preserving ordering, normalized-key collisions, and error behavior.
  • Gateway connection authentication imports canonical string normalization; pairing metadata builders/readers share one projection.
  • Terminal attach reuses open-result properties, and wizard status drops a private alias while retaining its exported declaration position. Independent schema identities and emitted API declarations remain unchanged.
  • Memory JSONL error handling, session ownership, path comparison, and keyword uniqueness have one local owner. A private SQLite forwarding layer is removed.
  • Markdown role-header clipping and render preparation share existing owners; ANSI stripping and terminal restoration share repeated bookkeeping.
  • Inline-image validation and bounded ACP escape scanning remove redundant intermediate flows.

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):

Command / contract Result
node scripts/run-vitest.mjs across the shared package suites 443 files, 6,833 tests passed; 2 skipped; 170 s
Import-boundary tests, including fs-safe, plus process/redaction consumers 26 files, 370 tests passed; 1 skipped; 80 s
pnpm build Passed; 309 s
pnpm plugin-sdk:api:diff --base origin/main --head HEAD --require-acknowledgement No Plugin SDK API changes; 147 s; no acknowledgement used
pnpm protocol:check Passed; Swift/Kotlin output unchanged; 2 s
Base/candidate ProtocolSchemas JSON byte comparison Identical; 5 s
Focused type-aware lint of the corrected files and UI consumer Passed with zero warnings/errors; 17 s
node scripts/check-changed.mjs All type shards, ratchets, metadata/dependency guards, and three Knip scans passed. Core lint stopped on the inherited failure below.
Eight guards sequenced after core lint Passed separately: native state schema versions, database-first stores, media helpers, runtime sidecars, import cycles, webhook bodies, pairing stores, and pairing account scope.

The final Blacksmith Testbox proof lease was tbx_01m3nne5f2fx6702n9ekb6nraf; the eight trailing guards used tbx_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 originating checks-node-compact-small-18 plus its aggregate CI gate. The originating job failed only ci-node-worker-owner-boundary.test.ts cases modern-corrupt and modern-unshared: ERR_MODULE_NOT_FOUND for the copied fixture's scripts/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 blob 4fb84c1edc2cd5e0191b5536a8da50558f566c12 and runner blob b5fd136d596caa802873825bbb18acb96164f75b match this head, that independent head, and fetched main 4ee8770db67df7fdd9c69393d05825d9068b0ad6. 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 imported normalization-core/record-coerce leaf 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.

Lines Production file Coverage and outcome
1863 packages/tool-call-repair/src/stream-normalizer.ts READ: preserve bounded buffering, protected-range authority, event indexes, terminal snapshots and all syntax distinctions; replace cast with discriminant narrowing, use existing suppressor dispatcher, remove clone forwarding, unify terminal/EOF auxiliary projection branches.
1717 packages/ai/src/providers/openai-chatgpt-responses.ts READ: shared required-key resolution; preserve connection ownership, replay, retry, timeout and refusal boundaries. Personally inspected sibling codex-rs/core/src/client.rs and codex-api/src/endpoint/responses_websocket.rs continuation ownership.
1562 packages/agent-core/src/agent-loop.ts READ: remove the public entry point's redundant private forwarding layer while preserving original emitted export order; use the existing tool-batch owner for hidden-progress resolution. Retain the taintedMessage temporary because it prevents TypeScript excess-property rejection at the public return boundary. Admission, settlement, hook order, cancellation and taint contracts remain distinct.
1509 packages/markdown-core/src/ir.ts READ. One parser/render-state owner; append/slice branches differ in source metadata and ownership transfer. Prior passes already consolidated shared spans.
1307 packages/gateway-client/src/client.ts READ — Node adapter policy, device-token persistence, protocol negotiation, and shutdown ordering belong to this adapter; wire state machine already delegates to protocol-client.
1211 packages/gateway-protocol/src/schema/agents-models-skills.ts READ — Distinct request/result schema contracts and owner-local static types; existing proposal attribution fields already share a canonical object. No further safe structural cut without changing public nominal schema identities or field constraints.
1014 packages/agent-core/src/harness/compaction/compaction.ts READ: no sound additional cut; estimation, retained-tail selection and summary fitting have different contracts, and prior passes already consolidated prompt/summary ownership. Prompt bytes and persistence metadata must remain identical.
944 packages/ai/src/providers/mistral.ts READ: shared required-key resolution and one text/thinking end-event publication path; retain SDK-default index identity disambiguation and schema conversion semantics.
906 packages/memory-host-sdk/src/host/session-files.ts READ — share path comparison with corpus discovery; remove a one-caller path forwarding layer; reuse the existing transcript-store-entry type. Retain archive versus SQLite, incognito, worker, redaction, and reset-generation contracts.
812 packages/gateway-protocol/src/schema/plugins.ts READ — Retained independent result fields: sharing property objects triggers duplicate-type lint in downstream PluginMutationResult even though schema JSON and declarations match.
791 packages/gateway-protocol/src/schema/sessions.ts READ — Retained explicit fork editor fields: spreading rewind properties preserves JSON but reorders emitted API declarations, violating the exact baseline contract.
782 packages/gateway-protocol/src/schema/channels.ts READ — Removed pure narration; retained explicit tuning and browser session fields because spreads reorder emitted API declarations. Kept correlation, delimiter, compatibility, secret, and schema-light account comments.
766 packages/gateway-protocol/src/schema/worker-admission.ts READ — Prior passes already share worker tool, approval, fallback, and terminal fields. workerLiveObject preserves const-generic readonly inference, so it is not a redundant alias.
753 packages/gateway-client/src/session-projection.ts READ — Retained the existing string-reader module and imports because its full declaration module is SDK-reachable. Projection ownership, optimistic adoption, ordering, and terminal inference remain distinct.
749 packages/gateway-protocol/src/schema/cron.ts READ — Creation, patch, reported payloads, and delivery variants have different nullable/report-only contracts; existing canonical shared field owners retained.
746 packages/llm-core/src/types.ts READ — Retained public interfaces, compatibility settings, declaration-merge behavior, and stream/message wire shapes; these are the npm contract rather than duplicate runtime owners.
735 packages/ai/src/transports/openai-responses-stream-internal.ts READ — Combined text, Azure text, and refusal delta slot resolution/projection; retained distinct content-part admission and terminal ordering.
731 packages/memory-host-sdk/src/host/query-expansion.ts READ — collect unique keywords through one Set and flatten duplicated Japanese token emission; retain all multilingual stop-word data and tokenizer-specific output.
730 packages/model-catalog-core/src/model-catalog-normalize.ts READ. Normalizers enforce distinct strict-number, enum, list, prototype-key and suppression rules. Shared coercion is already imported; further schema-generic normalization would obscure field contracts or alter key order.
726 packages/memory-host-sdk/src/host/memory-schema.ts READ — no change: explicit legacy/canonical admission and copy assertions protect retained operator data; repeated SQL operations have distinct migration order and error contracts.
724 packages/agent-core/src/agent.ts READ: no sound additional cut without altering public/private declarations or mixing prompt-start and continuation validation; queues already share one owner. Preserve initial-steering skip and restoration/commit ordering.
717 packages/markdown-core/src/reasoning-tag-parser.ts READ. Provider-tag and CommonMark/GFM scanners preserve distinct grammars; static stripping already consumes the stream reducer.
716 packages/ai/src/transports/openai-responses-client.ts READ — Removed redundant model projections, repeated options cast, and the one-use Azure deployment forwarder.
706 packages/ai/src/transports/anthropic-payload-policy.ts READ — Retained: cache breakpoints, OAuth identity, endpoint eligibility, and context-management transforms implement distinct wire contracts; previous passes already share request cache ownership.
695 packages/sdk/src/client.ts READ — Public namespaces and run/session handles are SDK contracts; existing RpcNamespace owns shared calls. Connection/event pump shutdown and error precedence are deliberate.
691 packages/ai/src/transports/openai-responses-websocket.ts READ — Retained: lease ownership, dispatch classification, steering, and cancellation have separate lifecycle invariants.
680 packages/ai/src/transports/openai-completions-stream.ts READ — Reused canonical llm-core content types and the normalization-core nonempty-string reader for all three thought-signature fields; simplified the final boolean result.
676 packages/gateway-client/src/protocol-client.ts READ — One socket/handshake/reconnect owner already exists; callback reentrancy and generation authority checks protect different side-effect boundaries.
672 packages/gateway-protocol/src/public-schema.ts READ — Explicit named exports are the protected public schema surface, not dead forwarding exports.
652 packages/agent-core/src/types.ts READ: public declarations and explanatory behavioral contracts retained unchanged; type inheritance rewrites would create API baseline churn.
647 packages/ai/src/providers/anthropic.ts READ: consolidate adaptive-thinking option projection; remove header and beta forwarding wrappers; shared simple-entry key resolution.
642 packages/agent-core/src/harness/env/kill-tree.ts READ: canonical ps invocation/error handling and procfs stat parsing now serve all existing consumers; collapse repeated prose while preserving PID-reuse, depth and descendant authority rationale. No signal ordering, platform policy, deadline or error behavior changes.
637 packages/ai/src/transports/anthropic-transport-stream.ts READ — Retained: parser-local pending frame limit, reader cancellation ownership, OAuth/API-key/Foundry headers, and error redaction cannot share broader policy without changing behavior.
629 packages/gateway-protocol/src/schema/audit-activity.ts READ — Existing actionTerminalVariants owns correlation construction; explicit wire types preserve TypeBox allOf semantics and compact public declarations.
627 packages/gateway-protocol/src/connect-error-details.ts READ — Builder and reader now use one pairing metadata normalization function; detail code reader uses existing string normalizer.
625 packages/ai/src/transports/anthropic-stream-reducer.ts READ — Consolidated text, thinking, and redacted-thinking block-start bookkeeping and event publication while preserving each initial payload and delta rule.
619 packages/ai/src/transports/openai-responses-replay-messages-internal.ts READ — Re-exported the shared text-signature encoder from its lightweight utility owner, preserving signature bytes and existing public export.
612 packages/tool-call-repair/src/payload.ts READ: no sound additional cut; JSON/XML precedence, incomplete candidates, byte caps and structural line breaks differ deliberately. Third pass already consolidated per-syntax parse projection.
605 packages/memory-host-sdk/src/host/session-transcript-corpus.ts READ — one resolver now owns active/retained session alias and agent ownership decisions; path comparison is shared. Retain separate active/retained projection because trim rules, provenance exclusions, and timestamp presence differ; retain sync/async filesystem timing contracts.
599 packages/terminal-core/src/table.ts READ. Water-fill sizing and ANSI reopen/wrap ordering are independent output contracts. Third pass already consolidated borders.
597 packages/ai/src/transports/openai-completions-params.ts READ — Retained: direct/managed modes now already share the request builder; remaining differing tool, reasoning, output-budget, and cache policies are intentional contracts.
577 packages/gateway-protocol/src/validator-registry.ts READ — Every exported validator is public named surface and compiles through lazyCompile; the worker depth-check wrapper preserves a separate JSON safety constraint.
567 packages/ai/src/transports/transport-stream-shared.ts READ — Removed narrating file header. Retained public stream/usage wrappers and distinct lifecycle callbacks: they are exported through ai transports and plugin SDK, and cancellation cannot replace primary failures.
564 packages/markdown-core/src/reasoning-tags.ts READ. Incremental ambiguity and bounded raw-source retention differ from static scanning; removing that state changes delayed emission.
560 packages/gateway-client/src/session-subscriptions.ts READ — One subscription coordinator owns leases/capability upgrades, serialized requests, and retained observer cleanup. Timeout recovery and pending-owner checks are not redundant.
556 packages/sdk/src/run-event-replay.ts READ — SDK-specific observer ownership, retained tails, receipt ordering, and recovery context differ from gateway-client transcript identity; terminal reply recovery already delegates.
549 packages/ai/src/transports/openai-responses-debug.ts READ — Unified absent/empty compaction diagnostic projection and direct optional failure fields; kept redaction and bounds.
535 packages/ai/src/providers/agent-tools-parameter-schema.ts READ: prior passes already consolidate array normalization; malformed input, reference preservation, composition and provider contracts deliberately differ.
526 packages/ai/src/providers/google-interactions-shared.ts READ. Shared text/thought delta admission, mutation, and event emission through one local helper; consolidated repeated array text extraction. Preserved payload validation, SSE parsing, original error strings, usage accounting, thought signatures, and cancellation timing.
514 packages/memory-host-sdk/src/host/internal.ts READ — no change: discovery, extra-root authorization, source error wrapping, and multimodal identity validation are distinct responsibilities; earlier passes already centralized repeated file-read/retry paths.
511 packages/gateway-protocol/src/schema/logs-chat.ts READ — Chat cursor, input-custody, streaming, and error-detail schema contracts differ; bounded redacted provider facts preserve the producer boundary.
499 packages/ai/src/transports/openai-transport-shared.ts READ — Removed misplaced narrating import comment. Retained distinct header/event model attestation and content/refusal mirror rules; no equivalent smaller owner exists.
495 packages/net-policy/src/redact-sensitive-url.ts READ. Nested query/path/fragment and malformed-authority branches preserve different encoding and fail-closed rules. Prior consolidation leaves no equivalent repeated flow to merge.
481 packages/gateway-protocol/src/schema/openclaw.ts READ — Setup detection/activation and chat handoff schemas have distinct field limits and authority semantics; repeated metadata fields cannot be combined without less clear contracts or negligible artificial abstractions.
467 packages/gateway-protocol/src/schema/session-placement.ts READ — Existing property factories distinguish unowned/worker/terminal placement states; state tuples and typed registry remain necessary for exact generated/native contracts.
466 packages/ai/src/providers/clean-for-gemini.ts READ: reference namespace and metadata insertion order differ from generic ref owner; preserve cycle-safe traversal and provider enum/union behavior.
456 packages/llm-core/src/validation.ts READ — Simplified literal boolean coercion and merged tuple/homogeneous-array descent into one recursive loop; kept nullable unions, scoped references, TypeBox fallback, cloning, and exact errors.
445 packages/ai/src/transports/anthropic-messages.ts READ — Retained: the shared converter already absorbs provider/transport differences; native thinking signatures, replay omissions, grouped tool results, and media budgets have independent contracts.
440 packages/gateway-protocol/src/schema/worker-inference.ts READ — Const-generic schema wrapper preserves readonly static API; validator wrappers preserve public named type guards and bounded JSON traversal before Value.Check.
433 packages/memory-host-sdk/src/host/memory-schema-storage-migration.ts READ — no change: frozen old schemas, dependent-object refusal, atomic binary conversion, and foreign-key restoration each protect explicit storage migration contracts.
431 packages/gateway-protocol/src/schema/users.ts READ — Existing auth-poll variants reuse canonical GitHub outcome schemas; profile mutations preserve separate named native identities and ownership rules.
426 packages/memory-host-sdk/src/host/types.ts READ — no change: public memory contracts and diagnostics preserve API shape, distinct configuration/version ownership, and exact operator guidance.
420 packages/gateway-protocol/src/schema/agent.ts READ — Conversation send/turn identity and media/run envelopes have distinct contracts; shared result and provenance fields already canonical.
417 packages/ai/src/transports/openai-transport-params.ts READ — Removed a redundant cacheControlFormat projection from an already-spread result. Kept own-property/getter guards required by code-mode payload tests and distinct hosted/grouped-tool admission.
411 packages/agent-core/src/harness/session/tool-result-pairing.ts READ: synthetic-result replacement now reuses the existing occurrence queue; keep cross-frame uniqueness and original-result provenance.
409 packages/net-policy/src/ip.ts READ. Canonical versus loose parsing, special-use exceptions and IPv6 transition families have distinct SSRF contracts; ipaddr remains canonical classifier.
406 packages/gateway-protocol/src/schema/approvals.ts READ — Removed only comments repeating enum/schema names; retained reviewer-safety, source attribution, standing-grant lifetime, native-generation, and replay semantics.
406 packages/agent-core/src/agent-stream-response.ts READ: no sound additional cut; fragment ownership, streamed admission and terminal usage sequencing are distinct from final tool batches. Public event union already owned by llm-core.
401 packages/markdown-core/src/render-aware-chunking.ts READ, CHANGED. Removed forwarding render resolver/type and separate message-boundary wrapper; all candidates use the existing renderer owner.
395 packages/markdown-core/src/render.ts READ. Marker nesting, provenance, annotations and zero-width insertions differ observably; span registration already shared.
393 packages/workboard-contract/src/index.ts READ. Public constants and structural types are the canonical workboard contract. Deleting or rewriting their exported shape conflicts with the surface constraint.
393 packages/ai/src/providers/google-stream.ts READ. No sound further consolidation: already the canonical SDK/managed stream reducer; signed-Part byte identity, sparse usage, prompt blocks, tool IDs, finish reasons, and terminal delivery require the retained branches.
392 packages/acp-core/src/structured-auth-redaction.ts READ, CHANGED. Serialized line, tab and quote parsing now share one bounded backslash scanner; retained exact 64-slash limit, delimiter handling and credential spans.
391 packages/gateway-protocol/src/theme.ts READ — Palette/color/font validators enforce different supported CSS grammars and exact error text. Explicit descriptors are data, not duplicated control flow.
390 packages/ai/src/transports/openai-responses-payload-policy.ts READ — Retained: native, proxy, Azure, and compact endpoint capabilities differ deliberately.
389 packages/ai/src/transports/openai-responses-stream-terminal-internal.ts READ — Derived private terminal options from canonical stream options instead of redeclaring five fields.
383 packages/ai/src/utils/credential-redaction.ts READ — Canonical bounded hostile-object/credential/media projection; descriptor snapshots, getter avoidance, text cache, and prose exemptions carry distinct security or byte-preservation contracts.
381 packages/gateway-protocol/src/schema/exec-approvals.ts READ — Native policy/file-backed snapshots, node writes, approval requests, and grants have distinct conditional constraints; shared policy properties already canonical.
375 packages/sdk/src/types.ts READ — Retained private and public aliases to keep emitted declarations literally stable, in addition to preserving all public names and shapes.
374 packages/normalization-core/src/number-coercion.ts READ: no sound additional cut; aliases are public exports and numeric parsers have deliberately different strictness, rounding and fallback semantics.
372 packages/gateway-protocol/src/schema/board.ts READ — Named operation/content branches are generated/public protocol types; shared snapshot and content schemas already reused.
368 packages/mermaid-renderer/src/renderer.ts READ. Renderer owns frame lifecycle/queue and sanitized SVG projection. Frame checks and post-render sanitization are separate untrusted boundaries; merging or deleting either is unsound.
362 packages/retry/src/index.ts READ. Numeric and options retry paths have distinct zero-delay scheduling, hooks, jitter and cap semantics. Abortable sleep also differs from chunked long-delay sleep. Retained named public behavior.
361 packages/ai/src/transports/openai-responses-compaction-replay.ts READ — Retained: prior pass unified replay; retained-window, suppression, and compacted-prefix recovery remain distinct.
359 packages/tool-call-repair/src/grammar.ts READ: no sound additional cut; XML/plain name alphabets and prefix outcomes differ, whitespace routines preserve different grammar boundaries; shared JSON object scanner already owns incremental parsing.
358 packages/agent-core/src/harness/compaction/utils.ts READ: no sound additional cut; shared message projection already serves both estimation and rendering, with sender attribution and omission budgets intact.
357 packages/agent-core/src/harness/utils/truncate.ts READ: no sound additional cut; head/tail line selection differs, byte truncation repairs lone surrogates, retained string copying matters, and truncateLine's negative/fractional behavior differs from generic UTF-16 helpers.
356 packages/ai/src/transports/openai-completions-compat.ts READ — Retained: endpoint classification and explicit override precedence are canonical owners; defaults cannot collapse to an object spread because nullish values must retain defaults.
354 packages/ai/src/providers/google-shared.ts READ. Removed stale error-path index deletion: 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.
354 packages/ai/src/openai-completions-messages.ts READ — Second pass already unified message handling; remaining branches encode different replay roles, media projection, provider compat, and cache-carrier placement. No safe duplicated owner remains.
352 packages/gateway-protocol/src/schema/audit-run.ts READ — Display/full provenance, identity states, and exact-run vs execution selection intentionally differ; no collection, scope, retention, or schema changes.
349 packages/normalization-core/src/json-schema.ts READ: no sound additional cut; normalization and JSON-value admission intentionally differ from provider-specific schema rewriting; third pass already owns the schema traversal.
349 packages/markdown-core/src/assistant-transcript.ts READ, CHANGED. Text and image role annotations share clipping logic; local spans drive token splitting.
349 packages/gateway-protocol/src/schema/environments.ts READ — createEnvironmentSummaryProperties deliberately creates independent nested closedObject identities for generated list/status/create/destroy shapes; converting it to a shared object would alter nominal codegen.
348 packages/normalization-core/src/error-coercion.ts READ: no sound additional cut; safe property access, realm errors, structured copying and lossy coercion are distinct public contracts. Retain injected owner-specific redaction.
347 packages/ai/src/providers/anthropic-model-contract.ts READ: canonical provider thinking/replay owner; model identity, source/target and API routing distinctions are necessary.
345 packages/gateway-protocol/src/schema/config.ts READ — Update metadata, campaign state, report consent, and config hints are distinct wire contracts; existing shared apply/patch and Git metadata properties remain.
339 packages/ai/src/host.ts READ — Host ports intentionally isolate package transport behavior from core policy. Inert defaults and pending registration draining retain separate lifecycle contracts; forwarding callback deliberately omits unsupported options.
338 packages/ai/src/transports/openai-completions-dsml.ts READ — Retained: grammar scanning is already shared with visible-text filtering; body recovery, UTF-8 bounds, and exact matching delimiters carry separate safety semantics.
337 packages/ai/src/transports/openai-responses-replay-internal.ts READ — Retained: request and streamed rejection have different admission, observer, and recovery points.
335 packages/ai/src/transports/openai-responses-params-internal.ts READ — Shortened long explanatory comments to their prompt-continuation and xAI compact invariants.
333 packages/memory-host-sdk/src/host/memory-schema-fts.ts READ — no change: body/path indexes differ in columns, triggers, rowid ownership, and custom-table compatibility; genericizing them would replace visible SQL with policy descriptors without simplifying the invariant.
329 packages/model-catalog-core/src/remote-catalog-bundle.ts READ. V1/V2 schema and transport stripping boundaries preserve error shape, dictionary identity and strict model contracts. Existing model fields/cost schemas are shared where equivalent.
329 packages/ai/src/transports/openai-completions-transport.ts READ — Retained: raw DONE observation is required because the SDK hides it; client URL/header handling and response hooks are distinct wire/lifecycle boundaries.
326 packages/media-core/src/mime.ts READ. Canonical MIME tables, byte sniffing and fallback precedence already serve callers. Container ambiguity and alias tables are data contracts, not duplicated algorithms.
322 packages/terminal-core/src/ansi-sequences.ts READ, CHANGED. Shared consumed-byte advancement across CSI/escape/compat states; explicit reprocessing retained.
320 packages/sdk/src/transport.ts READ — Broader SDK callbacks/types intentionally adapt GatewayClient; raw event receipts and reconnect epochs carry SDK replay authority and cannot be dropped.
319 packages/terminal-core/src/ansi.ts READ, CHANGED. OSC/CSI/compat matches share output and cursor bookkeeping; incomplete CSI and embedded controls retained.
319 packages/ai/src/transports/openai-completions-replay.ts READ — Removed type laundering of typed assistant messages, unified paired invalid reasoning-field cleanup, removed redundant delete guards, and iterated the fixed candidate snapshot directly.
315 packages/ai/src/transports/simple-completion-transport.ts READ — Removed narrating file header. Retained wrapper registration and API projections: aliases select dispatch owners while the original API must remain visible to wire policy.
313 packages/ai/src/providers/openai-completions-tool-calls.ts READ: legacy buffering and modern alias tracking enforce different ordering and byte-cap contracts; finalization already canonical across consumers.
311 packages/ai/src/providers/google-interactions-request.ts READ. String user input now enters the same text-part normalization path as array user input, preserving serialized bytes, empty-text padding, and sanitization. Request version discovery, rejected options, step chronology, and thinking mapping remain route-specific.
308 packages/gateway-protocol/src/schema/update-runs.ts READ — Uses canonical update vocabularies; explicit bounded ledger fields preserve redaction, admission, rollback, and status constraints.
307 packages/model-catalog-core/src/model-catalog-types.ts READ. Public model types already share llm-core data contracts where identical; catalog/API/routing variants retain documented fields.
306 packages/gateway-client/src/pending-request.ts READ — Correlation/deadline owner already canonical; separate JSON serialization/send catches cover independently throwing boundaries and identity-only retries preserve write safety.
302 packages/ai/src/providers/tool-schema-refs.ts READ: canonical local-reference owner; separate defs namespaces, unresolved-ref retention and own-property writes are required.
302 packages/ai/src/providers/openai-responses-shared.ts READ: lifecycle already shared by OpenAI/Azure; retain acceptance settlement, retries and context-vs-billing semantics.
301 packages/ai/src/transports/provider-compaction-replay.ts READ — Retained: public replay-pressure APIs preserve exact checkpoint identity, reference-sensitive content reindexing, and distinct text/image/tool accounting.
301 packages/ai/src/providers/google-messages.ts READ. Folded the one-use major-version parsing wrapper into multimodal-function-response admission. Retained both signature validators because managed replay trims and checks padding while SDK replay preserves bytes. Retained local stable serialization because normalization-core differs for undefined, nonfinite numbers, bigint, binary values, errors, and cycles.
301 packages/agent-core/src/harness/compaction/branch-summarization.ts READ: use findLast for common-ancestor lookup instead of copying/reversing and a mutable loop; keep branch prompt, output budget and BranchSummaryError semantics.
298 packages/acp-core/src/runtime/types.ts READ. Public adapter interface, event unions and legacy optional capability contracts; no dead internal implementation to remove.
293 packages/gateway-protocol/src/schema/nodes.ts READ — Node data shapes retain distinct IDs, limits, policy metadata, and native types; shared primitives already own validation.
291 packages/markdown-core/src/frontmatter.ts READ. YAML and malformed-line fallback paths preserve differing recovery semantics. Third pass already shared error-location handling.
286 packages/gateway-protocol/src/schema/sessions-row.ts READ — Canonical session-row projection already supplies consumers; nullable/mutable fields and permissive update contract require explicit types.
285 packages/ai/src/providers/openai-tool-projection.ts READ: OpenAI reports field-specific descriptor diagnostics unlike Anthropic; shared JSON schema projection already owns overlap.
281 packages/markdown-core/src/html-scanner.ts READ. One scanner already owns tag parsing; script escaped/double-escaped states and malformed-input policy remain necessary.
279 packages/gateway-client/src/session-projection-final-identity.ts READ — Terminal compatibility matching is intentionally broader than transcript identity and must not be replaced by sameTranscriptIdentity. Snapshot indexing already has one lazy owner.
279 packages/ai/src/transports/openai-responses-continuation.ts READ — Retained: input/output normalization differs deliberately; claimed/ready state protects continuation ownership.
279 packages/ai/src/providers/anthropic-tool-projection.ts READ: wire-name collisions, OAuth casing and tuple migration are provider contracts; do not force onto OpenAI projection.
278 packages/model-catalog-core/src/model-catalog-pricing.ts READ. Shared four-rate reader and context tier builder already consolidate providers. Per-token/upstream units, missing-cache defaults and conditional-price admission differ intentionally.
278 packages/ai/src/providers/openai-completions.ts READ: shared simple-entry key resolution; preserve delayed client validation and content end-event ordering.
276 packages/memory-host-sdk/src/host/memory-recall-metadata.ts READ — no change: shared candidate query already owns trigger/project filtering; bounded prefilters and keyset pagination prevent foreign scoped rows starving eligible results.
268 packages/gateway-protocol/src/gateway-error-details.ts READ — Error readers intentionally use differing exact field, hash, legacy-message, and code checks; common record coercion is already canonical.
267 packages/session-url-contract/src/focus.ts READ. Builder, syntax-only base inference and decoded selector parsing intentionally accept different inputs; unifying would change route fallback/unsupported results.
265 packages/gateway-protocol/src/schema/snapshot.ts READ — Health producer-specific records, optional startup fields, presence identity, and version snapshots differ; shared primitives and health records already reused.
262 packages/gateway-protocol/src/schema/devices.ts READ — Removed pure narration; retained token delivery correlation, shipped legacy shape, setup credential reconciliation, and per-role scope semantics.
257 packages/ai/src/transports/anthropic-compaction-replay.ts READ — Retained: persisted-state validation, replay suppression, and capture admission differ from Responses state; shared identity hashes already have a canonical owner.
255 packages/ai/src/transports/openai-responses-stream-slots-internal.ts READ — Retained: indexed/unindexed state and encrypted-ID aliases prevent duplicate output publication.
255 packages/ai/src/providers/anthropic-usage.ts READ: billing iterations and context snapshots deliberately treat absent cache counters differently; earlier pass owns common field application.
254 packages/ai/src/env-api-keys.ts READ — Second-pass table already owns environment names; lazy builtins preserve browser loading, Bun proc-env fallback is named upstream compatibility, ADC sentinel behavior differs from required keys. Shared required-key guard added in a separate non-barreled utility.
242 packages/ai/src/internal/retry-after.ts READ — HTTP-date forms, leap-second ordering, two-digit-year resolution, and getter-safe native-header/error access preserve distinct semantics. No change; lead independently reached same conclusion.
240 packages/memory-host-sdk/src/host/markdown-chunks.ts READ — no change: retain the reachable SDK declaration/import shape, byte/weighted-character splitting, overlap accounting, and curated-entry provenance spans.
238 packages/gateway-protocol/src/schema/frames.ts READ — Removed frame-name narration; retained handshake ordering, additive fields, device compatibility, attachment bounds, and generator discriminator explanation.
235 packages/normalization-core/src/agent-run-terminal-outcome.ts READ: no sound additional cut; lifecycle normalization, wait snapshots and final facts have separate precedence and status contracts.
234 packages/ai/src/providers/tool-result-text.ts READ: structured redaction and media omission preserve exact output text and budgets; existing owner shared by providers.
232 packages/gateway-protocol/src/schema/protocol-schema-selection.ts READ — Prior lane already replaced manual schema registration with typed source derivation; exclusions are contract data and cannot be deleted.
232 packages/ai/src/transcript-transform.ts READ — Cross-model async relocation, thinking identity, missing-result pairing, and non-vision placeholders are canonical transcript policy. Agent-core and Responses reorderers implement distinct lifecycle/replay contracts; merging would alter behavior.
229 packages/gateway-protocol/src/schema/sessions-catalog.ts READ — Existing catalog locators/properties are shared. Terminal result shape mirrors terminal.open, but terminal.ts imports this owner, so reversing the import would create a runtime initialization cycle.
228 packages/memory-host-sdk/src/host/config-utils.ts READ — no change: narrow config shape avoids loading runtime owners, legacy versus explicit agent ownership differs deliberately, and workspace null-byte stripping is a shared invariant.
228 packages/gateway-client/src/session-projection-message-identity.ts READ — Retained readSessionProjectionString because its full module declaration is SDK-reachable despite no top-level re-export. Persisted, imported, optimistic, and stream identities retain distinct precedence.
228 packages/ai/src/transports/openai-responses-contracts.ts READ — Retained: possible metadata type reuse would alter exported compact-result declarations, prohibited by the public baseline contract.
227 packages/model-catalog-core/src/provider-model-id-normalization.ts READ. Manifest policy and built-in aliases retain ordering, case and whitespace distinctions; provider fallback is documented for manifest-free callers.
226 packages/ai/src/providers/openai-reasoning-effort.ts READ: model/version-specific public behavior; normalization already imports canonical helpers.
224 packages/agent-core/src/internal-hooks.ts READ: no sound additional cut; WeakMap helpers encode private authority, consume-once acknowledgement and provenance-copy rules, not redundant generic state.
223 packages/ai/src/providers/openai-tool-schema.ts READ: strict projection and boolean compatibility have distinct traversal/diagnostic contracts; caches preserve identity.
222 packages/acp-core/src/runtime/session-identity.ts READ. Ensure/event/status identity inputs resolve at different lifecycle points; existing identity builder already centralizes projection without downgrading stable IDs.
219 packages/llm-core/src/utils/event-stream.ts READ — Producer completion, pending consumers, payload release, text coalescing, and thinking-append retention are separate proven invariants; queue/iterator branches cannot collapse without changing terminal behavior.
218 packages/ai/src/providers/azure-openai-responses.ts READ: shared simple-entry key resolution; deployment config/key errors and OpenAI-vs-Azure client distinction retained.
216 packages/tool-call-repair/src/promote.ts READ: remove redundant Set.has before delete and combine identical rejection branches after the final text flush. Keep factory calls and protection checks in their original order.
216 packages/memory-host-sdk/src/host/batch-runner.ts READ — no change: one canonical runner already owns grouping, split-on-provider-error recursion, result identity, and bounded polling; exported preparation helpers retain their public contract.
205 packages/llm-core/src/model-contracts/anthropic.ts READ — Model identity and capability facets are canonical and already touched by second pass. Similar capability predicates represent independently evolving provider contracts; public exports/profile aliases retained.
202 packages/gateway-client/src/websocket-transport.ts READ — URL trust and TLS pin enforcement remain separate policy/transport boundaries; no host-allowlist or credential-delivery changes.
202 packages/ai/src/transports/openai-responses-compaction-window.ts READ — Retained: JSON bounds, wire-preservation checks, checkpoint binding, and byte ceilings protect distinct admission failures.
201 packages/ai/src/providers/openai-tool-schema-compat.ts READ: recovery and diagnostics visit schema applicators with literal-key and null-constraint distinctions; no sound owner collapse remains.

@clawsweeper

clawsweeper Bot commented Sep 29, 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.

@openclaw-barnacle openclaw-barnacle Bot added app: web-ui App: web-ui gateway Gateway runtime size: XL labels Sep 29, 2026
@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 29, 2026
@clawsweeper

clawsweeper Bot commented Sep 29, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 29, 2026, 2:18 AM ET / 06:18 UTC (Revision 2).

ClawSweeper review

What this changes

The 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
Reviewed head: 71113f080df244465dcb4ea20edc78cae44e6676

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The cleanup is coherent and has substantial reported contract validation, while its broad scope limits source-only parity confidence.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: This member-authored internal refactor is exempt from the external-contributor after-fix proof gate. The body reports package and consumer tests plus API and protocol comparisons, but no direct user-flow run; the inspected changes do not alter a stored-data contract, so upgrade migration proof is not applicable.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This member-authored internal refactor is exempt from the external-contributor after-fix proof gate. The body reports package and consumer tests plus API and protocol comparisons, but no direct user-flow run; the inspected changes do not alter a stored-data contract, so upgrade migration proof is not applicable.
Evidence reviewed 9 items Introduced change: The pinned merge-base-to-head diff retains process-instance checks while consolidating process inspection; the branch also changes provider, protocol, and memory helpers.
Stored-data boundary: The SQLite edit changes an import from a private forwarding file to its existing owner. The package export map does not expose the removed file; the session edits retain the stored entry fields, and the JSONL edit changes parsing of an output artifact.
Tuple coercion contract: The consolidated array loop still reaches tuple item schemas because the existing schema-object predicate accepts non-null arrays. An existing test specifies coercion through tuple references.
Findings None None.
Security None None.

How this fits together

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

Before merge

  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

Source -679, Other -2. Total -681 across 71 files.

View PR surface stats
Area Files Added Removed Net
Source 70 597 1276 -679
Tests 0 0 0 0
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 4 6 -2
Total 71 601 1282 -681

Review metrics

None.

Stored data model

Persistent data-model change detected: serialized state: packages/memory-host-sdk/src/host/batch-output.ts, unknown-data-model-change: packages/gateway-protocol/src/schema/approvals.ts, unknown-data-model-change: packages/gateway-protocol/src/schema/channels.ts, unknown-data-model-change: packages/gateway-protocol/src/schema/devices.ts, unknown-data-model-change: packages/memory-host-sdk/src/host/session-files.ts, unknown-data-model-change: packages/memory-host-sdk/src/host/session-transcript-corpus.ts, and 3 more. Confirm migration or upgrade compatibility proof before merge.

Technical review

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

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is internal cleanup with no intended user-visible change or established urgent defect.
  • 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: This member-authored internal refactor is exempt from the external-contributor after-fix proof gate. The body reports package and consumer tests plus API and protocol comparisons, but no direct user-flow run; the inspected changes do not alter a stored-data contract, so upgrade migration proof is not applicable.

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)
  • Vincent Koc: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Erick Kinnee: 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 (1 earlier review cycle)
  • reviewed 2026-09-29T05:56:39.343Z sha 71113f0 :: blocked before merge. :: none

@steipete
steipete marked this pull request as ready for review September 29, 2026 06:10
@github-actions

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: 71113f080df244465dcb4ea20edc78cae44e6676
  • 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.

Carefully review these changes before merging.

@steipete
steipete merged commit c259398 into main Sep 29, 2026
264 of 314 checks passed
@steipete
steipete deleted the deslop/l155-packages4-final branch September 29, 2026 06:40
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 30, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

app: web-ui App: web-ui gateway Gateway runtime 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