Repository navigation
fix(tools): on macOS, default file search skips the folders macOS guards with a prompt - #5599
Conversation
…rds with a prompt On a Mac, an undirected file search no longer freezes the turn behind a "GAIA would like to access files in your Documents folder" dialog the user may never see. The default scopes walked ~/Documents, ~/Desktop and ~/Downloads, macOS blocked the first read until someone answered, and the tool sat until its 180 s timeout, then the agent retried the same search. - find_files (smart, home, cwd, everywhere), search_file (including deep search) and search_directory now skip Desktop, Documents, Downloads and iCloud Drive (~/Library/Mobile Documents) on macOS, unless the user named that folder as the scope or it is inside the chat's allowed paths. Home and / grant nothing, since the flagship's default sandbox is ~. - When folders are skipped the result says so in one line, so the model can ask the user to name the folder. - A time budget cannot help here: the read blocks inside the kernel on the prompt, so the walk must not start it. Other platforms are unchanged. Changes tool output the model sees. Eval categories to watch on the next RC: tool_selection, error_recovery, gaia_files, gaia_honesty. Fixes amd#5578
|
Verdict: Approve with suggestions On macOS, an open-ended file search no longer walks into Desktop, Documents, Downloads or iCloud Drive, so the turn can't freeze behind the macOS "GAIA would like to access your Documents folder" prompt. The result now says which folders it skipped so the model can ask the user to name one. The guard is applied at every point the three search tools descend into a folder, a folder the user names or allows is still searched, and other platforms behave exactly as before. Nothing blocks the merge. Worth knowing before the macOS check:
Real-world evidenceN/A: no evidence bundle was produced, and the change only does anything on macOS, which this Linux runner can't exercise. The verdict rests on static review alone. I couldn't run the new tests here either (pytest isn't installed on this runner), so the pass counts are the author's. The macOS golden-path check and the eval categories named in the PR are still open. 🔍 Technical detailsIssues 🟢 🟢 Checked and fine
Strengths
|
…-skips-macos-protected
…ved paths A caller passing an unresolved path would miss a guarded folder silently, so the guard's docstring now says paths must come from a resolved root.
|
Took the docstring note: the guard now says it matches exact paths built from a resolved root. The recent-files prompt risk is left for a follow-up, since listing those folders is that tool's job. |
) On a Mac, an open-ended file search could freeze a chat in `~/Music`. macOS guards that folder behind its "Media & Apple Music" prompt, and the first read blocks until someone answers. amd#5599 made searches skip Desktop, Documents, Downloads and iCloud Drive, but not Music. On rc6 that left a chat stuck on "Finding files" for over two minutes. Music, the TV app's library (`~/Movies/TV`, behind the same prompt) and the Photos library (guarded by the "Photos" prompt) are now skipped too, unless the user names them or the chat allows them, and the result says which folders were skipped. A whole-disk search now skips them too: it used to reach them through macOS's `/System/Volumes/Data` path, which the guard didn't recognise. Fixes amd#5669 ## Test plan - [x] `pytest tests/unit/test_search_skips_macos_protected_folders.py`: 14 pass. With the two folders added to the test's guarded list, 3 failed before the fix: an undirected search, a deep search and the skip note all walked into them. - [x] Reproduced on rc6, macOS 26.5.1: the sidecar's search thread was blocked in `opendir` on `~/Music`. - [x] Retested on rc6 plus the open fixes: a home-wide `find_files` still hit the 180 s timeout, this time blocked on `~/Movies/TV`. With it skipped, a walk of the same home finishes in about 8 s. - [x] A whole-disk search (scope `everywhere`) reached `~/Music` again as `/System/Volumes/Data/Users/<u>/Music` and hung. The guard now matches by inode as well; the same search answers in 28 s and names the skipped folders. - [ ] On a Mac that has never granted media-library access, ask GAIA to find a file without naming a folder. It answers without a prompt, and the result names `~/Music` as skipped. --------- Co-authored-by: Kalin Ovtcharov <[email protected]>
…reezing (amd#5709) On a fresh Mac, asking GAIA "what was I working on?" froze the turn behind macOS's "GAIA would like to access files in your Documents folder" dialog until the tool timed out. The first read of a guarded folder blocks in the kernel until someone answers. Now GAIA opens each guarded folder on a background thread first. All probes share one 2-second deadline. A read still held after it means the dialog is up: that folder is reported as waiting, with a line telling the user to answer the dialog and ask again, and the other folders are listed meanwhile. A folder the user answered "Don't Allow" for is reported as denied, with where in System Settings to turn access on, instead of as searched with nothing in it. On a Mac that has already granted access, nothing changes, and the probe costs about 0.1 ms per folder. Closes amd#5607. Builds on amd#5599, which made undirected searches skip these folders. This tool can't skip them, because listing them is its job. ## Test plan - [x] `pytest tests/unit/test_recent_files_waits_on_macos.py` (11 tests, platform patched, temp home): - a held read counts as pending and clears once answered; - asking again while the dialog is open reuses the waiting probe; - only guarded folders are probed, and nothing is probed off macOS; - the other folders are listed while one waits; - all folders waiting is a not-executed error that says what to do; - three held folders cost one shared wait, not three; - a denied folder is reported with where to allow it; - a folder outside the sandbox is never probed. The two tool-level tests fail without the fix. - [x] `test_search_skips_macos_protected_folders.py`, `test_file_tools.py`, `test_file_tools_allowed_folders.py`, `test_file_search_scope.py` (297 passed) - [x] On this Mac (access already granted): each probe takes 0.1–0.2 ms, and `list_recent_files(days=7)` returns the same 2 files in 0.01 s - [x] black, isort, pylint (errors only) - [ ] On a Mac that hasn't granted GAIA folder access: ask "What files have I changed recently?" The answer names the folder macOS is asking about within a few seconds, instead of hanging. --------- Co-authored-by: Kalin Ovtcharov <[email protected]>
On a Mac, asking GAIA about a document could freeze the turn behind a macOS privacy dialog. The default file search walks
~/Documents,~/Desktopand~/Downloads; the first read made macOS ask "GAIA would like to access files in your Documents folder" and block until someone answered, so the tool hung 180 s, the agent retried, and the UI said only "Model is processing". An undirected search on macOS now skips those folders (and iCloud Drive) and says so in one line, so the model can ask the user to name the folder. A folder the user names, or one inside the chat's allowed paths, is still searched; other platforms are unchanged.Found testing v0.25.1-rc5 on macOS (
tccd:AUTHREQ_PROMPTING … kTCCServiceSystemPolicyDocumentsFolder). Fixes #5578.LLM-affecting (tool output text changes). Eval categories to watch on the next RC:
tool_selection,error_recovery,gaia_files,gaia_honesty.Test plan
pytest tests/unit/test_search_skips_macos_protected_folders.py tests/unit/test_file_search_scope.py: 62 passed; 9 of the 14 new tests fail onmain(the other 5 guard explicit scopes, allowed paths and Linux).test_persisted_grants_are_not_unioned_into_a_host_scope) fails the same way onmain.gaia eval agenton the categories above (next RC).🔍 Technical details
The rule lives in a new
src/gaia/agents/tools/protected_folders.py;find_files(smart/home/cwd/everywhere),search_file(incl. deep search) andsearch_directorygain small guard calls, to keep overlap with #5565 small. A 20 s search budget (#5565) can't interrupt a read blocked in the kernel on the prompt, so both are needed.~and/don't count as granting the folders, since the flagship's default sandbox is~.list_recent_filesis unchanged: its job is to list those folders, and its argument names them.