Repository navigation
fix(tools): recent-files reports the macOS folder dialog instead of freezing - #5709
Conversation
…reezing On a fresh Mac the first read of ~/Documents blocks behind "GAIA would like to access files in your Documents folder" until someone answers, so "what was I working on?" froze the turn until the tool timed out. list_recent_files can't skip those folders the way an undirected search does, since listing them is its job. It now opens each guarded folder on a thread first. A read still held after 2 s means the dialog is up, so that folder is reported as waiting (locations_waiting_for_macos, with a line telling the user to answer it) and the other folders are listed. The probe ends on its own once the user answers, and a probe already waiting is reused. Closes amd#5607.
|
Verdict: Approve with suggestions On a fresh Mac, "what was I working on?" no longer hangs behind the macOS folder-access dialog. GAIA now probes each guarded folder on a background thread. Any folder still blocked after 2 seconds is reported as waiting on the dialog, and the other folders are listed as usual. The approach is sound: no blocking read ever runs on the agent's thread, and asking again reuses the probe that's already waiting, so blocked threads don't pile up. I found no blocking issues. One thing to know: the only proof so far comes from a Mac that had already granted access. The unchecked test-plan item, a Mac that hasn't granted it yet, is the case this PR exists for, so please run it before merge. The probe is right in principle, but nothing here has exercised the real dialog. Real-world evidenceN/A: no evidence bundle was produced. The changed surface only behaves differently on macOS, and this CI lane runs on Linux, so none of it could be exercised here. This verdict rests on static review plus the author's own measurements on a Mac that had already granted access. The cold-start dialog case is still unverified. I also couldn't run the new tests in this lane because pytest isn't installed. 🔍 Technical detailsIssues 🟢 Worst-case wait adds up across folders ( 🟢 "Don't Allow" still counts as searched ( Strengths
|
…as denied All guarded folders are probed at once against one shared 2 s deadline, so a fresh Mac stalls the turn about 2 s, not 2 s per folder. A folder the user answered "Don't Allow" for is no longer counted as searched with no files: it is reported in locations_denied_by_macos, with where to turn access on. A folder GAIA's own sandbox refuses is never probed, so it can't raise the macOS dialog.
|
Both suggestions are done in the latest commit: the folder probes now share one 2-second wait, and a folder the user answered "Don't Allow" for is reported as denied, with where in System Settings to turn access on. The cold-Mac check in the test plan still needs a Mac that hasn't granted folder access. It's left for manual release testing. |
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 #5607. Builds on #5599, which made undirected searches skip these folders. This tool can't skip them, because listing them is its job.
Test plan
pytest tests/unit/test_recent_files_waits_on_macos.py(11 tests, platform patched, temp home):The two tool-level tests fail without the fix.
test_search_skips_macos_protected_folders.py,test_file_tools.py,test_file_tools_allowed_folders.py,test_file_search_scope.py(297 passed)list_recent_files(days=7)returns the same 2 files in 0.01 s