fix: flatten multiline session titles before printing - #3
Merged
Merged
Conversation
A session title can contain newlines (e.g. a pasted multi-step prompt), so counting lines to decide single-vs-multiple matches miscounted one session as many. Flatten newlines/tabs in titles in both resume and sessions.
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.
问题
会话标题可能包含换行(例如粘贴进来的一大段多步 prompt)。
resume之前用wc -l数行数来判定「唯一命中还是多条命中」,结果一条多行标题的会话被数成了多行——比如一条标题有 18 行的会话,报成「匹配到 18 条」。改动
resume和sessions在打印前把标题里的换行、回车、制表符压平为空格(resume再截断到 60 字),让「一行 = 一条」。tests/test_smoke.py::test_resume_multiline_title_counts_once。验证
python3 tests/test_smoke.py:10 个测试全过。