Skip to content

fix(plugin-sdk): block removal of shipped stable SDK surface without a dated compat record - #167036

Merged
steipete merged 4 commits into
mainfrom
steipete/plugin-sdk-shipped-surface-guard
Oct 8, 2026
Merged

steipete merged 4 commits into
mainfrom
steipete/plugin-sdk-shipped-surface-guard

Conversation

@steipete

@steipete steipete commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Related: #166404

What Problem This Solves

Fixes: shipped Plugin SDK subpaths and exports could be removed without the surface check noticing, which broke published third-party plugins such as @tencent-weixin/openclaw-weixin on 2026.10.1-beta.1.

User Impact

User impact: the stable Plugin SDK surface can no longer silently disappear. Removing a subpath or named export that shipped in the latest stable release now fails pnpm plugin-sdk:surface:check unless a compatibility record covers it with a final compatibility day that has passed. No runtime behavior changes; nothing is restored here (restoring the removed subpaths for #166404 is a separate product decision).

Why This Change Was Made

plugin-sdk:surface:check only enforced maximum export-count budgets, and the API baseline diff is report-only. The commits that retired config-runtime, infra-runtime, channel-message, command-auth and four other subpaths (912+ named exports that shipped in v2026.9.8) lowered those budgets in the same change, so the check passed. A ceiling cannot detect a removal.

This adds a committed inventory of the latest stable release's typed public surface (scripts/lib/plugin-sdk-shipped-surface.json, pinned to the current npm latest v2026.9.9: 158 typed subpaths, 4,591 named exports, identical to v2026.9.8). It is generated from the release tag's package exports and declarations by pnpm plugin-sdk:shipped-surface:gen -- --release <tag>, reusing the existing tagged-revision renderer from plugin-sdk:api:diff, and is regenerated during stable closeout (documented in RELEASING.md). The surface check compares the current tree against it:

  • A missing shipped subpath, or a missing name in a surviving subpath, needs a compat record whose surfaces names openclaw/plugin-sdk/<subpath> (whole subpath) or the qualified openclaw/plugin-sdk/<subpath>.<Name>. Bare names do not count.
  • The record must be deprecated, removal-pending, or removed with a removeAfter strictly before the current UTC date (the date is the final compatibility day). A removalGate alone or a future date does not authorize; budgets play no role.
  • Packaged private runtime facades without a types condition are excluded: they are not a declared contract.

To make current main pass without restoring anything, the already-landed removals are recorded honestly:

Release-note context: Plugin SDK authors get a migration-guide row for each of the 14 retroactively recorded exports in docs/plugins/sdk-migration/removed-surfaces.md.

Evidence

  • Inventory generation from tag v2026.9.8 (fc23bc8): 158 typed subpaths, 4,591 names; config-runtime 115, infra-runtime 583, channel-message 136, command-auth 78 names.
  • Historical transition, guard + inventory overlaid on throwaway worktrees with OPENCLAW_PLUGIN_SDK_SURFACE_NOW=2026-10-01: e649be31^ shows only pre-existing gaps; e649be31 additionally fails on exactly channel-lifecycle (23), channel-message (136), channel-reply-pipeline (12), config-runtime (115), infra-runtime (583) despite its lowered budgets.
  • Final tree: pnpm plugin-sdk:surface:check → shipped Plugin SDK v2026.9.8: no unauthorized removals. Reverting the tombstone dates re-reports all eight subpaths; pinning OPENCLAW_PLUGIN_SDK_SURFACE_NOW=2026-10-07 re-reports the eight Skill Workshop types (strict date semantics).
  • The guard already caught a live regression during this PR: cfee851 landed on main mid-review and the rebased check failed on its eight unqualified types until the record was fixed.
  • Regenerated against v2026.9.9 (bcfc888) after it went stable mid-review: zero subpaths or names added or dropped versus v2026.9.8; check still clean.
  • PR wrapper inventory lists the new compat-record module (first CI run failed eager-import-closure / pr-worktree-provision on its absence).
  • Focused tests (--maxWorkers=1): test/scripts/plugin-sdk-shipped-surface.test.ts 20 passed (~2.2 s wall), src/plugins/compat/registry.test.ts 12 passed, test/scripts/plugin-sdk-surface-report.test.ts 11 passed / 1 Linux-only skip; all three ~11.7 s wall. Pure evaluator tests, no TS project boots, no timers.
  • node scripts/check-changed.mjs: every lane passed except two inherited from main: the dead-export scan (observePlacementAuthority, already fixed on main by 0178423) and core lint on three over-length files this PR does not touch. Direct oxlint on all changed .ts/.mts files is clean.
  • Autoreview (Codex, P2 threshold): scoped-clean.

@clawsweeper

clawsweeper Bot commented Oct 8, 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 docs Improvements or additions to documentation scripts Repository scripts size: XL labels Oct 8, 2026
@clawsweeper clawsweeper Bot added P2 Normal backlog priority with limited blast radius. merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. proof: sufficient ClawSweeper judged the real behavior proof convincing. 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 8, 2026
@clawsweeper

clawsweeper Bot commented Oct 8, 2026 •

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed October 8, 2026, 1:56 PM ET / 17:56 UTC (Revision 2).

ClawSweeper review

What this changes

The PR makes the SDK surface check reject removal of shipped stable subpaths or named exports unless a dated compatibility record authorizes it.

Example: A contributor removes openclaw/plugin-sdk/channel-message and lowers export budgets

  • Before: The export-count check can pass despite removal of the shipped subpath.
  • After: The check rejects the removal unless a covering compatibility record has passed its final compatibility day.

Review scores

Measure Result What it means
Overall readiness 🦐 gold shrimp (3/6) Command-level proof supports a useful preventative repair, while affected-plugin recovery remains separate and one redundant test limits the rating.
Proof confidence 🦞 diamond lobster (5/6) Sufficient (terminal): The inspected body records the real inventory generator and surface-check entry point detecting historical removals despite lowered budgets, rejecting premature removal dates, and accepting the recorded final tree. Regeneration against v2026.9.9 preserved the surface; source inspection establishes that the new repository artifact needs no user-data migration.
Patch quality 🐚 platinum hermit (4/6) No actionable review findings were identified.

Product

Kind: Bug fix · Worth it: Yes · Fix scope: Partial
User problem: Published plugins can stop loading when stable SDK exports disappear without the repository check rejecting the removal.
Reason: The guard protects an established public contract and follows the area's recorded owner direction. It intentionally leaves affected-plugin recovery unresolved and correctly uses Related.

Merge readiness

✅ Ready for maintainer review

This PR remains useful: current main lacks the shipped-surface guard, and the earlier wrapper-inventory blocker is resolved. No concrete patch defects remain; the redundant test suggestion is still applicable.

Priority: P2
Reviewed head: 3977a906ad3899c2eeff434cdbcf1d06e6d697d2

Before merge

None.

Findings

None.

Provenance

  • scripts/plugin-sdk-surface-report.mts: original intent not found (unknown: The feature-history search reached TypeScript migration commit c70aee2; earlier blob inspection failed with HTTP 403, so the original ceiling rationale remains unknown.)

Tests

  • Low-value test test/scripts/plugin-sdk-surface-report.test.ts: does not let a lowered export budget authorize a shipped name removal: The prior optional suggestion remains applicable: this separately calls two evaluators with synthetic inputs, duplicates missing-name coverage, and does not exercise command wiring; remove this redundant case.
Agent review details

How this fits together

The Plugin SDK is the public interface that plugins import from OpenClaw. Repository checks inspect its exports before publication; this change compares them with stable-release declarations and compatibility records.

flowchart TD
  A[Stable release declarations] --> B[Committed release inventory]
  C[Current typed exports] --> D[SDK surface check]
  B --> D
  E[Dated compatibility records] --> D
  D --> F{Removal authorized?}
  F -->|Yes| G[Check passes]
  F -->|No| H[Report missing exports]
Loading

Technical review

Best possible solution:

Keep stable-surface enforcement in the existing SDK check and compatibility registry, while tracking affected-plugin recovery separately.

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

Yes, current-main source shows that export ceilings cannot reject removals accompanied by lowered budgets, and the PR records historical command-level detection after the fix. No target code was executed during this review.

Is this the best way to solve the issue?

Yes, the existing surface check and compatibility registry are the appropriate owners, and the shared renderer avoids a competing generation path. The redundant evaluator test adds no command-wiring coverage.

AGENTS.md: found and applied where relevant.

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

Provenance checked

Testing

Proof path: shipped entry point. Added test files: 3.

Security

None.

Evidence

What I checked:

  • Current main still needs the guard: Current main evaluates export budgets without loading a shipped-release inventory or checking removal authorization. (scripts/plugin-sdk-surface-report.mts:588, 1c8be7fb6e9a)
  • Existing check owns removal enforcement: The check reads the committed inventory, compares current typed exports against registry records, and returns failure for unauthorized removals independently of budgets. (scripts/plugin-sdk-surface-report.mts:620, 3977a906ad38)
  • Previous finding resolved: The new compatibility-record module is now explicitly included in the trusted wrapper inventory. The earlier reviewed commit was unavailable locally, so resolution was verified against the retained finding and current source. (scripts/pr-lib/wrapper-components.txt:1245, 3977a906ad38)
  • Stable inventory independently checked: Read-only JSON inspection found v2026.9.9, commit bcfc888, 158 typed subpaths, 4,591 names, and no duplicate names. GitHub's package.json at that release commit has exactly the same typed-subpath set. (scripts/lib/plugin-sdk-shipped-surface.json:1, 3977a906ad38)
  • Relevant command-level proof: The complete supplied PR body records inventory generation, historical surface-check failures despite lowered budgets, final-tree success, strict final-day rejection, and regeneration against v2026.9.9 without surface changes. Captured body identity: 212feb4403c599290a1c2e4651c25f321ac280726330ea44ab98e9a238b406c6. These are contributor observations; this read-only review did not execute target code. (3977a906ad38)
  • Approved retirement direction retained: Merged refactor(plugin-sdk)!: retire deprecated compatibility facades #162333 records SDK-owner approval for early retirement of five facades. The current PR preserves those removals and documents their dates rather than restoring competing compatibility paths. (src/plugins/compat/plugin-sdk-subpath-records.ts:19, e649be315d75)

Likely related people:

  • steipete: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)
  • obviyus: Suggested for follow-up; no historical authorship or introduction is verified. (role: unverified routing candidate; confidence: low)

PR surface

Source +157, Tests +174, Docs +48, Config +1, Other +5199. Total +5579 across 18 files.

View PR surface stats
Area Files Added Removed Net
Source 5 200 43 +157
Tests 3 175 1 +174
Docs 3 48 0 +48
Config 1 1 0 +1
Generated 0 0 0 0
Other 6 5315 116 +5199
Total 18 5739 160 +5579

Review metrics

Metric Value Why it matters
Compatibility-date control 1 new maintenance environment variable OPENCLAW_PLUGIN_SDK_SURFACE_NOW selects the UTC date used to evaluate removal eligibility.

Stored data model

Persistent data-model change detected: migration/backfill/repair: src/plugins/compat/plugin-sdk-subpath-records.ts, migration/backfill/repair: src/plugins/compat/registry-records.ts, migration/backfill/repair: src/plugins/compat/session-persistence-records.ts, serialized state: scripts/plugin-sdk-shipped-surface.mts, unknown-data-model-change: scripts/plugin-sdk-shipped-surface.mts. Migration or upgrade compatibility proof is recorded; maintainers should verify it before merge.

Root-cause cluster

Relationship: partial_overlap
Canonical: #166404
Summary: The linked issue owns plugin-loading recovery; this PR prevents unrecorded removals and does not restore the retired exports.

Members:

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

Labels

Label changes:

  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • remove merge-risk: 🚨 automation: Current PR review selected no merge-risk labels.
  • remove status: ⏳ waiting on author: Current PR status label is status: 👀 ready for maintainer look.

Label justifications:

  • P2: This repairs a bounded release-protection gap rather than directly restoring the unavailable plugin workflow.
  • rating: 🦐 gold shrimp: Overall readiness is 🦐 gold shrimp; proof is 🦞 diamond lobster and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR.
  • proof: sufficient: Contributor real behavior proof is sufficient.

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 need explicit maintainer commands such as @clawsweeper autofix or @clawsweeper automerge.

History

Review history (1 earlier review cycle)
  • reviewed 2026-10-08T07:45:08.962Z sha a799d38 :: blocked before merge. :: [P2] Include the new registry module in the wrapper inventory

Budgets only capped export counts, so e649be3/0d530ea5 could remove
v2026.9.8 subpaths while lowering budgets (#166404). Adds a generated
per-stable inventory (scripts/lib/plugin-sdk-shipped-surface.json,
v2026.9.8, 158 typed subpaths, 4,591 names) via
`pnpm plugin-sdk:shipped-surface:gen`, and `plugin-sdk:surface:check` now
fails when a shipped subpath/name disappears without a qualified compat
record whose removeAfter has passed.

Records the eight retired subpaths with dated tombstones and 14 later
export removals retroactively (owner decision 2026-10-07).
cfee851 (#161057) removed eight shipped v2026.9.8 plugin-entry types under a removed-status record that used bare names and no removeAfter. Qualify the names and record 2026-10-07 as the final compatibility day so the shipped-surface guard accepts the recorded removal.
@steipete
steipete force-pushed the steipete/plugin-sdk-shipped-surface-guard branch from a799d38 to 3977a90 Compare October 8, 2026 17:48
@clawsweeper clawsweeper Bot added status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. and removed merge-risk: 🚨 automation 🚨 May affect CI, automerge, proof capture, label sync, or maintainer automation. status: ⏳ waiting on author ClawSweeper has contributor-facing work open and is waiting for author action. labels Oct 8, 2026
@steipete

steipete commented Oct 8, 2026

Copy link
Copy Markdown
Contributor Author

Landing note: the only red check on head 3977a90 is checks-node-changed-20, where test/e2e/qa-lab/runtime/telegram-message-tool-failure-settlement.e2e.test.ts hit its 120 s timeout. This PR touches only SDK surface scripts, compat-registry metadata, the PR wrapper inventory and docs; nothing on that Telegram path. The same test passes locally on this exact head (1 passed, 118 s file duration). Treated as an unrelated timing flake and landed via admin merge without rerun.

@steipete
steipete merged commit 28d3760 into main Oct 8, 2026
254 of 259 checks passed
@steipete
steipete deleted the steipete/plugin-sdk-shipped-surface-guard branch October 8, 2026 18:14
github-actions Bot pushed a commit to Desicool/openclaw that referenced this pull request Oct 9, 2026
…a dated compat record (openclaw#167036)

Related: openclaw#166404

## What Problem This Solves

Fixes: shipped Plugin SDK subpaths and exports could be removed without the surface check noticing, which broke published third-party plugins such as `@tencent-weixin/openclaw-weixin` on 2026.10.1-beta.1.

## User Impact

User impact: the stable Plugin SDK surface can no longer silently disappear. Removing a subpath or named export that shipped in the latest stable release now fails `pnpm plugin-sdk:surface:check` unless a compatibility record covers it with a final compatibility day that has passed. No runtime behavior changes; nothing is restored here (restoring the removed subpaths for openclaw#166404 is a separate product decision).

## Why This Change Was Made

`plugin-sdk:surface:check` only enforced maximum export-count budgets, and the API baseline diff is report-only. The commits that retired `config-runtime`, `infra-runtime`, `channel-message`, `command-auth` and four other subpaths (912+ named exports that shipped in v2026.9.8) lowered those budgets in the same change, so the check passed. A ceiling cannot detect a removal.

This adds a committed inventory of the latest stable release's typed public surface (`scripts/lib/plugin-sdk-shipped-surface.json`, pinned to the current npm `latest` v2026.9.9: 158 typed subpaths, 4,591 named exports, identical to v2026.9.8). It is generated from the release tag's package exports and declarations by `pnpm plugin-sdk:shipped-surface:gen -- --release <tag>`, reusing the existing tagged-revision renderer from `plugin-sdk:api:diff`, and is regenerated during stable closeout (documented in RELEASING.md). The surface check compares the current tree against it:

- A missing shipped subpath, or a missing name in a surviving subpath, needs a compat record whose `surfaces` names `openclaw/plugin-sdk/<subpath>` (whole subpath) or the qualified `openclaw/plugin-sdk/<subpath>.<Name>`. Bare names do not count.
- The record must be `deprecated`, `removal-pending`, or `removed` with a `removeAfter` strictly before the current UTC date (the date is the final compatibility day). A `removalGate` alone or a future date does not authorize; budgets play no role.
- Packaged private runtime facades without a `types` condition are excluded: they are not a declared contract.

To make current `main` pass without restoring anything, the already-landed removals are recorded honestly:

- Dated tombstones for the five subpaths retired under the Sept 30 owner decision (`removeAfter` 2026-09-30) and new tombstones for `command-auth`, `discord`, `telegram-account`, whose records were deleted in bc7ecd0 (`removeAfter` 2026-10-01).
- 14 later named-export removals from surviving subpaths (936fe5d openclaw#165431, ed04ab7 openclaw#165288, 0e5b206 openclaw#163587) recorded retroactively per owner decision; each release note states the export was removed without a compatibility window.
- The Skill Workshop proposal-hook types removed by 1991553 (openclaw#161057) already had a tombstone; its surfaces are now qualified and dated.

Release-note context: Plugin SDK authors get a migration-guide row for each of the 14 retroactively recorded exports in `docs/plugins/sdk-migration/removed-surfaces.md`.

## Evidence

- Inventory generation from tag `v2026.9.8` (fc23bc8): 158 typed subpaths, 4,591 names; `config-runtime` 115, `infra-runtime` 583, `channel-message` 136, `command-auth` 78 names.
- Historical transition, guard + inventory overlaid on throwaway worktrees with `OPENCLAW_PLUGIN_SDK_SURFACE_NOW=2026-10-01`: `3be7252f^` shows only pre-existing gaps; `3be7252f` additionally fails on exactly `channel-lifecycle` (23), `channel-message` (136), `channel-reply-pipeline` (12), `config-runtime` (115), `infra-runtime` (583) despite its lowered budgets.
- Final tree: `pnpm plugin-sdk:surface:check` → `shipped Plugin SDK v2026.9.8: no unauthorized removals`. Reverting the tombstone dates re-reports all eight subpaths; pinning `OPENCLAW_PLUGIN_SDK_SURFACE_NOW=2026-10-07` re-reports the eight Skill Workshop types (strict date semantics).
- The guard already caught a live regression during this PR: 1991553 landed on main mid-review and the rebased check failed on its eight unqualified types until the record was fixed.
- Regenerated against v2026.9.9 (bcfc888) after it went stable mid-review: zero subpaths or names added or dropped versus v2026.9.8; check still clean.
- PR wrapper inventory lists the new compat-record module (first CI run failed `eager-import-closure` / `pr-worktree-provision` on its absence).
- Focused tests (`--maxWorkers=1`): `test/scripts/plugin-sdk-shipped-surface.test.ts` 20 passed (~2.2 s wall), `src/plugins/compat/registry.test.ts` 12 passed, `test/scripts/plugin-sdk-surface-report.test.ts` 11 passed / 1 Linux-only skip; all three ~11.7 s wall. Pure evaluator tests, no TS project boots, no timers.
- `node scripts/check-changed.mjs`: every lane passed except two inherited from `main`: the dead-export scan (`observePlacementAuthority`, already fixed on main by 6dfbb46) and core lint on three over-length files this PR does not touch. Direct oxlint on all changed `.ts`/`.mts` files is clean.
- Autoreview (Codex, P2 threshold): scoped-clean.
@clawsweeper clawsweeper Bot mentioned this pull request Nov 23, 2026
5 of 7 tasks
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 P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. 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