Repository navigation
[AI-1066] Exclude kcap's own helper sub-sessions from import missing-cwd report - #204
Conversation
…cwd report The "N sessions reference N distinct paths that no longer exist on disk" warning was dominated by kcap's own headless `claude -p` runs (title and what's-done summaries). Those run in an ephemeral temp working dir that is deleted the moment the run ends, so their recorded cwd is permanently missing. Classification already drops them from the import as InternalSubSession, but ReportMissingCwds runs earlier and counted them too, flooding the report with dead temp paths the user can neither remap nor act on. Skip IsCapacitorSubSession transcripts in ResolveTranscriptReposAsync so they never enter sessionCwds (the report's input). Claude-only, mirroring the existing classification short-circuit. Adds ImportResolveReposSubSessionTests and updates the README missing-cwds description. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
PR Summary by QodoExclude kcap helper sub-sessions from import missing-cwd warning
AI Description
Diagram
High-Level Assessment
Files changed (3)
|
Code Review by Qodo
1.
|
…from prompt text - Fold the sub-session check and cwd extraction into one ≤20-line read (ExtractCwdAndDetectSubSession) so discovery opens each transcript once instead of twice. Marker detection mirrors IsCapacitorSubSession's first-5-line window so the two stay in agreement. - Build the test's queue-operation content from TitleGenerator.TitlePromptPrefix (JSON-encoded) instead of a hard-coded prompt string, so it survives prompt template rewording. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Problem
kcap importprints a one-shot warning like "134 sessions reference 134 distinct paths that no longer exist on disk". Investigating the data behind AI-1066, that list was dominated by kcap's own background helper runs, not lost user sessions.Of 163 project dirs in
~/.claude/projects/, 162 had a missing cwd:kcap-claude-*temp dirs — kcap's headlessclaude -pruns (title / what's-done summaries).claude/worktrees/...paths under repos that still existThe
kcap-claude-*runs come fromClaudeCliRunner, which creates an ephemeralPath.GetTempPath()/kcap-claude-<guid>working dir and deletes it infinally— so their recorded cwd is permanently gone. These are already excluded from import (classification flags themInternalSubSession), butReportMissingCwdsruns before classification and counted them anyway, flooding the report with dead temp paths the user can neither remap nor act on.Fix
Skip
TitleGenerator.IsCapacitorSubSessiontranscripts inResolveTranscriptReposAsyncso they never entersessionCwds(the report's input). Claude-only, mirroring the existing classification short-circuit (Codex rollouts have no analogous sub-session transcript). The missing-cwd report is now scoped to genuine user sessions whose repo really moved — for those,kcap remapand the existingWorktreePathResolverremain the right tools.Notes
Investigated but not built: resolving a repo from transcript content. Low yield where it matters — 0/152 helper transcripts captured a git remote URL and only ~7% referenced a real repo path.
Testing
ImportResolveReposSubSessionTests: a real missing-cwd session is reported; a kcap sub-session is not.dotnet publish -c Release— no IL30xx/IL20xx AOT warnings.🤖 Generated with Claude Code