fix(hook): fix UserPromptSubmit payload to capture input text instead of empty string#2305
Open
AkaCoder404 wants to merge 2 commits into
Open
fix(hook): fix UserPromptSubmit payload to capture input text instead of empty string#2305AkaCoder404 wants to merge 2 commits into
AkaCoder404 wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes the UserPromptSubmit hook payload so hooks and matchers receive the actual user-entered prompt text when the shell UI passes input as list[ContentPart] instead of a plain string (resolves #2303).
Changes:
- Extract hook
prompt/matcher_valuefrom non-stringuser_inputviaMessage.extract_text(...)inKimiSoul.run(). - Add a regression test ensuring
UserPromptSubmitreceives"hello world"when input is provided as content parts. - Document the fix in the unreleased changelog entries.
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
src/kimi_cli/soul/kimisoul.py |
Ensures UserPromptSubmit hook uses extracted text for non-string user_input instead of always "". |
tests/core/test_kimisoul_hooks.py |
Adds coverage for content-part input so the hook payload prompt is populated correctly. |
CHANGELOG.md |
Adds an Unreleased entry describing the hook payload fix. |
docs/en/release-notes/changelog.md |
Mirrors the Unreleased changelog note in the English docs. |
docs/zh/release-notes/changelog.md |
Mirrors the Unreleased changelog note in the Chinese docs. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This was referenced May 16, 2026
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
Resolve #2303 #1779
Description
Fixes the
UserPromptSubmithook payload so that thepromptfield contains the actual user input text instead of an empty string.Problem:
The shell UI passes user input as
list[ContentPart]tosoul.run(). The existing code only checkedisinstance(user_input, str), causingtext_input_for_hookto always fall back to"". As a result:promptfield in theUserPromptSubmithook payload was always empty.matcherfilters on prompt text never matched.Fix:
When
user_inputis not a string, extract the text from theContentPartlist using the sameMessage.extract_text()approach already used by the agent turn loop:This ensures plain-text input (and any text extractable from multimodal input) is correctly passed to the hook engine for both payload generation and matcher evaluation. As a result, the payload.prompt can contain the message sent by the user (or adjusted message when SubagentStart is called).
Checklist
make gen-changelogto update the changelog.