Skip to content

refactor(core): deslop system-agent, claws, talk, security and worker second pass - #158984

Merged
steipete merged 7 commits into
mainfrom
deslop/l86-src-misc2
Sep 26, 2026
Merged

steipete merged 7 commits into
mainfrom
deslop/l86-src-misc2

Conversation

@steipete

@steipete steipete commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

This maintainer-requested second pass removes repeated types, forwarding layers, and duplicated internal flows across system-agent, Claws, Fleet, media, Talk, meeting-bot, security, plugin state, transcripts, TTS, and workers.

Related: #157982. Its name-only diff was reviewed before this pass; these are additional simplifications.

User Impact

No intended user-visible behavior change. Security decisions, error text and ordering, worker lifecycle and authority checks, persisted data, transcript bytes, consent/media flows, and configuration keys remain unchanged. No schema, retention, protocol, or dependency changes.

Why This Change Was Made

  • Claws/Fleet: derive manifest types from the schema owner, reuse package/workspace indexing, share diagnostic projections, and run container/network inspection through one subprocess/result owner.
  • Plugin state/transcripts: dispatch typed worker commands directly, share the identical prepared-update mutation, and reuse existing metadata/export ownership queries.
  • Talk/meeting-bot: reuse provider and loopback types, canonical string/error/timer helpers, prompt assembly, node command envelopes, and speech readiness projection.
  • TTS: construct synthesis requests once, forward them through adapters, and simplify provider/config resolution without changing selection or resource ownership.
  • Workers: reuse the strict protocol schema owner for workspace results, remove an internal RPC barrel and error wrapper, and share paired stream-event validation.
  • Media/system-agent/security: preserve public names with direct aliases, remove single-use forwarding and copied option types, share simple command descriptors and Docker audit probes, and remove redundant intermediate projections.

Measured diff: 867 net production lines removed (+902/-1769). This is below the 1,000-line target after reading the complete production subtree. The coverage log below records every current production file over 200 lines, sorted by size; retained code carries distinct safety, lifecycle, byte, or compatibility contracts.

Evidence

Published head: 7ad8d8ddfb86d32e3eb302e8cdf01a2a085f4e63. Its empty CI-refresh commit preserves the exact tested tree from 2b798d8d9fd83160821c50a18591796791903479, based on main 1c91579634541d991dbc77144f3d26d58baf68d9: 1db011bd8454c1253565a3fe61bc6a0d6a20b42b.

Completed Blacksmith Testbox proof, lease tbx_01m3fjskq3ny89gyfyk2dmc1bb (stopped): architecture checks, core typing, all 25 test typecheck groups, and dead-export scanning passed. 156 focused tests in 8 files passed. Cross-shard proof passed 4,541 tests in 351 files, with 12 existing skipped tests and two skipped files, across seven Vitest shards in 458.91 seconds. pnpm build passed in 6m51.9s. No test, check, or build ran on the shared Mac.

check-changed did not pass: its broad core lint stage reports the inherited 705-line src/state/openclaw-state-worker-runtime.ts against a 700-line limit. An additional whole-core lint diagnostic reports the same issue. The file is byte-identical to the base (blob 11cf6048622e46f3e795ff1bf8c485da94a7c8f9); #158995 owns that repair. Deleting the redundant worker barrel causes the existing changed-check planner to choose whole-core lint. No paths were filtered and no CI environment, limits, or suppressions were altered to hide the failure. The wrapper completed the remaining proof stages and returned 1 for this lint debt.

Hosted CI is blocked by an upstream registry-discovery race, so this PR is not yet ready to land. Exact-head CI failed in checks-node-compact-large-25, at src/gateway/talk/handlers/client-native-actions.test.ts, with AgentDatabaseRegistryChangedError. The failed test and registry/lifetime owners are unchanged by this PR and match its CI merge's main parent 19c6ef8d9e0260471b798615e8a1eaf42b9aada3. #159163 owns the exact repair: bounded initial-discovery recovery with source revalidation, retaining repeated-invalidation and retarget rejection. The repair remains OPEN and unmerged at 7a233c5dfaf960f11fd6ae1f3b04c0a1fe2160bf. Its final-head CI failed in checks-node-changed-compact-large-9: teardown of src/gateway/session-group-mutation-targets.test.ts reports Retired agent cleanup cannot adopt a replacement shared database through resource drainage/reclamation cleanup. This differs from the initial registry-read failure; causal independence has not been established. The owner records 3/3 original-shard passes and 20/20 consecutive Talk-case passes on Testbox, but that does not clear the new integration failure. This lane is BLOCKED, not ready to land, pending the existing repair owner's CI resolution and landing. The next action is a source-tree-preserving CI refresh after verifying the landed repair. No background watcher or Testbox command remains running. CodeQL, Critical Quality Checks, and OpenGrep passed for this head.

CI corrections in this PR remove a mapped-type name collision, retain the owner-bound awaited post-write callback and provider-token ordering, and place shared Claws manifest foundations in a leaf contract to remove the schema/consent/types cycle. Final lint corrections rename an inner catch variable, remove a redundant object clone, and reuse a schema-owned boolean directly. The earlier upstream OpenRouter suppression repair (#159039) is incorporated; the subsequent CI refresh includes the landed cron fixture repair c0e6951d6f02d3eabd4bc13cf8e9fa9e77d290ac through GitHub's merge ref. No cron or audit source was changed by this PR.

Independent Codex autoreview is scoped-clean at P2, with no accepted/actionable findings. The completed ClawSweeper review of this head also identifies no introduced defect. Its automatic config/data-model checklist is inapplicable: src/claws/schema.ts gains inferred TypeScript exports without changing validation, defaults, config keys, or stored formats; the shared plugin-state operation retains insertion/expiry/upsert/limit ordering, and transcript export reuses the same existing reader and fields. No migration is required.

Required remote commands (each preceded by a frozen-lockfile install through the repository Crabbox wrapper):

node scripts/check-changed.mjs
pnpm build
node scripts/run-vitest.mjs src/system-agent/ src/claws/ src/meeting-bot/ src/talk/ src/security/ src/media/ src/worker/ src/transcripts/ src/plugin-state/ src/tts/ src/fleet/ src/node-host/node-worker-workspace-processes.test.ts packages/normalization-core/src/error-coercion.test.ts src/gateway/server-methods/tts.test.ts src/commands/status-runtime-shared.test.ts src/commands/status-json.test.ts src/commands/status.usage-routing.test.ts extensions/openai/speech-runtime.contract.test.ts

Earlier focused proof (201 tests; Claws timing refreshed separately). Measured /usr/bin/time -p pnpm test <file> --maxWorkers=1 wall times:

Test file Passed tests Wall seconds
src/claws/application-schema.test.ts 26 17.73
src/worker/inference-stream.runtime.test.ts 14 17.47
src/worker/node-workspace-protocol.test.ts 34 1.68
src/worker/worker-connection.test.ts 30 2.25
src/worker/worker-rpc-clients.test.ts 16 2.20
src/worker/worker.runtime.test.ts 81 67.24

The runtime suite's existing process, fencing, permission, replay, and settlement integration contracts account for its higher cost; this PR only changes its imports, not its fixtures or assertions. The only added tests exercise workspace-result protocol admission. The Claws extension test now exercises the production package index instead of exporting a private mapper for tests; other test edits redirect imports or remove duplicate coercion coverage retained at the canonical package owner.

Validation corrections: shrink the assertion-safety ratchet after removing casts; restore an explicit closed TTS acquisition-result type after inlining exposed TypeScript union inference. The dead-export scan also caught the extension mapper after its production caller moved into the same module; it is now private and its test uses the production index. These corrections preserve runtime behavior. Lease recovery: the first lease expired during local source preparation. A reused run then reset the replacement lease claim to its default idle timeout; final proof pins the provider timeout on both warmup and run. Test timeouts and assertions are unchanged.

Final independent Codex autoreview: scoped-clean at P2, with no accepted/actionable findings.

Complete production coverage (192 reviewed files; 191 currently over 200 lines)

l86 second-pass production coverage

Original read baseline: a53efa5e72513169c225c3fab8495c9e8c16eae4. Current sizes below reflect the candidate based on main 1c91579634541d991dbc77144f3d26d58baf68d9. All 191 current production files over 200 lines are covered; the table retains all 192 original large-file read dispositions, including the file now below that threshold. The first-pass name-only diff was reviewed before editing. Smaller files and caller searches were also covered by the subsystem passes.

Current lines File Disposition
1496 src/security/audit.ts READ. Retained: ordered finding collection, suppression projection, raw-config validation, and security decisions; first-pass file. Similar policy traversals have different reach and normalization contracts.
1254 src/media/web-media.ts READ: use WebMediaResult for its identical finalization input; remove module narration. Keep ordered URL resolution, host-read decisions, exact errors, compression grids, and provenance storage untouched.
1222 src/security/audit-extra.sync.ts READ. Retained: config-specific exposure checks and precise error/remediation text; first-pass file. Shared tool resolution already owns policy assembly where semantics match.
999 src/system-agent/verified-inference.ts READ — Exact auth/runtime/artifact identity validation has distinct creation and revalidation failure contracts; no sound further reduction without changing authority/error behavior.
805 src/fleet/backup.runtime.ts READ — Backup/restore admission, archive budgets, token rotation, phased recovery and lease checkpoints have distinct contracts; no behavior-neutral consolidation remains.
792 src/fleet/service.runtime.ts READ — Create/upgrade/remove differ in reservation, recovery and mutation order; first-pass owner consolidation retained and no checkpoints moved.
765 src/media/fetch.ts READ: body-to-buffer and body-to-store flows have distinct failure and retry/authority contracts; do not unify their handling. Content-Disposition compatibility is explicit and tested.
763 src/system-agent/operations-execution-helpers.ts READ — Persistent approval, fresh secret entry retention, verification and post-write reconciliation already share canonical owners; retained their ordering and messages.
751 src/talk/client-voice-session.ts READ. Transcript reservation/publication, close barriers, grant cleanup and digest retry ownership are distinct persistence/lifecycle steps; leave unchanged.
750 src/fleet/containers.runtime.ts READ — APPLIED: one runtime inspection pipeline shares command/error/parse handling for containers and networks, with existing result projections.
750 src/system-agent/setup-inference-turn.ts READ — Probe admission, owner revalidation, bound verification and completion have distinct lifetimes and result contracts; no safe further consolidation.
741 src/transcripts/capture.ts READ — Retained exact capture-owner checks, accepted-append drainage, and separate provider/persistence cleanup paths; merging them would change lifecycle ordering.
734 src/talk/client-voice-confirmation.ts READ. Challenge identity, persisted utterance receipts, one-shot grants and expiry order are required consent boundaries; leave unchanged.
729 src/transcripts/store-read.ts READ — Retained bounded SQLite payload projection, scoped cursors, snapshot ordering, and legacy reader limits; variants have distinct byte contracts.
727 src/transcripts/auto-start.ts READ — Retained continuous versus occupancy startup state, retry authority, shutdown joining, and configured-source diagnostics; no redundant flow survives without distinct lifecycle ownership.
726 src/meeting-bot/session-runtime.ts READ — use the existing bounded sleep helper in readiness polling; preserve all join/leave ownership and post-await checks.
723 src/fleet/service-support.runtime.ts READ — Shared profile, ownership, health, containment and checkpoint owners already centralize callers; generation pinning and heartbeat settlement retained.
719 src/claws/packages.ts READ — Artifact preflight, install/reuse and rollback intentionally recheck different ownership facts after awaits; no safe broad merge of phases.
704 src/claws/lifecycle-state.ts READ — Remove planning and ordered application carry current authority through monitor/package/config/filesystem owners; separate partial outcomes retained.
704 src/media/store.ts READ: publication, channel-read ownership, ENOENT recovery, cleanup order, TTLs, MIME precedence and stream-consumption rules all encode distinct contracts; no sound further removal.
697 src/meeting-bot/chrome-transport.ts READ — first-pass file; startup ownership and local/node/external transport policies remain distinct.
696 src/meeting-bot/node-host.ts READ — first-pass file; drain/retention and output-generation fencing are substantive contracts.
694 src/claws/lifecycle.ts READ — Add planning preserves deterministic action ordering and capability digests; workspace stat admission and later reads serve separate aggregate-budget contracts.
690 src/claws/add.ts READ — Resume phases and result construction reflect different committed state; further collapse would obscure named rollback/partial-state boundaries.
689 src/system-agent/operations-execute.ts READ — Cases have distinct public output and persistent gates; approval/audit already belongs to applyPersistentOperation.
687 src/media/parse-output.ts READ: legacy directive and Markdown extraction preserve different whitespace/source rules; normalized URL and local path checks intentionally differ. No byte-affecting parser changes.
679 src/system-agent/setup-inference-credentials.ts READ — Saved/new/interactive/discovered credentials have distinct consent, persistence and retry behavior; repeated-looking branches are not interchangeable.
676 src/media/playback-transcode.ts READ: inspection and transcode jobs have distinct waiters, admission, cancellation, descriptor ownership and cache lifetimes; retain them.
671 src/claws/update-plan.ts READ — Per-resource drift, ownership, readiness and removal policies are materially different; current ordered action and blocker projection retained.
661 src/claws/update-capability-changes.ts READ — APPLIED: select current/desired field source and path together before shared lookup; classifiers, redacted effects and digest values unchanged.
660 src/claws/schema.ts READ — APPLIED: schema owns inferred manifest/package/MCP/cron/extension types and profile assembly; shared foundational types and constants live in the leaf manifest contract, avoiding the consent/type cycle.
657 src/system-agent/greeting.ts READ — Cache CAS, watermark acknowledgement, single-flight/failure caching and host alerts enforce separate timing/persistence contracts; retained.
657 src/transcripts/store.ts READ — Retained worker facade, export ownership/leases, and explicit byte encoders; previous-pass file left untouched.
655 src/claws/package-remove.ts READ — Managed/reference selection and post-claim live ownership checks enforce separate safety boundaries; no coalescing across awaits or state reads.
655 src/system-agent/chat-wizard-host.ts READ — Deduplicated runner dependency types; retained wizard authority checks, cancellation, masked handoff and completion handling.
653 src/meeting-bot/status-call-source.ts READ — first-pass file; DOM route and caption identities require their existing branches.
639 src/claws/export.ts READ — Portable profile field omissions and file ordering bind artifact bytes; explicit selected-field projections retain distinct truthy/undefined rules.
637 src/system-agent/setup-inference-activate.ts READ — Candidate activation/undo and credential authority checks are substantive and order-sensitive; retained.
636 src/system-agent/operations-parse.ts READ — Consolidated simple command dispatch and removed redundant type aliases/comments; all argument-bearing and sensitive-config parsers retained.
634 src/plugin-state/plugin-state-store.ts READ — Retained public async/sync SDK compatibility methods and their distinct validation/admission ordering; no safe full-facade collapse.
634 src/system-agent/chat-turn-router.ts READ — Proposal consumption, navigation interception, wizard handoff and post-write repair are distinct owner boundaries; retained.
625 src/meeting-bot/realtime-engine.ts READ — remove the internal forwarding reexports of engine-support functions; direct consumer now imports the owner.
623 src/system-agent/setup-apply.ts READ — Config/workspace/Gateway cutover retains revalidation before every effect and recovery warnings; no safe second-pass deletion.
618 src/claws/provenance.ts READ — Persistence, compare-and-swap and legacy read contracts retained; folding rows/queries would touch protected SQLite admission semantics.
608 src/security/install-policy.ts READ. Retained: process, filesystem ownership and ordered fail-closed checks carry distinct security boundaries; first-pass file. No policy/schema/config changes.
607 src/system-agent/setup-inference-core.ts READ — Shared types/validation preserve wire compatibility and error identities; genericizing result types would mainly relocate code.
606 src/plugin-state/plugin-blob-store.sqlite.ts READ — Applied: share identical namespace-scoped blob metadata query among live listing and both expired-row readers; SQL predicates/order remain at callers.
602 src/security/audit-channel.ts READ. Retained: source-vs-resolved credentials, account diagnostics, wildcard principal routing and collision de-duplication are distinct contracts. Policy normalizations may process raw/pre-migration inputs.
592 src/meeting-bot/browser-controller.ts READ — shared exact error coercion and bounded sleep replace local copies; browser selection/adoption semantics retained.
585 src/tts/tts-synthesis-support.ts READ: construct the canonical SpeechSynthesisRequest once for all adapters; reuse existing request/context types; inline single-use setup and failure projections. Keep resource acquisition, config refresh between attempts, hook input-copy isolation, attempt ordering, timeout classification, and cleanup intact.
583 src/talk/agent-consult-runtime.ts READ. Admission, model-lock revalidation, routing enrichment and inherited session setup have separate error and ownership contracts; leave unchanged.
582 src/claws/update-apply.ts READ — Resource phases have different compensation order and partial mutation messages; first-pass rollback owner preserved.
579 src/security/audit-extra.async.ts READ. Applied: one Docker subprocess/result decoder owns timeout/error handling for list, inspect, and port probes; removed redundant timeout predicate and locally copied Docker function signature. Decisions, argv, string normalization, timeout errors and finding order unchanged.
571 src/claws/lifecycle-delete-support.ts READ — Filesystem staging, digest revalidation, original-path recovery and deletion-journal settlement have distinct lifecycle duties; preserved.
571 src/system-agent/tui-backend.ts READ — Backend protocol methods and inference-failure retirement differ from CLI/chat adapters; apparent duplicate guards have distinct cleanup/error boundaries.
558 src/system-agent/config-redaction.ts READ — Unknown owner, dynamic key, URL, invalid-config and sensitive-prefix paths protect different information boundaries; preserved.
557 src/claws/reader.ts READ — APPLIED: singleton file failure projection shared across reader exits and canonical isRecord replaces local package metadata guards.
554 src/worker/worker-connection.ts READ — replace pure connection-error forwarding calls with the existing exact shared coercion owner; leave admission, heartbeat, retry, fencing, and terminal ordering intact.
552 src/media/media-facts.ts READ: canonical and legacy projections preserve sparse positions, explicit field order, staged ownership and transcript bytes; public compatibility surfaces retain real callers.
542 src/security/audit-plugins-trust.ts READ. Retained: plugin-vs-hook messages deliberately differ. The local tool-policy helper differs from resolveConfiguredToolPolicies in profile alsoAllow handling; substituting the shared owner would change decisions and was rejected.
535 src/tts/tts-provider-resolution.ts READ: one config-resolution path handles explicit voice models and normal requests; remove one-use inventory/voice-model forwarding helpers; avoid copying before toSorted. Preserve alias precedence, input/runtime scopes, prepared-inventory lookup bypass, timeout policy, and fallbacks.
524 src/meeting-bot/runtime-facade.ts READ — facade translates stable platform/runtime contracts and owns request-session context; its wrappers carry that contract.
523 src/meeting-bot/participation.ts READ — shared exact error coercion replaces local copies; claims, hash bytes, validation order, and authority checks retained.
505 src/claws/mcp.ts READ — MCP leases, pending writes and sibling ownership checks are semantic boundaries; no duplicate path can be removed without ownership changes.
503 src/plugin-state/plugin-state-store.sqlite.ts READ — Applied: use canonical prepared-update mutation and derive registration/update input shapes from existing registration owner.
494 src/meeting-bot/transcripts-bridge.runtime.ts READ — durable/subscriber queues and finalization retry handling protect different settlement boundaries.
483 src/talk/realtime-session-harness.ts READ. Response-ID fencing, legacy event dedupe and audio flush generations protect different transport races; no safe removal.
483 src/worker/embedded-agent.runtime.ts READ — no further safe structural reduction: setup/turn/tool cleanup/transcript flush/terminal ACK order enforces distinct authority and settlement boundaries; previous-pass changes retained.
482 src/claws/cron.ts READ — Gateway definition matching and uncertain-write reconciliation serve distinct scheduler contracts; no change to scheduler/persisted semantics.
479 src/media/input-files.ts READ: image and document intake share guarded transport already, with different base64 defaults, charset and validation order. Abort helper has distinct error semantics from shared race helper; do not substitute it.
470 src/security/audit-gateway-config.ts READ. Retained: credential precedence, strength checks and strict loopback checks have security-specific semantics. Finding text and order remain untouched.
461 src/meeting-bot/platform-adapter.ts READ — first-pass file; browser parsing, optional legacy shapes, and SDK factory surface preserved.
458 src/claws/workspace.ts READ — APPLIED: one per-action constructor preserves diagnostic code/path/message and created-file evidence; removed one-use action filter wrapper.
458 src/system-agent/setup-inference-detect.ts READ — Manual/prepared/native/discovered candidates intentionally use distinct availability and partial-result rules.
455 src/system-agent/inference-route.ts READ — Authored/materialized/execution route projections bind distinct identities; retained explicit clone and comparison contracts.
454 src/plugin-state/plugin-state-store.kernel.ts READ — Retained connection-owned prepared statements, expiry batching, scalar decoding, and keyed query shapes; existence/count queries intentionally avoid JSON bodies.
454 src/system-agent/agent-turn.ts READ — CLI/embedded transcripts, proposal mirroring and authority revalidation after cleanup are distinct and required.
453 src/security/external-content.ts READ. Retained: Unicode marker folds, original-offset mapping, prefix truncation and random boundary construction protect exact prompt/transcript bytes; no safe structural deletion justified.
451 src/claws/project.ts READ — APPLIED: project metadata now uses the canonical non-array record coercer; deterministic build/discovery/exclusion policy retained.
448 src/meeting-bot/session-transcript-store.ts READ — use exact shared error coercion; snapshot overlap, cursor advancement, and pending delivery retained byte-for-byte.
429 src/talk/audio-codec.ts READ. Direct and precomputed resampling have different numeric ordering and edge behavior; first-pass file, unchanged.
412 src/security/audit.deep.runtime.ts READ. Retained: plugin-vs-skill scanner flows differ in bounded manifest/content reads, failure text, scope and partial-scan findings. Shared cache/scanner helpers already own common behavior.
410 src/talk/provider-types.ts READ. Canonical public provider contract consumed by changed session/internal adapters; retained all exports and SDK shapes.
410 src/tts/openai-compatible-speech-provider.ts READ: first pass already centralized normalization. Distinct raw/Talk/explicit override precedence and HTTP cleanup are contractual; no further sound reduction found.
409 src/talk/forced-consult-coordinator.ts READ. Pending/native/delivered state transitions and bounded timers carry different dedupe semantics; first-pass file, unchanged.
407 src/talk/realtime-session-lifecycle.ts READ. Generation fencing, connect sharing and terminal notification ownership are required; first-pass file, unchanged.
407 src/worker/inference-stream.runtime.ts READ — merge each delta/end pair's identical active-block lookup/validation; preserve literal resulting errors, content mutation, gap tolerance, signature handling, preview scheduling, and terminal projection. Import inference client directly.
401 src/system-agent/hosted-setup.runtime.ts READ — Removed wider mutable hook state and redundant forwarding; retain the owner-bound awaited post-write callback. Write, memory import, audit and error semantics are unchanged.
394 src/claws/doctor.ts READ — Findings differ by resource and live evidence availability; no safe shared classifier replaces those separate diagnostic contracts.
387 src/system-agent/overview.ts READ — Overview and welcome renderers intentionally differ in missing-config/model and gateway recovery phrasing; retained.
384 src/fleet/doctor.runtime.ts READ — Fleet findings preserve per-check warning/failure distinctions and exact ordering; first-pass disk-limit owner retained.
384 src/meeting-bot/status-prejoin-source.ts READ — first-pass file; page/session ownership and mute restoration are platform state boundaries.
377 src/meeting-bot/plugin-entry.ts READ — first-pass file; trusted runtime context and gateway/tool ownership checks retained.
377 src/talk/agent-run-control-shared.ts READ. Conservative classifier and stable model-facing text form public SDK contracts; first-pass file, unchanged.
371 src/worker/launch-descriptor.ts READ — closed assignment/admission/browser/computer/GitHub schemas protect separate wire contracts; optional-key handling and local/protocol limits are intentionally different, so no sound simplification remains.
369 src/system-agent/setup-app-recommendations.ts READ — Removed repeated inventory normalization/sorting, identity prompt projection and one-use token accumulation.
369 src/talk/session-runtime.ts READ, CHANGED. Derive facade bridge methods and provider request fields from canonical provider types; preserve runtime admission/disposal and callback code byte-for-byte.
368 src/talk/client-voice-mutation-digest-owner.ts READ. Retry state and active-attempt generations deliberately distinguish deferred live work, failed work and retained identity budgets; unchanged.
366 src/claws/provenance-runtime-read.ts READ — Prepared provenance facts, invalidation and async publication admission are lifecycle-owned; separate absent/error/unknown states retained.
366 src/system-agent/plugin-artifact.ts READ — Exact archive digest, review retention, lifecycle lease and approval gates are required; no safe simplification under immutable security/storage contracts.
359 src/system-agent/rescue-message.ts READ — Remote persisted-operation validation, sender scoping, consume-before-await and unsupported-operation decisions retained.
358 src/meeting-bot/realtime-local-audio-transport.ts READ — first-pass file; process/stdio ownership and injected-stream diagnostics differ from node transport.
357 src/security/safe-regex.ts READ. Retained: custom conservative tokenizer, repetition classification and bounded cache semantics; first-pass file. No regex acceptance changes.
355 src/talk/activation-name.ts READ. Leading/trailing fuzzy matches have distinct grammar and boundary restrictions; merging loops would obscure preserved matching behavior.
351 src/meeting-bot/realtime-agent-engine.ts READ — import engine-support helpers directly instead of through the realtime-engine forwarding layer.
349 src/transcripts/store-sqlite-read.ts READ — Retained bounded identity matching and snapshot reads; its export ownership query now also serves the write owner.
348 src/worker/worker.runtime.ts READ — import RPC implementations directly and remove their forwarding barrel; all deferred imports, abort/fence checks, durable ACK, cleanup, and environment restoration stay in place.
346 src/tts/tts-settings.ts READ — Collapse duplicate enabled/disabled model-override policy objects into one short-circuit projection and reuse the schema-owned boolean directly. Preference ownership and compatibility normalization stay unchanged.
339 src/security/fix.ts READ. Retained: file mutation sequencing, symlink refusal, OS-specific ACL/chmod paths and config-before-permission order are required contracts.
334 src/fleet/cell-profile.ts READ — Container argument order, environment provenance and Docker/Podman differences are explicit runtime contracts; existing common builder retained.
331 src/transcripts/capture-summary.ts READ — Retained summary queue generation, live timer custody, inference drainage, and snapshot CAS; repeated authority checks occur after distinct awaits.
330 src/security/audit-extra.summary.ts READ. Retained: provider-aware tool-policy selection and diagnostic text; first-pass file. Wrappers supply distinct extra policies rather than mere forwarding.
328 src/worker/embedded-agent-live.runtime.ts READ — event bounding, commentary phase projection, degradable previews, and durable terminal merge have different invariants; previous-pass implementation already consolidates tool event construction.
321 src/claws/lifecycle-status.ts READ — Status preserves orphan inventory, bootstrap lifecycle and offline versus requested online inspection; first-pass common projection retained.
317 src/meeting-bot/realtime-engine-support.ts READ — remains the canonical provider selection, log formatting, and lifecycle-event owner; no sound further reduction.
314 src/system-agent/chat-engine.ts READ — Facade owns queue/history/inference identity and delegates routing/wizards already; no extra owner needed.
312 src/meeting-bot/node-invoke-policy.ts READ — first-pass file; untrusted node validation and command-policy decisions preserved.
312 src/meeting-bot/output-loopback-verifier.ts READ — export its health shape for the transport and session types to consume instead of redeclaring it.
310 src/worker/worker-connection-frames.ts READ — use canonical structured-error coercion directly; request specs already own dispatch/schema mapping, with no duplicated lifecycle policy to remove.
306 src/worker/worker-command.runtime.ts READ — managed and one-shot command streams have distinct admission, write-settlement, environment retention, and disposal contracts; merging them would hide rather than remove those invariants.
299 src/talk/agent-run-control.ts READ. Keep narrow dependency callback contract explicitly preserved by released SDK tests; retain live target/authority checks and lazy commands.
299 src/tts/tts-payload.ts READ: payload guards have different returned payloads, timing, and visible-fallback semantics; status success/failure projections intentionally differ. First pass covered persistence plumbing; no further sound reduction found.
298 src/tts/directives.ts READ: streaming and final directives have distinct buffering/code-region contracts. Lazy provider lookup prevents unintended provider activation; no sound shared flow beyond first pass.
296 src/talk/agent-consult-tool.ts READ, CHANGED. Use canonical record/string alias/option readers; replace duplicated proxy/nonproxy instruction construction with shared ordered blocks while retaining proxy empty blocks.
294 src/claws/application-plan.ts READ — APPLIED: moved pure extension-package projection to application-provenance, its sole production caller, avoiding model-catalog imports for key/index consumers.
294 src/transcripts/store-sqlite.ts READ — Retained exact transcript row codecs and idempotence comparison, including lone-surrogate handling; these define transcript bytes.
290 src/plugin-state/plugin-state-store.retention.ts READ — Retained insertion/refusal versus post-write eviction ordering, monotonic journal creation, and import-local retained counts.
290 src/system-agent/assistant-prompts.ts READ — Prompt and transcript bytes are part of the requested hard contract; retained both real planner and tool-loop prompts.
288 src/meeting-bot/browser-session-control.ts READ — exact shared error coercion and bounded sleep; leave/confirmation and retained-tab identity decisions unchanged.
287 src/claws/package-update.ts READ — APPLIED: reuse canonical package identity helper; package claims, rollback and mutation uncertainty remain unchanged.
287 src/meeting-bot/runtime-facade-types.ts READ — first-pass file; public generic facade and hook contracts retained.
286 src/meeting-bot/realtime-output-owner.ts READ — queue generation, provider response ownership, and continuous-audio rules serve distinct invariants.
281 src/media/media-probe.ts READ: selected streams, duration fallback, fd compatibility and display rotation are independent ffprobe contracts; no sound further reduction.
276 src/claws/lifecycle-config-removal.ts READ — Current deletion journal and monitor quiescence/drainage authority checks stay at all original effect boundaries.
275 src/media/local-media-access.ts READ: retain default-root public export as a direct alias; share boundary option type. Authority revalidation, errors, hardlink and descriptor checks unchanged.
273 src/media/read-capability.ts READ: host and remote workspace readers retain different authority and root exclusion semantics; existing shared callback owner already handles byte limits.
271 src/meeting-bot/runtime-probes.ts READ — speech waveform verification and caption advancement have distinct baselines and deadline semantics.
271 src/tts/tts-synthesis.ts READ: buffered synthesis forwards the canonical prepared request. Retain distinct Talk availability guard, persistence error projection, and channel transcode rules.
271 src/worker/node-workspace-protocol.ts READ — replace manual result own-key/field validation with existing workerProtocolObject owner and reuse workspace process-ID schema. Preserve original validated object identity, optional undefined acceptance, exact integer/path/byte limits, and null result on rejection. Input parser remains unchanged.
270 src/meeting-bot/page-script-source.ts READ — page transcript and audio-leave scripts preserve historic row bytes, media identities, and native-page effects.
269 src/meeting-bot/plugin-config.ts READ — first-pass file; normalization fallback and public config keys retained.
268 src/media/store.read-scope.ts READ: requested-directory identity, real-directory identity, retained-descriptor identity and post-await authority are separate checks; cleanup/settlement ordering retained.
268 src/plugin-state/plugin-blob-store.ts READ — Retained facade validations and SDK/test factories; previous-pass file left untouched.
266 src/meeting-bot/browser-audio-capture-source.ts READ — microphone exclusion, source replacement, mute ownership, and asynchronous authority checks are necessary.
265 src/worker/worker-rpc-live-event-client.ts READ — use exact canonical toStringifiedError coercion; cumulative ACK/resync, preview degradation, terminal completion, and replay-generation handling remain separate.
262 src/claws/mcp-update.ts READ — Release/remove/change need different config compare-and-swap and compensation; preserve existing canonical mutation owner and leases.
260 src/system-agent/system-agent.ts READ — CLI one-shot/JSON/TUI modes and scoped plugin generation have distinct inference gates; retained.
254 src/fleet/registry.kernel.ts READ — Fleet registry transactions and generation lease checks are persistent-state contracts; no query/admission changes.
252 src/plugin-state/plugin-store-validation.ts READ — Retained shared keyed/blob validation owner; plain-object descriptor checks protect cross-realm JSON without invoking accessors.
249 src/system-agent/assistant.ts READ — Tool-free planner/greeting already share execution; retained temporary workspace cleanup and post-cleanup owner validation.
247 src/meeting-bot/agent-consult.ts READ — first-pass file; consult routing and cancellation checks retained.
246 src/talk/realtime-voice-lazy-lifecycle.ts READ. Load adoption, disposal claiming and final-transcript admission guard distinct reentrant races; unchanged.
241 src/system-agent/setup-inference-auth-options.ts READ — Shared guided projection already exists; manual/install sorting and filtering intentionally differ, so retained.
241 src/system-agent/setup-model-selection.ts READ — Agent/default/utility selection and runtime pins preserve different authored config contracts; retained.
240 src/meeting-bot/audio-backend.ts READ — first-pass file; platform-specific backend and command provisioning contracts retained.
239 src/claws/openclaw-profile.ts READ — Conventional and legacy profile pointer behavior has a named published contract; dynamic profile consent migration retained.
236 src/meeting-bot/plugin-shell.ts READ — wrappers supply platform defaults and lazy CLI registration; pluginTypes is a public SDK type surface.
235 src/system-agent/setup-inference-transition.ts READ — Existing config and credential owners retain undo and recovery authority; no persistence semantics changed.
235 src/talk/agent-talkback-runtime.ts READ. Serial queue and metadata batching are necessary. Local abort predicate is deliberately narrower than shared infra predicate; replacing it would change fallback delivery.
235 src/worker/worker-connection-admission.ts READ — use canonical structured-error coercion directly; generation, socket state, admission transition, observer isolation, and close ordering are required.
232 src/system-agent/setup-inference-credential-access.ts READ — Credential preparation, publication and rollback lineage are separate guarded boundaries; retained.
230 src/meeting-bot/session-durable-transcripts.ts READ — policy transitions, lazy bridge admission, and generation-fenced retries are necessary lifecycle work.
230 src/worker/transcript-message.ts READ — retained closed projection and byte-budget paths protect transcript bytes/provider replay. Text/image clone helpers have real outside-worker callers, so deleting or moving them would break this lane's cutover boundary.
229 src/claws/project-build.ts READ — Deterministic selection, byte revalidation, tar inventory and atomic publication each establish a different artifact invariant.
227 src/plugin-state/plugin-state-store.journal.ts READ — Retained atomic sequence allocation, cursor eviction recovery, exact key bounds, and separate cursor/journal eviction; each branch serves a persisted contract.
225 src/media/media-reference.ts READ: URI, local and sandbox projections differ intentionally in normalization, symlink fallback and error mapping; retained.
224 src/worker/node-supervisor-protocol.ts READ — previous-pass schema owner is already canonical; launch, cancel, stop, receipt and diagnostic parsers retain distinct limits and exact errors.
223 src/meeting-bot/session-cleanup-tracker.ts READ — inline failed-join retry in the catch that owns it, deleting redundant boolean control state.
222 src/talk/talk-session-controller.ts READ, CHANGED. Fold one-use remember forwarder into emit; remove unnecessary TalkEvent casts and narrating type/function comments. Event ordering, payload defaulting and turn guards unchanged.
221 src/media/channel-inbound-roots.ts READ: fold single-use loader forwarding into existing normalized lookup owner. Keep lazy artifact loading, bundled-before-installed precedence and plugin policy intact.
221 src/transcripts/library.ts READ — Retained public reader/export formats, artifact filtering, and incremental byte budgets; exports intentionally differ from storage JSONL.
220 src/tts/tts-streaming-resources.ts READ: cancellation-before-join, captured async scope, explicit-vs-implicit release, reader lock release, and primary-error ordering all carry resource invariants; no sound reduction found.
217 src/worker/worker-rpc-inference-client.ts READ — no safe lifecycle simplification: per-operation resume scheduling, synchronous replay cursor reset, identity checks, callback failure settlement, and disposal have separate ordering requirements.
216 src/plugin-state/plugin-state-store.types.ts READ — Retained shipped async and deprecated sync SDK shapes, action-bound methods, and error metadata; removing compatibility would break named public contract.
215 src/security/dm-policy-shared.ts READ. Retained: deprecated APIs remain exposed by public channel-access-compat SDK barrel; removing them would break a named compatibility contract.
214 src/claws/cron-update.ts READ — Gateway readiness, declaration convergence, uncertain writes and undo have separate observable results; retained.
213 src/talk/turn-context-tracker.ts READ. Closed-turn pruning and later-audio pruning serve different lifetime rules; owner marker and ignored-context TTL retained.
212 src/tts/tts-core.ts READ: lazy LLM imports and injected-vs-owned model acquisition have named public/resource contracts; abort mapping and timer lifetime preserved; no sound reduction found.
212 src/tts/voice-models.ts READ: canonical candidate builder already owns fallback policy. Primary-only candidate selection avoids inspecting unrelated provider models; existing SDK-adjacent helpers and config alias precedence preserved.
211 src/fleet/registry.ts READ — Worker admission plus live scope and cleanup phases fence queued writes; deferred loading and settlement retained.
211 src/transcripts/status.ts READ — Retained metadata-only provider projection, exact lifecycle-token matching, uncertain source fallback, and bounded diagnostic output.
209 src/media/local-roots.ts READ: explicit workspace authority, shared-sandbox exclusion and source-parent expansion are different policies. Existing canonical path owner retained.
209 src/talk/provider-internal.ts READ, CHANGED. Reuse canonical configured-provider context type for internal readiness and capability contracts; preserve runtime property projections and optional hook behavior.
208 src/transcripts/store-sqlite-write.ts READ — Applied: reuse canonical export-ownership reader in the existing export-state transaction; no query or serialized data changes.
207 src/plugin-state/plugin-state-worker-client.ts READ — Applied: executor accepts typed command directly; removes repeated dispatch closures while retaining FIFO admission, post-await authority, missing-state, and failure classification.
204 src/talk/client-voice-session-store.ts READ. Durable schema validation, native SQLite error ordering and recovery query snapshots are explicit persistent-store contracts; unchanged.
203 src/system-agent/inference-fallback.ts READ — Per-owner attempts and provider-wide retirement have distinct failure rules; retained.
203 src/transcripts/summary-model.ts READ — Retained lazy runtime import, bounded whole-utterance prompt clipping, model fallback, and cancellation settlement; no interchangeable duplicate path.
201 src/claws/types.ts READ — APPLIED: removed duplicate manifest component declarations; downstream types use schema inference and the leaf agent settings contract, preserving the narrower ToolProfileId contract.
201 src/media/audio-transcode.ts READ: inline one-recipe afconvert selector and remove unused source argument; same flags, validation precedence and cleanup.
201 src/transcripts/provider-types.ts READ — Retained public provider, consent, ownership, source, and callback contracts; apparent wrapper types document distinct public shapes.
193 src/meeting-bot/realtime-node-audio-transport.ts READ — one bound RPC envelope for pull/push/clear/stop; retain generation snapshots, checks after awaits, legacy queue, and command timeouts.

Main refreshes: inspected the new inbound-media URI owner, avatar/media/config-unset changes, and the later transcript bounded-query optimization; preserved upstream behavior. The landed OpenRouter suppression repair is included from main. The new 66-line src/claws/manifest-contract.ts was read and independently reviewed as the cycle-free foundational owner. No new production file over 200 lines is omitted.

@clawsweeper

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

@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 26, 2026
@clawsweeper

clawsweeper Bot commented Sep 26, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 26, 2026, 6:15 PM ET / 22:15 UTC (Revision 9).

ClawSweeper review

What this changes

The branch consolidates duplicated types, parsing, queries, and dispatch helpers across setup, Claws, media, voice, security audits, plugin state, transcripts, TTS, Fleet, and workers.

Merge readiness

⛔ Blocked before merge - 2 items remain

This PR contains distinct, unmerged cleanup beyond the earlier merged pass. The inspected changes and prior review establish no concrete introduced blocker, so it remains a useful landing candidate.

Priority: P3
Reviewed head: 7ad8d8ddfb86d32e3eb302e8cdf01a2a085f4e63

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The cleanup has focused contract coverage and reported broad validation, with no concrete defect found in the inspected changes.
Proof confidence 🐚 platinum hermit (4/6) Not applicable: The author has verified repository admin permission, so external-contributor proof is not required. The changed worker validator has focused protocol coverage and the PR reports broader Testbox validation, but no user-visible behavior change is claimed; the inspected state changes do not alter a stored-data contract.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The author has verified repository admin permission, so external-contributor proof is not required. The changed worker validator has focused protocol coverage and the PR reports broader Testbox validation, but no user-visible behavior change is claimed; the inspected state changes do not alter a stored-data contract.
Evidence reviewed 12 items Pinned introduced change: The merge-base-to-head diff changes internal helpers across the named subsystems; the prior merged cleanup is a separate pass.
Claw schema boundary: The changed section derives TypeScript types from existing validation schemas; the manifest parser still uses the same schema.
Plugin-state write ordering: The shared mutation retains insertion admission, expiry calculation, upsert, and post-register limit enforcement in that order.
Findings None None.
Security None None.

How this fits together

These core subsystems turn setup and Claw manifests, media and voice requests, and worker messages into runtime actions. Shared validators, state workers, providers, and audit collectors produce session results and diagnostics.

flowchart LR
A[Setup and Claw manifests] --> D[Shared owners and validators]
B[Media and voice requests] --> D
C[Worker messages] --> D
D --> E[Plugin state and transcripts]
D --> F[Providers and Fleet]
D --> G[Session results and audit findings]
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

Metric Value Why it matters
Upgrade surface 0 new config keys; 0 migrations The prior compatibility question concerns inferred types and reused state operations, with no introduced stored format.

Stored data model

Persistent data-model change detected: database schema: src/claws/schema.ts, database schema: src/claws/types.ts, unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Technical review

Best possible solution:

Keep the consolidated owners and stable contracts, then land the branch after the normal exact-head merge gates pass.

Do we have a high-confidence way to reproduce the issue?

Not applicable: this PR is an internal refactor and does not report a user-facing bug to reproduce. The changed validators and state operations can be compared directly with their prior owners.

Is this the best way to solve the issue?

Yes for the inspected changes: they reuse existing schema, query, and dispatch owners without establishing a competing public contract.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 8864423309d3.

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is internal cleanup with no intended user-visible behavior change or established urgent regression.
  • 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 author has verified repository admin permission, so external-contributor proof is not required. The changed worker validator has focused protocol coverage and the PR reports broader Testbox validation, but no user-visible behavior change is claimed; the inspected state changes do not alter a stored-data contract.

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)

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 (8 earlier review cycles)
  • reviewed September 26, 2026, 11:55 AM ET / 15:55 UTC sha unknown :: blocked before merge. :: none
  • reviewed 2026-09-26T16:47:39.013Z sha dba78ba :: blocked before merge. :: none
  • reviewed 2026-09-26T18:18:39.174Z sha da92398 :: blocked before merge. :: none
  • reviewed 2026-09-26T18:57:33.961Z sha a9c55d0 :: blocked before merge. :: none
  • reviewed 2026-09-26T19:35:01.468Z sha 2b798d8 :: blocked before merge. :: none
  • reviewed 2026-09-26T20:54:44.354Z sha 7ad8d8d :: blocked before merge. :: none
  • reviewed 2026-09-26T21:05:29.530Z sha 7ad8d8d :: blocked before merge. :: none
  • reviewed 2026-09-26T22:02:14.497Z sha 7ad8d8d :: blocked before merge. :: none

@steipete
steipete marked this pull request as ready for review September 26, 2026 16:40
@github-actions

github-actions Bot commented Sep 26, 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: ea6c8dd2024002a26127de2af800277c282dfaf8
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/security/audit-channel.collect.runtime.ts: Controls product security checks or trust decisions. Check whether the change weakens detection, protection, or remediation.
  • src/security/audit-extra.async.ts: Controls product security checks or trust decisions. Check whether the change weakens detection, protection, or remediation.
  • src/security/audit.runtime.ts: Controls product security checks or trust decisions. Check whether the change weakens detection, protection, or remediation.

Carefully review these changes before merging.

@steipete
steipete enabled auto-merge (squash) September 26, 2026 22:35
@steipete
steipete merged commit e9dc62b into main Sep 26, 2026
232 checks passed
@steipete
steipete deleted the deslop/l86-src-misc2 branch September 26, 2026 22:45
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 27, 2026
… second pass (openclaw#158984)

* refactor(core): deslop system-agent, claws, talk, security and worker second pass

* fix(plugin-state): avoid shadowed request type key

* refactor(core): correct manifest ownership and setup callbacks

* ci: refresh after upstream cron fixture repair

Regenerate merge-ref checks after 03f9f7e repaired the inherited scheduler fixtures on main. The production source tree is unchanged.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

fleet 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