Skip to content

fix: capture namespace SDK imports in published plugins - #104

Merged
vincentkoc merged 1 commit into
mainfrom
fix/sdk-namespace-capture-20261014
Oct 14, 2026
Merged

vincentkoc merged 1 commit into
mainfrom
fix/sdk-namespace-capture-20261014

Conversation

@vincentkoc

@vincentkoc vincentkoc commented Oct 14, 2026 •

Copy link
Copy Markdown
Member

What Problem This Solves

Fixes capture failures when published plugins access SDK helpers through namespace imports or compiled doctor-contract re-exports. The observed Feishu capture failure reports a missing mock function although the public host exports it.

User Impact

Offline capture can inspect these published plugin descriptors. Actual doctor migration execution remains explicitly unsupported by the mock and raises an error.

Why This Change Was Made

Reuse the existing parser and scope analysis for static namespace members, preserving closures, shadowed bindings and type-only imports. Supply the verified public doctor-builder exports and descriptor shapes required by namespace enumeration; avoid inferring arbitrary bundler data flow or changing plugins.

Contracts checked directly: OpenClaw v2026.9.9 src/plugin-sdk/runtime-doctor-migrations.ts, src/config/channel-alias-migration.ts, and the published @openclaw/feishu@2026.9.9 doctor bundle (provenance 2b988ee83444f08ccaf37aa5e98f370726c75f6e). No dependency, package-version or release changes. Production delta: +38 lines, justified by namespace discovery and the public descriptor contract; regression tests: +82 lines.

Evidence

  • Exact head ece61ce8212dd18cfb2a8f40a22993a0ae7f65b8: Node 22 CI passes all 577 tests, package contents, 12 retained-import contracts, and 7 Bun import tests. CodeQL passes.
  • Independent source review and Astra autoreview found no blocking issue. Namespace-only, closure/shadow/type-only, compiled descriptor capture, and explicit unsupported-execution regressions pass.
  • Direct AWS Crabbox run run_d28fc7531eed, lease cbx_7458f538731d, Node 24.19.0: downloaded the actual published Feishu 2026.9.9 tarball, verified npm SHA-512 integrity and the provenance subject/source SHA above, then compared base d0cfd5e with this exact head. The actual dist/.setup/doctor-contract-3XC0vbIw.mjs fails on base because defineChannelAliasMigration is not a function; it imports successfully with this fix. The actual dist/index.js captures one channel, two hooks, and 14 tool registrations. Exit 0; mock SDK temporary-directory cleanup passes; plugin execution has no credentials. This proves import/registration capture, not doctor normalization or live Feishu API behavior.
  • Required Crabpot consumer smoke passes in AWS run run_30e53a34d424, Node 24.19.0: frozen consumer 82f2c52781b7869bd638133e9c79fa90cec4f959, controlled published Feishu 2026.9.9 fixture with its unchanged channel/tool expectations, and both this exact source CLI and an unpublished npm-packed/install CLI. All 61 installed package files equal candidate source bytes. Both --check --runtime --resources runs report one fixture and zero breakages, preserve the intentional Gateway rejection (one passing and one intentionally failing runtime probe), and pass resource collector checks. Source and packed static reports are identical. Exit 0; lease released. This is scoped consumer smoke, not full fixture qualification or a resource workload.
  • Crabpot's execution owner will adopt the merged Inspector source SHA for exact fixture qualification; the existing published package pin stays unchanged. No package publication is needed.

Related: openclaw/crabpot#449

@vincentkoc
vincentkoc marked this pull request as ready for review October 14, 2026 06:33
@vincentkoc
vincentkoc requested a review from a team as a code owner October 14, 2026 06:33
@clawsweeper

clawsweeper Bot commented Oct 14, 2026

Copy link
Copy Markdown

ClawSweeper reviews are opt-in for maintainers. If a review is required, finish the work and validation first, then comment @clawsweeper review. Please avoid repeated requests while a review is queued or running; agents should not request reviews automatically.

@vincentkoc

Copy link
Copy Markdown
Member Author

@clawsweeper review

@clawsweeper

clawsweeper Bot commented Oct 14, 2026 •

Copy link
Copy Markdown

🦞👀
Exact review queued.

Re-review progress:

@clawsweeper clawsweeper Bot added P2 Normal priority bug or improvement with limited blast radius. 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 Oct 14, 2026
@clawsweeper

clawsweeper Bot commented Oct 14, 2026

Copy link
Copy Markdown

Codex review: needs changes before merge.

What this changes

This PR discovers static SDK namespace members and supplies doctor descriptor mocks for published plugin capture.

Example: Capture the published @openclaw/feishu@2026.9.9 package.

  • Before: Its doctor bundle fails because defineChannelAliasMigration is not a function.
  • After: The reported candidate capture records one channel, two hooks, and 14 tool registrations.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Focused, useful patch with no actionable code findings; independently inspectable runtime evidence is limited and required consumer validation remains pending.
Proof confidence 🦐 gold shrimp (3/6) Maintainer-authored PR is outside the ordinary contributor proof gate; its body reports exact-head published Feishu import and registration capture, while independently inspectable supplied execution coverage consists of regression tests and CI.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Complete
User problem: Valid published plugins fail offline capture because generated SDK mocks omit helpers used through namespaces.
Reason: The maintainer-authored direction restores documented capture behavior while keeping actual migration execution outside the mock contract.

Merge readiness

⛔ Needs changes before merge - 1 item remains

Keep open: this maintainer-authored PR fixes a concrete capture failure still present on main; no introduced correctness defect was found.

Priority: P2
Reviewed head: ece61ce8212dd18cfb2a8f40a22993a0ae7f65b8

Before merge

  • Complete next step - Complete Crabpot source-mode and unpublished-packed candidate plugin-inspector smoke against this change before landing; coordinate source-ref adoption and relevant expectations without publishing a package.

Findings

None.

Agent review details

How this fits together

Offline runtime capture scans plugin imports, generates temporary SDK mocks, and imports plugin entrypoints to record registrations.

flowchart LR
 A[Published plugin source] --> B[Runtime import collector]
 B --> C[Generated SDK mocks]
 C --> D[Capture subprocess]
 A --> D
 D --> E[Registration report]
Loading

Technical review

Best possible solution:

Land the focused collector and descriptor repair after completing the repository-required consumer validation.

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

Main's source establishes the missing namespace exports; the author also reports a base-failing, head-passing run against published Feishu, which this read-only review did not execute.

Is this the best way to solve the issue?

Reusing the existing binding analysis and modeling public descriptors fixes the capture owner without changing plugins or pretending to execute migrations.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: in-process harness.

Security

None.

Evidence

What I checked:

Likely related people:

  • Vincent Koc: Raw commit 5c42348 adds src/runtime-imports.js:2 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: 5c42348b45e1; files: src/runtime-imports.js)
  • Peter Steinberger: Raw commit a1a5bca adds src/sdk-mock.js:349 relative to its recorded parents. This identifies author metadata, not feature responsibility or a PR merger. (role: source-line author; confidence: high; commits: a1a5bcac209d; files: src/sdk-mock.js)

Review metrics

Metric Value Why it matters
Patch scope Production +42/-4; tests +82; changelog +2 The production growth supports namespace discovery and explicit descriptor contracts without adding runtime dependencies.

Labels

Label changes:

  • add P2: A reproducible offline inspection failure affects published plugins, with limited impact outside compatibility capture.
  • add rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • add status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

Label justifications:

  • P2: A reproducible offline inspection failure affects published plugins, with limited impact outside compatibility capture.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦐 gold shrimp and patch quality is 🐚 platinum hermit.
  • status: ⏳ waiting on author: ClawSweeper has contributor-facing work open and is waiting for author action.

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.

Reviewed October 14, 2026, 2:41 AM ET / 06:41 UTC.

@vincentkoc

Copy link
Copy Markdown
Member Author

Completed the remaining Before merge item at unchanged head ece61ce8212dd18cfb2a8f40a22993a0ae7f65b8.

AWS consumer run run_30e53a34d424 used frozen Crabpot 82f2c52781b7869bd638133e9c79fa90cec4f959 and the actual published Feishu 2026.9.9 tarball (npm integrity and SLSA source verified). The scoped configuration preserves the fixture's required channel/tool registrations. The exact source CLI and an unpublished npm-packed/install CLI both pass the native consumer --check --runtime --resources recipe: one fixture, zero breakages; expected Gateway rejection preserved; resource collector contract passed. All 61 packed files equal candidate source bytes, and both static reports are identical. Exit 0; lease released.

Source-ref adoption is coordinated with the Crabpot execution owner for post-merge exact qualification. Its published package pin remains unchanged. No package was published, release created, or tag pushed. The PR body contains the evidence and scope limits; no code changed after review.

@vincentkoc
vincentkoc merged commit c95d1df into main Oct 14, 2026
11 checks passed
@vincentkoc
vincentkoc deleted the fix/sdk-namespace-capture-20261014 branch October 14, 2026 06:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal priority bug or improvement with limited blast radius. 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.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant