Repository navigation
refactor(runtime): deslop core subsystems - #157982
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 25, 2026, 9:51 AM ET / 13:51 UTC (Revision 6). ClawSweeper reviewWhat this changesThe branch consolidates duplicated setup and runtime code and stops an abandoned meeting-audio output process when input startup fails. Merge readiness⛔ Blocked before merge - 5 items remain This PR contains a useful meeting-audio fix that is absent from current main. I found no discrete introduced defect, but the required published-updater compatibility proof for changed Claw and fleet lifecycle paths remains unrecorded. Priority: P2 Review scores
Verification
How this fits togetherOpenClaw setup and runtime services turn configuration and requests into managed resources, responses, and diagnostics. The changed meeting-audio path starts local processes and must clean them up when startup fails. flowchart LR
A[Configuration and requests] --> B[Setup and runtime services]
B --> C{Ownership and safety checks}
C --> D[Claw and fleet resources]
C --> E[Meeting audio processes]
D --> F[Responses and diagnostics]
E --> F
Before merge
Agent review detailsSecurityNone. PR surfacePR surface statistics unavailable: the file list is incomplete. Review metricsNone. Stored data modelPersistent data-model change detected: Root-cause clusterRelationship: Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Merge-risk optionsMaintainer options:
Technical reviewBest possible solution: Preserve the existing lifecycle and ownership checks, then record a published OpenClaw updater upgrading and rolling back representative installed Claw and fleet state before landing. Do we have a high-confidence way to reproduce the issue? Yes. Current main starts meeting-audio output before input and has no cleanup if input construction throws; the PR adds an injected-process regression, which this read-only review did not run. Is this the best way to solve the issue? Yes for the focused audio cleanup and reuse of existing owners. The lifecycle changes still need the repository-required published-updater compatibility result. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning high; reviewed against f65afe9abb4d. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rank-up movesOptional improvements that raise the rating; they are not merge blockers.
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (5 earlier review cycles)
|
fc0f4db to
9005a67
Compare
9005a67 to
1393606
Compare
Consolidate equivalent internal flows and reuse canonical types across the supporting runtime subsystems, preserving security, lifecycle, storage, and SDK contracts. Fix meeting audio partial startup cleanup so an input spawn failure terminates abandoned output and handles delayed output errors without replacing the original failure.
1393606 to
937072f
Compare
|
Merged via squash.
|
* refactor(runtime): deslop supporting runtime subsystems Consolidate equivalent internal flows and reuse canonical types across the supporting runtime subsystems, preserving security, lifecycle, storage, and SDK contracts. Fix meeting audio partial startup cleanup so an input spawn failure terminates abandoned output and handles delayed output errors without replacing the original failure. * refactor(runtime): deslop core subsystems
Closes #157965
What Problem This Solves
Maintainer-requested lane l43 removes duplicated plumbing and dead internal paths across core runtime subsystems, including channel/provider/search setup, hooks, and shared JSON Schema handling.
User Impact
The cleanup preserves existing behavior, security decisions, persisted data, provider selection, and public interfaces. One bug fix makes failed meeting-audio startup terminate abandoned output processes and absorb their delayed spawn errors while preserving the original input failure.
Why This Change Was Made
Equivalent internal paths now share their existing owners; private forwarding layers and duplicate types are removed. No schema, retention, permission, provider selection, tool contract, or public protocol changes are intended.
Simplifications by subsystem
System agent: use canonical planner and inference entry points, share turn queuing and wizard dispatch, remove unwritten follow-up state and redundant types.
Claws: reuse add failure results, update partial-error handling, empty plans and summary inventories while keeping mutation and rollback ordering.
Meetings: share Gateway response/error handling and local/node realtime engine construction, reuse transcript parsing and transport types, remove duplicate predicates and unreachable caption cleanup.
Talk/TTS: give preference reading and path/auto-mode resolution one owner, reuse directive projection and canonical helpers, remove redundant branches and stored state.
Security: use canonical finding types and full-distance Levenshtein calculation, collapse identical findings paths and private forwarding helpers, retain decisions, error text, and order.
Media: remove redundant result/types/forwarding code and unused private options, reuse codec normalization, and drop unreachable compression fallbacks while preserving all safety and byte constraints.
Worker/fleet: share ownership predicates, protocol validators and runtime-owned types without moving fencing or lifecycle checkpoints.
Transcripts/plugin state: reuse the result factory per typed transcript branch, share plugin error encoding and blob preparation; reuse existing types and errno checks without changing SQL, transactions, schemas, retention, or transcript bytes.
Flows: share catalog install/back/resume handling and config/result projections; replace the literal status-label switch with descriptors while preserving lazy translation.
Hooks: reuse canonical numeric/string normalization, simplify import-cache selection and slug extraction, and remove duplicated tutorials/narration; event names, payloads, order and error isolation remain intact.
Shared schema handling: bind private recursive child operations to the existing resource context and share ordered dependency traversals; retain all exports and ref/default/error semantics.
Fixes found along the way
Input process construction can throw after the meeting output process has started. Local startup now cleans up that output; local and node startup also handle a delayed output error after abandoning construction. Existing injected-process fixtures cover both cases. The local regression fails on the base because
SIGTERMis never sent; the node regression fails because the delayed output error escapes. Both pass with the repair.Evidence
Execution proof ran on Linux Blacksmith Testbox. The broad proof used
tbx_01m3b9xsy9cz4e8egsb4ws5jp9; after that lease was cancelled, final validation used replacementtbx_01m3bg9h1wxx3w4p1r2bdvk648. Testbox runs: broad proof, final proof. The wrapper command results below are the execution authority; stopped Testbox carrier runs can show cancelled. Validation base:818b0092d2ee65080b53a57e8949b0f8b4e03ff9. The branch was subsequently rebased ontoa68216889f1to carry the landed CI-budget and upgrade-fixture corrections;git range-diffconfirms the refactor patch is unchanged, and incoming main did not alter production files in this lane. Original validated head:139360696b0(CI).pnpm build: passed initially (479.19s wall) and after the transcript typing repair (508.15s wall).cce9cfb1has 131 reachable closure changes across nine deduplicated declaration sections: private type removal, equivalent owner-type reuse, TTS preference ownership/re-exports, and property-order noise. The public member chains and structural types remain compatible.check-changed: final production-path and baseline selection passed (1,635.81s), including core types, all 25 test-type shards, lint, dead-export scans, import cycles, and the selected guards. Earlier transcript typing and three lint findings were corrected; no casts, increased budgets, or skipped checks were used. Changed-test typing/lint also passed in the earlier full selection.Initial hosted CI run finished with 146 successful jobs and two failing test shards (plus the aggregate gate). The hosted-tail row-budget assertion is already corrected on main by #157836: dist rows are excluded from the existing 70-row Node cap while retaining the 90-row compact cap. The Gateway SecretRef restart fixture timed out on the GitHub merge tree, including #157964; its lease-settlement race is repaired by the separately landed #158027. The next CI run also reported an upgrade shell-fixture initialization failure now fixed by #157996, plus a different real-timer promoted-no-op stop timeout. A bounded observation-only replay of that exact 56-file Gateway group passed (134.22s); all receipt, restart, and cleanup phases completed, so that historical timeout remains unlocalized and is not claimed fixed. The demonstrated fake-timer SecretRef lease race landed as
2d64a7470e8c2bc8256797c5d3e3d5ca2aef94ba. Exact-head CI and both requiredopenclaw/ci-gatecontexts passed on139360696b0; that original proof remains valid for the unchanged portion of this PR. This PR has not been merged.Changed test costs, measured with
pnpm test <file> --maxWorkers=1:src/meeting-bot/realtime-local-audio-transport.test.tssrc/meeting-bot/node-host.audio.test.tssrc/system-agent/assistant.configured.test.tsPer-file hosted CI timings were not uploaded, and the available preflight artifact/log does not map files to jobs. The isolated command costs above are measured; hosted per-file seconds are unavailable.
Production: 908 lines added, 2,227 removed, 1,319 net removed. Tests: 57 added, 24 removed. The generated assertion baseline only lowers eight existing allowances, removing fifteen total; no allowances are added.
All lane production files were read. Export/importer traces cover
src,extensions,packages,test,scripts,ui, andapps; existing SDK compatibility exports remain intact. The widened sweep exceeds the campaign target. The coverage log includes the added flows, shared, and hooks subtrees.Widening proof
The added flows, hooks, and shared-schema changes remove another 443 production lines. Fresh independent Codex P0–P2 review found no actionable issues. Both shared-schema exports and all SDK-reachable exports remain available with unchanged signatures.
On Blacksmith lease
tbx_01m3byc2sy1n2pqd7h3rkw00xg(run), the owner/cross-consumer selection passed 129 passing file runs / 2,071 test executions; one native-Windows file with ten cases was skipped on Linux. The selection includes onboarding E2E, CLI and wizard setup, hosted setup, Gateway hook mapping, plugin schema validation, MCP runtime, and media cache consumers. Command wall was 1,235.475s, including the required 892.9s private-QA build preflight.The first changed-check attempt correctly required the assertion baseline to shrink from 28 to 25 for
src/shared/json-schema-defaults.ts. The canonical pruning command owns that update; no allowance was raised. The next changed-check run passed core typing and all 25 test-type groups, then identified the last direct consumer of the canonicalChannelSetupResultexport. Its typed result adapter is retained, with the redundant Boolean projection removed; no public export was deleted. A subsequent lint pass required the Doctor finding projection to use a freshObject.assigntarget instead of spread insidemap; optional-field presence and insertion order are preserved. The final lint preflight passed on all 97 changed source/test files (38.448s); Doctor projection owner and flow integration tests passed 154 tests across two files (29.338s). Finalcheck-changedpassed (1,848.275s), including core typing, all 25 test-type groups, every selected guard, dead exports, cycles, and lint. SDK export registration (0.226s) and surface budgets (3.842s) passed. SDK base/head API comparison passed (346.343s): no entrypoint/export additions or removals and all 131 affected export records have unchanged direct declaration text and kind. Reviewed digest69a51c81c729575513b1b870b2647f04443ce257c5dc715e32afbebc8af87a56. The eleven deduplicated sections resolve to equivalent internal type reuse, private-only removal, whole-module fallback pairing, and unchanged-source emitter ordering; public member chains remain compatible. None originates in the newly widened flows/hooks/shared files.The corrected setup consumers passed 725 test executions (79.276s).
pnpm build, with private QA enabled for the onboarding E2E consumer, passed (764.780s); the last Doctor projection adjustment was mechanical lint cleanup and received fresh owner tests, core/type checks, and independent review.The first lease’s carrier was cancelled during an unfinished type-check continuation (transport exit 255; no code diagnostic). Its completed build/test results remain valid. The unfinished gates moved to
tbx_01m3c5cbkd5kjcqn37n57ken5z(completion run), warmed with a 90-minute lease inactivity limit for the measured command duration. Test timeouts and assertions were unchanged. A short-lived replacement was stopped before execution. All widening leases are stopped. Published candidate:937072f80eb584a7a883602e32cd4a7b51bd00e8, rebased onto fresh main2ae0e9141cc19655e7fac445b796dc3cf508fcc0. Both commits are patch-identical bygit range-diff. Incoming main preserves its media legacy-URL fix, Claws unused-argument removal and Doctor runtime cleanup contribution. The post-rebase persisted-media regression passed all 40 tests (36.388s command wall; the only local focused test during widening). READY-TO-LAND: exact-head CI passed, and dependency/security review published successful required statuses for this head, includingopenclaw/ci-gate. The PR is open and non-draft, with auto-merge disabled; landing remains with the coordinator. No CI reruns were needed for this candidate.Coverage: all 232 production files over 200 lines, sorted by baseline size
src/flows/model-picker.tssrc/security/audit.tssrc/media/web-media.tssrc/flows/doctor-core-checks.tssrc/security/audit-extra.sync.tssrc/shared/json-schema-defaults.tssrc/flows/channel-setup.tssrc/system-agent/verified-inference.tssrc/fleet/backup.runtime.tssrc/fleet/service.runtime.tssrc/shared/text/assistant-visible-text.tssrc/media/fetch.tssrc/flows/search-setup.tssrc/fleet/containers.runtime.tssrc/media/store.tssrc/talk/client-voice-session.tssrc/system-agent/setup-inference-turn.tssrc/meeting-bot/session-runtime.tssrc/transcripts/capture.tssrc/fleet/service-support.runtime.tssrc/talk/client-voice-confirmation.tssrc/transcripts/store-read.tssrc/transcripts/auto-start.tssrc/claws/packages.tssrc/meeting-bot/chrome-transport.tssrc/claws/lifecycle.tssrc/claws/lifecycle-state.tssrc/claws/add.tssrc/meeting-bot/node-host.tssrc/claws/update-plan.tssrc/hooks/install.tssrc/claws/update-capability-changes.tssrc/system-agent/operations-execution-helpers.tssrc/system-agent/setup-inference-credentials.tssrc/media/parse-output.tssrc/system-agent/chat-wizard-host.tssrc/system-agent/operations-execute.tssrc/media/playback-transcode.tssrc/meeting-bot/status-call-source.tssrc/system-agent/greeting.tssrc/system-agent/operations-parse.tssrc/transcripts/store.tssrc/claws/package-remove.tssrc/hooks/message-hook-mappers.tssrc/claws/schema.tssrc/claws/export.tssrc/flows/doctor-core-checks.runtime.tssrc/system-agent/chat-turn-router.tssrc/system-agent/setup-inference-activate.tssrc/flows/doctor-health-contribution-runners.config.tssrc/plugin-state/plugin-state-store.tssrc/meeting-bot/realtime-engine.tssrc/system-agent/setup-apply.tssrc/claws/reader.tssrc/system-agent/setup-inference-core.tssrc/security/audit-extra.async.tssrc/flows/doctor-health-contributions.tssrc/tts/tts-synthesis-support.tssrc/claws/provenance.tssrc/security/install-policy.tssrc/plugin-state/plugin-blob-store.sqlite.tssrc/claws/update-apply.tssrc/security/audit-channel.tssrc/flows/channel-setup.status.tssrc/meeting-bot/browser-controller.tssrc/system-agent/tui-backend.tssrc/talk/agent-consult-runtime.tssrc/tts/tts-provider-resolution.tssrc/claws/lifecycle-delete-support.tssrc/flows/doctor-health.tssrc/system-agent/config-redaction.tssrc/media/media-facts.tssrc/worker/worker-connection.tssrc/plugin-state/plugin-state-store.sqlite.tssrc/security/audit-plugins-trust.tssrc/meeting-bot/runtime-facade.tssrc/claws/mcp.tssrc/claws/workspace.tssrc/flows/doctor-health-contributions-initial.tssrc/flows/doctor-tool-schema-runtime.tssrc/worker/embedded-agent.runtime.tssrc/media/input-files.tssrc/flows/doctor-health-contributions-final.tssrc/talk/realtime-session-harness.tssrc/claws/cron.tssrc/meeting-bot/transcripts-bridge.runtime.tssrc/security/fix.tssrc/system-agent/agent-turn.tssrc/security/audit-gateway-config.tssrc/system-agent/setup-inference-detect.tssrc/claws/project.tssrc/system-agent/inference-route.tssrc/plugin-state/plugin-state-store.kernel.tssrc/security/external-content.tssrc/meeting-bot/plugin-entry.tssrc/meeting-bot/session-transcript-store.tssrc/talk/audio-codec.tssrc/hooks/gmail-watcher.tssrc/talk/forced-consult-coordinator.tssrc/worker/inference-stream.runtime.tssrc/tts/openai-compatible-speech-provider.tssrc/security/audit.deep.runtime.tssrc/tts/tts-settings.tssrc/meeting-bot/platform-adapter.tssrc/talk/provider-types.tssrc/talk/realtime-session-lifecycle.tssrc/system-agent/hosted-setup.runtime.tssrc/talk/session-runtime.tssrc/claws/doctor.tssrc/meeting-bot/status-prejoin-source.tssrc/talk/agent-run-control-shared.tssrc/fleet/doctor.runtime.tssrc/system-agent/overview.tssrc/system-agent/setup-app-recommendations.tssrc/worker/launch-descriptor.tssrc/flows/bundled-health-checks.tssrc/talk/client-voice-mutation-digest-owner.tssrc/claws/provenance-runtime-read.tssrc/system-agent/plugin-artifact.tssrc/security/safe-regex.tssrc/shared/text/text-projection.tssrc/hooks/internal-hooks.tssrc/hooks/bundled/session-memory/handler.tssrc/talk/activation-name.tssrc/system-agent/rescue-message.tssrc/hooks/gmail-setup-utils.tssrc/security/audit-extra.summary.tssrc/worker/worker.runtime.tssrc/meeting-bot/realtime-agent-engine.tssrc/meeting-bot/realtime-local-audio-transport.tssrc/hooks/gmail-ops.tssrc/claws/types.tssrc/fleet/cell-profile.tssrc/shared/assistant-error-format.tssrc/transcripts/capture-summary.tssrc/claws/lifecycle-status.tssrc/worker/embedded-agent-live.runtime.tssrc/worker/node-workspace-protocol.tssrc/tts/directives.tssrc/hooks/gmail.tssrc/meeting-bot/realtime-engine-support.tssrc/system-agent/chat-engine.tssrc/meeting-bot/node-invoke-policy.tssrc/worker/worker-connection-frames.tssrc/meeting-bot/output-loopback-verifier.tssrc/talk/agent-consult-tool.tssrc/meeting-bot/runtime-facade-types.tssrc/worker/worker-command.runtime.tssrc/claws/application-plan.tssrc/tts/tts-payload.tssrc/talk/agent-run-control.tssrc/transcripts/store-sqlite.tssrc/claws/package-update.tssrc/meeting-bot/browser-session-control.tssrc/shared/pid-alive.tssrc/plugin-state/plugin-blob-store.tssrc/plugin-state/plugin-state-store.retention.tssrc/system-agent/assistant-prompts.tssrc/media/media-probe.tssrc/shared/config-eval.tssrc/media/media-reference.tssrc/meeting-bot/realtime-output-owner.tssrc/media/local-media-access.tssrc/tts/tts-synthesis.tssrc/shared/usage-aggregates.tssrc/claws/lifecycle-config-removal.tssrc/media/read-capability.tssrc/transcripts/store-sqlite-read.tssrc/meeting-bot/runtime-probes.tssrc/shared/device-bootstrap-profile.tssrc/meeting-bot/page-script-source.tssrc/media/store.read-scope.tssrc/meeting-bot/plugin-config.tssrc/shared/dot-path.tssrc/meeting-bot/browser-audio-capture-source.tssrc/worker/worker-rpc-live-event-client.tssrc/claws/mcp-update.tssrc/meeting-bot/agent-consult.tssrc/system-agent/assistant.tssrc/system-agent/system-agent.tssrc/plugin-state/plugin-state-worker-client.tssrc/fleet/registry.kernel.tssrc/talk/talk-session-controller.tssrc/hooks/update.tssrc/plugin-state/plugin-store-validation.tssrc/shared/store-writer-queue.tssrc/hooks/discovery.tssrc/meeting-bot/audio-backend.tssrc/talk/realtime-voice-lazy-lifecycle.tssrc/shared/tailscale-status.tssrc/system-agent/setup-inference-auth-options.tssrc/system-agent/setup-model-selection.tssrc/claws/openclaw-profile.tssrc/meeting-bot/plugin-shell.tssrc/security/dm-policy-shared.tssrc/worker/node-supervisor-protocol.tssrc/media/channel-inbound-roots.tssrc/system-agent/setup-inference-transition.tssrc/talk/agent-talkback-runtime.tssrc/worker/worker-connection-admission.tssrc/system-agent/setup-inference-credential-access.tssrc/flows/channel-setup.prompts.tssrc/flows/doctor-health-contribution-runners.state.tssrc/meeting-bot/session-durable-transcripts.tssrc/worker/transcript-message.tssrc/claws/project-build.tssrc/shared/text/tool-call-shaped-text.tssrc/meeting-bot/session-cleanup-tracker.tssrc/plugin-state/plugin-state-store.journal.tssrc/shared/worker-bundle-archive.tssrc/shared/async-work-scope.tssrc/transcripts/library.tssrc/talk/provider-internal.tssrc/tts/tts-streaming-resources.tssrc/shared/chat-message-content.tssrc/media/local-roots.tssrc/worker/worker-rpc-inference-client.tssrc/plugin-state/plugin-state-store.types.tssrc/claws/cron-update.tssrc/meeting-bot/realtime-node-audio-transport.tssrc/talk/turn-context-tracker.tssrc/tts/voice-models.tssrc/tts/tts-core.tssrc/fleet/registry.tssrc/transcripts/status.tssrc/transcripts/store-sqlite-write.tssrc/media/audio-transcode.tssrc/tts/tts-config.tssrc/talk/client-voice-session-store.tssrc/system-agent/inference-fallback.tssrc/transcripts/summary-model.tssrc/transcripts/provider-types.ts