Skip to content

feat: VS Code session remaining edge cases (resume delay + duplicate tab fixed in PR #109) #107

@grimmerk

Description

@grimmerk

Summary

Track VS Code-specific edge cases and resume delay optimization for the session switching feature added in PR #103.

Edge Cases

Edge case Risk Current behavior Suggested fix
code CLI not in PATH Low execFile('code') fails silently Fixed in PR #102 — uses open -b bundleId instead
VS Code Stable + Insiders both installed Low vscode:// goes to whichever registered Detect which has the extension active
Extension version < 2.1.72 Medium URI handler doesn't exist, silently fails Check extension version or detect failure + show user message
Extension disabled Low Same as above Same
Remote SSH session Low JSONL is on remote, not local Not easily fixable — document as limitation
First-time URI handler permission dialog One-time User must click "Allow" Document in README / first-use notification

Resume Delay Optimization ✅ Done (PR #109)

Current resume flow for closed VS Code sessions:
1. execFile('code', [projectPath]) — opens/activates VS Code window
2. Hardcoded 2s delay — waits for workspace to load
3. URI handler vscode://anthropic.claude-code/open?session=<UUID>

Replaced with IDE lock file polling (PR #109):

  • Reads ~/.claude/ide/*.lock to detect if VS Code has the project open
  • If project open → instant URI handler (~0.5s)
  • If project not open → open -b + poll lock files (250ms interval) + 1.5s post-ready delay
  • Fallback to 2s fixed delay if lock dir doesn't exist

Duplicate Tab (Cold Start) ✅ Fixed (PR #109)

VS Code restore + URI handler race condition caused duplicate Claude Code tabs.

Fixed with two mechanisms:

  • Active sessions + project not open → skip URI handler (let VS Code restore handle the tab)
  • Closed sessions + project not open → 1.5s post-ready delay (lets restore finish before URI handler)

All 8 test cases now pass (see PR #109 test matrix).

Comparison: VS Code vs Terminal Matching Layers

VS Code uses UUID-based URI handler, which is more precise than terminal title/TTY matching:

Feature iTerm2 Terminal.app Ghostty cmux VS Code
Same-cwd disambiguation TTY + title cross-ref TTY + title CWD + title TTY + CWD + title + project name N/A — UUID precise
Active switch precision Tab-level Tab-level Tab-level Surface-level Session-level
Closed resume claude --resume in new tab Same Same Same URI handler (opens in VS Code)
Cross-ref refinement Yes (TTY + tab name) No No Yes (TTY + tree parsing) N/A — no ambiguity
Fallback layers 3 (title → TTY → activate) 3 (title → TTY → activate) 3 (title → CWD → clipboard) 4+ (title → TTY → CWD → project name) 1 (URI handler)

Related

🤖 On behalf of @grimmerk — generated with Claude Code

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions