bug(desktop): exclude internal review-channel sessions from Claude Code import
- Dominant language
- TypeScript
- Stars
- 2.7k
- Forks
- 401
- Avg merge
- 21h 48m
- Merged PRs (30d)
- 776
Description
## 问题描述 / What happened
Claude Code sessions created by an internal review runtime are shown as normal candidates in **Settings → Local Task Import** and can be imported into Cindy as ordinary user tasks.
Their first user message starts with an explicit internal envelope such as:
```text
```
After import, the Cindy task list contains many titles beginning with that raw envelope. These are disposable reviewer execution sessions rather than user-authored tasks, so they add substantial list noise and may also add local DB data after their histories are opened.
### Actual behavior
- Internal review executions appear beside normal Claude Code sessions.
- Their raw channel envelope becomes the task title.
- Users can bulk-import hundreds of them without a useful way to distinguish or clean them up.
- Deleting an imported row is not sufficient by itself if a later scan presents the same source session again.
### Expected behavior
- Explicitly marked internal review sessions should not appear as import candidates and should not be importable by ID.
- Normal user-facing channel sessions must remain importable. Do **not** filter every message beginning with ``.
2. Open Cindy Desktop → Settings → Local Task Import.
3. Scan Claude Code sessions.
4. Observe a candidate whose title begins with the raw `` messages, since real user-facing Feishu/other channel conversations may use the same outer format.
4. Revalidate the source transcript during `importExternalClaudeCodeSessions()`; do not rely only on candidate-list filtering.
5. For existing `claude-*` imported rows that can be matched back to an internal source transcript, offer an explicit hide/archive cleanup action or a conservative migration. Do not auto-delete sessions that contain Cindy-local user messages.
6. Keep source Claude transcript files untouched; cleanup should only affect Cindy visibility/storage ownership.
## 验收标准 / Acceptance criteria
- [ ] A top-level Claude session whose first user message is explicitly marked `review-session-channel / local-review` is absent from scan results.
- [ ] The same session cannot be imported by passing its SDK session ID directly.
- [ ] Regular Claude Code sessions still scan and import normally.
- [ ] A normal user-facing message using a generic `` envelope is not rejected.
- [ ] Existing imported internal-review sessions can be safely identified and hidden/archived without deleting unrelated sessions or Claude's source transcripts.
- [ ] Already-imported sessions with Cindy-local user messages are not silently removed.
- [ ] Tests cover both `readClaudeCodeSessionScanSummary()` and `readClaudeCodeSessionSummary()`, including exact review markers, generic channel messages, `isSidechain`, and direct-ID import revalidation.
- [ ] Codex import behavior does not regress.
Contributor guide
Research direction
Start in apps/desktop/src/main/maker-host/claude-local-sessions.ts by reading collectClaudeSessionFiles(), readScanSummaryFromHead(), and readClaudeCodeSessionSummary(), then trace importExternalClaudeCodeSessions(). Add focused coverage for scan and direct-ID import behavior. Done means exact review markers are rejected in both paths, generic channel sessions remain available, and existing imported sessions can be safely hidden without deleting unrelated data.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- electron, typescript
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Quiet
- Clarity
- Mostly clear
- Newbie friendliness
- 50/100