feat(workspace): native OS directory picker (#3074) + per-host recents - #3246
Open
ptr-syrto wants to merge 1 commit into
Open
feat(workspace): native OS directory picker (#3074) + per-host recents#3246ptr-syrto wants to merge 1 commit into
ptr-syrto wants to merge 1 commit into
Conversation
…host recents Add an OS-native directory chooser for local workspace selection in the new-session dialog and surface per-host recents as a clickable list. Native dialog: - Host advertises a `native_directory_dialog` capability (macOS + GUI session only); Windows/Linux report unsupported and fall back. - macOS opens an NSOpenPanel-style `choose folder` via osascript and returns the chosen absolute path over the authenticated host tunnel. - Dialog runs as a background task so host keepalives keep flowing; concurrent requests are rejected; disconnect fails pending futures fast (502, not a 300s hang). - Server enforces the capability (422 if absent); client additionally gates on the local Electron desktop host identity (capability alone is insufficient). - Host-switch race: the result is discarded unless the selected host still matches when the promise resolves. - Absolute-path invariant enforced at the frame decode boundary. Recents: - Per-host most-recent-first list in the workspace popover, capped at 8, persisted under `omnigent:recent-workspaces`. Recorded on selection (native pick + recent click) and on session create. Existing schema and ForkSessionDialog usage unchanged. The in-app WorkspacePicker remains the always-available fallback for remote/headless/unsupported/older hosts; no protocol-compatibility break. Co-authored-by: penny (Omnigent) <penny@omnigent.ai>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Native workspace picker: recents + system directory dialog
Summary
The new-session workspace chip opens a popover that jumps straight into the
in-app folder browser, with no memory of where you worked last and no way to
use the OS's own directory picker. This adds:
as workspaces are selected.
local Electron desktop host and that host advertises the
native_directory_dialogcapability. Clicking it asks the local host toopen the macOS-native directory chooser (
NSOpenPanelviaosascript) andfills the workspace path with the chosen absolute directory.
WorkspacePickerremains directly below, unchanged, asthe fallback for every other host/platform combination.
Closes #3074
Key design decisions
background task on the host so a long-lived
osascriptpicker dialog can'tblock or time out the request; the host connection keepalive is tracked
independently so a slow user pick doesn't get treated as a dead host.
server only allows the native-dialog call when the target host's advertised
capabilities include
native_directory_dialog; the client only shows thebutton when the selected host is additionally the local Electron desktop
host (capability alone isn't sufficient — see nit below).
dialog request is in flight discards the stale response instead of
populating the workspace path for the wrong host.
actually selected (not just browsed to), keyed per host, most-recent-first,
capped and persisted in
localStorageunderomnigent:recent-workspaces.Windows/Linux hosts report the capability as unsupported and always fall
back to the in-app picker.
Demo
Screenshots attached below in the GitHub PR editor. Captions:
Manual repro steps
advertises
native_directory_dialog) and open New session.for the current host, most-recent-first, and that clicking an entry
selects it.
the in-app picker; click it, choose a folder in the native macOS chooser,
and confirm the workspace path updates to the chosen absolute path.
confirm the button disappears, leaving only Recents + the in-app picker.
Verification
pytest(host/server suites touched by this change):203 passed. One unrelated pre-existing failure,
tests/host/test_connect.py::test_run_host_process_announces_session_log_dir_on_start,is a log-ordering assertion untouched by this diff and reproduces the same
way on
main.web:tsc -bclean, no type errors.web: lint clean on all files touched by this change except thepre-existing index-key warning noted below.
webunit tests (NewChatDialog.test.tsxand friends) exercise the newrecents/native-dialog behavior directly; full-suite validation happens in
CI because this machine's local Vitest run hits a pre-existing
jsdom/
localStorageenvironment bug affecting ~40 unrelated test files.Known nits
NewChatDialog.tsxuses an array index asa React key in one list render, flagged by
no-array-index-key; thispredates this change and isn't introduced by it.
capability + ownership, not capability alone:a host can advertise
native_directory_dialogwithout being the localElectron desktop host (e.g. a remote macOS host), and the button should
only appear when the user's own machine can show a native dialog. This
is by design, not an oversight.
Type of change
Test coverage
Coverage notes
Manual verification: captured live screenshots of the popover (Recents list +
"Use system dialog" button + fallback picker) via a Playwright script against
the real Vite dev server, with a test-harness-only Electron identity stub and
localStorage seed (see Demo section). Backend behavior (capability
enforcement, background dialog task, keepalive, host-switch race guard) is
covered by
tests/server/integration/test_hosts_native_directory_dialog.pyand the updated
tests/host/test_connect.py/tests/host/test_frames.py/tests/server/test_host_registry.pysuites (203 passing, see Verification).