fix(kap-server): defer global search activation - #2376
Open
linxule wants to merge 1 commit into
Open
Conversation
|
linxule
marked this pull request as ready for review
July 29, 2026 16:05
linxule
added a commit
to linxule/kimi-plugin-cc
that referenced
this pull request
Jul 29, 2026
KIMI_TESTED_MINORS gains {0,30}; the H9 out-of-range warning stops firing.
The substantive change is not the certification -- it is the discovery that
the evidence backing it was worthless.
An exact-0.30.0 smoke:real had already passed 10/0/43. It proved nothing
about the one behavior in question: every isolated KIMI_CODE_HOME is created
empty, kimi-code's cross-session indexer short-circuits on zero sessions, so
the path exited before doing anything. Nothing in the harness checked that
its own premise held. A green test whose precondition never held is worse
than a red one -- it reads as evidence. The new populated-home case asserts
its precondition (wire.jsonl count > 0) and fails loudly instead of passing
quietly. That is now a standing rule in AGENTS.md, because the failure mode
is generic to any smoke whose behavior depends on host state.
The test pins the invariant, not the side effect: writes stay denied under a
populated home, agent-core-v2 genuinely served the run, and no search index
ever appears in the workspace -- while only RECORDING whether
<KIMI_CODE_HOME>/search-index materialized. Asserting its absence would
encode an upstream bug as a plugin failure; asserting its presence would
break the day the upstream fix ships.
Exact-0.30.0 smoke:real GREEN: 11 pass / 0 fail, 49 assertions in 348.05s,
and non-vacuous this time (index PRESENT, wire files=1). Write-swarm stayed
confined (patchBytes=334, userTreeClean=true, worktreeCleaned=true).
The source audit was re-run against 0.30.0 rather than inheriting the daily
monitor's verdict -- monitor reports are continuity-only and do not certify
a version. Every load-bearing contract holds. The deepest check: agent.hooks
is OPTIONAL, so an unwired subagent would silently fail open through policy
index 0; it is wired unconditionally by createAgent's
`config.hookEngine ?? this.hookEngine` fallback, and no production call site
supplies config.hookEngine.
Scope correction worth recording: the audit clone's package.json reads
0.30.0, but origin/main is eight commits ahead of the released tag. Custom
agent files, plugin-contributed agents, plugin systemPrompt, and the
secondary-model flag are all queued for 0.31.0 and are NOT in the shipped
binary. Auditing the wrong tree would have certified behavior users do not
have.
0.30.0 carries one characterized caveat: experimental-v2 App bootstraps
eagerly activate the KAP global-search service, creating
<KIMI_CODE_HOME>/search-index. Engine-internal (never a tool call), confined
to KIMI_CODE_HOME, and the default v1 engine is unaffected -- not a hook
bypass, worktree write, or credential read. Root-caused and fixed upstream
by MoonshotAI/kimi-code#2376, which flips the registration to App-scope
OnDemand.
Residual, stated rather than buried: write-swarm still runs against a
session-less home, so "an un-awaited index sync cannot race the patch
capture" is composed from two tests rather than observed end to end in one.
Before certifying 0.31.0: v1 custom agent files will auto-scan project roots
with no flag gating, and an override:true file can replace the default agent
profile. AgentFileDefinition carries no permission/hook/cwd field, so it
reshapes the system prompt and tool list only and our label allowlist fails
closed -- a prompt-injection surface for repo-scoped rescue/swarm-write, not
a hook bypass. It needs a docs/safety.md paragraph before 0.31 lands.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Related Issue
None. This is a focused, reproducible bug fix.
Problem
IGlobalSearchServiceis registered through the CLI's unconditional web-commandimport chain. With
OnScopeCreated, experimental-v2 App bootstraps—includingkimi -pand v2 SDK/TUI clients—constructed it without a KAP server and startedcross-session indexing under
<KIMI_CODE_HOME>/search-index.The default v1 engine is unaffected.
What changed
OnDemand.kimi webbehavior through its existing explicit service resolution.Verification
OnDemand; matchedOnScopeCreatedcontrol created the index within 1 second.
OnScopeCreatedfailed the zero-call assertion;OnDemandpassed.No changeset is needed under
gen-changesetsCore Rule 6: shippedkimi webbehavior is unchanged, while the corrected behavior is limited to experimental-v2
surfaces with no documented configuration. No user-facing docs cover this feature.
Checklist
gen-changesetsskill, or this PR needs no changeset.gen-docsskill, or this PR needs no doc update.