CommandCodeAI / CommandCodeAI/desktop

Session switched projects on its own — duplicate session IDs across project directories

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

@aliarain 已经在做这个了。

开始于 2026年9月7日。

主要语言
Shell
星标
80
派生
2
PR 合并指标
30 天内没有已合并 PR

描述

Session switched projects on its own — duplicate session IDs across project directories

Summary

With two projects registered in Command Code Desktop, a session spontaneously started referencing the wrong project. No manual project switch was made. Investigation shows the same session IDs exist in both project directories with completely different transcripts, indicating a cross-project session collision.

Environment

  • OS: Windows
  • App: Command Code Desktop v0.1.22 → v0.1.25 (auto-updated during session window)
  • Projects: 2 projects registered ~1 hour apart (Project A and Project B)
  • Session where bug was reported: KYLwd2_uwfTpKTw6JyVnr — "Session Switch Bug" (2026-09-03)

Evidence — duplicate session IDs in both project slugs

Sessions are stored per docs as ~/.commandcode/projects/<project-slug>/<session-id>.jsonl (header records cwd). Two IDs exist in both slugs with divergent content:

ID 0OdgweRGWNjtJoVOitaAw
Project A slug Project B slug
.meta.json title Install Agent Browser Explore Repository
.jsonl header cwd Project A root Project B root
header timestamp 2026-09-02T13:27:41Z 2026-09-02T12:41:22Z
first user message install agent browser explore AGENTS.md
ID ClB46Yifwhg5QzUo8NIP-
Project A slug Project B slug
.meta.json title Deployment Exploration Run Project
.jsonl header cwd Project A root Project B root
header timestamp 2026-09-03T05:52:54Z 2026-09-02T13:40:13Z
first user message how is this deployed and working without my env? run this project

Each duplicate has completely different traceIds sets in the .meta.json, confirming they are different transcripts, not copies.

Also observed placeholder metas with minimal content in both project dirs (27-byte files).

What happened from the user's perspective

"it changed one projects session to another and started referencing the wrong thing. it switched on its own its not something i did"

Reported during session KYLwd2_uwfTpKTw6JyVnr. The transcript shows normal flow until 503 Service temporarily unavailable / 400 name must match ^[a-zA-Z0-9_.-]+$ errors at the same time.

Logs checked

  • AppData\Roaming\Command Code\logs\main.log — only startup/updater lines ([thread-index] ready, [updater] checking/up-to-date). No explicit project/session switch entry at bug time.
  • AppData\Roaming\Command Code\app-state.json — confirms 2 projects registered, active thread pointed to one project while session files exist in both.

Expected vs actual

  • Expected: Session IDs are globally unique; ~/.commandcode/projects/<slug>/ is strictly scoped, picker/resume only shows sessions for the launched cwd.
  • Actual: Same ID resolves to two different transcripts on disk; app state collapses both to one projectPath, so resume/references can pick the wrong file and the session appears to "switch projects."

Repro / clues

  1. Register two projects (Project B, then Project A ~65 min later).
  2. Create sessions in each around 2026-09-02. Observe IDs collide.
  3. The newer Project A copy shadows the older Project B copy — unclear if ID generator reused IDs or a copy/migration duplicated files to wrong slug.

Impact

Data integrity — wrong cwd, wrong transcript, potential file edits/checkpoints applied to wrong project.

Suggested fix / next steps

  • Ensure session ID generation is globally unique (or namespace by slug) and guard against writing a session with a cwd that doesn't match its slug.
  • thread-index.db should enforce (id, projectSlug) uniqueness and surface a conflict instead of silently shadowing.
  • Add diagnostic to main.log when a session file is resolved/loaded that logs sessionId + resolved slug + header cwd to make future switches traceable.

Teams can reproduce by checking for duplicate <session-id>.jsonl filenames across ~/.commandcode/projects/*/ and comparing their headers/metas. No user-identifying paths needed.

贡献指南

这个仓库没有索引到贡献指南

从这里开始

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

评估

这个 Issue 还没有评估数据。

把新 issue 发到你的邮箱

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