Hacktoberfest 2026:維護者為十月標記出來的 issue,仍然開放、適合新手。 瀏覽 Hacktoberfest issue

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

已關閉
#55 1 則留言 0 個 reaction 已指派 1 人 在 GitHub 檢視

@aliarain 已經在處理了。

開始於 2026年9月7日。

評估

這個 Issue 還沒有評估資料。

描述

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.

主要語言
Shell
星號
89
分支
7
平均合併
2 小時 46 分鐘
30 天內合併 PR
1

環境準備

這個專案沒有提供開發容器、Dockerfile 或貢獻指南,環境需要你自己搭建:先看它的 README,通用步驟見我們的新手貢獻指南。

從這裡開始

  1. 先讀完整個 Issue,再讀專案的貢獻指南。
  2. 在 Issue 下留言說明你要接手 —— 這能避免兩個人做同樣的事。
  3. Fork 儲存庫,在一個分支上完成修改。
  4. 送出 Pull Request,並在描述裡引用這個 Issue 編號。

CommandCodeAI/desktop 的其他 Issue

查看 CommandCodeAI/desktop 的全部 Issue

相似的 Issue

更多 Shell/Bash Issue

把新 issue 寄到你的電子郵件信箱

精選適合新手參與的 GitHub issue 摘要。