fix(kimi-code): drop matchers on the matcher-less Kimi Code events - #2639
Merged
Conversation
Kimi Code's Event Reference documents Stop, SessionHeartbeat, and Interrupt as matching an empty string, so a matcher on those events is a dead field. Drop it with a warning at emission time, keyed on the native event name since SessionHeartbeat and Interrupt are only reachable through a kimi-code override. Closes #2615
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.
Premise correction
The issue is right that rulesync emits
matcheron Kimi Code events that cannot use one, but it names the wrong event set. Verified directly against the upstream Event Reference table (source):Stop,SessionHeartbeat, andInterrupt.PermissionResultmatches "Tool name", so a matcher there is meaningful. The issue lists it as matcher-less; it is not, and this PR keeps matchers on it.Stop, which genuinely is matcher-less.This PR therefore implements the corrected set rather than the one in the issue body.
Change
src/features/hooks/kimi-code-hooks.tsis a bespoke converter — it does not go throughtool-hooks-converter.ts, so the sharednoMatcherEventsmechanism does not apply. Added a localKIMI_CODE_NO_MATCHER_EVENTSset and aresolveMatcherParthelper used at the emission site: when the event is in the set and the definition carries a matcher, the matcher is skipped and a warning is logged with the same wording the shared converter uses (tool-hooks-converter.ts:806-810).The set is keyed on native event names because the check runs after the canonical → native mapping, and
SessionHeartbeat/Interrupthave no canonical counterpart at all — they are only reachable through a per-toolkimi-codeoverride naming them directly.Claude Code's
CLAUDE_NO_MATCHER_EVENTSis deliberately not reused: Kimi Code'sUserPromptSubmitmatches the submitted prompt text, which Claude's does not, so the two sets are genuinely different.The import path still preserves matchers, matching the asymmetry already documented at
tool-hooks-converter.ts:843.Tests
Added to
kimi-code-hooks.test.ts: one case asserting all three matcher-less events drop the matcher and warn, and one asserting matchers survive onPermissionRequest,UserPromptSubmit,StopFailure, andPermissionResultwith no warning at all.Verification
pnpm cichecknpx vitest run --config vitest.e2e.config.ts src/e2e/e2e-hooks.spec.tsCloses #2615