fix(agent): restrict auto-title to first exchange only - #11313
Open
Magicray1217 wants to merge 1 commit into
Open
fix(agent): restrict auto-title to first exchange only#11313Magicray1217 wants to merge 1 commit into
Magicray1217 wants to merge 1 commit into
Conversation
maybe_auto_title() was intended to fire only on the first user-assistant exchange, but the boundary condition (user_msg_count > 2) allowed it to also fire on the second exchange. This could generate a title based on the second message instead of the opener. Tighten the guard to user_msg_count > 1 so only the very first exchange triggers title generation. Add regression test for the 2-user-messages case. Fixes NousResearch#11201
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.
Summary
maybe_auto_title() was intended to fire only on the first user-assistant exchange, but the boundary condition (user_msg_count > 2) allowed it to also fire on the second exchange. This could generate a title based on the second message instead of the opener.
Changes
Root Cause
The comment said "first exchange only" but the code allowed user_msg_count == 2 to pass through. With the fix, exactly 1 user message in history is the only case that triggers auto-titling.
Fixes #11201