feat(hooks): include assistant response text in Stop hook payload#969
feat(hooks): include assistant response text in Stop hook payload#969itxaiohanglover wants to merge 2 commits into
Conversation
The Stop hook payload only contained stop_hook_active. Users building memory/logging layers need the assistant response text to persist conversation context. Add an optional responseText field that extracts the last assistant message text. Fixes MoonshotAI#952
🦋 Changeset detectedLatest commit: 1c206ab The changes in this PR will be included in the next version bump. This PR includes changesets to release 1 package
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 |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: f06d6d642e
ℹ️ About Codex in GitHub
Codex has been enabled to automatically review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
When you sign up for Codex through ChatGPT, Codex can also answer questions or update the PR, like "@codex address that feedback".
| inputData: { stopHookActive: stopHookContinuationUsed }, | ||
| inputData: { | ||
| stopHookActive: stopHookContinuationUsed, | ||
| responseText: responseText || null, |
There was a problem hiding this comment.
Add a changeset for this hook payload change
This line adds a user-visible Stop hook payload field, but the commit contains no .changeset entry. The repo-level AGENTS.md says, “After finishing a task and before submitting a PR, you must run the gen-changesets skill,” and without that release tooling will not version or changelog the new hook behavior for users.
Useful? React with 👍 / 👎.
|
Thanks for the review — changeset added. |
|
Changeset was added in a follow-up commit (1c206ab). The latest commit includes |
|
Thanks for opening this - it's exactly the missing piece for conversation logging. We use the Stop hook to persist each turn to a local SQLite database for cross-session recall. Right now we can log the user's prompt via UserPromptSubmit, but the assistant's response isn't available in the Stop payload, so the transcript is one-sided. With responseText added, we'll finally have a complete back-and-forth history. Happy to test this against our logger once it's in a release and report back. |
|
Thanks @GlobalInvestor152! That is exactly the use case this PR was designed for — the Stop hook had session_id and cwd but no response text, making conversation logging one-sided. Your SQLite cross-session recall setup sounds great. Once this merges and hits a release, I would love to hear how it works with your logger. If you run into any issues with the responseText field (e.g. empty for tool-only turns, or truncation on very long responses), please let me know. |
|
@itxaiohanglover , great. When can we expect the pull request to merge and go live? |
Fixes #952
Problem
The Stop hook payload only contains
stop_hook_activeand basic fields (session_id, cwd). Users building persistent session memory or conversation logging on top of Kimi Code hooks have no way to access the assistant response text.What changed
Added an optional
responseTextfield to the Stop hook payload. It extracts the last assistant message text from the conversation history before the Stop hook fires.responseTextisnullwhen the assistant response is emptyValidation
triggerBlock(Stop, ...)is callednullis passed when there is no assistant message (edge case)