Repository navigation
fix(ui): make the new-chat folder chip work on installed GAIA - #5961
Conversation
… own process On an installed GAIA the new-chat folder chip was plain text, and folders added to a chat never reached the agent, because GAIA runs its agent as a daemon sidecar and every folder path refused sidecars outright. - The chip, creating a chat with folders, and adding a folder now ask the running sidecar whether it takes a file scope (contract 2.18+). Only an older agent, or one that can't start, is refused, with a message that says what to do. - Each relayed turn sends the chat's added folders with its scope, still narrowed by GAIA_ALLOWED_PATHS. A chat with folders on a sidecar too old to take them stops with an update message instead of dropping them. - Removing a folder and the internet switch still refuse for a sidecar; their message no longer tells a GAIA chat to start a GAIA chat. Closes amd#5957
The desktop app now opens the computer's own folder picker for a new chat's folder chip and the session panel's Add folder. The browser version keeps GAIA's popup, which now hides dot folders behind a Show hidden checkbox so a home folder opens on Documents and Downloads, not a wall of config folders. - New dialog:pick-folder IPC channel (services/folder-dialog.cjs), exposed as gaiaAPI.dialog.pickFolder. It resolves the chosen path or null on cancel, and errors reach the UI. - useFolderPicker holds the desktop-or-browser choice for both callers. - A typed path still opens any folder, hidden ones included.
A folder picked with the new-chat folder chip was granted to the agent but never named to the model, so asking about "this folder" made it guess the home folder. Each turn's query to the chat's agent, relayed or in-process, now opens with a short note naming the chat's folders. The stored chat, title and turn summary keep what the user typed.
|
Verdict: Approve Picking a folder for a new chat now works when GAIA runs its agent as a separate process, which is how an installed GAIA runs it. The desktop app opens the computer's own folder picker, and the agent is told which folder "this folder" means, so it stops wandering off to the home folder. An agent too old to take folders now stops with an "update GAIA" message instead of quietly ignoring them. I found no blocking issues. Every chat path that sends a turn to a separate-process agent passes the folders along. The background-task path is the exception, but it has no chat and so no folders. Two small things are worth knowing. Neither blocks the merge:
Real-world evidenceNo evidence bundle was produced for this run. The PR description has its own: rendered before/after screenshots from the desktop app with the agent running as its own process (macOS, contract 2.21), the OS picker opening from the chip, the agent reading a file in the picked folder, the agent answering "what are we working on in this folder?" from the right folder, and the browser popup with hidden folders tucked away. That covers the Agent UI surface this PR changes. Windows hasn't been tried, and my verdict there rests on reading the code. 🔍 Technical detailsIssues found 🟢 Folder note is re-added every turn and lands in memory and history ( 🟢 Verified while reviewing
Strengths
|
A chat made while the agent ran inside GAIA can have a sub-folder taken away from a folder it was given. Once the same chat's agent runs as its own process, the turn sent the folder as a whole, and the sidecar could read and write the sub-folder the user removed. An allowed-paths list can't express a removal, so such a chat now stops with a message to start a new chat. Also pins that a relayed folder grants that folder and not its siblings, and that GAIA_ALLOWED_PATHS still narrows it.
|
Thanks for this, @kurplunkin. Sending the chat's folders on every turn, and refusing loudly when the agent is too old to take them, are the right calls. The live-sidecar test that checks the folder reaches the real I pushed one small fix. A chat can have a sub-folder taken away while its agent runs inside GAIA. If that same chat later runs on a relayed agent, for example after switching from a source install to an installed GAIA, the whole folder was sent, removed sub-folder included. A relayed turn can't express a removal, so that chat now stops and asks the user to start a new one. New chats on an installed GAIA can't reach that state, so the demo path is unaffected. Because this widens what a relayed agent may read and write, it still needs a maintainer's sign-off on the permission scope before merge. 🔍 Technical details
|
Since amd#5961 the new-chat chip can show a folder the user picked, and the agent is told "this chat is working in" that folder, but a bare "notes.txt" still went to the process folder. The chat's first picked folder is now the workspace, for in-process and relayed agents alike; with none picked it stays the folder the chip shows by default. Adds adversarial checks that the workspace base can't move a write out of the chat's folders: a symlink inside it, a path on another drive (C:foo style) and a drive-root path (\foo) on Windows all resolve outside and are refused, and the approval prompt names the same path.
main's amd#5966 took contract 2.22 for /query's reasoning field, and that contract shipped in v0.25.2-rc5. internet_off and /sessions/{id}/internet move to 2.23, so a 2.22 agent from rc5 is not mistaken for one that takes the switch and sent a field it would 422. From amd#5961, a relayed GAIA chat can now be given a folder; only taking one away is still refused, and that refusal no longer mentions the internet. The live-sidecar switch tests released the parked agent before the relay had re-read the switch, so they raced the push they were checking. They now wait for the relay to go live, as a real first tool call waits on a model reply.
The new chat keeps main's folder picker under the message box (amd#5826, amd#5961), and this branch's chip now shows only in an existing chat's composer, where it opens the session panel's folders. - Kept main's library documents, first-run setup notice, private chip, saved draft and typing-while-the-chat-is-created queue in the new chat; the task cards stay removed, so the agent-ui guide no longer offers them. - setHole reuses its mask when the grid size is unchanged.
#5826 turned the new-chat folder chip into a real picker, but only when the GAIA agent runs inside the app. When the agent runs as its own process, the chip went back to plain text, because that process had no way to receive the folder. Installed copies run the agent that way, so most people still couldn't use the picker. This PR closes that gap: the chip works whenever the agent can take a folder, and the picked folder actually reaches the agent on every message.
It also changes how you pick. In the desktop app, the chip and the session panel's Add folder now open the operating system's own folder picker. GAIA's popup stays for the browser version only, and it now hides dot folders behind a Show hidden checkbox, as the file browser already does since #5834.
The Mac folder picker opened from the chip, then the picked folder on the chip:
The agent reads a file in a folder outside the home folder, picked this way:
Asked "what are we working on in this folder?" with a project folder picked, the agent goes straight to it:
The browser version's popup, with hidden folders tucked away:
Closes #5957
🔍 Technical details
session_environment.takes_folders(agent_type): in-process agents always can; a relayed one can whenscope_supported(profile, handle.api_version)(contract 2.18+). A daemon start failure raisesEnvironmentChangeError, never a silent False._dispatch_sidecar_querytakesfoldersand merges them intoallowed_pathsthrough_effective_scope, soGAIA_ALLOWED_PATHSstill narrows them. With folders and no scope support it emitsagent_error.enforced: False), so after the chat starts, folders are added from the chip only. Unlocking the panel's Add folder is left for a follow-up.dialog:pick-folderIPC inservices/folder-dialog.cjs, exposed asgaiaAPI.dialog.pickFolder;useFolderPickerpicks native vs popup in one place for both callers.with_folder_note), on both the relayed and in-process paths, so it works with already-installed agents and needs no contract change. Only the text sent to the agent changes; the stored message, title and attachment parsing keep the user's words.Evals to watch on the next RC (the folder note changes prompt text, only in chats with picked folders):
gaia_files,gaia_resilience,gaia_tool_selection,tool_selection,gaia_code,gaia_git,gaia_shell.Test plan
pytest tests/unit/chat/ui/test_environment_router.py tests/unit/chat/ui/test_start_screen.py tests/unit/chat/ui/test_relayed_scope.py tests/unit/test_relay_flagship_documents.py tests/unit/chat/ui/test_gaia_home_storage.py(85 passed), plustests/unit/chat/ui/with the folder-note tests (2499 passed)npx tsc --noEmit -p .andnpx vitest runinsrc/gaia/apps/webui(1920 passed)npx jestintests/electron(1256 passed)python util/lint.py --black --isortand--flake8