Skip to content

fix: unblock search session recovery and preserve installer IO errors - #3974

Merged
kev1n77 merged 3 commits into
openBitFun:mainfrom
uiharuayako:codex/fix-workspace-search-recovery
Nov 19, 2026
Merged

kev1n77 merged 3 commits into
openBitFun:mainfrom
uiharuayako:codex/fix-workspace-search-recovery

Conversation

@uiharuayako

@uiharuayako uiharuayako commented Nov 17, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Fixes #3973.

  • Release the workspace-search cache read lock before probing daemon health or evicting an unhealthy session, retaining the existing per-repository open guard.
  • Preserve target paths and underlying OS errors for installer extraction/copy failures, including the full error chain returned to the frontend.
  • Add a real-daemon recovery/shutdown regression, real filesystem failure tests, and a Windows exclusive-file-handle regression.

Type and Areas

Type: Bug fix.

Areas: Shared workspace-search service; installer Rust backend.

Motivation / Impact

With Rust 2021 temporary lifetimes, the cached-session if let retains its read lock throughout the branch. After a failed health check, acquiring the write lock deadlocks recovery and prevents desktop shutdown cleanup from acquiring the same lock. Cloning the cached entry in a separate statement releases the read lock before daemon IO and recovery.

Installer IO failures now identify the affected file/directory and retain the original system error code. Existing payload validation, symlink rejection, and installation transactions retain their behavior.

Verification

AI-assisted implementation and review; focused tests executed on Linux/WSL.

The new daemon test failed on the original implementation with Elapsed(()) at the five-second recovery deadline and passed after the fix. The three new filesystem diagnostic tests also failed before the fix and passed afterward.

Passed:

  • node scripts/prepare-flashgrep-resource.mjs --target x86_64-unknown-linux-musl
  • FLASHGREP_DAEMON_BIN="$PWD/resources/flashgrep/flashgrep-x86_64-unknown-linux-musl" cargo test --locked -p openbitfun-services-integrations --no-default-features --features workspace-search --lib workspace_search:: -- --include-ignored --nocapture — 29 passed, including recovery and subsequent shutdown against the real daemon.
  • cargo test --locked -p openbitfun-services-integrations --no-default-features --features workspace-search --test workspace_search_contracts — 5 passed; existing content-indexing E2E ignored.
  • cargo test --offline --manifest-path OpenBitFun-Installer/src-tauri/Cargo.toml --lib installer::extract::tests — 4 passed, including legacy ZIP compatibility.
  • cargo test --offline --manifest-path OpenBitFun-Installer/src-tauri/Cargo.toml --lib installer::commands::tests — 9 passed.
  • cargo check --offline --manifest-path OpenBitFun-Installer/src-tauri/Cargo.toml
  • pnpm --dir OpenBitFun-Installer run type-check
  • pnpm run fmt:rs, pnpm run fmt:rs -- --check, pnpm run i18n:audit, and git diff --check.

The full installer build with --skip-app-build could not proceed because target/release/openbitfun-desktop.exe is absent. Windows exclusive-handle tests and GUI exit/install acceptance were not run.

Reviewer Notes

No persisted shapes, commands, or wire contracts changed. Local Linux service and installer filesystem behavior were exercised; remote workspace, remote control, Peer Device Mode, and Detached Dispatch were not exercised end to end.

Checklist

  • This PR is focused and does not include secrets, temporary prompts, generated scratch files, or unrelated artifacts.
  • Relevant verification is recorded above, or skipped checks are explained.
  • User-facing strings, docs, and locales are updated where applicable.

Clone the cached session before probing daemon health so stale-session recovery can acquire the write lock. Add a real-daemon regression covering reopening and subsequent shutdown.
Attach file and directory context to extraction and copy failures and retain the full error chain at the command boundary. Cover real filesystem conflicts, legacy ZIP payloads, and Windows file sharing violations.
@uiharuayako

Copy link
Copy Markdown
Contributor Author

这个bug有时会导致应用无法正常退出,只能在任务管理器中结束,希望能关注一下

Update the activity epoch while the cache read lock is held, and release the lock before daemon IO. Add a real-daemon regression for a pending idle release.

AI-assisted. Verified on Windows with 30 workspace search unit tests and 6 contract tests, including ignored real-daemon cases.
@kev1n77
kev1n77 merged commit 34e196f into openBitFun:main Nov 19, 2026
13 checks passed
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.

[Bug]: 搜索会话异常恢复时发生读写锁自锁,导致托盘退出无响应

2 participants