Skip to content

fix: align datasource plugin environment#595

Open
7Sageer wants to merge 2 commits into
MoonshotAI:mainfrom
7Sageer:fix/datasource-env-oauth
Open

fix: align datasource plugin environment#595
7Sageer wants to merge 2 commits into
MoonshotAI:mainfrom
7Sageer:fix/datasource-env-oauth

Conversation

@7Sageer

@7Sageer 7Sageer commented Jun 9, 2026

Copy link
Copy Markdown
Collaborator

Related Issue

No linked issue. This PR addresses a focused datasource plugin environment mismatch.

Problem

When Kimi Code runs against a non-default managed environment, the official Kimi Datasource plugin needs to use the same service endpoint and the OAuth credentials from the matching environment-scoped credential slot. Without that, datasource calls can read the wrong token file or continue targeting the default service endpoint.

What changed

  • Inject the active managed Kimi Code base URL and OAuth host into the official datasource plugin MCP server.
  • Teach the datasource plugin to derive its /tools endpoint from KIMI_CODE_BASE_URL and resolve the same environment-scoped credential name used by managed OAuth login.
  • Bump the datasource plugin to 3.1.2 and update its plugin metadata, changelog, skill instructions, docs, and release changeset.
  • Add coverage for persisted environment injection and the real datasource MCP subprocess using env-scoped credentials.

Verification

  • pnpm exec vitest run test/rpc/plugins-rpc.test.ts from packages/agent-core
  • pnpm exec vitest run test/utils/kimi-datasource-plugin.test.ts from apps/kimi-code
  • pnpm --dir docs build
  • git diff --check

Note: I ran the gen-docs workflow, but its documented docs/scripts/sync-changelog.mjs prerequisite is not present in this checkout. The affected bilingual docs page was updated directly and the docs build passes.

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.
  • Ran gen-docs skill, or this PR needs no doc update.

@changeset-bot

changeset-bot Bot commented Jun 9, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 18590ed

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 2 packages
Name Type
@moonshot-ai/kimi-code Patch
@moonshot-ai/agent-core Patch

Not sure what this means? Click here to learn what changesets are.

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

@pkg-pr-new

pkg-pr-new Bot commented Jun 9, 2026

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

commit: 18590ed

Pin the datasource credential-name test to the canonical
resolveKimiCodeOAuthKey so a digest drift in the standalone plugin
fails CI, and drop the hardcoded plugin-name special case so every
stdio plugin receives the active managed Kimi base URL / OAuth host
consistently (process.env and KIMI_CODE_HOME are already shared with
all plugins).
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