Repository navigation
refactor(sdk): retire deprecated Copilot token exchange - #163587
Conversation
|
🦞👀 Pull request received. I will update this pull request when review starts. ClawSweeper review completeClawSweeper finished reviewing this revision. The review result is being finalized. |
|
Codex review: needs maintainer review before merge. Reviewed October 2, 2026, 2:47 PM ET / 18:47 UTC (Revision 5). ClawSweeper reviewWhat this changesThe PR removes four deprecated Copilot authentication SDK exports, their token-exchange cache and exclusive tests, documents plugin migration, and tightens SDK budgets. Merge readiness✅ Ready for maintainer review This remains useful cleanup absent from main and the latest stable release. No actionable introduced defect was found, and the captured native verification evidence resolves the previous API-acknowledgement blocker. Priority: P2 Review scores
Verification
How this fits togetherThe provider-auth SDK supplies authentication helpers to plugins. The supported GitHub Copilot plugin separately validates credentials and resolves the account endpoint used for model requests. flowchart TD
A[Plugin imports] --> B[Provider authentication SDK]
B --> C[Supported authentication hooks]
D[GitHub credential] --> E[Copilot provider]
E --> F[Account validation]
F --> G[Model API endpoint]
Before mergeNone. Agent review detailsSecurityNone. PR surfaceSource -454, Tests -823, Docs +11, Other -3. Total -1269 across 10 files. View PR surface stats
Review metrics
Technical reviewBest possible solution: Complete the documented SDK retirement while keeping provider-owned authentication and existing stored credentials intact. Do we have a high-confidence way to reproduce the issue? Not applicable: this retires a deprecated implementation rather than fixing a reported current bug. Is this the best way to solve the issue? Yes: removing the unused exchange and its exclusive helpers leaves the supported provider authentication owner intact. AGENTS.md: found and applied where relevant. Codex review notes: model internal, reasoning medium; reviewed against 72dfbb85f7f8. LabelsLabel changes: No label changes. Label justifications:
EvidenceWhat I checked:
Likely related people:
Rating scale
Overall follows the weaker of proof and patch quality. Workflow
HistoryReview history (4 earlier review cycles)
|
…a dated compat record (#167036) 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: - 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 0d530ea (`removeAfter` 2026-10-01). - 14 later named-export removals from surviving subpaths (2fec39f #165431, bd64d93 #165288, f2de06b #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 cfee851 (#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`: `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.
…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.
What Problem This Solves
The public SDK still carried a deprecated GitHub Copilot token exchange and cache alongside the provider-owned authentication flow.
User Impact
Removes
DEFAULT_COPILOT_API_BASE_URL,deriveCopilotApiBaseUrlFromToken,resolveCopilotApiToken, andCachedCopilotTokenfromopenclaw/plugin-sdk/provider-auth. Plugins importing these exports must migrate before updating the host.normalizeGithubCopilotDomainremains supported.The current GitHub Copilot plugin continues to validate the original credential through
/copilot_internal/user. This change does not rewrite credentials, alter schemas, delete existing cache rows, or change that provider's authentication flow.Why This Change Was Made
The old SDK implementation independently called
/copilot_internal/v2/tokenand maintained an exchange cache, while the current provider owns authentication and account endpoint resolution. Delete that unused implementation and its exclusive proxy-token/cache helpers and tests. Preserve domain normalization, current credential/profile behavior, and unrelated SDK exports.These exact exports were annotated deprecated in
ccf0b96a5635, first shipped in stablev2026.5.12. The July 25 compatibility registry, first shipped inv2026.8.1, set October 1 as the earliest removal date with a published-reader condition. The scoped artifact audit found no reader of the four SDK exports; the provider-local constant with the same name is distinct and retained.Production (
src/**andextensions/**, excluding tests/support/fixtures): +1 / -455 / net -454. The surface owner also receives four measured, shrink-only ratchet updates.Evidence
Codex autoreview of the source and generated budget change passed at P2. The subsequent max-lines and assertion-safety baseline cleanups each received a clean P2 review. The final head is
519621aea87b11ed355c8808c32f0797619b7a35.The published-reader audit inspected 43 integrity-verified archives on Testbox lease
tbx_01m3yg7fwandf3eb3rtjv44gta: core 2026.9.7, eleven official standalone packages, and 31 selected third-party artifacts. None of the 42 non-core artifacts contained the four candidate export names. Core occurrences were inspected, including all three large worker bundles; the provider-local constant is distinct and retained. This is a bounded audit, not universal ecosystem absence.Native surface collection measured public exports 3635 → 3631, callable exports 2109 → 2107, and deprecated exports 137 → 133. The generated global deprecated cap 141 → 137 preserves four entries of unrelated headroom; the
provider-authdeprecated cap changes 19 → 15. Base/candidate collection cost was 7.12 s / 7.15 s. The surface check passed in 7.40 s and the existing surface-owner suite passed 11 tests, 17.00 s wall with--maxWorkers=1.The actual native API acknowledgement and surface verification passed on AWS lease
cbx_70286bb7120a, runrun_7c76556560f687af8d48e4bd7f4bdba8, at prior headaf29a78a6095a995fecc3a3e246ebaf358927de5: 251.80 s for API acknowledgement and 6.98 s for the surface check. The API report contains the four documented export removals, 154 reachable declaration changes, and no entrypoint additions/removals. Approved and natively accepted digest:0a489f1c95305d7794c80e20e84d7799061201b9a2f5f9e17a47634e3cdf3959(0a489f1c).Those original artifacts remain prior-head evidence. The complete
af29a78a6095→519621aea87bdelta is exactly three obsolete baseline entries removed from two files:provider-auth.test.tsfromconfig/max-lines-baseline.txt, and the retired assertions forprovider-auth-copilot-cache.tsandprovider-auth.tsfromconfig/assertion-safety-baseline.txt. No other bytes or file modes changed. API/surface source inputs are identical, so the accepted evidence is reused with this inspected mechanical-delta qualification; it has not been restamped as a new-head API run.Current-Head CI and Focused Coverage
CI run 37044695728 passed for PR head
519621aea87b11ed355c8808c32f0797619b7a35. Lint, production/test types, runtime topology, package boundaries, and the CI gate passed. The package-boundary job explicitly selected GitHub Copilot through itsprovider-authimport, compiled 31 plugins, and produced current-run SDK declarations (sdk-declarations-37044695728-1). This validates the hosted PR merge candidate and the selected SDK/package build boundary; it is not a claim that a standalonepnpm buildran.src/plugin-sdk/provider-auth.test.tssrc/plugins/compat/registry.test.tsextensions/github-copilot/auth.test.tsextensions/github-copilot/provider-auth.contract.test.tsextensions/github-copilot/domain.test.tsThe extension bundle also passed all 20 reported Copilot stream cases. Under the maintainer-authorized pure-deletion CI fallback, the completed hosted checks, retained SDK tests, and package compilation cover their selected gates. The three provider-specific suites ran with
pnpm test <file> --maxWorkers=1on native Hetzner leasecbx_4bd8b1e038b0, runrun_63fbd4b4d3938e7cf44878d025dbc70d, against the exact final head after its frozen install. That command passed in 118.872 s, including its identity and clean-tree checks. No repeat full checks, build, API report, or surface verification was needed for unchanged inputs.The two encountered ratchet failures were owned cleanup defects: deleting the obsolete implementation/tests left stale exemption entries. The final commits remove those exact entries; no assertions were weakened, no timeouts increased, and no retry was used to conceal a failure. Formatting and
git diff --checkpassed. No local tests, builds, or typechecks ran.Update Behavior
This diff retires deprecated SDK exports and their exclusive helpers. It changes no updater, Doctor, migration, plugin-loader, service-lifecycle, or storage-schema implementation, and adds no persisted-state rewrite or cache deletion. The supported Copilot authentication owner is unchanged. No published-driver 2026.9.7 update cell is required for this deletion-only scope. Plugins importing the removed exports must apply the documented import/auth-owner migration before updating the host.