Skip to content

fix: support Windows drive letters in transcript fallback regex - #2310

Open
faisalhussain-devs wants to merge 4 commits into
MemPalace:developfrom
faisalhussain-devs:fix/windows-transcript-path
Open

fix: support Windows drive letters in transcript fallback regex#2310
faisalhussain-devs wants to merge 4 commits into
MemPalace:developfrom
faisalhussain-devs:fix/windows-transcript-path

Conversation

@faisalhussain-devs

Copy link
Copy Markdown

What does this PR do?

Closes #2304

This PR updates the _wing_from_transcript_path fallback regex to gracefully handle Windows-encoded paths (e.g., D--Code...) generated by Claude Code.

Previously, the regex strictly required a leading dash (/\.claude/projects/-([^/]+)), causing Windows drive letters to miss the match and silently fall back to wing_sessions. The regex has been updated to (?:-|[a-zA-Z]--) to support both POSIX hyphens and Windows drive letter prefixes.

How to test

I have added a dedicated Windows test fixture in tests/test_hooks_cli.py using the exact failing path provided in the issue report.

You can verify the fix by running:
uv run pytest tests/test_hooks_cli.py::test_stop_hook_derives_wing_from_transcript_path_windows -v

Checklist

  • I have read the contributing guidelines.
  • Code is formatted via pre-commit (Ruff).
  • A test was added to prevent future regressions.
  • Local test suite passes (uv run pytest tests/ -v).

@igorls igorls left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the clear write-up and for including a real regression test — the issue described the fix and this matches it precisely.

CI is green across all nine jobs, including Windows. I also checked the regex against the path shapes that seemed most likely to break:

POSIX (regression)        -> wing_mempalace                              unchanged
Windows drive letter      -> wing_code_blm_blm_cadastral_returns_tools   fixed
lowercase drive           -> wing_lowercase_drive                        works
two letters (not a drive) -> wing_sessions                               unchanged
no prefix at all          -> wing_sessions                               unchanged

The alternation ordering is what makes this safe: - is tried first, so every POSIX-encoded folder takes exactly the path it took before and the new branch is only reachable for a single leading letter followed by --. Nothing else can start matching by accident. Merged against current develop the full suite passes here as well.

Two small things before this goes in:

  1. Please add a CHANGELOG.md entry under ## [Unreleased] -> ### Bug Fixes, referencing the issue number. The house style is a bolded one-line summary followed by the mechanism — the surrounding entries are the pattern to copy.
  2. The branch is 4 commits behind develop, which has moved a few times today. A merge or rebase from develop will be needed before this can go in.

One observation rather than a change request: the fallback only triggers when cwd is missing from the transcript JSONL, so as the issue notes this is the second line of defence rather than the common path. That is the right place to fix it — just worth knowing the blast radius is smaller than the "100% of checkpoints in wing_sessions" symptom suggests for sessions that do carry cwd.

Nice catch on the test that was encoding the POSIX assumption while being named for Windows.

@igorls igorls added bug Something isn't working area/mining File and conversation mining area/windows Windows-specific bugs and compatibility needs-rebase PR has merge conflicts with develop and needs rebase labels Aug 24, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

area/mining File and conversation mining area/windows Windows-specific bugs and compatibility bug Something isn't working needs-rebase PR has merge conflicts with develop and needs rebase

Projects

None yet

Development

Successfully merging this pull request may close these issues.

_wing_from_transcript_path fallback never matches Windows-encoded project folders (D--...)

2 participants