Skip to content

refactor: fold duplicated helpers onto canonical owners - #159409

Merged
steipete merged 10 commits into
mainfrom
deslop/l100-clone-census
Sep 27, 2026
Merged

steipete merged 10 commits into
mainfrom
deslop/l100-clone-census

Conversation

@steipete

@steipete steipete commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Runtime adapters and public type declarations repeat logic already owned elsewhere, making equivalent paths harder to keep consistent.

User Impact

No intended user-visible change. The candidate removes 1,020 net production lines while preserving public Plugin SDK names, package export maps, configuration, CLI behavior, Gateway protocol, persisted data, dynamic entry points, and callback timing. No migration or operator action is required.

Why This Change Was Made

This combines bounded folds onto existing owners:

  • Reuse transport completion/error handling and host-policy ports; remove private forwarding layers.
  • Share Markdown list-item projection while preserving coordinate calculations, serialized property order, and hidden metadata descriptors.
  • Share worker JSON traversal checks while retaining validation messages, depth bounds, and schema construction.
  • Derive OAuth, provider-model, generated-attachment, install, and namespace types from their owners. Keep public interfaces and the const-generic schema boundary where their type semantics matter.
  • Reuse channel send, setup, mention, conversation-binding, and elevated-permission contracts while preserving optionality and readonly fields. Keep provider registration types in a leaf to avoid a registry/extension import cycle.
  • Reuse the existing browser SDK resolved-config type while retaining the browser plugin's raw profiles, relay fields, and headless provenance.
  • Derive plugin-command metadata and legacy execution parameters from their canonical contracts. The legacy overload remains mutable and deliberately excludes runtimeContext.
  • Share Gateway/Control UI approval-review normalization and worker-slot parsing; reuse the existing session-navigation owner.
  • Move identical MCP denial normalization to its configuration owner; retain the CLI's different sorting contract.
  • Share shell-wrapper extraction and channel ordering. Simplify eligibility checks and role-list normalization while preserving evaluation order, fallback behavior, and each caller's empty-array contract.
  • Reuse lightweight zero-usage and deferred constructors while retaining allocation conditions, release points, and existing await/cleanup chains.
  • Share cron worker logging in the existing mutation owner and derive the task-flow patch shape from its record contract.
  • Consolidate Discord send/upload dispatch and role lookup, retaining permission-check scheduling; reuse the existing local TTS PCM converter.
  • Share Workboard execution wrappers while keeping literal operation calls, the original operation table, write flags, and optional-argument wrappers. Track committed mutations through the existing runtime owner.
  • Remove decorative separators and comments that merely repeat the surrounding code; retain API constraints, ownership, lifecycle, ordering, and security explanations.

Fixes found along the way

The census reproduced the legacy Workboard attachment: null Doctor crash. Its fix and regression landed in #158847 and are retained unchanged from main. CI also caught the shared node parser missing from the trusted PR wrapper extraction inventory; the inventory now includes that runtime dependency, and the existing extracted-wrapper tests cover the correction.

Evidence

READY-TO-LAND, intentionally unmerged with auto-merge off. Candidate 8249d759183cab1db46da03e2979b003e985f34f, tree 9c658c0e50eca15c00bd8e31f3d4e88f43fb113e, based on c991b6bf8f1ba5ab76b8bc15bdbda6e17e520cf9.

Exact-head CI passed, including the CI gate, dependency review, and security review. Independent reviews cover the folds, type repairs, wrapper inventory correction, and final narration cleanup; no accepted actionable findings remain.

Final remote proof used Blacksmith Testbox (blacksmith-testbox), lease tbx_01m3hmfk63w0qkxjz47pfmhq3c, prepared run. The wrapper verified the source tree before execution. The combined command completed with zero failures; the lease is stopped. External lease cleanup can mark the prepared Actions run cancelled; the wrapper command result is the proof outcome.

Command / selection Result
node scripts/check-changed.mjs --base <pinned-base> --head HEAD Passed: all type graphs, lint, format, dead-export, and contract guards
pnpm check:madge-import-cycles Passed, zero cycles
pnpm build Passed
pnpm plugin-sdk:check-exports and pnpm plugin-sdk:api:diff Passed; zero entrypoint or export additions/removals
pnpm protocol:check Passed; generated Swift/Kotlin protocol files unchanged
pnpm test test/scripts/eager-import-closure.test.ts --maxWorkers=1 16 passed; 18.32 seconds wall
node scripts/run-vitest.mjs cross-shard core selection 102 files / 2,256 tests passed
Same wrapper, package selection 21 files / 540 tests passed
Same wrapper, import-boundary selection including fs-safe and siblings 18 files / 74 tests passed
pnpm test:extensions:batch browser,discord,tts-local-cli,workboard 606 files / 8,770 tests passed
Same Vitest wrapper, UI/browser navigation selection 7 files / 200 tests passed
pnpm test:docker:published-upgrade-survivor Passed: [email protected] published driver × candidate tarball, legacy-operator-state, auto-auth restart
npx --no-install jscpd matched before/after scan Passed; report below

The selected Vitest runs total 11,856 passing executions across 755 files, including the existing wrapper regression suite. This PR does not change test files, assertions, retry policies, or skip rules.

The published-driver receipt reports successful update and automatic restart by the baseline updater. State survival, Gateway probes/status, agent/plugin operation, no-op update behavior, and backup/rollback with raw transcript restoration passed. Its initial post-core exit snapshot is unavailable, so that intermediate outcome remains unknown; final acceptance and rollback evidence are recorded separately.

The ordinary Testbox build emitted a startup-JavaScript advisory (371,432 B against 371,332 B). The controlled exact-head CI performance comparison passed both budgets: startup 371,208 B / 371,332 B and largest ordinary JS 214.8 KiB / 215.0 KiB. No budget or baseline was raised. Earlier inherited type/line-cap failures are absent from the final gates.

SDK declaration text changes reflect canonical type reuse, preserving modifiers and optionality. Public entrypoints, package export maps, configuration, CLI/protocol surface, and Workboard table/SQL/migration definitions remain unchanged by this PR.

Clone census

Full before/after census, ranked production clusters, and owner decisions.

Metric Before After Reduction
Clone matches 779 745 34
Duplicated lines 8,561 8,129 432
Duplicated tokens 57,641 54,999 2,642

jscpd 5.3.0 ran through npx --no-install, minimum 60 tokens / 5 lines, over src, extensions, packages, and ui/src. Both trees use the same exclusion filters. Two residual test-support matches are excluded from the production rankings; aggregate values above preserve the raw scanner summary. The report was posted directly to the PR after the artifact broker failed to return an upload receipt.

@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review complete

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

View the workflow run.

@steipete
steipete marked this pull request as ready for review September 27, 2026 04:16
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Sep 27, 2026
@clawsweeper

clawsweeper Bot commented Sep 27, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: blocked before merge. Reviewed September 27, 2026, 10:46 AM ET / 14:46 UTC (Revision 9).

ClawSweeper review

What this changes

The branch consolidates duplicated types and runtime helpers across provider transports, plugins, channels, agent and Gateway lifecycles, Workboard, and the Control UI without intending to change user-visible behavior.

Warning

SQLite table change

This PR modifies persisted SQLite tables in extensions/workboard/src/sqlite-store.ts. Prefer a design that avoids changing persisted SQLite tables. If the change is necessary, verify migration and upgrade compatibility against an existing database before merge.

Merge readiness

⛔ Blocked before merge - 6 items remain

This remains a substantive change absent from current main. I found no definite introduced defect, but final-head upgrade compatibility is not yet established.

Priority: P2
Reviewed head: 8249d759183cab1db46da03e2979b003e985f34f

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The consolidation has useful validation and no confirmed patch defect, while final-head upgrade compatibility remains unresolved.
Proof confidence 🌊 off-meta tidepool Not applicable: The Repository State identifies a MEMBER-authored internal refactor, so the external-contributor real-setup gate does not apply. Earlier Testbox build and API comparisons are supplemental; final-head shipped-plugin and updater results remain merge risks. The Workboard wrapper changes do not alter a stored-data contract.
Patch quality 🦐 gold shrimp (3/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The Repository State identifies a MEMBER-authored internal refactor, so the external-contributor real-setup gate does not apply. Earlier Testbox build and API comparisons are supplemental; final-head shipped-plugin and updater results remain merge risks. The Workboard wrapper changes do not alter a stored-data contract.
Evidence reviewed 12 items Introduced public type derivation: The PR derives ChannelPlugin from the setup contract while retaining an account-specific config field.
Plugin SDK reachability: ChannelPlugin is exported through the Plugin SDK, so its emitted declaration reaches plugin consumers.
Documented plugin compatibility practice: The SDK guide tells plugin authors to pin OpenClaw and test each host version they claim to support.
Findings None None.
Security None None.

How this fits together

Plugin settings, provider responses, and agent events pass through shared contracts and runtime helpers. Those helpers feed Gateway and channel delivery, stored activity, and the Control UI.

flowchart LR
A[Plugin settings] --> B[Shared contracts]
C[Provider responses] --> D[Runtime helpers]
B --> D
D --> E[Gateway and channels]
E --> F[Stored activity]
F --> G[Control UI]
Loading

Before merge

  • Resolve merge risk (P1) - Derived declarations reach the public Plugin SDK, but the captured final-head evidence does not establish that representative plugins pinned to v2026.9.6 still compile and load after upgrade.
  • Resolve merge risk (P1) - The PR body still describes the final published-updater × candidate restart validation as running, leaving the touched Gateway startup and plugin lifecycle path without its final-head upgrade result.
  • Complete next step (P2) - Record final-head Plugin SDK declaration and v2026.9.6-pinned plugin compile/load results, then complete the published-updater × candidate restart cell.
  • Resolve review confidence - ClawSweeper must reach high confidence before merge readiness is known.
  • Review config compatibility - Confirm compatibility and upgrade impact for the changed config or default surface before merge.
  • Add data-model compatibility proof - Confirm migration or upgrade compatibility proof before merge.
Agent review details

Security

None.

PR surface

PR surface statistics unavailable: the file list is incomplete.

Review metrics

None.

Stored data model

Persistent data-model change detected: unknown-data-model-change: extensions/workboard/src/sqlite-store.ts, unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Merge-risk options

Maintainer options:

  1. Verify the shipped upgrade (recommended)
    Compare final-head emitted SDK declarations with v2026.9.6, compile and load representative version-pinned plugins, and record the published-updater restart result before merge.

Technical review

Best possible solution:

Keep the canonical helper ownership once final-head checks demonstrate compatible emitted plugin declarations and a successful upgrade and restart with existing state.

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

Not applicable: this PR proposes a behavior-preserving refactor rather than reporting a current-main bug.

Is this the best way to solve the issue?

Unclear: folding duplicates onto existing owners fits the repository design, but final-head upgrade checks must establish the claimed compatibility.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 6786cc7c7e30.

Labels

Label changes:

No label changes.

Label justifications:

  • P2: This is useful internal cleanup with a bounded upgrade-compatibility question.
  • merge-risk: 🚨 compatibility: Public Plugin SDK declarations and Gateway lifecycle code change while shipped-plugin and published-updater results remain pending.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🌊 off-meta tidepool and patch quality is 🦐 gold shrimp.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: The Repository State identifies a MEMBER-authored internal refactor, so the external-contributor real-setup gate does not apply. Earlier Testbox build and API comparisons are supplemental; final-head shipped-plugin and updater results remain merge risks. The Workboard wrapper 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)
  • Shakker: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • Ayaan Zaidi: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

Rank-up moves

Optional improvements that raise the rating; they are not merge blockers.

  • Compare final-head emitted SDK declarations with v2026.9.6 and compile and load representative version-pinned plugins.
  • Record the published v2026.9.6 updater × final-head candidate restart result.

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 2026-09-27T04:24:56.083Z sha 85aeaea2d2b95bc8b1ad0ca8073a4676e864fd28 :: blocked before merge. :: none
  • reviewed September 27, 2026, 1:55 AM ET / 05:55 UTC (Revision 2) sha unknown :: blocked before merge. :: none
  • reviewed 2026-09-27T09:43:53.267Z sha 33804be :: blocked before merge. :: none
  • reviewed 2026-09-27T10:27:52.034Z sha 33804be :: blocked before merge. :: none
  • reviewed 2026-09-27T11:26:03.757Z sha 33804be :: blocked before merge. :: none
  • reviewed 2026-09-27T12:00:56.876Z sha 1738f8d :: blocked before merge. :: none
  • reviewed 2026-09-27T12:17:22.866Z sha 12340bc :: blocked before merge. :: none
  • reviewed 2026-09-27T14:36:47.624Z sha 8249d75 :: blocked before merge. :: none

@steipete
steipete force-pushed the deslop/l100-clone-census branch 2 times, most recently from b1fa680 to 33804be Compare September 27, 2026 09:36
@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 27, 2026
@openclaw-barnacle openclaw-barnacle Bot reopened this Sep 27, 2026
@steipete
steipete force-pushed the deslop/l100-clone-census branch 2 times, most recently from 1738f8d to 12340bc Compare September 27, 2026 12:10
Reuse existing transport, message, usage, deferred, schema, and store owners while preserving public surfaces and ordering. Workboard Doctor now skips null legacy attachments with the existing warning path instead of interrupting valid sibling migration. Independent review completed; both reported findings were disproved by the existing string and rendering owners. Remote validation follows on the rebased candidate.
Reuse the existing deferred constructor for desktop audio and invoke the queue owner directly without a forwarding method. Keep the null-attachment repair and regression with the already-open Workboard maintainer PR #158847 instead of duplicating it.
Keep Workboard method names correlated with their argument tuples through the existing operation contract. Remove redundant host-owned header selectors and an unnecessary narrowed-object assertion. Shrink only the assertion baseline entries removed by the refactor.
@steipete
steipete force-pushed the deslop/l100-clone-census branch from 12340bc to 8249d75 Compare September 27, 2026 14:28
@openclaw-barnacle openclaw-barnacle Bot added the scripts Repository scripts label Sep 27, 2026
@steipete

Copy link
Copy Markdown
Contributor Author

Clone census: canonical helper folds

Base commit: c991b6bf8f1ba5ab76b8bc15bdbda6e17e520cf9. Candidate commit: 8249d759183cab1db46da03e2979b003e985f34f. Verified candidate tree: 9c658c0e50eca15c00bd8e31f3d4e88f43fb113e.

Blacksmith Testbox; jscpd 5.3.0 through npx --no-install; minimum 60 tokens and 5 lines, maximum 10,000 lines. Same tool and options for both trees.

Scope: src/**, extensions/**, packages/**, ui/src/**. Test/spec/cases/suite files, named test/live/e2e helpers, test directories, fixtures, declarations, bundles, assets, dependencies, and build output excluded by the census command. Additional test-support fragments excluded from the production rankings below.

Metric Before After Change
Clone matches 779 745 -34
Duplicated lines 8,561 8,129 -432
Duplicated tokens 57,641 54,999 -2,642

The table above preserves the raw jscpd summary. The rankings exclude residual test-support matches whose nonstandard names evade the scanner globs. No test cluster is selected for cleanup.

Rankings group identical reported fragments and count redundant lines as fragment lines times (distinct locations minus one). Overlapping windows are not merged. These cluster scores are for prioritization and are separate from jscpd's aggregate metrics. Production reduction is measured separately with Git.

Before: largest production clusters

2 residual test-support matches excluded from ranking.

Rank Redundant lines Fragment lines Locations
1 39 39 extensions/openai/openai-chatgpt-oauth-preflight.runtime.ts:6-44
src/plugins/provider-openai-chatgpt-oauth-tls.ts:13-53
2 36 36 ui/src/pages/chat/components/chat-composer-view.ts:109-144
ui/src/pages/chat/components/chat-composer.ts:688-723
3 33 11 extensions/clickclack/src/ws-runtime.ts:1-11
extensions/discord/src/internal/ws-runtime.ts:1-11
extensions/signal/src/ws-runtime.ts:1-11
extensions/xai/ws-runtime.ts:1-11
4 31 31 extensions/anthropic/cli-constants.ts:35-65
src/node-host/invoke-agent-cli-claude-params.ts:77-107
5 30 30 extensions/google/model-id.ts:11-40
packages/model-catalog-core/src/provider-model-id-normalize.ts:7-34
6 29 29 extensions/telegram/src/command-ui.ts:11-39
src/plugin-sdk/telegram-command-ui.ts:5-33
7 28 28 packages/llm-core/src/types.ts:641-668
packages/model-catalog-core/src/model-catalog-types.ts:78-92
8 28 14 extensions/groq/index.ts:107-120
extensions/opencode-go/stream-termination.ts:75-88
packages/ai/src/providers/register-builtins.ts:40-53
9 28 14 src/image-generation/runtime.ts:74-87
src/music-generation/runtime.ts:63-76
src/video-generation/runtime.ts:131-144
10 27 27 src/agents/sessions/extensions/types.ts:89-115
src/plugin-sdk/provider-oauth-runtime.ts:49-90
11 26 26 extensions/diagnostics-otel/src/service-trace-context.ts:13-38
src/logging/logger.ts:174-199
12 26 26 extensions/onepassword/onepassword-secret-ref-resolver.js:17-42
extensions/vault/vault-secret-ref-resolver.js:13-38
13 26 26 src/agents/subagents/spawn/subagent-spawn-request.ts:333-358
src/agents/subagents/spawn/subagent-spawn.ts:80-105
14 26 26 src/plugins/commands.ts:40-65
src/plugins/plugin-command-runtime.ts:31-55
15 26 13 src/gateway/server-methods/sessions-sharing.ts:339-351
src/gateway/server-methods/sessions-sharing.ts:469-481
src/gateway/server-methods/sessions-sharing.ts:630-642
16 25 25 extensions/acpx/src/pi-session-upstream-activity.ts:86-110
extensions/anthropic/session-upstream-activity.ts:84-108
17 25 25 extensions/discord/src/send.permissions.ts:174-198
extensions/discord/src/send.permissions.ts:222-246
18 25 25 extensions/discord/src/setup-surface.ts:69-93
extensions/slack/src/setup-surface.ts:62-86
19 24 8 extensions/matrix/src/cli-devices.ts:33-40
extensions/matrix/src/cli-devices.ts:51-58
extensions/matrix/src/cli-verification-backup.ts:10-17
extensions/matrix/src/cli-verification.ts:221-228
20 23 23 extensions/diffs-language-pack/src/plugin.ts:57-79
extensions/diffs/src/http.ts:180-202

After: largest production clusters

2 residual test-support matches excluded from ranking.

Rank Redundant lines Fragment lines Locations
1 39 39 extensions/openai/openai-chatgpt-oauth-preflight.runtime.ts:6-44
src/plugins/provider-openai-chatgpt-oauth-tls.ts:13-53
2 36 36 ui/src/pages/chat/components/chat-composer-view.ts:109-144
ui/src/pages/chat/components/chat-composer.ts:688-723
3 33 11 extensions/clickclack/src/ws-runtime.ts:1-11
extensions/discord/src/internal/ws-runtime.ts:1-11
extensions/signal/src/ws-runtime.ts:1-11
extensions/xai/ws-runtime.ts:1-11
4 31 31 extensions/anthropic/cli-constants.ts:35-65
src/node-host/invoke-agent-cli-claude-params.ts:77-107
5 30 30 extensions/google/model-id.ts:11-40
packages/model-catalog-core/src/provider-model-id-normalize.ts:7-34
6 29 29 extensions/telegram/src/command-ui.ts:11-39
src/plugin-sdk/telegram-command-ui.ts:5-33
7 28 28 packages/llm-core/src/types.ts:641-668
packages/model-catalog-core/src/model-catalog-types.ts:78-92
8 28 14 extensions/groq/index.ts:107-120
extensions/opencode-go/stream-termination.ts:75-88
packages/ai/src/providers/register-builtins.ts:40-53
9 28 14 src/image-generation/runtime.ts:74-87
src/music-generation/runtime.ts:63-76
src/video-generation/runtime.ts:131-144
10 26 26 extensions/diagnostics-otel/src/service-trace-context.ts:13-38
src/logging/logger.ts:174-199
11 26 26 extensions/onepassword/onepassword-secret-ref-resolver.js:17-42
extensions/vault/vault-secret-ref-resolver.js:13-38
12 26 26 src/agents/subagents/spawn/subagent-spawn-request.ts:333-358
src/agents/subagents/spawn/subagent-spawn.ts:80-105
13 26 13 src/gateway/server-methods/sessions-sharing.ts:339-351
src/gateway/server-methods/sessions-sharing.ts:469-481
src/gateway/server-methods/sessions-sharing.ts:630-642
14 25 25 extensions/acpx/src/pi-session-upstream-activity.ts:86-110
extensions/anthropic/session-upstream-activity.ts:84-108
15 25 25 extensions/discord/src/send.permissions.ts:172-196
extensions/discord/src/send.permissions.ts:220-244
16 25 25 extensions/discord/src/setup-surface.ts:69-93
extensions/slack/src/setup-surface.ts:62-86
17 24 8 extensions/matrix/src/cli-devices.ts:33-40
extensions/matrix/src/cli-devices.ts:51-58
extensions/matrix/src/cli-verification-backup.ts:10-17
extensions/matrix/src/cli-verification.ts:221-228
18 23 23 extensions/diffs-language-pack/src/plugin.ts:57-79
extensions/diffs/src/http.ts:180-202
19 23 23 packages/markdown-core/src/chunk-text.ts:20-42
src/auto-reply/chunk.ts:572-592
20 23 23 src/infra/device-auth-store.kernel.ts:112-134
src/infra/device-auth-store.kernel.ts:179-199

Owner decisions

The PR removes 1,020 net lines from production files (892 added, 1,912 removed). Literal clone reduction captures part of that change; type reuse, forwarding-layer removal, deferred construction, and redundant comment cleanup account for the rest.

  • OAuth declarations, plugin-command parameters, browser configuration, channel callback shapes, and generated-attachment types reuse their existing owners. Legacy command parameters retain mutability and exclude runtimeContext; browser profiles and relay fields remain plugin-owned.
  • Transport completion/error paths, Markdown metadata projection, worker JSON validation, Workboard execution wrappers, and deferred construction share canonical implementations while retaining their existing ordering and optional-argument contracts.
  • The largest TLS preflight match stays separate: the plugin has cancellation and current-authority checks absent from the core preflight, and no existing lightweight SDK operation exposes the complete shared path.
  • The composer match connects the named argument handoff to its matching destructure, preserving the existing snapshot of values.
  • Google model normalization stays local to the plugin because the existing SDK export loads the broader provider replay/runtime barrel. The fold must preserve that loading boundary.
  • HTTP completion handlers retain different scheduling and recovery contracts: Chat Completions uses queueMicrotask, while Responses uses setImmediate.
  • Routing interfaces retain their own members for public module augmentation. Private JSON Schema keyword sets retain their distinct validation boundaries.

Run identity

Provider: blacksmith-testbox. Lease: tbx_01m3hmfk63w0qkxjz47pfmhq3c.

Prepared Testbox run. The wrapper verified the candidate commit and tree above before executing the checks. Both census trees used jscpd 5.3.0 with the same options; the base was materialized with git archive.

@steipete
steipete merged commit 22221e8 into main Sep 27, 2026
264 checks passed
@steipete
steipete deleted the deslop/l100-clone-census branch September 27, 2026 16:24
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Sep 28, 2026
)

* refactor: fold duplicated helpers onto canonical owners

Reuse existing transport, message, usage, deferred, schema, and store owners while preserving public surfaces and ordering. Workboard Doctor now skips null legacy attachments with the existing warning path instead of interrupting valid sibling migration. Independent review completed; both reported findings were disproved by the existing string and rendering owners. Remote validation follows on the rebased candidate.

* refactor: finish deferred cleanup and defer owned Workboard fix

Reuse the existing deferred constructor for desktop audio and invoke the queue owner directly without a forwarding method. Keep the null-attachment repair and regression with the already-open Workboard maintainer PR openclaw#158847 instead of duplicating it.

* fix: preserve typed operation bindings through canonical helper folds

Keep Workboard method names correlated with their argument tuples through the existing operation contract. Remove redundant host-owned header selectors and an unnecessary narrowed-object assertion. Shrink only the assertion baseline entries removed by the refactor.

* refactor: reuse deferred owner for response and route lifecycles

* refactor: repair type ownership and finish canonical helper folds

* refactor: preserve lint contracts in helper consolidation

* refactor: reuse existing browser and plugin command contracts

* refactor: share deferred lifecycle construction

* fix: include shared node parser in wrapper extraction

* refactor: finish session and plugin cleanup

Remove redundant module and code narration while retaining contract and lifecycle guidance. Keep the single tool-result details declaration from main after the overlapping type fold.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling app: web-ui App: web-ui channel: discord Channel integration: discord extensions: browser extensions: tts-local-cli gateway Gateway runtime merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. plugin: workboard rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts 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