Repository navigation
Description
Before submitting
- I searched existing issues and did not find a duplicate.
- I included enough detail to reproduce or investigate the problem.
Area
apps/server
Steps to reproduce
- Open a project whose folder has a local Claude Code session and import that session (agent session import). T3 creates the thread
import:claudeAgent:<session-id>. - Send a message or two in that thread in T3 Code, or continue the session in the Claude Code CLI or Claude desktop app, so the transcript changes.
- Delete the thread in T3 Code.
- Import sessions for the same project again.
Expected behavior
The session is imported again with its current transcript and the thread shows up in the project, the same way #44863 now handles ACP sessions after a thread is deleted.
Actual behavior
The thread does not come back, and there is no way in the UI to get the session into T3 again.
Deleting the thread is a soft delete, and the importer doesn't account for that:
- The thread id is deterministic (
import:${providerInstanceId}:${providerSessionId}), so re-import looks up the same id andorchestrator.getThreadRecordsreturns the soft-deleted thread (deletedAtset, sameprojectId,historyOrigin: "v1_import", its messages already released). - The
provider_session_runtimerow for the thread is kept, withruntimePayload.importedTranscriptsstill listing the transcript. - Unchanged transcript → the scanner yields
AlreadyImported, which is counted as imported but creates nothing. - Changed transcript →
Importable. The existing-thread branch then compares stored messages (now 0) with the transcript. The thread has runs, so the result isfalseand nothing is imported. Onmain@ 270fb87, a thread without runs would get its messages rewritten, butdeletedAtstays set, so the thread is still hidden.
How this relates to existing issues:
- [Bug]: Re-importing a deleted project imports zero sessions (stale import records and soft-deleted threads block import) #34043 / fix(server): re-importing a deleted project's folder restores its imported threads #34064 cover the same root cause when a project is deleted. The open fix in fix(server): re-importing a deleted project's folder restores its imported threads #34064 only restores threads where
isDeletedElsewhereis true, which requiresthread.projectId !== projectId. A thread deleted inside the same project is therefore still unrecoverable after that PR. - fix(server): allow ACP session re-import after thread deletion #44863 fixed this exact scenario for ACP sessions only (
AcpRegistrySessions.ts), not for the Claude Code / Codex importer (AgentSessionImporter.ts).
A possible fix is to treat a soft-deleted v1_import thread as absent regardless of project: import into a fresh thread as #44863 does, or extend #34064's restore path to same-project deletions. Clearing importedTranscripts from provider_session_runtime when an imported thread is deleted would also stop the AlreadyImported dead end.
Impact
Major degradation or frequent failure
Version or commit
Desktop 0.1.13 (stable); the importer logic is unchanged on main @ 270fb87
Environment
macOS 14.6 (Apple Silicon), T3 Code desktop 0.1.13, Claude Code provider (claudeAgent), Claude Opus 5.5
Logs or stack traces
# statev2.sqlite after deleting the thread and re-importing (ids redacted)
orchestration_v2_projection_threads
thread_id = import:claudeAgent:<session-id>
title = Deleted thread
historyOrigin = v1_import
deleted_at = 2026-11-28T16:49:44.187Z
messages = 0
provider_session_runtime
thread_id = import:claudeAgent:<session-id>
status = stopped
runtime_payload_json = {"cwd":"~/t3","importedTranscripts":[{"provider":"claudeAgent",
"providerSessionId":"<session-id>","filePath":"~/.claude/projects/-…-t3/<session-id>.jsonl",
"size":571892, ...}]}
# Rows for the deleted thread still present in:
# provider_session_runtime, orchestration_v2_projection_threads, _run_attempts,
# _provider_sessions, _provider_threads, _provider_turns, _checkpoint_scopes,
# _checkpoints, orchestration_v2_effect_outbox, orchestration_events,
# orchestration_command_receipts
# server.trace.ndjson: both re-import attempts end with
# ws.rpc.agentSessions.import exit=Success
# so no error is logged for the skipped session.Screenshots, recordings, or supporting files
No response
Workaround
- Copy the Claude transcript under a new session id and import that copy. It becomes a separate conversation.
- Or, with T3 closed and the DB backed up, delete every row for
import:claudeAgent:<session-id>from the tables above (the same workaround as [Bug]: Re-importing a deleted project imports zero sessions (stale import records and soft-deleted threads block import) #34043).
Activity
fix(client-runtime): a thread recreated after its deletion loads again (
fix(server): re-import also restores a deleted import thread that has…
test(server): re-importing a deleted Claude import thread brings it back