fix(session): skip turn_meta block when deriving session title
`SessionManager::create_saved_session_with_id_and_mode` picks the
first `ContentBlock::Text` off the user's message via `find_map`
and uses that as the session title. The engine prepends a synthetic
`<turn_meta>...</turn_meta>` block (Block 0) ahead of the real user
text (Block 1), so the `/sessions` picker was rendering the metadata
blob as the session name.
Guard the find_map filter on `!text.starts_with("<turn_meta>")` so
titles fall through to the actual user input. Existing sessions
without the prefix block are unaffected (the guard is a no-op when
no metadata block is present); the existing `truncate_title` long-
input handling continues to apply.
Harvested from PR #1498 by @wdw8276
Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -16,6 +16,15 @@ real world uses."
|
||||
|
||||
### Fixed
|
||||
|
||||
- **`/sessions` picker no longer shows `<turn_meta>` as the
|
||||
session title** (harvested from PR #1498 by **@wdw8276**).
|
||||
`session_manager::create_saved_session_with_id_and_mode`
|
||||
picked the first text content block off the user message via
|
||||
`find_map`; the engine prepends an internal `<turn_meta>` block
|
||||
ahead of the real user text, so the picker rendered that
|
||||
metadata blob as the session name. Guard added so titles fall
|
||||
through to the actual user input. Existing sessions without
|
||||
the prefix block are unaffected.
|
||||
- **Kitty keyboard protocol now activates on Windows (VSCode +
|
||||
Windows Terminal), so `Shift+Enter` inserts a newline instead
|
||||
of submitting** (#1359, harvested from PR #1483 by
|
||||
|
||||
@@ -674,7 +674,9 @@ pub fn create_saved_session_with_id_and_mode(
|
||||
.find(|m| m.role == "user")
|
||||
.and_then(|m| {
|
||||
m.content.iter().find_map(|block| match block {
|
||||
ContentBlock::Text { text, .. } => Some(truncate_title(text, 50)),
|
||||
ContentBlock::Text { text, .. } if !text.starts_with("<turn_meta>") => {
|
||||
Some(truncate_title(text, 50))
|
||||
}
|
||||
_ => None,
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user