Skip to content

refactor: eliminate final wrapper-shadowing hazards - #122157

Merged
steipete merged 8 commits into
mainfrom
steipete/burn-wrapper-shadowing-final
Aug 11, 2026
Merged

steipete merged 8 commits into
mainfrom
steipete/burn-wrapper-shadowing-final

Conversation

@steipete

@steipete steipete commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

The wrapper-shadowing guard still carried 30 debt entries where the same exported spelling could select either a low-level implementation or a behavior-complete lazy/runtime/SDK boundary. Importing the inner module by accident could silently bypass wrapper-owned behavior such as activation checks, session privacy filtering, persistence binding, redaction, compatibility materialization, or lazy loading.

This burns the final #121300 wrapper-shadowing debt tranche requested after #122040: one exported spelling now identifies one behavior at each owner boundary.

Why This Change Was Made

Behavior-complete wrappers keep their canonical names, while their wrapped owners receive grep-unique Core or concept-specific names. Four true duplicate forwarders are deleted instead of preserved: the three unused web-media runtime aliases and the outbound readBooleanParam alias. Shipped Plugin SDK export names and callable counts stay unchanged; only internal mappings and generated closure hashes move.

Entry Classification Old → new
loadBundledPluginPublicSurfaceModuleSync behavior-complete runtime wrapper inner → loadBundledPluginPublicSurfaceModuleSyncCore
loadCombinedSessionStoreForGateway privacy-filtering SDK wrapper inner → loadCombinedSessionStoreForGatewayCore
loadPluginManifestRegistry lazy docs/runtime boundary inner → loadPluginManifestRegistryCore
loadWebMediaRaw true duplicate unused runtime forwarder deleted; owner name unchanged
loadWebMedia true duplicate unused runtime forwarder deleted; owner name unchanged
maybeApplyTtsToPayload persistence-binding wrapper inner → maybeApplyTtsToPayloadCore
normalizeCronRunDiagnostics redacting authoring wrapper inner → normalizeCronRunDiagnosticsCore
normalizeOutboundReplyPayload SDK contract projection inner → normalizeOutboundReplyPayloadCore
normalizePluginsConfigWithResolver policy boundary inner → normalizePluginsConfigWithResolverCore
optimizeImageToJpeg true duplicate unused runtime forwarder deleted; owner name unchanged
pruneStaleCommandPolls lazy runtime boundary inner → pruneStaleCommandPollsCore
readAmbientTranscriptWatermark different abstraction levels entry reader → readAmbientTranscriptWatermarkFromEntry
readBooleanParam true duplicate outbound alias deleted; SDK owner name unchanged
readSessionTranscriptVisibleMessageDelta failure-normalizing SDK wrapper inner → readSessionTranscriptVisibleMessageDeltaCore
resolveAllowedModelRef public selection facade inner → resolveAllowedModelRefCore
resolveApiKeyForProvider runtime/SDK ownership split owner → resolveApiKeyForProviderCore; internal runtime → resolveProviderRuntimeApiKey; SDK spelling retained
resolveHeartbeatPrompt config-precedence wrapper inner → resolveHeartbeatPromptCore
resolvePluginProviders auth-choice runtime boundary inner → resolvePluginProvidersCore
resolvePluginSetupProvider auth-choice runtime boundary inner → resolvePluginSetupProviderCore
resolveProviderPluginChoice auth-choice runtime boundary inner → resolveProviderPluginChoiceCore
resolveSecretPlanTargetByPath SDK projection wrapper inner → resolveSecretPlanTargetByPathCore
resolveSessionFilePath legacy-materializing SDK wrapper inner → resolveSessionFilePathCore
resolveSessionKeyForRequest cold CLI/runtime boundary inner → resolveSessionKeyForRequestCore
resolveSessionStoreEntry shipped SDK compatibility wrapper inner → resolveSessionStoreEntryCore
resolveStorePath ownership-recording SDK wrapper inner → resolveSessionStorePathCore; SDK spelling retained
runProviderModelSelectedHook auth-choice runtime boundary inner → runProviderModelSelectedHookCore
runSecurityAudit lazy status/runtime boundary inner → runSecurityAuditCore
sha256HexPrefix length-normalizing redaction wrapper inner → sha256HexPrefixCore
shouldSuppressBuiltInModel lazy catalog boundary inner → shouldSuppressBuiltInModelCore
textToSpeech persistence-binding wrapper inner → textToSpeechCore

AI-assisted: yes. The full branch was reviewed with the repository autoreview workflow, and every actionable finding gate is clean.

User Impact

None. This is behavior-neutral internal ownership cleanup. Existing operators, plugin authors, and Plugin SDK consumers keep the same public names and runtime behavior.

Evidence

  • Initial focused implementation proof: 14 Vitest shards, 30 files, 458 tests passed.
  • Post-rebase overlap proof: 7 Vitest shards, 9 runnable files, 137 tests passed.
  • Type proof: core production/tests, extension production/tests, and root tests all pass tsgo on the final rebased head.
  • Plugin SDK surface is unchanged: 337 entrypoints / 7,766 exports total; 152 public entrypoints / 4,868 public exports.
  • pnpm plugin-sdk:api:check, pnpm check:import-cycles, and git diff --check pass.
  • Export-name collision guard passes with an empty baseline; current main already removed its overlapping debt in refactor: eliminate final export name collisions #122083.
  • pnpm check:wrapper-shadowing passes with 0 current / 0 baselined. The original assigned list drops 30 → 0; after concurrent main cleanups, this rebased branch drops the remaining 14 → 0. A second generator run is idempotent at 0.
  • Grep/export proof: canonical wrapper/SDK spellings remain at their behavior-complete boundaries; wrapped owners use the distinct names shown above, with no compatibility aliases.
  • Final branch autoreview against current origin/main: clean, 0 accepted/actionable findings, overall 0.98.

@clawsweeper

clawsweeper Bot commented Aug 11, 2026

Copy link
Copy Markdown
Contributor

🦞👀
ClawSweeper picked this up.

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

@openclaw-barnacle openclaw-barnacle Bot added docs Improvements or additions to documentation channel: telegram Channel integration: telegram gateway Gateway runtime cli CLI command changes scripts Repository scripts commands Command implementations docker Docker and sandbox tooling agents Agent runtime and tooling labels Aug 11, 2026
@steipete steipete self-assigned this Aug 11, 2026
@steipete
steipete marked this pull request as ready for review August 11, 2026 17:00
@steipete
steipete requested a review from a team as a code owner August 11, 2026 17:00
@openclaw-barnacle openclaw-barnacle Bot added size: XL maintainer Maintainer-authored PR labels Aug 11, 2026
@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 Aug 11, 2026
@clawsweeper

clawsweeper Bot commented Aug 11, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 11, 2026, 4:09 PM ET / 20:09 UTC.

ClawSweeper review

What this changes

The PR renames internal implementations behind behavior-complete runtime and Plugin SDK façades, deletes duplicate forwarders, and removes remaining wrapper-shadowing baseline entries.

Merge readiness

⚠️ Ready for maintainer review - 2 items remain

No actionable patch regression was identified; the two prior Plugin SDK compatibility concerns are addressed by retaining public façades over distinct internal owners. This maintainer-labeled refactor should remain open for its exact-head contract and CI completion.

Priority: P3
Reviewed head: cdb6b76b45fda99bb7b09badb1ece46cbd83c02c

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The façade-preserving repair addresses the earlier compatibility findings; exact-head validation remains the material pre-merge check.
Proof confidence 🌊 off-meta tidepool Not applicable: This is a maintainer-owned, behavior-neutral internal refactor; focused contract and runtime validation, rather than contributor live proof, is the relevant merge evidence.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: This is a maintainer-owned, behavior-neutral internal refactor; focused contract and runtime validation, rather than contributor live proof, is the relevant merge evidence.
Evidence reviewed 5 items Public provider-auth spelling remains stable: Current main exports the published Plugin SDK name while mapping it to the renamed internal implementation; the runtime layer uses a distinct internal runtime spelling.
Public session-store compatibility remains intact: The Plugin SDK retains resolveSessionStoreEntry as a documented beta compatibility bridge while delegating to its internal session-store owner.
Privacy-filtering wrapper stays at the SDK boundary: The cross-session SDK façade calls the renamed gateway-store owner and filters incognito rows before exposing its result.
Findings None None.
Security None None.

How this fits together

Core and plugins enter public SDK or runtime façades, which preserve behavior such as lazy loading, privacy filtering, and provider-auth routing before delegating to internal owners. The wrapper-shadowing guard prevents future internal exports from reusing those façade names.

flowchart LR
A[Core and plugin callers] --> B[Public SDK and runtime facades]
B --> C[Lazy behavior boundaries]
C --> D[Internal owner implementations]
D --> E[Provider auth, sessions, and audit behavior]
D --> F[Wrapper-shadowing check]
Loading

Before merge

  • Resolve merge risk (P1) - This broad rename fanout touches published Plugin SDK aliases and provider-auth dispatch, so it should not merge until the exact-head API-contract and focused CI checks complete.
  • Complete next step (P2) - Protected maintainer handling and completion of the exact-head contract matrix are the remaining actions; no narrow automated code repair is identified.
Agent review details

Security

None.

Review metrics

Metric Value Why it matters
Production versus test churn raw +820/-834 (net -14); production/tooling is described as net-negative after mechanical renames The large fanout is primarily ownership renaming and generated baseline refresh, so public API checks matter more than raw line movement.

Stored data model

Persistent data-model change detected: serialized state: src/sessions/session-key-case-preservation.test.ts, unknown-data-model-change: src/sessions/session-key-case-preservation.test.ts, unknown-truncated-pull-files. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster

Relationship: same_root_cause
Canonical: #121300
Summary: This PR completes remaining wrapper-shadowing debt introduced by the guard established in the canonical merged cleanup.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge-risk options

Maintainer options:

  1. Complete exact-head contract validation (recommended)
    Merge after the current head passes the Plugin SDK API, wrapper-shadowing, type, and focused provider-auth/session checks.
  2. Pause if the contract diverges
    If any exact-head contract check changes a public spelling or provider-auth routing result, pause this rename batch and retain the existing façade.

Technical review

Best possible solution:

Keep public SDK and behavior-complete wrapper names stable, use distinct internal owner names, and merge only after exact-head contract validation confirms the generated API surface remains compatible.

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

Not applicable: this PR is an internal naming and ownership refactor, not a report of a reproducible user failure.

Is this the best way to solve the issue?

Yes. Retaining behavior-complete public façades while giving lower-level owners distinct names is the narrowest durable way to prevent ambiguous imports without breaking Plugin SDK callers.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 09c39e0ec528.

Labels

Label changes:

  • add P3: This is behavior-neutral internal cleanup rather than a reported user-facing regression.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-owned, behavior-neutral internal refactor; focused contract and runtime validation, rather than contributor live proof, is the relevant merge evidence.
  • remove P1: Current review triage priority is P3, so this older priority label is no longer current.
  • remove rating: 🦐 gold shrimp: Current PR rating is rating: 🐚 platinum hermit, so this older rating label is no longer current.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P3: This is behavior-neutral internal cleanup rather than a reported user-facing regression.
  • merge-risk: 🚨 compatibility: The refactor changes implementation spellings behind published Plugin SDK entrypoints and generated API baselines.
  • merge-risk: 🚨 auth-provider: Provider API-key resolution is rerouted through renamed runtime-auth symbols.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🌊 off-meta tidepool and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Not applicable: This is a maintainer-owned, behavior-neutral internal refactor; focused contract and runtime validation, rather than contributor live proof, is the relevant merge evidence.

Evidence

What I checked:

  • Public provider-auth spelling remains stable: Current main exports the published Plugin SDK name while mapping it to the renamed internal implementation; the runtime layer uses a distinct internal runtime spelling. (src/plugin-sdk/agent-runtime.ts:33, 09c39e0ec528)
  • Public session-store compatibility remains intact: The Plugin SDK retains resolveSessionStoreEntry as a documented beta compatibility bridge while delegating to its internal session-store owner. (src/plugin-sdk/session-store-runtime.ts:364, 09c39e0ec528)
  • Privacy-filtering wrapper stays at the SDK boundary: The cross-session SDK façade calls the renamed gateway-store owner and filters incognito rows before exposing its result. (src/plugin-sdk/session-transcript-hit.ts:25, 09c39e0ec528)
  • Related feature-history provenance: Current main contains the earlier merged collision-cleanup commit that established the same public-façade/internal-owner pattern used by this PR. (src/plugin-sdk/agent-runtime.ts:33, 3d7624679283)
  • Exact-head branch evidence: The PR body and final commits state that the public Plugin SDK names are retained and that API, import-cycle, wrapper-shadowing, and focused test checks were run; the hosted exact-head matrix is still in progress. (cdb6b76b45fd)

Likely related people:

  • steipete: Authored the merged export-collision cleanup that established the current façade/internal-owner pattern and authored this follow-up refactor. (role: feature-history author and recent area contributor; confidence: high; commits: 3d7624679283; files: src/plugin-sdk/agent-runtime.ts, src/plugin-sdk/session-store-runtime.ts, src/plugins/runtime/runtime-model-auth.runtime.ts)

Rank-up moves

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

  • Allow the current exact-head API-contract and focused CI matrix to complete before merge.

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 (2 earlier review cycles)
  • reviewed 2026-08-11T17:05:34.112Z sha 532b04110efe1f50d52c7e35612a832ca7555201 :: needs maintainer review before merge. :: none
  • reviewed 2026-08-11T18:09:18.847Z sha 98912e39934abbc5b4c4527510d48e1b7caf53c5 :: found issues before merge. :: [P1] Preserve the published provider-auth export | [P1] Keep the public session-store path export

@steipete
steipete force-pushed the steipete/burn-wrapper-shadowing-final branch 2 times, most recently from b92ccf6 to 98912e3 Compare August 11, 2026 18:01
@clawsweeper clawsweeper Bot added merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. and removed P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Aug 11, 2026
@steipete
steipete force-pushed the steipete/burn-wrapper-shadowing-final branch from d84a6dd to d02ab03 Compare August 11, 2026 18:33
@openclaw-barnacle openclaw-barnacle Bot removed channel: telegram Channel integration: telegram docker Docker and sandbox tooling labels Aug 11, 2026
@steipete
steipete force-pushed the steipete/burn-wrapper-shadowing-final branch from d02ab03 to 0d6546e Compare August 11, 2026 18:38
@steipete
steipete force-pushed the steipete/burn-wrapper-shadowing-final branch 3 times, most recently from 55890b2 to cdb6b76 Compare August 11, 2026 20:03
@clawsweeper clawsweeper Bot added P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed P1 High-priority user-facing bug, regression, or broken workflow. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Aug 11, 2026
@steipete
steipete force-pushed the steipete/burn-wrapper-shadowing-final branch from cdb6b76 to 2681bc4 Compare August 11, 2026 20:20
@steipete
steipete merged commit e74be5d into main Aug 11, 2026
123 checks passed
@steipete
steipete deleted the steipete/burn-wrapper-shadowing-final branch August 11, 2026 20:34
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

vincentkoc added a commit to tangtaizong666/openclaw that referenced this pull request Aug 11, 2026
…-prep

* commit 'edb7a1692e58d78ff7e196db39ea8eff297b2e19': (1351 commits)
  fix(telegram): expose live location updates to hooks (openclaw#122185)
  fix(ui): remove the pre-creation session row (openclaw#122259)
  fix(openai): surface failed realtime response outcomes (openclaw#121177)
  fix(logging): publish diagnostics ZIP through staged atomic overwrite (openclaw#122130)
  test(cli): trim duplicate MCP probe process cases (openclaw#122260)
  feat(agents): replay persisted native video (openclaw#122257)
  fix(test): serialize default e2e runner (openclaw#122203)
  fix(ui): always show full assistant responses (openclaw#122207)
  feat(mcp): per-requester OAuth for MCP servers (openclaw#122166)
  fix(ui): preserve focus on composer accessory clicks (openclaw#122243)
  fix(backup): exclude state temp files (openclaw#122250)
  fix(browser): let attached workers exit after CDP use (openclaw#122103)
  test(cli): trim duplicate Claw authoring process cases (openclaw#122248)
  refactor(outbound): inline delivery diagnostics (openclaw#122219)
  refactor: eliminate final wrapper-shadowing hazards (openclaw#122157)
  fix(ui): keep new-session identity anchored (openclaw#122242)
  test(cli): trim duplicate gateway process cases (openclaw#122240)
  fix(media): decode local file URLs safely (openclaw#122192)
  refactor(agents): centralize typed activity event emission (openclaw#122188)
  fix(ui): effort slider matches selected level after model switches (openclaw#122125)
  ...
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 12, 2026
* refactor: disambiguate wrapper-shadowed exports

* test: align renamed session and facade boundaries

* test: cover renamed runtime mock exports

* refactor: align remaining wrapper owner call sites

* test: align overlap-rebased runtime mocks

* refactor: preserve public SDK names after overlap rebase

* chore: regenerate wrapper shadowing baselines

* test: align cron model selection mocks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling cli CLI command changes commands Command implementations docs Improvements or additions to documentation gateway Gateway runtime maintainer Maintainer-authored PR merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P3 Low-priority cleanup, docs, polish, ergonomics, or speculative work. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. 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