Skip to content

test(home): regression test for folder browser backend-switch (closes #200)#713

Open
CryptoJones wants to merge 1 commit into
OpenHands:mainfrom
CryptoJones:aaron/test-folder-browser-backend-switch-200
Open

test(home): regression test for folder browser backend-switch (closes #200)#713
CryptoJones wants to merge 1 commit into
OpenHands:mainfrom
CryptoJones:aaron/test-folder-browser-backend-switch-200

Conversation

@CryptoJones
Copy link
Copy Markdown

  • A human has tested these changes.

Why

Issue #200 reported that switching from a Local backend to a custom remote backend left the Add-Workspace folder browser displaying the previous backend's home directory (e.g. `/Users/joepelletier` instead of `/Users/homeadmin`) and 404'ing on the next navigation.

PR #306 fixed this by (a) including the active backend's `id` + `orgId` in the React Query keys for `useHomeDirectory` / `useSearchSubdirs` and (b) adding a reset effect in `FolderBrowserModal` that nulls `currentPath` whenever `active.backend.id` changes. Both pieces are still in place on `main`.

The existing `tests/components/features/home/workspace-selection-form.test.tsx` covers opening the modal once but never drives a backend switch, so neither piece of the fix has regression coverage today. This PR adds that coverage and closes the still-open #200.

Summary

  • Add `folder-browser-modal-backend-switch.test.tsx` mounting `FolderBrowserModal` directly, mocking `useActiveBackend` and `FileClient.getHome` per backend, then re-rendering with a different active backend and asserting the breadcrumb re-seeds to the new home (and the previous one is gone).
  • Test-only — no source changes.

Issue Number

Closes #200

How to Test

```bash
npm install
npm run make-i18n
npx vitest run tests/components/features/home/folder-browser-modal-backend-switch.test.tsx
```

To confirm it catches the regression, temporarily delete the `useEffect(() => { setCurrentPath(null); }, [active.backend.id, active.orgId]);` block in `src/components/features/home/workspace-dropdown/folder-browser-modal.tsx` and re-run — the test fails. (Verified locally.)

Type

  • Bug fix
  • Feature
  • Refactor
  • Breaking change
  • Docs / chore

Notes

Sister cleanup: issue #205 (Export Conversation server-side zip failure) is also being closed as already-fixed in `software-agent-sdk#3170`, which is included in our currently pinned `agent-server` v1.23.0 (`config/defaults.json`). No code change there.

PR OpenHands#306 fixed issue OpenHands#200 by keying useHomeDirectory / useSearchSubdirs
on the active backend id+orgId and adding a reset effect that clears
currentPath when the active backend changes, but the existing
workspace-selection-form tests don't drive a backend switch and so
wouldn't catch a regression of either piece.

Add a focused FolderBrowserModal test that mounts the modal with one
backend, switches active backend mid-test, and asserts the breadcrumb
re-seeds to the new backend's home directory (and that the previous
backend's path is gone). The test was verified to fail when the reset
effect is removed from folder-browser-modal.tsx.

Closes OpenHands#200

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
@vercel
Copy link
Copy Markdown

vercel Bot commented May 21, 2026

@CryptoJones is attempting to deploy a commit to the openhands Team on Vercel.

A member of the Team first needs to authorize it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

bug: Workspace is incorrect when switching to a non-Local backend

1 participant