Repository navigation
fix(desktop): make Export Logs skip locked files, reveal safely, and show toast feedback - #1679
Merged
Merged
Conversation
…show toast feedback On Windows, rune-perf holds an exclusive mandatory LockFileEx lock on %LOCALAPPDATA%\rune-opencode\Logs\perf\.perf.lock while the app runs. Within 24 hours of first creating .perf.lock, Export Logs collected it and aborted the entire archive with ERROR_LOCK_VIOLATION, swallowing the error via eprintln! with no UI feedback. - Skip *.lock sentinels and symlinks in collect(), and handle per-file read errors gracefully (recording skipped entries in manifest.json) instead of aborting the whole archive. - Write the zip atomically via a sibling .part file with unique output names and record the real build version and channel in manifest.json. - Reveal the archive via harness_log::reveal (SHOpenFolderAndSelectItems on Windows), with a raw_arg explorer.exe fallback for redirected or junction Downloads folders, and honor Windows FOLDERID_Downloads in dirs::downloads() when not rooted. - Drive export lifecycle through an explicit ExportLogs state machine with waiting, success (with Reveal button), and failure toasts.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Addresses the unresponsive "Export Logs…" bug reported in #1649 (keeping #1649 open for the reporter's memory breakdown follow-up).
Root causes fixed
rune-perfholds an exclusiveLockFileExlock on%LOCALAPPDATA%\rune-opencode\Logs\perf\.perf.lockwhile the app runs. On Windows, byte-range locks are mandatory, so within 24 hours of.perf.lockbeing createdexport_logscollected it and failedread_to_end()withERROR_LOCK_VIOLATION, aborting the entire archive and leaving a partial zip.export_logsonly printed failures viaeprintln!(invisible in a Windows GUI app), returned silently if Downloads was unavailable, and gave zero toast feedback on start, success, or failure.explorer.exe /select,<path>quoting and redirected Downloads:Command::arg(format!("/select,{}", file.display()))quotes paths containing spaces as"/select,C:\...", which Explorer rejects. Alsodirs::downloads()always used%USERPROFILE%\Downloadsinstead ofFOLDERID_Downloads.Changes
*.lockfiles and symlinks inexport_logs::collect(), read each log file's tail resiliently (skipping unreadable/locked files and recording them underskippedinmanifest.json), write the archive atomically via a sibling.partfile with non-colliding filenames, and recordcrate::updater::build_version()/build_channel()inmanifest.json.ExportLogsstate machine (Idle/Exporting) inopencode_kernel::StateSlotspolled viastage::INGEST_LOCAL, showing waiting, success (with a Reveal action button), and error toasts.harness_log::reveal(SHOpenFolderAndSelectItemson Windows), with a saferaw_argexplorer.exe /select,"<path>"fallback when Downloads is on a junction or redirected drive.win_install::downloads()(SHGetKnownFolderPath(FOLDERID_Downloads)) and use it indirs::downloads()on non-rooted Windows runs.Verification
pwsh scripts/guardrails.ps1(10/10 passed),cargo check -p win-install -p opencode-desktop --lib --bins --features stories, andcargo clippy -p win-install -p opencode-desktop --lib --bins --no-deps(0 warnings in touched files).