CM-72541: Report the model on every AI guardrails hook event - #544
Merged
Merged
Conversation
The model reached the platform only through the conversation created at session start, and switching models starts no new conversation, so every event after a switch was attributed to the model the conversation opened with. Hook payloads already carry the model configured at the time of the event; send it with the event so the platform can attribute each one to the model that actually ran. Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Ilanlido
approved these changes
Sep 14, 2026
omer-roth
approved these changes
Sep 14, 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.
TL;DR
A user opens a chat on one model, switches to another mid-conversation, and the platform keeps attributing every later prompt, file read and MCP call to the model they started on. Hook events now carry the model they ran under, so the platform can attribute each event to the model that actually served it.
Why
The model reached the backend in exactly one place:
create_conversation, called by the session-start hook.create_eventnever carried one, so the model of the conversation's first turn stood in for every event in it.No IDE starts a new conversation when the user picks a different model. Cursor keeps the same
conversation_idwhen the composer's model changes and fires nosessionStart, so nothing ever corrected the record. Every hook payload already carries the model configured at that moment -Cursor.parse_hook_payloadhas been reading it intoAIHookPayload.modelall along - so the CLI had the right answer in hand on every hook and dropped it on the floor.Reviewer notes
modelis sent even when it isNone(a Claude Code transcript with no assistant turn yet, for one), consistent with the other optional fields on this body.Reproduced against the ticket's flow in Cursor - a conversation opened on
grok-4.6and switched togpt-5.6-sol.CM-72541
🤖 Generated with Claude Code