Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@

### Corrected

- `resume` and `sessions` now flatten newlines/tabs in session titles before printing, so a single session whose title spans multiple lines is no longer miscounted as multiple matches.
- Braced variables next to Chinese punctuation in CLI messages so macOS Bash does not consume part of a UTF-8 character as a variable name and abort. The existing Linux/macOS smoke suite covers these command paths.
- Distinguished read-only session lookup from authenticated resume; documented shared-home parallel use as author-reported experience rather than guaranteed isolation or a fixed token lifetime.
- Installation instructions now use a clone, as required by the existing installer.
Expand Down
7 changes: 6 additions & 1 deletion codex-switch
Original file line number Diff line number Diff line change
Expand Up @@ -247,6 +247,7 @@ rows = cur.execute("""
""").fetchall()
print(f"当前 provider:{prov}(* = 与当前 provider 一致;无 * 的会话用 codex resume <id> 可跨 provider 恢复)")
for t, mp, tid, title, src in rows:
title = (title or '').replace('\n', ' ').replace('\r', ' ').replace('\t', ' ').strip()
mark = "*" if mp == prov else " "
print(f"{mark} {t} {mp:<8} {src:<4} {tid} {title[:48]}")
con.close()
Expand Down Expand Up @@ -283,7 +284,11 @@ else:
ORDER BY updated_at DESC
""", (f"%{kw}%",)).fetchall()
for r in rows:
print("\t".join(r))
rid, title, provider, t = r
title = (title or '').replace('\n', ' ').replace('\r', ' ').replace('\t', ' ').strip()
if len(title) > 60:
title = title[:57] + '...'
print("\t".join((rid, title, provider, t)))
con.close()
PY
)"
Expand Down
18 changes: 18 additions & 0 deletions tests/test_smoke.py
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,24 @@ def test_resume_by_session_id(self):
"-c", 'model_provider="new-provider"', "-c", 'model="new-model"',
])

def test_resume_multiline_title_counts_once(self):
self.seed(provider="new-provider", model="new-model")
with closing(sqlite3.connect(self.home / "state_5.sqlite")) as db:
db.execute(
"CREATE TABLE threads "
"(id TEXT, title TEXT, model_provider TEXT, updated_at INTEGER, source TEXT)"
)
db.executemany("INSERT INTO threads VALUES (?, ?, ?, ?, ?)", [
("fixture-multi", "install codex\nstep two\nstep three", "openai", 1700000000, "cli"),
])
db.commit()
# 标题含换行时,仍应作为「一条」会话命中,而不是被数成多行
self.run_cli("resume", "install codex")
self.assertEqual(json.loads(self.calls.read_text()), [
"resume", "fixture-multi",
"-c", 'model_provider="new-provider"', "-c", 'model="new-model"',
])

def test_installer_from_another_directory_and_destination_with_spaces(self):
destination = self.base / "custom bin"
result = subprocess.run(
Expand Down
Loading