[bug] clicking "New" on an empty conversation creates duplicate empty sessions

未关闭
#246 0 条评论 0 个 reaction 已指派 0 人 在 GitHub 查看

维护者通常 1 天内回复

还没有人认领这个 Issue。

评估

难度
3/5
预计耗时
1-2 天
新手友好度
58/100
Issue 类型
缺陷
描述清晰度
描述清楚
活跃度
活跃
技术栈
typescript
领域
backend, frontend

调研方向

The payload names no files, so begin with the "New conversation" click handler in the Chat with AI panel and the backend create path that archives the current session. Confirm how the client generates the conversation ID, then check the reuse logic on the server. Done means repeated clicks on an empty conversation yield one session, and a backend contract test covers repeated create against an empty current session.

由索引模型根据 Issue 内容生成。

描述

area:agent type:bug

Summary

On the Chat with AI panel, when the current conversation has no messages,
clicking "New conversation" creates a new empty session on every click
instead of reusing the current one. Empty sessions accumulate in the history
list and in project storage until the 100-conversation limit blocks new
sessions entirely.

Steps to reproduce

  1. Open a project and the Chat with AI panel, with the current conversation
    empty.
  2. Click "New conversation" several times.
  3. Open the history panel: one empty session has been created per click.

Cause

The client generates a fresh conversation ID per click, while the backend's
create path is idempotent only by conversation ID, so the dedupe never
matches: each request archives the previous empty session and creates a new
one. The same accumulation is reachable from the agent/HTTP entry points,
because "reuse the empty active session" is not enforced as a server-side
rule.

Proposed fix

  • Frontend: when the current conversation is empty, "New" reuses it instead
    of creating a new session.
  • Backend: in the create path, return the current session when it is empty
    instead of archiving it and creating a new one. This protects the agent
    and HTTP entry points as well.

Acceptance

  • Repeated clicks with an empty current conversation produce exactly one
    session, and the history list stops accumulating empty entries.
  • Backend contract test: repeated create against an empty current session is
    idempotent.
主要语言
TypeScript
星标
119
派生
16
平均合并
16 小时 13 分钟
30 天内合并 PR
195

环境准备

这个项目没有提供开发容器、Dockerfile 或贡献指南,环境需要你自己搭建:先看它的 README,通用步骤见我们的新手贡献指南。

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

ThinkFlowLab/OpenDirector 的其他 Issue

查看 ThinkFlowLab/OpenDirector 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。