Skip to content

fix: reuse current location for directory browsing - #46970

Merged
Hona merged 3 commits into
v2from
location-browse
Sep 3, 2026
Merged

fix: reuse current location for directory browsing#46970
Hona merged 3 commits into
v2from
location-browse

Conversation

@opencode-agent

@opencode-agent opencode-agent Bot commented Sep 3, 2026

Copy link
Copy Markdown
Contributor

Summary

Directory completion and the project picker used each directory being browsed as a new Location. The first request to each one booted its complete runtime, including inherited MCP servers.

Keep the existing filesystem endpoint and browse through one stable Location instead:

  • Allow fs.list({ location, path }) to accept absolute paths or paths relative to the Location, including parents and siblings outside its cwd. Returned entries stay relative to that Location, including ./ when listing the cwd from its parent.
  • Leave file-read containment, including symlink checks, unchanged.
  • Keep the current Location and workspace selector during TUI /cd completion and app picker navigation, preloading, and suggestions. Only committed navigation changes the selected Location.
  • Pass absolute listing paths directly from the app and TUI; no client-side relative-path calculation is needed.
  • Pass the composer's Location into the picker only for the same server; Home and cross-server pickers resolve one server-default Location.
  • Cover Desktop's shared remote/SSH/WSL picker. Local native Electron dialogs already browse without making filesystem API requests and need no IPC change.
  • Preserve indexed recursive suggestions within the current Location; outside it, use direct directory listings instead of booting candidate runtimes.

No new endpoint, host-global filesystem fallback, or MCP lifecycle redesign.

Fixes #46826.

Validation

  • Core filesystem tests: 35 passed, including parent/sibling listings, self-entry paths, literal file reads, and lexical/symlink read containment.
  • Server filesystem + HTTP tests: 13 passed. The regression boots one real local MCP process, browses parents/siblings with relative and absolute paths, checks identical entries, and asserts that loaded Locations and MCP starts remain at one.
  • App selection/workspace tests: 35 passed, including workspace identity, relative results, stale searches, drive/UNC paths, and literal ~ filenames.
  • TUI prompt/location tests: 66 passed.
  • Desktop file adapter/attachment and WSL connection tests: 14 passed.
  • Core, Server, App, and TUI package typechecks passed. Regenerated the client with bun run generate; the Effect client's list path now accepts a plain string rather than requiring a RelativePath brand. Formatting and diff checks passed.
  • Real Chromium app with a mocked filesystem: parent navigation, sibling expansion, and Escape passed. The same scenario on the base used four Location selectors; this branch used only /workspace/current across five listings.

Boundaries and follow-up

  • Physical Windows validation was attempted but the shared Windows machine was unreachable over SSH. Native Windows/Electron interaction is not claimed as tested.
  • The existing Path already exists: "sibling/nested/" tree-expansion error was reproduced on both the base and this branch. The navigation assertion passes here, but that separate preload/application defect remains unchanged.
  • This retains the existing Location-scoped filesystem implementation and workspace identity; it does not implement the separate outstanding sandbox-filesystem routing work.

Requested by: @thdxr (dax via Slack)

thdxr and others added 2 commits September 3, 2026 03:41
The picker now sends absolute listing paths, so the old empty-path-only mock returned no directories. Browse the real parent and return the project entry relative to the unchanged Location; assert that browsing keeps that Location and selects the exact project.
@Hona
Hona merged commit b42555c into v2 Sep 3, 2026
8 checks passed
@Hona
Hona deleted the location-browse branch September 3, 2026 06:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants