fix: CLI namer 不再往会话列表里堆「起名会话」 - #5
Conversation
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>
There was a problem hiding this comment.
💡 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".
| if proc is not None and proc.returncode != 0 and _unknown_flag(proc.stderr): | ||
| proc = _run(required + trailing, env=env, cwd=cwd) |
There was a problem hiding this comment.
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 👍 / 👎.
| if any(m.role == "user" and util.is_namer_artifact(m.text) for m in msgs): | ||
| return ("namer-artifact", None, msgs) |
There was a problem hiding this comment.
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>
What this changes
默认
auto/claude/codexnamer 会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默认模型没有改:
auto(默认)claudeCLI → Haiku;否则 → Codexgpt-5.3-codex-sparkclaudehaikucodexgpt-5.3-codex-spark(OpenAI 官方 id,不是gpt-5-codex)已经堆出来的垃圾会话不会被自动删除,需要在 Claude Code / Codex 里手动清;升级后不会再新增。
版本已升到 1.0.1,合并后会打
v1.0.1tag 发 GitHub Release / PyPI。Checklist
pytestpasses(83 passed)