Skip to content

Registry watch on ~/.docsreader never activates on macOS: agent-created workspaces appear only after window refocus #22

Description

@anbturki

Summary

The fs scope glob matching requires a literal leading dot on unix, so the $HOME/** scope entries can never match ~/.docsreader. The registry watch therefore throws PathForbidden at setup on every macOS install; the error is swallowed as a debug log whose comment assumes "directory does not exist yet" is the only failure mode. Net effect: workspaces created by agents while the app is open never appear live; they only show up when the window loses and regains focus (the reconcile fallback). The same scope rule silently breaks watching and reading for any workspace under a dot directory or outside $HOME.

Reproduction (release build of f485396, macOS, isolated $HOME)

  1. With the app open and frontmost, write a valid entry into ~/.docsreader/workspaces.json (exact shape the MCP sidecar writes) for a workspace at ~/agent-ws.
  2. Wait: the workspace switcher never shows agent-ws (first screenshot, taken 6 s after the write; it stayed absent for minutes). A working watch would surface it in about 1 s (200 ms watch delay + 600 ms debounce).
  3. Force a real window focus event (defocus, refocus): agent-ws appears immediately (second screenshot, switcher now shows "welcome docs-ws agen[t-ws]").

Root cause

  • Tauri fs scope: require_literal_leading_dot defaults to true on unix (tauri-plugin-fs-2.5.1/src/commands.rs:1559, tauri-2.11.2/src/scope/fs.rs:198-208), so $HOME/** (src-tauri/capabilities/default.json:82-94) cannot match ~/.docsreader. No override in tauri.conf.json.
  • The failed watch(registryDir) is logged at debug level and never retried: src/hooks/useLibrary.ts:466-470. The focus fallback at useLibrary.ts:473 is the only remaining sync channel.
  • Related asymmetries: the Rust scan command is not scope checked (src-tauri/src/tauri_api/mod.rs:28-34) while frontend watch/readTextFile are, so a workspace under a dot path or outside $HOME (MCP init_workspace accepts any absolute path, src-tauri/mcp/src/server/workspace_tools.rs:104-113) renders a browsable tree that can neither sync nor open files. The workspace watch failure is equally silent and never retried (useLibrary.ts:424-426).

Upstream reference for watch scope behavior: tauri-apps/plugins-workspace#2362.

Proposed fix

  • Add explicit scope entries for $HOME/.docsreader and $HOME/.docsreader/** (watch + read).
  • Surface watch failures to the user and retry instead of debug-logging them once.
  • Decide a policy for dot-path and out-of-home workspaces: either scope them explicitly or reject them at init_workspace, so a workspace is fully usable or clearly refused.

Screenshots

Registry entry written while the app is open and frontmost, workspace absent; appears only after a real focus cycle:

Image Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions