build(plugins): enforce extension package root boundaries#61498
build(plugins): enforce extension package root boundaries#61498
Conversation
|
Too many files changed for review. ( |
|
Closing this PR because it looks dirty (too many unrelated or unexpected changes). This usually happens when a branch picks up unrelated commits or a merge went sideways. Please recreate the PR from a clean branch. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 692dea7fae
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| "compilerOptions": { | ||
| "rootDir": "." | ||
| }, | ||
| "include": ["./*.ts", "./*.mts", "./*.cts", "./src/**/*.ts", "./src/**/*.tsx"], |
There was a problem hiding this comment.
Exclude test-support files from extension TS project includes
The new project glob includes every src/**/*.ts file, which pulls in non-runtime helpers like extensions/telegram/src/test-support/write-skill.ts and extensions/telegram/src/test-support/inbound-context-contract.ts; those files import ../../../../src/... and immediately violate the new rootDir: "." boundary with TS6059. As a result, tsc -p extensions/telegram/tsconfig.json --noEmit now fails even when production plugin code is clean, so the boundary project is unusable for affected extensions.
Useful? React with 👍 / 👎.
| if (env?.[DISABLE_PLUGIN_SDK_DTS_ENV]?.trim()) { | ||
| return; |
There was a problem hiding this comment.
Honor the existing postinstall kill switch for DTS build
The new declaration-build step only checks OPENCLAW_DISABLE_PLUGIN_SDK_DTS_POSTINSTALL, but the script entrypoint now always calls it before runBundledPluginPostinstall, so setting the existing OPENCLAW_DISABLE_BUNDLED_PLUGIN_POSTINSTALL flag no longer disables all postinstall work. In source checkouts that rely on the legacy flag to keep installs side-effect-free, this unexpectedly runs tsc anyway (or emits warnings if TypeScript is unavailable).
Useful? React with 👍 / 👎.
4889f15 to
952e35c
Compare
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 952e35c1d9
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| /** Optional per-agent default verbose level. */ | ||
| verboseDefault?: "off" | "on" | "full"; |
There was a problem hiding this comment.
Remove duplicated verboseDefault field from AgentConfig
This commit adds a second verboseDefault property to AgentConfig, which causes TypeScript to emit TS2300: Duplicate identifier 'verboseDefault' when this type is compiled. Because src/config/types.agents.ts is part of the main source tree, normal typecheck/build workflows that include this file will fail until one of the duplicate declarations is removed.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 02e54a759c
ℹ️ 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".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| description: "Matrix channel plugin (matrix-js-sdk)", | ||
| register: registerMatrixCliMetadata, | ||
| }); | ||
| export { registerMatrixCliMetadata } from "./src/cli-metadata.js"; |
There was a problem hiding this comment.
Export a plugin entry from matrix cli-metadata module
In bundled cli-metadata mode, the loader always prefers cli-metadata.ts and resolves it through resolvePluginModuleExport, which only accepts a default function/exported definition with register/activate. This file now exports only registerMatrixCliMetadata, so the loader gets no register function and records the Matrix plugin as a load error (missing register/activate export), which prevents Matrix CLI metadata registration in that mode.
Useful? React with 👍 / 👎.
| "compilerOptions": { | ||
| "rootDir": "." | ||
| }, | ||
| "include": ["./*.ts", "./*.mts", "./*.cts", "./src/**/*.ts", "./src/**/*.tsx"], |
There was a problem hiding this comment.
Exclude Discord test-support files from tsconfig includes
This new include glob pulls src/test-support/component-runtime.ts into the package project, and that helper imports ../../../../src/plugins/conversation-binding.js and ../../../../src/security/dm-policy-shared.js outside the package root. With rootDir: ".", tsc -p extensions/discord/tsconfig.json --noEmit now hits TS6059 even when production plugin code is clean, so the boundary project is unusable for Discord until test-support files are excluded (fresh evidence beyond the existing Telegram comment: this same regression now occurs in Discord).
Useful? React with 👍 / 👎.
Summary
Describe the problem and fix in 2–5 bullets:
src/**by relative path, and package-localtsconfig.jsonfiles alone did not make TypeScript fail closed.tscfeedback, so boundary enforcement depended too heavily on custom scripts and convention.rootDir: ".", pointed extension TS resolution at emitted Plugin SDK declaration surfaces instead of rawsrc/plugin-sdk/*.ts, added explicitdevDependencies.openclaw = "workspace:*"for bundled plugins, and taught postinstall to build the declaration surface for source checkouts.extensions/tree into the root lint pipeline.Change Type (select all)
Scope (select all touched areas)
Linked Issue/PR
Root Cause (if applicable)
For bug fixes or regressions, explain why this happened, not just what changed. Otherwise write
N/A. If the cause is unclear, writeUnknown.rootDirboundary to reject relative escapes.tsconfig.jsonfiles existed only as topology on the earlier prototype branch; they did not yet combine declaration-based package resolution withrootDirenforcement.extensions/, so the default local loop did not surface these boundary breaks early enough.Regression Test Plan (if applicable)
For bug fixes or regressions, name the smallest reliable test coverage that should catch this. Otherwise write
N/A.src/plugins/contracts/extension-package-project-boundaries.test.tstest/extension-package-tsc-boundary.test.tssrc/plugins/contracts/plugin-sdk-package-contract-guardrails.test.tstest/scripts/postinstall-bundled-plugins.test.tsextensions/xaitypechecks cleanly when it only importsopenclaw/plugin-sdk/*and same-package files, but fails withTS6059when it imports../../src/cli/acp-cli.ts.User-visible / Behavior Changes
TS6059failures when a bundled plugin reaches outside its own package root by relative import.Diagram (if applicable)
Security Impact (required)
Yes/No) NoYes/No) NoYes/No) NoYes/No) NoYes/No) NoYes, explain risk + mitigation:Repro + Verification
Environment
extensions/xaidist/plugin-sdkdeclarationsSteps
./node_modules/.bin/tsc -p tsconfig.plugin-sdk.dts.json../node_modules/.bin/tsc -p extensions/xai/tsconfig.json --noEmit.extensions/xaiimporting../../src/cli/acp-cli.ts, rerun the xAI typecheck, and runnode scripts/check-extension-plugin-sdk-boundary.mjs --mode=relative-outside-package.Expected
tscand the boundary script.Actual
extensions/xaitypecheck passed.TS6059.src/cli/acp-cli.tsescape.Evidence
Attach at least one:
Human Verification (required)
What you personally verified (not just CI), and how:
./node_modules/.bin/tsc -p tsconfig.plugin-sdk.dts.json./node_modules/.bin/tsc -p extensions/xai/tsconfig.json --noEmit./node_modules/.bin/vitest run src/plugins/contracts/extension-package-project-boundaries.test.ts test/extension-package-tsc-boundary.test.ts test/scripts/postinstall-bundled-plugins.test.ts src/plugins/contracts/plugin-sdk-package-contract-guardrails.test.tsnode scripts/check-extension-plugin-sdk-boundary.mjs --mode=relative-outside-packagedist/plugin-sdk, rannode scripts/postinstall-bundled-plugins.mjs, then reran./node_modules/.bin/tsc -p extensions/xai/tsconfig.json --noEmitopenclaw/plugin-sdk/*imports still typecheck inextensions/xai../../src/cli/acp-cli.tsfails withTS6059pnpm checkpnpm testtscReview Conversations
If a bot review conversation is addressed by this PR, resolve that conversation yourself. Do not leave bot review conversation cleanup for maintainers.
Compatibility / Migration
Yes/No) YesYes/No) NoYes/No) NoRisks and Mitigations
List only real risks for this PR. Add/remove entries as needed. If none, write
None.devDependencies.openclaw, which could drift over time.src/plugins/contracts/plugin-sdk-package-contract-guardrails.test.tsnow enforces that contract.Post-Deploy Monitoring & Validation
No additional operational monitoring required. This PR changes local/compiler boundary enforcement and source-checkout bootstrap behavior, not runtime gateway behavior.