Skip to content

refactor: consolidate duplicate HTTP, voice, and catalog adapters - #169756

Merged
steipete merged 3 commits into
mainfrom
deslop/w12-dup-clusters-20261011
Oct 12, 2026
Merged

steipete merged 3 commits into
mainfrom
deslop/w12-dup-clusters-20261011

Conversation

@steipete

@steipete steipete commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Maintainer-requested duplicate-code consolidation gives HTTP, realtime voice, and catalog adapters shared execution owners instead of parallel implementations that can drift.

Continues #169499 after its below-threshold closeout. GitHub refused to reopen that PR after the rebased branch update; this continuation contains only the remaining work and new approved-scope consolidations.

User Impact

Existing HTTP, voice, catalog, and media behavior stays intact. Successful MCP configuration retries no longer return stale failure text after the stored error has been cleared. No configuration, protocol, database schema, retention, permission, or dependency change is required.

Why This Change Was Made

The adapters now share OpenAI-compatible HTTP execution, OpenAI/xAI WebSocket transport, provider-selection preparation, UI set-request lifecycle, hosted-media request parsing, and bounded JSONL activity scanning. Vendor authentication, wire messages, transcript classification, stream-flush differences, resource bounds, and authorization remain with their existing owners. The retained branch also contains ACP catalog-adoption and TLS-preflight consolidation.

Net production reduction: 681 lines (+1,839/−2,520), excluding tests, fixtures, generated files, declaration files, documentation, and baseline maintenance. This uses the campaign's 500–999-line exception after the extended implementation pass; the coverage log below records rejected clusters. The former icon/usage-rendering changes are absent because #169367 already landed them.

Best-effort tradeoffs accepted

  • Removed duplicate per-upload cleanup-promise memoization in SMS and Synology Chat. The hosted store already serializes deletion and treats repeated deletion of an absent upload as a no-op; repeat cleanup now calls that owner directly. The wrappers originated with feat(sms): add Twilio MMS support #118664 and fix(synology-chat): deliver attachments without forwarding source URLs [AI] #119941, not an established human-reported failure. Vendor limits, reader retention, capability revocation, and retry-after-failure remain intact.
  • No security-effect check, common crash/restart durability, public contract, or realistic concurrency protection was removed. Other changes consolidate existing policy rather than relax it.

Evidence

  • 684 focused cases passed across HTTP wire/continuity/cancellation, provider selection, realtime connection/reconnect/terminal results, optional capture, hosted-media security/capacity, JSONL activity, UI acknowledgement/retry, and MCP suites. The MCP regression failed on the original returned/stored error mismatch and passed after the producer fix.
  • The new MCP regression took 4.210 seconds in its green run. The complete 13-case MCP file took 101.69 seconds including transforms; its wrapper took 298.83 seconds including 166.245 seconds of compiled-worker preparation. Exact-head CI completed its selected suites; the new case's CI seconds were not separately isolated.
  • Independent full-candidate review and fresh four-file follow-up review: no actionable P0–P2 findings. The follow-up review used the repaired configured transport and confirmed unchanged image validation, limits, abort and authority checks.
  • Eleven targeted image/media/upload HTTP cases passed after extraction; the filter intentionally left 121 other cases unselected. Formatting and all three lint-suppression tests passed on the final source (36.32-second suppression wrapper).
  • Production core/UI/extension types and focused type-aware lint passed, including the final Gateway extraction and extension import correction. Native SDK API comparison found no Plugin SDK API changes (digest ff7b090f); the follow-up only relocates private Gateway image handling and fixes import/shorthand lint. Final-head checks found zero runtime value cycles and zero Madge cycles.
  • Local changed checks passed the applicable boundary/ratchet/format guards. The full local invocation is not claimed green: its broad serial fixture-type sweep was deliberately stopped after 40 minutes under the CI-first proof rule. Remaining broad fixture types, legacy-store/media/sidecar/webhook/pairing repository scans, and full build are deferred to exact-head PR CI. The final native schema-version guard passed; the legacy-store scan was interrupted without a diagnostic. Dead-export scans also reported untouched UI component/page exports; this has not yet been qualified as a current-main failure. No finding named changed files, and no baseline was weakened.
  • All local runtime/test commands used task-owned HOME, OpenClaw state/config, and XDG directories. No operator Gateway was restarted. No visual appearance changed.
  • Reviewed source head: 93fac510284f12c5a52f459bbbcf1691434d358d. Merged as 2fc20b367b69df1c9dc52c88d85f100f8f203ef9, verified reachable on main with an exact reconstructed merge-tree match. Hosted run 38223234952 completed with 67 successful jobs, 20 inapplicable skips, and only the inherited inventory failure plus its aggregate gate failure. The documented campaign admin exception was used; CI is not claimed fully green.
  • Hosted run 38223234952: checks-node-compact-small-3 failed only the suppression inventory case because untouched scripts/lib/managed-cleanup-handoff.mts adds an unlisted Bun connect({ fd }) type suppression. The exact case reproduced on fresh main 2b4c2a10bb419014419482a8c44e3d2925b83310 (51.29-second wrapper; 19 entries versus 18 expected). The source, inventory owner, and test are byte-identical between CI parent 14b24b111abe2cafefb5c5fc5a94b0d8a1924887, tested merge e6a4942a7b7393495d8a271072c69bc757fc9286, and that fresh main. This is a qualified inherited failure for the campaign's admin exception, subject to attribution of every remaining failed check. No inventory entry or suppression was added here.
  • Full attribution: refactor: consolidate duplicate HTTP, voice, and catalog adapters #169756 (comment) . Main fixed the inventory mismatch with 64f11ced232c7dfe0fe262767f707f90597abff3 during the run; the merge retains that correction. All 240 exact-head check runs were enumerated before landing, including canceled ancillary automation with successful same-head successors. No product suite was canceled.
Duplicate-cluster coverage and retained distinctions

Exact-token and normalized structural scans covered the coordinator-approved production scope, followed by an SDK-only plugin scan. Tests, fixtures, generated declarations, other live-lane areas, audit, changelog and PR tooling were excluded from implementation scope.

Cluster Decision
Chat/Responses HTTP execution Shared preparation, JSON and SSE execution; preserve protocol encoding, different flush schedules, continuity persistence and cancellation.
OpenAI/xAI realtime bridges Shared socket/connect/retry/capture owner; preserve provider auth, parsing, replay, startup caps and audio backpressure.
Capability/Talk provider selection Shared candidate/config/error preparation; preserve separate synchronous and asynchronous callback execution.
Viewer presence/PR subscriptions Existing set-sync owner absorbs request identity/abort/retry; preserve final-clear acknowledgement and forced-refresh intent.
SMS/Synology hosted media Reuse canonical media-access normalization and shared request parsing; retain vendor security/resource controls.
Pi/Claude upstream activity Shared bounded file scan; retain provider row, timestamp, invalid-row and marker semantics.
CLI registrations and media commands Existing parameterized owners already cover the executable duplication; remaining import/data similarities do not justify a new abstraction.
UI/TUI controllers and CSS Different update-completion, authorization and queue semantics; scattered CSS similarities would add cascade coupling.
Config reload and managed secrets One reload scheduler already exists; secret activation/rollback is a distinct owner, not a duplicate scheduler.
Claw reference CRUD Different reconciliation/ownership and rollback semantics; no generic persistence factory. Fixed the directly observed stale MCP return-value defect instead.
Protocol validator/type lists Explicit public wire declarations, not removable duplicate runtime policy.

Provenance inspected includes #167775 and #115652 (HTTP/flush behavior), #117865 and #122414 (realtime lifecycle/bridge split), #169111 (async provider-selection counterpart), and #167925/#168656 (UI lifecycle/refresh bookkeeping). This is a structural cutover; no speculative race removal is claimed for those families.

Share HTTP execution, realtime WebSocket transport, provider selection, catalog activity, hosted media, and UI request lifecycle while retaining adapter-specific contracts. Clear stale returned MCP errors after successful configuration retries to match persisted state.
@clawsweeper

clawsweeper Bot commented Oct 12, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

ClawSweeper review in progress

ClawSweeper is reviewing this revision. This supersedes any previous blocked status.

View the workflow run.

@steipete

Copy link
Copy Markdown
Contributor Author

Campaign inherited-failure landing evidence for exact head 93fac510284f12c5a52f459bbbcf1691434d358d.

Enumerated all 240 check runs with the paginated commits/check-runs API immediately before landing. Every product build/test/type/lint/security check completed; no product suite was canceled. There are exactly two failed jobs:

Job Attribution
checks-node-compact-small-3, 114724790359 Only failed case: test/scripts/type-suppression-inventory.test.ts / keeps unchecked any casts at zero and negative type assertions explicit. Untouched scripts/lib/managed-cleanup-handoff.mts adds an unlisted Bun cleanup-socket suppression. Reproduced the exact 19-versus-18 assertion on then-current main 2b4c2a10bb419014419482a8c44e3d2925b83310, using the unchanged repository test wrapper in isolated state (51.29 seconds; other three cases unselected). The cleanup source, inventory implementation, and test are byte-identical across tested baseline 14b24b111abe2cafefb5c5fc5a94b0d8a1924887, CI merge e6a4942a7b7393495d8a271072c69bc757fc9286, and that main. None is changed by this PR.
openclaw/ci-gate, 114727041995 Aggregate-only failure. Its log names checks-node-core-test-nondist-shard: failure as the sole selected failing category; all other selected categories succeeded. The sole failing member is the inventory job above.

Main was corrected during this run by 64f11ced232c7dfe0fe262767f707f90597abff3 (test(tooling): inventory the Bun cleanup-socket suppression). That correction is already present on current main fdbe95f5d1d68c160d8d281560b7ea43894bf00d and will be retained by the merge. No branch refresh, rerun, or new CI dispatch was performed to obtain green.

Canceled ancillary jobs are not claimed as passing test proof. They only run PR metadata/comment automation; the inspected workflows contain no product test/build suite. Their missing metadata coverage has successful exact-head successors:

  • Auto-response jobs 114724499292, 114724498055, 114724497743, 114724497682, 114724496777, 114724495493, 114724493408, 114724493367, and 114724492747: superseded by successful auto-response 114726947682 on this exact head.
  • PR-context job 114724222916: superseded by successful PR context and evidence 114726947260 on this exact head.

Security-sensitive review and dependency review both succeeded. Independent full-candidate and final follow-up reviews found no actionable P0–P2 issue. Local final-source production types, focused lint/tests, suppression checks, runtime cycles (0), Madge (0), and SDK API comparison passed; the PR body retains the broader local-proof gaps. Net production reduction is 681 lines, under the campaign's documented 500–999-line exception after the extended implementation pass.

Using Peter's standing inherited-only-red admin exception, pinned to the exact reviewed head. This is not a claim that CI was fully green.

@steipete
steipete merged commit 2fc20b3 into main Oct 12, 2026
230 of 243 checks passed
@steipete
steipete deleted the deslop/w12-dup-clusters-20261011 branch October 12, 2026 08:33
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 13, 2026
…enclaw#169756)

* refactor: consolidate duplicated icons and provider helpers

* refactor: consolidate HTTP and provider runtime owners

Share HTTP execution, realtime WebSocket transport, provider selection, catalog activity, hosted media, and UI request lifecycle while retaining adapter-specific contracts. Clear stale returned MCP errors after successful configuration retries to match persisted state.

* refactor(gateway): isolate chat image input handling
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant