Skip to content

Ask AI on Windows: survive files named NUL; show progress while serve starts - #6

Merged
dandydarshan merged 2 commits into
mainfrom
fix/serve-windows-nul
Oct 19, 2026
Merged

dandydarshan merged 2 commits into
mainfrom
fix/serve-windows-nul

Conversation

@dandydarshan

Copy link
Copy Markdown
Owner

Summary

Two Ask AI fixes reported from a Windows machine.

1. "Could not answer ask failed: path is on mount '\\.\nul', start on mount 'C:'"

Every question walks the repo (grep and impact scans). The walk took relpath of each file. Windows resolves a file named NUL / CON / AUX… (what > nul in Git Bash leaves behind) to the device path \\.\nul, and relpath raises across "mounts".

 impact._repo_files
-  relpath(join(root, name), repo)          # resolves NUL -> \\.\nul on Windows
+  folder = relpath(root, repo); folder/name   # never resolves the file name

 Retriever._repo_files
-  its own copy of the walk
+  reuses impact._repo_files

2. codewiki serve was silent for ~5 s at start

Loading C:\dev\repo\docs …
⠼ Re-reading 265 file(s) changed since the docs…      # spinner, step text from the index's log
...
  Indexed:   429 doc sections, 1943 code components in 4.1s

QAIndex logs each slow step (git check, re-reading changed files, indexing) through logging, so the MCP server's stdout stays clean. serve shows those steps in a rich spinner, on stderr.

Evidence

  • Before: test_repo_walk_survives_windows_device_names fails. It adds a file named nul and makes os.path.relpath raise the Windows ValueError for it.
    After: it passes. grep, the impact scan and the walk all work.
  • codewiki serve --docs docs now shows the spinner and step messages, then the load time.
  • Full suite: 459 passed. The 4 changed modules, compiled with the wheel's Cython directives: 458 passed (CI's wheel test deselects the same test).
  • Not run on Windows itself: the device-name behaviour is simulated.

Merge Danger

Door: two-way

Blast Radius: ask-and-serve

  • Repo walk order and contents are unchanged; only how relative paths are built.
  • When stderr isn't a terminal, the rich status prints nothing, so piped output stays as before.

🤖 Generated with Claude Code

Darshan M U and others added 2 commits October 19, 2026 08:00
… starts

- The repo walk behind grep and impact (every Ask AI question) took
  relpath of each file. Windows resolves a file named NUL / CON / ... (what
  `> nul` in Git Bash leaves behind) to \\.\nul, so relpath raised "path is
  on mount '\\.\nul', start on mount 'C:'" and the answer failed. relpath
  is now taken of the folder only; retrieve.py reuses impact's walker
  instead of its own copy.
- `codewiki serve` prints a line at once, then a spinner naming the index
  step in progress (git check, re-reading changed files, indexing) and the
  load time, instead of ~5 s of silence. The index logs its steps (stderr
  via logging, so the MCP server's stdout stays clean).

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…prefix

A plain open("...\\nul") on Windows writes to the NUL device, so the
file never existed and the test failed on the Windows wheel jobs. With
\\?\ the file exists and relpath fails for real; other platforms keep the
simulated error.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@dandydarshan
dandydarshan merged commit 7242a6d into main Oct 19, 2026
13 checks passed
@dandydarshan
dandydarshan deleted the fix/serve-windows-nul branch October 19, 2026 03:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant