Repository navigation
refactor(core): deslop system-agent, claws, talk, security and worker second pass - #158984
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: blocked before merge. Reviewed September 26, 2026, 6:15 PM ET / 22:15 UTC (Revision 9). ClawSweeper reviewWhat this changesThe 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 Review scores
Verification
How this fits togetherThese 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]
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metrics
Stored data modelPersistent data-model change detected: Technical reviewBest 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. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (8 earlier review cycles)
|
|
Regenerate merge-ref checks after c0e6951 repaired the inherited scheduler fixtures on main. The production source tree is unchanged.
… 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.
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
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 from2b798d8d9fd83160821c50a18591796791903479, based on main1c91579634541d991dbc77144f3d26d58baf68d9: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 buildpassed in 6m51.9s. No test, check, or build ran on the shared Mac.check-changeddid not pass: its broad core lint stage reports the inherited 705-linesrc/state/openclaw-state-worker-runtime.tsagainst a 700-line limit. An additional whole-core lint diagnostic reports the same issue. The file is byte-identical to the base (blob11cf6048622e46f3e795ff1bf8c485da94a7c8f9); #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, atsrc/gateway/talk/handlers/client-native-actions.test.ts, withAgentDatabaseRegistryChangedError. The failed test and registry/lifetime owners are unchanged by this PR and match its CI merge's main parent19c6ef8d9e0260471b798615e8a1eaf42b9aada3. #159163 owns the exact repair: bounded initial-discovery recovery with source revalidation, retaining repeated-invalidation and retarget rejection. The repair remains OPEN and unmerged at7a233c5dfaf960f11fd6ae1f3b04c0a1fe2160bf. Its final-head CI failed inchecks-node-changed-compact-large-9: teardown ofsrc/gateway/session-group-mutation-targets.test.tsreportsRetired agent cleanup cannot adopt a replacement shared databasethrough 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
c0e6951d6f02d3eabd4bc13cf8e9fa9e77d290acthrough 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.tsgains 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):
Earlier focused proof (201 tests; Claws timing refreshed separately). Measured
/usr/bin/time -p pnpm test <file> --maxWorkers=1wall times:src/claws/application-schema.test.tssrc/worker/inference-stream.runtime.test.tssrc/worker/node-workspace-protocol.test.tssrc/worker/worker-connection.test.tssrc/worker/worker-rpc-clients.test.tssrc/worker/worker.runtime.test.tsThe 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 main1c91579634541d991dbc77144f3d26d58baf68d9. 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.src/security/audit.tssrc/media/web-media.tssrc/security/audit-extra.sync.tssrc/system-agent/verified-inference.tssrc/fleet/backup.runtime.tssrc/fleet/service.runtime.tssrc/media/fetch.tssrc/system-agent/operations-execution-helpers.tssrc/talk/client-voice-session.tssrc/fleet/containers.runtime.tssrc/system-agent/setup-inference-turn.tssrc/transcripts/capture.tssrc/talk/client-voice-confirmation.tssrc/transcripts/store-read.tssrc/transcripts/auto-start.tssrc/meeting-bot/session-runtime.tssrc/fleet/service-support.runtime.tssrc/claws/packages.tssrc/claws/lifecycle-state.tssrc/media/store.tssrc/meeting-bot/chrome-transport.tssrc/meeting-bot/node-host.tssrc/claws/lifecycle.tssrc/claws/add.tssrc/system-agent/operations-execute.tssrc/media/parse-output.tssrc/system-agent/setup-inference-credentials.tssrc/media/playback-transcode.tssrc/claws/update-plan.tssrc/claws/update-capability-changes.tssrc/claws/schema.tssrc/system-agent/greeting.tssrc/transcripts/store.tssrc/claws/package-remove.tssrc/system-agent/chat-wizard-host.tssrc/meeting-bot/status-call-source.tssrc/claws/export.tssrc/system-agent/setup-inference-activate.tssrc/system-agent/operations-parse.tssrc/plugin-state/plugin-state-store.tssrc/system-agent/chat-turn-router.tssrc/meeting-bot/realtime-engine.tssrc/system-agent/setup-apply.tssrc/claws/provenance.tssrc/security/install-policy.tssrc/system-agent/setup-inference-core.tssrc/plugin-state/plugin-blob-store.sqlite.tssrc/security/audit-channel.tssrc/meeting-bot/browser-controller.tssrc/tts/tts-synthesis-support.tssrc/talk/agent-consult-runtime.tssrc/claws/update-apply.tssrc/security/audit-extra.async.tssrc/claws/lifecycle-delete-support.tssrc/system-agent/tui-backend.tssrc/system-agent/config-redaction.tssrc/claws/reader.tssrc/worker/worker-connection.tssrc/media/media-facts.tssrc/security/audit-plugins-trust.tssrc/tts/tts-provider-resolution.tssrc/meeting-bot/runtime-facade.tssrc/meeting-bot/participation.tssrc/claws/mcp.tssrc/plugin-state/plugin-state-store.sqlite.tssrc/meeting-bot/transcripts-bridge.runtime.tssrc/talk/realtime-session-harness.tssrc/worker/embedded-agent.runtime.tssrc/claws/cron.tssrc/media/input-files.tssrc/security/audit-gateway-config.tssrc/meeting-bot/platform-adapter.tssrc/claws/workspace.tssrc/system-agent/setup-inference-detect.tssrc/system-agent/inference-route.tssrc/plugin-state/plugin-state-store.kernel.tssrc/system-agent/agent-turn.tssrc/security/external-content.tssrc/claws/project.tssrc/meeting-bot/session-transcript-store.tssrc/talk/audio-codec.tssrc/security/audit.deep.runtime.tssrc/talk/provider-types.tssrc/tts/openai-compatible-speech-provider.tssrc/talk/forced-consult-coordinator.tssrc/talk/realtime-session-lifecycle.tssrc/worker/inference-stream.runtime.tssrc/system-agent/hosted-setup.runtime.tssrc/claws/doctor.tssrc/system-agent/overview.tssrc/fleet/doctor.runtime.tssrc/meeting-bot/status-prejoin-source.tssrc/meeting-bot/plugin-entry.tssrc/talk/agent-run-control-shared.tssrc/worker/launch-descriptor.tssrc/system-agent/setup-app-recommendations.tssrc/talk/session-runtime.tssrc/talk/client-voice-mutation-digest-owner.tssrc/claws/provenance-runtime-read.tssrc/system-agent/plugin-artifact.tssrc/system-agent/rescue-message.tssrc/meeting-bot/realtime-local-audio-transport.tssrc/security/safe-regex.tssrc/talk/activation-name.tssrc/meeting-bot/realtime-agent-engine.tssrc/transcripts/store-sqlite-read.tssrc/worker/worker.runtime.tssrc/tts/tts-settings.tssrc/security/fix.tssrc/fleet/cell-profile.tssrc/transcripts/capture-summary.tssrc/security/audit-extra.summary.tssrc/worker/embedded-agent-live.runtime.tssrc/claws/lifecycle-status.tssrc/meeting-bot/realtime-engine-support.tssrc/system-agent/chat-engine.tssrc/meeting-bot/node-invoke-policy.tssrc/meeting-bot/output-loopback-verifier.tssrc/worker/worker-connection-frames.tssrc/worker/worker-command.runtime.tssrc/talk/agent-run-control.tssrc/tts/tts-payload.tssrc/tts/directives.tssrc/talk/agent-consult-tool.tssrc/claws/application-plan.tssrc/transcripts/store-sqlite.tssrc/plugin-state/plugin-state-store.retention.tssrc/system-agent/assistant-prompts.tssrc/meeting-bot/browser-session-control.tssrc/claws/package-update.tssrc/meeting-bot/runtime-facade-types.tssrc/meeting-bot/realtime-output-owner.tssrc/media/media-probe.tssrc/claws/lifecycle-config-removal.tssrc/media/local-media-access.tssrc/media/read-capability.tssrc/meeting-bot/runtime-probes.tssrc/tts/tts-synthesis.tssrc/worker/node-workspace-protocol.tssrc/meeting-bot/page-script-source.tssrc/meeting-bot/plugin-config.tssrc/media/store.read-scope.tssrc/plugin-state/plugin-blob-store.tssrc/meeting-bot/browser-audio-capture-source.tssrc/worker/worker-rpc-live-event-client.tssrc/claws/mcp-update.tssrc/system-agent/system-agent.tssrc/fleet/registry.kernel.tssrc/plugin-state/plugin-store-validation.tssrc/system-agent/assistant.tssrc/meeting-bot/agent-consult.tssrc/talk/realtime-voice-lazy-lifecycle.tssrc/system-agent/setup-inference-auth-options.tssrc/system-agent/setup-model-selection.tssrc/meeting-bot/audio-backend.tssrc/claws/openclaw-profile.tssrc/meeting-bot/plugin-shell.tssrc/system-agent/setup-inference-transition.tssrc/talk/agent-talkback-runtime.tssrc/worker/worker-connection-admission.tssrc/system-agent/setup-inference-credential-access.tssrc/meeting-bot/session-durable-transcripts.tssrc/worker/transcript-message.tssrc/claws/project-build.tssrc/plugin-state/plugin-state-store.journal.tssrc/media/media-reference.tssrc/worker/node-supervisor-protocol.tssrc/meeting-bot/session-cleanup-tracker.tssrc/talk/talk-session-controller.tssrc/media/channel-inbound-roots.tssrc/transcripts/library.tssrc/tts/tts-streaming-resources.tssrc/worker/worker-rpc-inference-client.tssrc/plugin-state/plugin-state-store.types.tssrc/security/dm-policy-shared.tssrc/claws/cron-update.tssrc/talk/turn-context-tracker.tssrc/tts/tts-core.tssrc/tts/voice-models.tssrc/fleet/registry.tssrc/transcripts/status.tssrc/media/local-roots.tssrc/talk/provider-internal.tssrc/transcripts/store-sqlite-write.tssrc/plugin-state/plugin-state-worker-client.tssrc/talk/client-voice-session-store.tssrc/system-agent/inference-fallback.tssrc/transcripts/summary-model.tssrc/claws/types.tssrc/media/audio-transcode.tssrc/transcripts/provider-types.tssrc/meeting-bot/realtime-node-audio-transport.tsMain 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.tswas read and independently reviewed as the cycle-free foundational owner. No new production file over 200 lines is omitted.