Skip to content

Read loaded files on a background thread with a timeout - #106

Open
voytas wants to merge 3 commits into
mainfrom
fix/network-path-load-timeout
Open

voytas wants to merge 3 commits into
mainfrom
fix/network-path-load-timeout

Conversation

@voytas

@voytas voytas commented Dec 3, 2026

Copy link
Copy Markdown
Contributor

Problem

On Windows, loading a recent file from an unreachable network share froze the app. File.OpenRead was called on the UI thread and blocks until Windows gives up on the SMB connection, which can take minutes and can't be cancelled.

Changes

  • FileReader (new, Spectron.Emulation/Files): reads a whole file into a MemoryStream on a background thread and stops waiting after 10 seconds, throwing a TimeoutException that names the path. ExistsAsync does the same for existence checks and returns false on timeout.
  • ZipArchiveReader: new constructor that reads an archive from a stream.
  • MainViewModel.Files: LoadFileCoreAsync reads the file once through FileReader and loads plain files and zips from that copy. Poke auto-load uses the timed check and read. A file that timed out stays in the recent files list; other errors still remove it.

All loading paths (recent files, favorites, drag-and-drop, command line, MCP) go through LoadFileCoreAsync.

Not covered

Tape insert (TapeManager.InsertTape(fileName)), FavoriteItemViewModel zip/exists checks and the MCP File.Exists check still open files on the calling thread.

Testing

  • New FileReaderTests: read, missing file, timeout, exists check, zip from stream.
  • MainWindowTests.ShouldExecuteLoadCommand now awaits the load command.
  • All non-integration tests pass. Not yet tried on Windows against a disconnected share.

🤖 Generated with Claude Code

Opening a file on an unreachable network share blocked the UI thread
until Windows gave up on the connection. Files are now read into memory
via FileReader, which gives up waiting after 10 seconds. A timed-out
file stays in the recent files list, since the share may come back.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@chatgpt-codex-connector

chatgpt-codex-connector Bot commented Dec 3, 2026 •

Copy link
Copy Markdown
Codex Review Summary: ✅ Completed

This comment shows the latest Codex review activity on this pull request.

Review Status Commit Review trigger
📝 Code Review ✅ Completed 2026-12-03T12:05:41.440090Z 15cb508 PR opened
ℹ️ About Codex in GitHub

Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you

  • Open a pull request for review
  • Mark a draft as ready
  • Comment "@codex review" or "@codex security review".

Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings.

voytas and others added 2 commits December 3, 2026 12:07
Path.Combine drops earlier arguments when a later one is rooted;
Path.Join doesn't, which addresses the code quality review comments.

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

This branch has not been deployed

No deployments
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