Skip to content

fix(plugins): load source artifacts without losing credential targets - #132166

Merged
steipete merged 1 commit into
mainfrom
codex/plugin-source-artifact-loader-20260828
Aug 28, 2026
Merged

steipete merged 1 commit into
mainfrom
codex/plugin-source-artifact-loader-20260828

Conversation

@steipete

@steipete steipete commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

What Problem This Solves

Fixes an issue where developers loading source plugin artifacts could get ERR_PACKAGE_PATH_NOT_EXPORTED despite valid installed dependencies, and credential-reference generation could silently omit a channel's targets after that failure.

Closes #132153. Found while validating Buzz multi-account setup; this repair leaves Google Chat's source and all dependency versions unchanged. AI-assisted maintainer repair.

Why This Change Was Made

Source and compiled public artifacts now share the existing canonical plugin loader instead of choosing a second require path whenever a TypeScript hook exists. Cache retirement clears transformed source modules and their plugin-local dependencies while preserving shared modules outside that boundary. Source credential-reference generation reports a present but broken contract; ordinary runtime discovery still isolates unavailable owners and retains healthy siblings. Optional artifact absence is resolved structurally rather than inferred from an error-message prefix.

User Impact

Source-checkout plugin tooling works with import-only package exports. Credential metadata cannot silently lose an affected owner's entries during generation. Built native loading, module identity, runtime degradation, and plugin boundary checks retain their existing contracts. There are no new configuration settings, dependency changes, migrations, or schema/version changes.

Evidence

Final normal build and hosted CI run 33217830954 passed on exact head 3af5ae1da35c4c5330846c62046bef79c1021a64.

  • Reproduced the original error in a fresh Node 24.20 process under the real repository TypeScript hook; native ESM and the canonical cached loader succeeded with the same installed dependencies. A generated tiny plugin with import-only exports independently reproduces the failure.
  • The initial repair exposed stale source dependency exports after cache retirement. The regression now checks exact module identity across bundled, installed, and SDK-facade access; same-generation stability; replacement after retirement; and unchanged outside-root shared identity.
  • Focused owner/sibling suite: 135 tests across 13 files passed. Follow-ups cover the private native-selection helper through its actual production config owner, and the corrected final source-generation fixtures. Counts overlap and are not summed.
  • Actual source credential-matrix generation, with network access and operator home denied: all 108 entries exactly match the committed matrix, including both Google Chat service-account targets.
  • Source-generation tests cover missing optional artifacts, throwing bundled/external contracts, dependency errors resembling the old missing-artifact prefix, cached boundary rejection, and healthy runtime sibling retention.
  • Full changed-file checks passed, including core/test types, lint, unused exports, and architecture guards. Independent Codex review found no actionable P0–P2 findings in the selected tracked diff; two optional owner-context packets were omitted under the helper's filename safety policy, with full owner reading performed separately.
  • The actual final-head built Google Chat entrypoint imported successfully in a fresh process with network access and the operator home denied: 131.66 MiB RSS, 88.64 MiB above baseline. The profile used the completed runtime output without triggering a rebuild.
  • Final local pnpm build passed all runtime/package bundles, 63 external plugins, 48 native control-plane module checks, public SDK checks, and UI performance checks. The first build on the older base failed the final UI guard at 347,446 gzip bytes against 347,037 allowed. None of this repair's six production owners occur in its UI source maps. Integrating upstream main at 64f9e1302eda8e99479099a111ec9bb00601928b, including the existing fix(ui): compact mobile session actions #132020 and fix(control-ui): re-scope credentials when editing Gateway URLs #131788 UI changes, resolved that build failure; git range-diff confirms this repair's patch stayed identical. No limit or assertion was relaxed by this PR.

Production LOC: +49/-77 (net -28). Tests: +246/-187. Docs: +2. The duplicate loader branch and obsolete export are removed; no replacement fallback or dependency workaround is added.

Provenance: the available shallow history ends at a carrier snapshot, so original introduction and merger are unknown. The carrier commit is not attributed as the cause. Installed Jiti 2.7.0 and executing Node 24.20 resolver/cache source were inspected directly.

Nearby follow-up: the separate bundled-channel metadata generator still has an older optional security-artifact prefix catch. Its actual check passes here; no defect was established for that path, so it is not changed in this PR.

Release context: plugin source artifacts correctly load import-only dependencies, and credential-reference generation reports broken owners instead of silently omitting targets.

@clawsweeper

clawsweeper Bot commented Aug 28, 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 size: L maintainer Maintainer-authored PR labels Aug 28, 2026
@steipete steipete self-assigned this Aug 28, 2026
@steipete
steipete marked this pull request as ready for review August 28, 2026 22:25
@steipete
steipete requested a review from a team as a code owner August 28, 2026 22:25
Use the canonical plugin loader for source and built public artifacts, retire transformed module dependencies with their cache generation, and report broken contracts during source credential-reference generation.

Fixes #132153
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. 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. labels Aug 28, 2026
@clawsweeper

clawsweeper Bot commented Aug 28, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed August 28, 2026, 6:50 PM ET / 22:50 UTC.

ClawSweeper review

What this changes

The PR routes source plugin public artifacts through the canonical cached loader and makes generated credential metadata fail when a present channel contract cannot load.

Merge readiness

⚠️ Ready for maintainer review - 3 items remain

Keep this maintainer-owned PR open: it removes the duplicate source-only loader path and makes generated credential metadata fail visibly instead of silently omitting a broken owner; no introduced blocking correctness defect was found, but exact-head CI is still incomplete.

Priority: P2
Reviewed head: 3af5ae1da35c4c5330846c62046bef79c1021a64

Review scores

Measure Result What it means
Overall readiness 🐚 platinum hermit (4/6) The patch is coherent, net-negative in production code, and exercises the changed loader and registry boundaries; exact-head CI remains the merge gate.
Proof confidence 🌊 off-meta tidepool Not applicable: The repository state classifies this as a maintainer-owned PR, so the external-contributor proof gate does not apply; the body nevertheless describes a real TypeScript-hook subprocess and generated-matrix run, while exact-head CI remains pending.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Verification

Check Result Evidence
Real behavior Not applicable Not applicable: The repository state classifies this as a maintainer-owned PR, so the external-contributor proof gate does not apply; the body nevertheless describes a real TypeScript-hook subprocess and generated-matrix run, while exact-head CI remains pending.
Evidence reviewed 7 items Current-main failure path: The fetched main revision retains a TypeScript-hook-specific direct require branch, separate from the cached plugin loader; this is the source path the PR removes.
Canonical loader repair: The introduced loader path obtains the existing cached loader with built-dist preference and invokes it for every public artifact, eliminating the source-only require decision.
Generation/runtime error split: Source-tree registry generation opts into load errors, while normal config and process-cached registry construction retains unavailable-owner isolation.
Findings None None.
Security None None.

How this fits together

Plugin public-surface loading feeds channel credential-contract discovery. The resulting registry drives generated SecretRef credential documentation while runtime discovery can isolate unavailable plugin owners.

flowchart LR
  A[Plugin public artifact] --> B[Canonical plugin loader]
  B --> C[Channel secret contract]
  C --> D[Credential target registry]
  D --> E[Generated credential documentation]
  C --> F[Runtime secret discovery]
Loading

Before merge

  • Resolve merge risk (P1) - Generated source credential documentation will now stop when a present channel contract fails to load rather than publish an incomplete matrix; this is intentional and compatibility-sensitive until exact-head CI completes.
  • Resolve merge risk (P1) - The review checkout has no installed Jiti source, so its dependency contract could not be independently inspected or rerun locally; the subprocess regression and exact-head CI are the remaining validation path.
  • Complete next step (P2) - This maintainer-owned, compatibility-sensitive PR has no discrete automated repair finding; wait for exact-head CI and normal maintainer merge review.
Agent review details

Security

None.

PR surface

Source -28, Tests +59, Docs +2. Total +33 across 16 files.

View PR surface stats
Area Files Added Removed Net
Source 6 49 77 -28
Tests 9 246 187 +59
Docs 1 2 0 +2
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 16 297 264 +33

Review metrics

Metric Value Why it matters
Production versus test delta production +49/-77 (net -28); tests +246/-187; docs +2 The bug fix removes the duplicate loader branch while adding boundary and lifecycle regression coverage.

Merge-risk options

Maintainer options:

  1. Confirm exact-head compatibility checks (recommended)
    Allow the pending exact-head CI to confirm source artifact loading and credential-matrix generation before merging the intentional generation-time failure behavior.
  2. Accept the explicit generation contract
    Merge with the documented tradeoff that a present but broken channel contract fails generated credential metadata instead of being silently omitted.

Technical review

Best possible solution:

Land the single canonical-loader path once exact-head CI confirms the source-artifact subprocess and generated credential-matrix checks, while preserving runtime isolation for unavailable owners.

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

Yes, source-reproducible: fetched main contains the distinct TypeScript-hook require branch, and the added subprocess regression targets import-only dependency resolution and cache retirement. This review could not rerun it because the checkout lacks installed dependencies.

Is this the best way to solve the issue?

Yes: removing the source-only require branch and using the existing canonical loader is the narrowest maintainable fix; the registry separately makes generation strict without weakening runtime owner isolation.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 86a0b223142e.

Labels

Label justifications:

  • P2: This repairs source-checkout plugin tooling and generated credential metadata without evidence of a live production outage.
  • merge-risk: 🚨 compatibility: Generated source credential documentation now fails on a present but unloadable channel contract rather than continuing with an incomplete credential list.
  • 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: The repository state classifies this as a maintainer-owned PR, so the external-contributor proof gate does not apply; the body nevertheless describes a real TypeScript-hook subprocess and generated-matrix run, while exact-head CI remains pending.

Evidence

What I checked:

Likely related people:

  • steipete: The supplied timeline assigns this PR to steipete, and the reviewed head commit owns the loader and registry repair. (role: assigned implementation owner; confidence: medium; commits: 3af5ae1da35c; files: src/plugins/public-surface-loader.ts, src/secrets/channel-contract-api.ts, src/secrets/target-registry-data.ts)

Rank-up moves

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

  • Let exact-head CI complete with the source-artifact subprocess and generated credential-matrix checks.

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 (1 earlier review cycle)
  • reviewed 2026-08-28T22:34:23.819Z sha 9ba57d57d1a0e845e2c7d3a2d5d6150d66161c46 :: needs maintainer review before merge. :: none

@steipete
steipete force-pushed the codex/plugin-source-artifact-loader-20260828 branch from 9ba57d5 to 3af5ae1 Compare August 28, 2026 22:42
@steipete

Copy link
Copy Markdown
Contributor Author

Land-ready verification for 3af5ae1da35c4c5330846c62046bef79c1021a64: CI run 33217830954 completed successfully on this exact head.

The original TypeScript-hook failure and stale source-cache generation were reproduced before repair. Public source and compiled artifacts now use the same canonical loader; cache retirement replaces plugin-owned source dependencies while retaining shared outside-root module identity. Source credential generation intentionally fails for a present broken owner, while normal runtime discovery continues to isolate unavailable owners. This is the best owner-boundary fix: the alternate loader and silent omission are removed, not replaced with dependency overrides or another fallback.

Verification includes 135 focused tests across 13 files, the final 12-test generation fixtures, and public/cache/SDK boundary coverage (overlapping counts). Final fixture command: OPENCLAW_VITEST_MAX_WORKERS=1 node scripts/run-vitest.mjs src/secrets/target-registry-data.current-snapshot.test.ts src/secrets/target-registry.docs.test.ts. Full node scripts/check-changed.mjs passed. Independent Codex review found no actionable P0–P2 findings.

Final pnpm build passed runtime, 63 external plugins, 48 native control-plane checks, public SDK, and UI checks. The old base's final UI-size failure was resolved by integrating the already-landed upstream UI repairs; range-diff confirms this patch was unchanged, and no threshold was relaxed here.

On the final built head, a fresh process with network and operator-home access denied imported the real Google Chat entrypoint: node --import ./scripts/tsx.mjs scripts/profile-extension-memory.mts --extension googlechat --skip-combined --concurrency 1 --json <task-root>/report.json. Result: 1/1 successful, 131.66 MiB RSS (88.64 MiB above baseline), no automatic rebuild. Actual source credential generation produced all 108 entries, including both Google Chat targets, with exact object and serialized-byte equality to the committed matrix. Source and built artifacts remained unchanged.

The latest review's rank-up is satisfied by completed exact-head CI. Its missing installed-dependency context was checked directly by the maintainer against the executing Node 24.20 resolver/cache and installed Jiti 2.7 source, plus the real subprocess/cache-generation proof. The stricter generation contract is intentional and verified; runtime degradation is preserved.

Production +49/-77 (net -28); tests +246/-187; docs +2. No new config, dependency, database, schema, or version changes. No external Google Chat authentication or native-Windows live claim. The separate metadata-generator prefix catch remains a named follow-up because its actual check passes and no defect was established.

@steipete
steipete merged commit cf2ede2 into main Aug 28, 2026
245 checks passed
@steipete
steipete deleted the codex/plugin-source-artifact-loader-20260828 branch August 28, 2026 22:59
@steipete

Copy link
Copy Markdown
Contributor Author

Merged via squash.

github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Aug 29, 2026
…openclaw#132166)

Use the canonical plugin loader for source and built public artifacts, retire transformed module dependencies with their cache generation, and report broken contracts during source credential-reference generation.

Fixes openclaw#132153
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

docs Improvements or additions to documentation maintainer Maintainer-authored PR merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P2 Normal backlog priority with limited blast radius. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: L 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.

[Bug]: Source plugin artifacts fail on import-only dependencies and can omit credential targets

1 participant