Skip to content

fix: unblock plugin-sdk channel runtime context dts build#64972

Closed
100yenadmin wants to merge 0 commit into
openclaw:mainfrom
electricsheephq:fix/shared-ci-channel-runtime-context
Closed

fix: unblock plugin-sdk channel runtime context dts build#64972
100yenadmin wants to merge 0 commit into
openclaw:mainfrom
electricsheephq:fix/shared-ci-channel-runtime-context

Conversation

@100yenadmin

Copy link
Copy Markdown
Contributor

Summary

  • fix the shared plugin-sdk/channel-runtime-context declaration build break now reproducing on current main
  • keep the public plugin-sdk surface stable while avoiding the current type re-export resolution failure
  • unblock the rebased GPT-5.4 parity PR wave from inheriting unrelated red CI

What changed

  • keep the runtime-context value exports forwarded from src/plugin-sdk/channel-runtime-context.ts
  • define the exported ChannelRuntimeContextKey shape directly in the plugin-sdk surface instead of relying on the failing type re-export path

Validation

  • pnpm exec tsc -p tsconfig.plugin-sdk.dts.json --pretty false
  • CI=1 pnpm exec vitest run src/infra/channel-runtime-context.test.ts
  • pnpm build

Scope

This is a narrow shared unblock PR only. It does not change strict-agentic behavior, parity scenarios, docs workflow behavior, or provider mock logic.

Copilot AI review requested due to automatic review settings April 11, 2026 18:42
@greptile-apps

greptile-apps Bot commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

Greptile Summary

Fixes the plugin-sdk/channel-runtime-context DTS build break by removing the chained type ChannelRuntimeContextKey re-export (which the declaration emitter could not resolve) and replacing it with an inline type definition that is structurally identical to the canonical shape in src/channels/plugins/channel-runtime-surface.types.ts. Value exports are unchanged.

Confidence Score: 5/5

Safe to merge — the inline type matches the canonical definition exactly and value exports are untouched.

The only finding is a P2 style suggestion about adding a compile-time drift guard; there are no correctness, data-integrity, or runtime issues introduced by this narrow fix.

No files require special attention.

Prompt To Fix All With AI
This is a comment left during a code review.
Path: src/plugin-sdk/channel-runtime-context.ts
Line: 7-11

Comment:
**Type drift risk from manual duplication**

The inline definition is currently byte-for-byte identical to `ChannelRuntimeContextKey` in `src/channels/plugins/channel-runtime-surface.types.ts`, but there's no enforcement keeping them in sync. If `accountId` is tightened, `capability` is narrowed, or a new required field is added to the canonical type, plugin authors will continue to compile against the stale plugin-sdk shape while the infra functions internally accept the updated type — leading to a structural mismatch that TypeScript's duck-typing may not immediately surface.

Consider adding a compile-time assertion near this definition to catch drift early:

```typescript
import type { ChannelRuntimeContextKey as _CanonicalKey } from "../channels/plugins/channel-runtime-surface.types.js";
// Ensure the plugin-sdk shape stays structurally compatible with the internal canonical type.
type _AssertCompat = _CanonicalKey extends ChannelRuntimeContextKey ? ChannelRuntimeContextKey extends _CanonicalKey ? true : never : never;
```

This is a pure type-level check (erased at emit) and wouldn't reintroduce the broken re-export path that triggered the DTS failure.

How can I resolve this? If you propose a fix, please make it concise.

Reviews (1): Last reviewed commit: "fix: stabilize plugin sdk channel runtim..." | Re-trigger Greptile

Comment thread src/plugin-sdk/channel-runtime-context.ts Outdated

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Fixes the plugin-sdk/channel-runtime-context declaration (.d.ts) build break by keeping the runtime exports forwarded while defining the ChannelRuntimeContextKey type locally in the plugin-sdk surface, avoiding the failing type re-export.

Changes:

  • Stop re-exporting ChannelRuntimeContextKey from ../infra/channel-runtime-context.js.
  • Define ChannelRuntimeContextKey directly in src/plugin-sdk/channel-runtime-context.ts while continuing to forward runtime-context value exports.

Comment thread src/plugin-sdk/channel-runtime-context.ts Outdated

Copy link
Copy Markdown
Contributor Author

Current head b4bcc34938 keeps PR N narrowly on the shared blocker it was opened for.

What changed on top of the original unblock:

  • plugin-sdk still defines ChannelRuntimeContextKey inline so the d.ts build no longer depends on the broken internal re-export
  • a type-only import + compile-time compatibility assertion now pins that inline shape to the canonical internal key type, so we don’t trade the build fix for silent drift later

Local validation passed:

  • pnpm exec tsc -p tsconfig.plugin-sdk.dts.json --pretty false
  • CI=1 pnpm exec vitest run src/infra/channel-runtime-context.test.ts

This remains intentionally narrow shared-CI/typecheck cleanup, not parity logic or runtime-slice scope.

@mjamiv

mjamiv commented Apr 11, 2026

Copy link
Copy Markdown
Contributor

Confirmed on main @ 462d8e3b. pnpm exec tsc -p tsconfig.plugin-sdk.dts.json fails with the ChannelRuntimeContextKey re-export resolution error at src/plugin-sdk/channel-runtime-context.ts:5. Applying this patch locally clears it. Defining the exported ChannelRuntimeContextKey shape directly (instead of routing through the re-export) is the right shape for the dts builder — narrow unblock looks correct.

Copy link
Copy Markdown
Contributor Author

Current head bd122aaabe now covers the shared channel-runtime/typecheck drift that was reproducing across the open parity branches.

Latest local validation:

  • pnpm build:plugin-sdk:dts
  • CI=1 pnpm exec vitest run src/infra/channel-runtime-context.test.ts src/gateway/server-channels.test.ts (18 tests)

This head now includes:

  • the plugin-sdk/channel-runtime compatibility assertion
  • the gateway server-channels test type update to ChannelRuntimeSurface
  • the shared OpenClawConfig and loaded-channel typing fixes that rebased branches were inheriting from main

The remaining local pnpm check failure is a separate extensions/msteams/src/sdk.ts optional-dependency issue (@azure/identity) and no longer the channel-runtime blocker this PR was opened to fix.

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: bd122aaabe

ℹ️ 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".

Comment on lines +20 to +25
type _AssertChannelRuntimeContextKeyCompat =
CanonicalChannelRuntimeContextKey extends ChannelRuntimeContextKey
? ChannelRuntimeContextKey extends CanonicalChannelRuntimeContextKey
? true
: never
: never;

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Make compatibility check fail when key types diverge

The _AssertChannelRuntimeContextKeyCompat alias does not actually enforce compatibility: if either extends check fails, the alias simply becomes never, which TypeScript accepts without an error. That means ChannelRuntimeContextKey can silently drift from the canonical key type in channel-runtime-surface.types.ts, and plugin-sdk consumers could compile against a stale contract until runtime behavior diverges. Use an assertion pattern that must resolve to true (for example via a constrained generic or value assignment) so mismatches fail the build.

Useful? React with 👍 / 👎.

@100yenadmin
100yenadmin force-pushed the fix/shared-ci-channel-runtime-context branch from bd122aa to 65267c1 Compare April 11, 2026 23:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling gateway Gateway runtime size: XS

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants