Skip to content

fix(kap-server): restrict debug RPC fallback to feature-contributed services - #2808

Open
sailist wants to merge 1 commit into
MoonshotAI:mainfrom
sailist:feat/event-subscription-introspection
Open

fix(kap-server): restrict debug RPC fallback to feature-contributed services#2808
sailist wants to merge 1 commit into
MoonshotAI:mainfrom
sailist:feat/event-subscription-introspection

Conversation

@sailist

@sailist sailist commented Aug 11, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

Follow-up to #2806 (merged as 8603549), addressing its Codex review finding (P2) that landed after the merge.

Problem

#2806 added a decorator-name fallback to the /api/v1/debug dispatcher so Feature-contributed services (which bypass the static scoped registry) remain callable. But the fallback resolved every decorator name, including kernel tokens that are seeded into each container yet were never registered as scoped services. Example: POST /api/v1/debug/instantiationService/dispose resolves the root container through the fallback and reflectively calls dispose() on it, tearing down the running server.

What changed

  • features/featureRegistry.ts gains a contributed-service table (recordContributedService / getContributedServices, deduped by scope + token); Feature.contributeService records every contribution there.
  • The dispatcher fallback (channelRegistry.resolveAnyScopedServiceId) now consults only that table instead of the global decorator registry: the reachable surface beyond the static registry is exactly "services a Feature explicitly contributed"; kernel tokens such as instantiationService stay unreachable. The now-unneeded lookupServiceDecorator export is removed.
  • Tests: a kap-server e2e regression asserting instantiationService/dispose is rejected with 40001, and a feature-assembly assertion that IDebugEventsService lands in the contributed-service table.

Checklist

  • I have read the CONTRIBUTING document.
  • I have linked a related issue, or explained the problem above.
  • I have added tests that prove my fix is effective or that my feature works.
  • Ran gen-changesets skill, or this PR needs no changeset.
  • Ran gen-docs skill, or this PR needs no doc update.

…ervices

The decorator-registry fallback resolved every decorator name, including
kernel tokens like instantiationService — a call to
instantiationService/dispose would tear down the root container. Record
Feature.contributeService tokens in a contributed-service table and fall
back to that table only, so runtime-contributed services stay callable
while unregistered kernel tokens remain unreachable.
@changeset-bot

changeset-bot Bot commented Aug 11, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 7352060

Merging this PR will not cause a version bump for any packages. If these changes should not result in a new version, you're good to go. If these changes should result in a version bump, you need to add a changeset.

This PR includes no changesets

When changesets are added to this PR, you'll see the packages that this PR includes changesets for and the associated semver types

Click here to learn what changesets are, and how to add one.

Click here if you're a maintainer who wants to add a changeset to this PR

@pkg-pr-new

pkg-pr-new Bot commented Aug 11, 2026

Copy link
Copy Markdown
pnpm dlx https://pkg.pr.new/@moonshot-ai/kimi-code@7352060
npx https://pkg.pr.new/@moonshot-ai/kimi-code@7352060

commit: 7352060

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant