Skip to content

fix: CLI namer 不再往会话列表里堆「起名会话」 - #5

Merged
cursor[bot] merged 2 commits into
mainfrom
cursor/namer-no-persist-sessions-3ffb
Aug 19, 2026
Merged

fix: CLI namer 不再往会话列表里堆「起名会话」#5
cursor[bot] merged 2 commits into
mainfrom
cursor/namer-no-persist-sessions-3ffb

Conversation

@study8677

@study8677 study8677 commented Aug 19, 2026

Copy link
Copy Markdown
Owner

What this changes

默认 auto / claude / codex namer 会 claude -p / codex exec 来写标题。这些 CLI 会把这次调用落成真实会话,标题就是起名提示词本身:

  • You name coding-assistant sessions…(本仓库的 namer prompt)
  • Generate a concise tab title for this coding chat…(Claude Code 自己的 tab 起名)

空闲窗口过后,rename 又把这些垃圾会话当成新工作再调一次 namer,形成循环;从每个项目目录跑一遍就会「每个项目都有几百条」。

这次改动:

  • claude--bare --no-session-persistence,并设置 CLAUDE_CODE_SKIP_PROMPT_HISTORY=1(部分 Claude Code 版本会忽略 flag,环境变量仍能禁止落盘)
  • codex--ephemeral --skip-git-repo-check
  • 两次调用都在独立 scratch 目录里跑,不再写进用户项目
  • 标题或用户消息长得像起名/自动标题 prompt 的会话直接跳过,已有垃圾不会再触发循环
  • 旧版 CLI 不认这些 flag 时自动去掉再试一次

默认模型没有改:

namer 实际用的模型
auto(默认) claude CLI → Haiku;否则 → Codex gpt-5.3-codex-spark
claude haiku
codex gpt-5.3-codex-spark(OpenAI 官方 id,不是 gpt-5-codex

已经堆出来的垃圾会话不会被自动删除,需要在 Claude Code / Codex 里手动清;升级后不会再新增。

版本已升到 1.0.1,合并后会打 v1.0.1 tag 发 GitHub Release / PyPI。

Checklist

  • pytest passes(83 passed)
  • New behaviour is covered by a test (synthetic fixtures only)
  • No real session data in code, tests, docs, or examples
  • Adapters only change titles — never edit/delete/reorder conversations
Open in Web Open in Cursor 

claude -p and codex exec were persisting each title request as a real
session named after the namer prompt, then rename tried to rename those
sessions and looped. Run the CLIs ephemerally in a scratch directory,
and skip leftover namer/auto-title artifacts so they cannot retrigger.

Co-authored-by: JingWen Fan <study8677@users.noreply.github.com>

@chatgpt-codex-connector chatgpt-codex-connector Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

💡 Codex Review

Here are some automated review suggestions for this pull request.

Reviewed commit: 865cf3f320

ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review".

If Codex has suggestions, it will comment; otherwise it will react with 👍.

Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".

Comment on lines +91 to +92
if proc is not None and proc.returncode != 0 and _unknown_flag(proc.stderr):
proc = _run(required + trailing, env=env, cwd=cwd)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Keep persistence protection on compatibility retries

When a CLI recognizes the persistence-prevention flag but rejects the other optional flag—for example, a Claude version supporting --no-session-persistence but not --bare—this retry removes the entire tuple and runs successfully without the supported protection. Likewise, codex exec --help defines --ephemeral as “Run without persisting session files to disk,” but this path drops it alongside --skip-git-repo-check. Retry only the rejected flag, or at least retain the persistence-prevention flag, otherwise the compatibility path recreates the junk sessions this change is intended to eliminate.

Useful? React with 👍 / 👎.

Comment thread src/rename/engine.py
Comment on lines +77 to +78
if any(m.role == "user" and util.is_namer_artifact(m.text) for m in msgs):
return ("namer-artifact", None, msgs)

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

P2 Badge Avoid rejecting real sessions that quote a naming prompt

Because this checks every user message using an unrestricted substring match, a legitimate coding session is permanently classified as a CLI artifact whenever the user quotes one of these prompts—for example while debugging this repository, reviewing the namer implementation, or discussing Claude's tab-title behavior. _record_skip then records seen_active, so the session is not renamed at all for that activity. Restrict detection to the known side-effect-session shape, such as an initial prompt matching the complete generated prompt, rather than any user turn containing a marker.

Useful? React with 👍 / 👎.

Co-authored-by: JingWen Fan <study8677@users.noreply.github.com>
@cursor
cursor Bot merged commit 4f428de into main Aug 19, 2026
6 checks passed
@cursor
cursor Bot deleted the cursor/namer-no-persist-sessions-3ffb branch August 19, 2026 06:08
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants