Skip to content

fix(agent): restrict auto-title to first exchange only - #11313

Open
Magicray1217 wants to merge 1 commit into
NousResearch:mainfrom
Magicray1217:fix/auto-title-first-exchange-only
Open

fix(agent): restrict auto-title to first exchange only#11313
Magicray1217 wants to merge 1 commit into
NousResearch:mainfrom
Magicray1217:fix/auto-title-first-exchange-only

Conversation

@Magicray1217

Copy link
Copy Markdown

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

  • agent/title_generator.py: Tighten guard from > 2 to > 1 so only the very first exchange triggers title generation
  • tests/agent/test_title_generator.py: Add regression test for the 2-user-messages boundary case

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

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
@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have labels Apr 25, 2026
@teknium1 teknium1 added sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform labels Jul 12, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have sweeper:blast-moderate Sweeper blast radius: moderate — a subsystem or single platform sweeper:risk-compatibility Sweeper risk: may break existing users, config, migrations, defaults, or upgrades sweeper:risk-session-state Sweeper risk: may lose/corrupt/mis-associate session or context state type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: maybe_auto_title still fires on the second exchange despite first-exchange contract

3 participants