Skip to content

fix(features): retract contributed service metadata - #2886

Merged
sailist merged 3 commits into
MoonshotAI:mainfrom
sailist:fix-feature-service-discovery-lifecycle
Aug 13, 2026
Merged

fix(features): retract contributed service metadata#2886
sailist merged 3 commits into
MoonshotAI:mainfrom
sailist:fix-feature-service-discovery-lifecycle

Conversation

@sailist

@sailist sailist commented Aug 13, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue.

Problem

Feature-contributed services are removed from the live DI scope when their Feature unloads, but their debug discoverability metadata remained registered. This left the debug channel registry advertising services that could no longer resolve.

What changed

  • Tie contributed-service metadata to the contributing Feature lifecycle.
  • Remove metadata when the Feature provider unloads.
  • Reject duplicate providers for the same service and scope while the original provider is live.
  • Cover Feature unload, duplicate registration, and kap-server debug channel lookup behavior.

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 feature works.
  • Ran gen-changesets skill, or this PR needs no changeset. This is an internal agent-core-v2 lifecycle fix.
  • Ran gen-docs skill, or this PR needs no doc update.

- tie contributed service discovery to feature disposal
- reject duplicate providers for the same scope and service
- cover feature unload and debug channel resolution
@changeset-bot

changeset-bot Bot commented Aug 13, 2026

Copy link
Copy Markdown

⚠️ No Changeset found

Latest commit: 2eb92d9

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 13, 2026

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

commit: 2eb92d9

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

Copy link
Copy Markdown

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: b53d7bb723

ℹ️ About Codex in GitHub

Codex has been enabled to automatically 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 👍.

When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".

Comment on lines +42 to +43
if (_contributedServices.some((entry) => entry.scope === scope && entry.id === id)) {
return;
throw new Error(`Service ${String(id)} is already contributed at scope ${scope}`);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

P2 Badge Allow duplicate metadata across App roots

When two independent App scopes are alive in the same process, the second FeatureAssemblyService run contributes the same built-in service ids again, but this module-global duplicate check now throws before the second root can finish assembling. The DI providers themselves are scoped per App root; only this debug metadata table is global, so concurrent test hosts/servers or a same-name feature replacement can fail even though the original provider is unrelated to the new root. Consider tracking provider ownership/refcounts and de-duping only in the debug lookup instead of rejecting the second live record.

AGENTS.md reference: packages/agent-core-v2/AGENTS.md:L18-L22

Useful? React with 👍 / 👎.

- remove the global contributed-service test reset
- keep provider cleanup local to each regression test
- store feature service metadata in the app-local collection tree
- bind debug lookup and test overrides to the owning app root
- keep duplicate provider activation atomic within one app
@sailist
sailist merged commit 4425409 into MoonshotAI:main Aug 13, 2026
14 checks passed
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