Skip to content

refactor: consolidate single-consumer internal surfaces - #180641

Merged
steipete merged 26 commits into
mainfrom
deslop/z25-97-internal-surface-20261015
Oct 22, 2026
Merged

steipete merged 26 commits into
mainfrom
deslop/z25-97-internal-surface-20261015

Conversation

@steipete

@steipete steipete commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Internal helpers and re-export modules expose APIs used by only one production caller, spreading a single responsibility across unnecessary boundaries.

User Impact

No user-visible change. Public CLI, configuration, protocol, Plugin SDK, and package entry points stay intact. Lazy-import boundaries, authorization, durable state, and normal concurrent behavior are preserved; no migration or operator action is required.

Why This Change Was Made

Fold private single-call preparation and presentation into their existing owners, remove the internal Workboard barrel, and absorb the Twitch action/status leaves into their sole plugin owner. Tests that imported those leaves now exercise existing public plugin operations with their assertions retained.

The narrowed cut removes 427 net production lines across 52 production paths (63 paths overall), measured against f5388585ceb2fe2737bece066e86ef3bbd1f2907, excluding tests, fixtures, test support, generated files, and declarations. Relocated algorithm bodies are not counted as deleted behavior. Phase E session memory is untouched. The original cut met the 500-line floor; campaign rule 8 removed only the paths reachable from inconclusive CI failures, preserving the other cleanup.

Best-effort tradeoffs accepted

No protective guard is removed. Private async-return hops disappear when their sole caller absorbs the body; exact microtask interleavings at those internal call frames are not retained as a contract. Actual I/O waits, live effect-authority checks, cancellation, child settlement, and cleanup remain. The Twitch authentication-success fix remains enforced.

Evidence

Focused public-boundary suites, targeted native typechecks, formatting, and line caps passed for the touched owners. Retained packets include 56 Twitch cases, 36 media-access cases, 49 update/auth UI cases, and 95 Workboard cases across eight suites. Existing platform skips remain; they are not native Windows proof.

CI repair: the local-service shutdown and handoff-reclamation cases passed in one serial exact-head/base replay each, which was inconclusive rather than proof of a fix. The browser executable fixture also failed on both heads, but additional Linux cases were not fully attributed. Runtime import closures identified the exact reachable changed paths: retry jitter, disk ancestor lookup, Windows executable paths, browser version probing, and the delegated-grant fold. These cuts and the corresponding grant test migration were removed, with their original postimages preserved on deslop/z25-parked-local-service-20261015 (no PR; 76 net production lines).

Two concrete stale test fixtures are repaired without weakening assertions: the update recovery clock now preserves real utility exports after main #180552 added a tryParseJson import (the original failure reproduced on the exact base; all 20 process-output cases now pass, 141.7s runner wall time); the Twitch outbound normalization cases now use the same direct success/error assertions as their siblings instead of two helpers removed by #180424 before #178480 landed. The latter failed targeted typing on unchanged main before repair; all 89 focused Twitch cases across five suites and targeted native typing pass afterward. The earlier Workboard All boards fixture correction is now already on main and is no longer part of this diff; its existing mounted-page heading contract passed, while actual routing remains an exact-head hosted E2E gate.

GitHub then reported a conflict with main's Twitch target-normalization fix. The conflict-only rebase preserves main's shared target.ts owner and outbound behavior; it does not restore the old private target parser. Range-diff shows 24 unchanged patches, the reviewed Twitch import resolution, and the already-landed Workboard fixture patch skipped. Fresh independent P0–P2 review is clean for both the resolved Twitch fold and the adjacent test repair.

Independent P0–P2 review passed for each packet and the complete signed branch. Runtime and static cycle checks both report zero cycles. No new assertion allowance, mock baseline, lint suppression, timeout, retry, or skip was added.

Local limitations: imported-type typed-lint diagnostics in unchanged Workboard, WhatsApp, and Twitch annotations reproduce on the clean tooling checkout. The suppression inventory reports the same three unchanged baseline extras in cron, transcript test support, and the sessions view (103 versus 100); no allowlist was widened. Wrapper/eager-import closure, assertion safety, and mock-export ratchets passed. Exact-head hosted CI is the broad proof. No local build, broad typecheck, E2E, paired-device, or live channel claim is made under the campaign's CPU budget. The opt-in Workboard mock fixture build remains a hosted proof gap. This is not a visual change.

@steipete steipete added the ci:full Keep ordinary native-locale CI selection on the next PR run. label Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 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.

@openclaw-barnacle openclaw-barnacle Bot added channel: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: whatsapp-web Channel integration: whatsapp-web app: web-ui App: web-ui gateway Gateway runtime cli CLI command changes scripts Repository scripts commands Command implementations agents Agent runtime and tooling channel: twitch Channel integration: twitch plugin: workboard extensions: browser size: XL labels Oct 22, 2026
@steipete
steipete marked this pull request as ready for review October 22, 2026 13:20
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex Review Summary

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-10-22T14:13:56.427695Z 990cc9d New commits
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

⚠️ Security sensitive changes

This maintainer PR changes sensitive security components.

No secops approval is required. This comment is informational because the PR author has Maintain or Admin access.

  • Current SHA: 990cc9d22c0643f9c3b4a43d4aa73ea3e95719fe
  • Maintainer: @steipete
  • Repository role: admin

These security sensitive changes were made:

  • src/agents/prepared-model-runtime.oauth-providers.ts: Controls credential persistence, secret resolution, or redaction. Check storage permissions, credential scope, and exposure in logs or responses.

Carefully review these changes before merging.

@steipete
steipete enabled auto-merge (squash) October 22, 2026 13:28
@steipete
steipete disabled auto-merge October 22, 2026 13:31
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. 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 Oct 22, 2026
@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge.

What this changes

This PR folds private helpers into their existing consumers and replaces the internal Workboard barrel with direct imports.

Example: A Twitch status probe receives an authentication failure.

  • Before: The private probe module reports failure and closes the client.
  • After: The plugin-owned probe reports the same failure and closes the client.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) The source review found a coherent consolidation with retained assertions and no actionable defect; supplied proof is primarily focused automated coverage.
Proof confidence 🦐 gold shrimp (3/6) This maintainer-authored refactor is outside the ordinary contributor media gate; focused suites are reported, and the inspected linked screenshots do not prove the consolidation.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Refactor · Worth it: Yes · Fix scope: Complete
User problem: There is no intended user-visible behavior change; private helper boundaries spread responsibilities across unnecessary internal surfaces.
Reason: The maintainer-authored direction is established, and the diff removes redundant boundaries while preserving existing owners and public behavior.

Merge readiness

✅ Ready for maintainer review

Keep this maintainer-directed PR open: the consolidation removes redundant internal surfaces, and review found no actionable introduced defect.

Priority: P3
Reviewed head: 301e51c6cf3499fcaafa0a0612921c588c1b15d8

Before merge

None.

Findings

None.

Tests

  • Missing end-to-end proof: Current-head hosted routing, build, and broader suites remain pending; the inspected screenshots cover the earlier title fix only.
Agent review details

How this fits together

CLI commands, Gateway preparation, channel plugins, and Control UI owners consume configuration and runtime facts to produce commands, status, delivery results, and presentation.

flowchart LR
  A[CLI and UI requests] --> B[Existing command and presentation owners]
  C[Configuration and runtime facts] --> B
  B --> D[Gateway and plugin operations]
  D --> E[Transport and filesystem effects]
  D --> F[Status and presentation results]
Loading

Technical review

Best possible solution:

Retain the consolidation and fixture repairs under the existing exact-head CI gates.

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

This is a behavior-preserving refactor; source inspection confirms the two stale fixture expectations, and no target code was executed during this read-only review.

Is this the best way to solve the issue?

Inlining into existing owners and deleting the retired modules is a complete consolidation without new state, wrappers, or public contracts.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning medium; reviewed against 09e09dcdf71e.

Provenance checked

  • OAuth registry reuse keeps the original intent (75d29a7: Fleet model preparation reuses captured facts while keeping distinct AuthStorage hook generations separate; the comparison is preserved exactly.)
  • Twitch authentication probe keeps the original intent (2d40bdf: fix(twitch): wait for authentication before probe success #178354 requires authentication success rather than socket connection before reporting success; the relocated probe retains that boundary.)
  • Agent provider summaries and tree bindings keeps the original intent (7b7d587: refactor: fold single-consumer CLI and reply surfaces #177514 consolidated read-only provider inventory; the routing-rule display added by fix(agents): tree listing omits routing rules with --bindings #176860 also remains intact.)
  • Workboard imports and routing fixture keeps the original intent (8eb23c3: fix(workboard): title the unfiltered Workboard page as All boards #174430 titles the resolved unfiltered page All boards; direct imports preserve the same implementations and the routing fixture now follows that contract.)
  • Formatting, delivery, workspace inventory, media, and skills keeps the original intent (unknown: Supplied provenance and local path history identify earlier formatting, delivery, transfer, and status work; available base hunks preserve their algorithms and guards, but missing historical blobs prevent establishing every helper's introduction.)
  • UI projections, numeric constraints, theme import, and network diagnostics keeps the original intent (unknown: Local path history shows prior owner consolidation and feature work; the diff preserves validation, limits, defaults, serialized output, and effect targets while removing private call frames.)

Testing

Proof path: unit tests only.

Security

None.

Evidence

What I checked:

PR surface

Source -427, Tests +14, Other 0. Total -413 across 63 files. Added test files: 0.

View PR surface stats
Area Files Added Removed Net
Source 52 1619 2046 -427
Tests 10 24 10 +14
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 1 3 3 0
Total 63 1646 2059 -413

Labels

Label changes:

No label changes.

Label justifications:

  • P3: This is internal cleanup with preserved user-facing behavior and focused test-fixture maintenance.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.

Rating scale

6/6 🦀 challenger crab · 5/6 🦞 diamond lobster · 4/6 🐚 platinum hermit · 3/6 🦐 gold shrimp · 2/6 🦪 silver shellfish · 1/6 🧂 unranked krab. Overall follows the weaker of proof and patch quality; ✨ marks media proof (a screenshot, video, or linked artifact) that directly shows the changed behavior.

Workflow

ClawSweeper edits this one comment on every review. Comment @clawsweeper re-review for a fresh review only. Repair and merge execution lanes are retired.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-22T13:39:01.345Z sha df73746 :: needs maintainer review before merge. :: none

Reviewed October 22, 2026, 9:52 AM ET / 13:52 UTC (Revision 2).

@steipete
steipete force-pushed the deslop/z25-97-internal-surface-20261015 branch from df73746 to 301e51c Compare October 22, 2026 13:43
@steipete

Copy link
Copy Markdown
Contributor Author

@clawsweeper re-review

CI repair is now at 301e51c6cf3499fcaafa0a0612921c588c1b15d8. Inconclusive process/browser replays were handled by removing only reachable changed paths, preserving the cuts on one parked branch without a PR. Two concrete stale fixtures were repaired: the update clock preserves utility exports, and the Workboard routing expectation follows main #174430's All boards heading. Focused proof and the updated 427-line measurement are in the PR body. Exact-head hosted CI is the broad gate; the previous head's results are not claimed for this head.

@clawsweeper

clawsweeper Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
Contributor

🦞👀
Exact review queued.

Re-review progress:

@steipete
steipete force-pushed the deslop/z25-97-internal-surface-20261015 branch from 301e51c to 990cc9d Compare October 22, 2026 14:09
@steipete
steipete merged commit fd3b7a8 into main Oct 22, 2026
161 of 163 checks passed
@steipete
steipete deleted the deslop/z25-97-internal-surface-20261015 branch October 22, 2026 14:41
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 23, 2026
)

* refactor(gateway): localize workspace inventory command stages

* refactor(infra): inline Windows process executable paths

* refactor(gateway): own session preamble normalization

* refactor(workboard): import internal browser owners directly

* refactor(retry): localize private jitter preparation

* refactor(agents): localize OAuth registry identity comparison

* refactor(cli): localize device command preparation frames

* refactor(ui): localize single-consumer owner preparation

* refactor(browser): localize snapshot and version probe frames

* refactor(infra): localize discovery and diagnostic preparation

* refactor(msteams): localize formatter preparation frames

* refactor(whatsapp): localize requester call preparation frames

* refactor(skills): localize single-consumer status assembly

* refactor(cli): localize agent command preparation and presentation

* refactor(ui): localize custom theme import preparation

* refactor(status): localize channel account presentation frames

* refactor(mattermost): localize preview preparation frames

* refactor: localize numeric and startup preparation frames

* refactor(presence): keep grouping type module private

* refactor(twitch): own private actions and status in plugin

* refactor(media): resolve read policy at sole call site

* refactor(ui): inline private update and auth projections

* refactor(update): validate child grants in delegated executor

* refactor(infra): locate disk ancestor in public reader

* fix(test): preserve utility exports in update recovery clock fixture

* test(twitch): inline retired target assertions in normalization cases
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: mattermost Channel integration: mattermost channel: msteams Channel integration: msteams channel: twitch Channel integration: twitch channel: whatsapp-web Channel integration: whatsapp-web ci:full Keep ordinary native-locale CI selection on the next PR run. cli CLI command changes commands Command implementations extensions: browser gateway Gateway runtime P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. plugin: workboard rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. scripts Repository scripts 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