Skip to content

fix(kimi): proven-empty manifest selection and read-only native projection - #462

Merged
777genius merged 3 commits into
mainfrom
fix/kimi-manifest-mcp-selection
Oct 20, 2026
Merged

777genius merged 3 commits into
mainfrom
fix/kimi-manifest-mcp-selection

Conversation

@777genius

@777genius 777genius commented Oct 20, 2026 •

Copy link
Copy Markdown
Owner

Summary

A skills-only Kimi package projects .kimi-plugin/plugin.json that declares "mcpServers" only when servers were selected. The managed MCP selection reader treated a verified document without that member as unrecognizable shape and refused every no-change update with "refusing silent update before previous MCP selection can be verified". Two more gaps on the same path surfaced once that gate passed:

  • the Kimi adapter never implemented the read-only native projection that a no-change update of a native-config lifecycle client requires, failing the update with "client "kimi" has no read-only native projection";
  • the group flow persisted the empty activation outcome of that pre-activation failure, which the state store then refused as an unknown lifecycle state — masking the real error as "refuse invalid state" and leaving remaining targets "not attempted".

Changes:

  • clients.SelectionLayout.ServersMemberOptional: a selection document that declares "mcpServers" conditionally records a verified document without the member as a proven empty selection; dedicated selection documents keep failing closed on a missing member.
  • clients/kimi: implements clients.ActiveNativeProjector. Everything Kimi owns — the projected manifest included — lives inside the digest-verified managed package directory, so the read-only projection revalidates the committed manifest identity and rebuilds no external ownership.
  • usecase/group_activate.go: a projection failure before activation preserves the recorded lifecycle and acknowledged objects (NativeEffectUnchanged, matching the refused-prepared-activation precedent) instead of persisting an empty outcome, so the report carries the projection error and remaining targets are not stopped by a bogus persist failure. A failed attempt no longer claims a mutation: only a successful re-activation of an incomplete projection marks the target changed.

Verification

Discriminating pairs — each test fails on pristine 37682cf for the exact bug and passes on this branch:

  • TestManifestSelectionWithoutServersMemberIsProvenEmpty (providers) — pre-fix fails with "managed MCP selection lacks mcpServers"; post-fix the kimi skills-only manifest is accepted as a proven empty selection.
  • TestProjectActiveNativeRevalidatesManifestIdentityWithoutWriting (clients/kimi) — does not compile before the adapter gained the capability; identity drift fails the read-only projection.
  • TestGroupedKimiNoChangeUpdateRunsReadOnlyNativeProjection (usecase) — pre-fix fails with "managed MCP selection lacks mcpServers"; post-fix the no-change update completes with no_change, zero receipts, no claimed mutation and byte-identical state.
  • TestGroupedProjectionFailurePreservesRecordedLifecycle (usecase) — pre-fix fails with the masked "refuse invalid state: ... unknown lifecycle state" and a false mutated=true on a path that wrote nothing; post-fix the projection error surfaces, the stage is not "persist", and the recorded lifecycle is preserved.

Complement guards (pass before and after; they pin the fix against over-broadening): TestDedicatedSelectionStillFailsClosedWithoutServersMember (a dedicated selection document without its member is still unrecognizable shape), TestManagedMCPSelectionRequiresExactArtifact including the kimi layout.

End-to-end on macOS with a clean agentplugins 0.1.88 build over a 13-client lifecycle cycle (codex, cursor, copilot, vscode, kiro, claude, gemini, opencode, cline, windsurf, grok, kimi, qoder):

  • add: 13/13 external_completed, grok/kimi/qoder activation active;
  • update with identical revision: 13/13 no_change=true mutated=false receipts=0 failure=null, including kimi and qoder, with before/after filesystem snapshots IDENTICAL — the direct counterpart of the pre-fix failure "refuse invalid state" that also stopped qoder ("not attempted");
  • remove sequence → empty list → doctor success.

Full Go suite: failure set identical to the pristine baseline (35 pre-existing darwin-local failures, no new ones). The three review findings (refused-prepared-activation NativeEffect precedent, contradictory Mutated/NoChange flags on a failed no-change projection, missing ctx check in the new projector) are addressed in the follow-up commit; a second follow-up splits the managed MCP selection parsing into focused helpers to satisfy the CI complexity gate and wraps its JSON errors with %w (verified behavior-preserving: selection tests and full providers failure set match the baseline).

Release Impact

Adapter and usecase only; no public JSON capabilities contract changes (SelectionLayout is installer policy and is not serialized). Released as agentplugins 0.1.88; registry CLI pin and binary digest bump follow in the registry PR.

Summary by CodeRabbit

  • New Features

    • Kimi projects with no selected servers are now recognized as valid empty selections.
    • Read-only validation now confirms Kimi manifest identity without modifying files.
  • Bug Fixes

    • Unchanged grouped updates avoid unnecessary mutations, receipts, and state rewrites.
    • Projection failures now report the original error while preserving lifecycle and native-object state.
    • Invalid dedicated selection documents continue to fail safely when required server data is missing.

…projection read-only

A skills-only Kimi package projects a manifest that declares "mcpServers"
only when servers were selected, so the managed selection reader treated a
verified projection as unrecognizable shape and refused every no-change
update. The same update path also required a read-only native projection
that the Kimi adapter never implemented, and the group flow persisted the
empty outcome of that early failure, which the state store then refused as
an unknown lifecycle state.

- selection documents that declare "mcpServers" conditionally record a
  verified document without the member as a proven empty selection;
  dedicated selection documents keep failing closed
- Kimi implements the read-only native projection by revalidating the
  committed manifest identity; everything it owns lives inside the
  digest-verified managed package directory
- a projection failure before activation preserves the recorded lifecycle
  so the report carries the projection error instead of a state refusal
@coderabbitai

coderabbitai Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration
  • Configuration used: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: 6603a5f3-3e7c-400f-9f86-07602bc23b9f
📥 Commits

Reviewing files that changed from the base of the PR and between 3dad336 and dff3ef8.

📒 Files selected for processing: 4
  • install/integrationctl/agentplugins/clients/kimi/project.go
  • install/integrationctl/agentplugins/providers/managed_selection.go
  • install/integrationctl/agentplugins/usecase/group_activate.go
  • install/integrationctl/agentplugins/usecase/group_test.go

Included review availability: This review used your included allowance. Your plan provides up to 1 included review per hour; 0 remain after this review.

📝 Walkthrough

Kimi managed manifests can omit mcpServers to represent an empty selection. Kimi now supports read-only native projection, and grouped updates preserve lifecycle outcomes when projection fails.

Changes: Kimi managed selection and projection

Layer / File(s) Summary
Optional MCP selection
install/integrationctl/agentplugins/clients/identity.go, install/integrationctl/agentplugins/clients/kimi/adapter.go, install/integrationctl/agentplugins/providers/managed_selection.go, install/integrationctl/agentplugins/providers/managed_selection_test.go
SelectionLayout now identifies when a nested manifest may omit mcpServers. Kimi enables this option. Selection parsing verifies the artifact before and after reading, handles missing files and invalid shapes, sorts names, and preserves fail-closed behavior for dedicated selection documents.
Read-only Kimi native projection
install/integrationctl/agentplugins/clients/kimi/project.go, install/integrationctl/agentplugins/clients/kimi/kimi_test.go
ProjectActiveNative checks cancellation, verifies the declared manifest, and returns no native ownership without writing. Tests cover unchanged and identity-mismatched manifests.
Grouped update outcome handling
install/integrationctl/agentplugins/usecase/group_activate.go, install/integrationctl/agentplugins/usecase/group_test.go
Projection errors return the managed lifecycle outcome with native effect unchanged. Failed activations retain noChange. Tests cover no-change updates, read-only projection failures, and preservation of persisted lifecycle state.

Priority: ⬇️ Low

Estimated code review effort: 3 (Moderate) | ~20 minutes

Change: Bug fix

Merge Risk: ⚪ Minimal · up to dff3e

No actionable merge-blocking risk was established for the Kimi selection and projection changes.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 27.27% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 11 functions across 8 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly identifies the two main changes: proven-empty Kimi manifest selection and read-only native projection.
Description check Passed The description is complete and directly addresses the required summary, verification, and release impact sections. It explains the root causes, implementation changes, focused tests, end-to-end resul…
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Full details: Description check

Explanation

The description is complete and directly addresses the required summary, verification, and release impact sections. It explains the root causes, implementation changes, focused tests, end-to-end results, and release considerations. It does not use the template checkbox format, but it provides equivalent verification details and is sufficiently complete.

  • Fix all pre-merge checks with AI
✨ Finishing Touches: 💡 1
📝 Generate docstrings: 💡
  • Commit to this branch
  • Create a new PR
🧪 Generate unit tests (beta)
  • Commit to this branch
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

A rabbit reads each line,
The patch grows clear beneath the moon,
Small changes hop in place,
Tests guard the garden path,
Reviews bloom before the dawn.

Comment @coderabbitai help to get the list of available commands.

@codecov

codecov Bot commented Oct 20, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 61.22449% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 62.77%. Comparing base (37682cf) to head (dff3ef8).
⚠️ Report is 5 commits behind head on main.

Files with missing lines Patch % Lines
...ionctl/agentplugins/providers/managed_selection.go 57.89% 8 Missing and 8 partials ⚠️
...ntegrationctl/agentplugins/clients/kimi/project.go 66.66% 1 Missing and 1 partial ⚠️
...ntegrationctl/agentplugins/clients/kimi/adapter.go 0.00% 1 Missing ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##             main     #462   +/-   ##
=======================================
  Coverage   62.76%   62.77%           
=======================================
  Files        1595     1595           
  Lines       91851    91874   +23     
=======================================
+ Hits        57654    57676   +22     
- Misses      25961    25962    +1     
  Partials     8236     8236           

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

…ation

A projection failure happens before the adapter can run: keep the recorded
lifecycle and acknowledged objects with NativeEffectUnchanged instead of
persisting an empty outcome, and only mark a no-change target mutated when
an incomplete projection actually re-activated successfully.
… lint

Split ManagedMCPNames into focused helpers to stay under the complexity
gate, wrap JSON errors with %w (errorlint), and keep the nil-map reset so
nested unmarshal replaces rather than merges server keys.
@777genius
777genius merged commit 24a69f4 into main Oct 20, 2026
55 checks passed
@777genius
777genius deleted the fix/kimi-manifest-mcp-selection branch October 20, 2026 14:22
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