Skip to content

fix(client): distinguish location sync failures - #45601

Closed
opencode-agent[bot] wants to merge 1 commit into
v2from
location-45592
Closed

opencode-agent[bot] wants to merge 1 commit into
v2from
location-45592

Conversation

@opencode-agent

Copy link
Copy Markdown
Contributor

Summary

location.sync() loads location info and then hydrates multiple independent resources. Previously, any rejected request could make the TUI replace the prompt with “Session location unavailable,” even when the directory existed and its info had loaded successfully.

  • Add LocationSyncError with the requested location, failed resource, original cause, and a classification that distinguishes directory, transport, lookup, and resource failures. Successful reads remain cached; failed reads remain retryable.
  • Return a structured LocationDirectoryError only after checking the requested placement's filesystem. Check before booting location services so initialization failures are not mistaken for missing directories. Follow directory symlinks and keep authorization intact.
  • Reserve directory recovery for explicit directory errors. Other sync failures show a resource-specific error toast with a working Retry action, without replacing the session prompt. Preserve stale-request and reconnect guards.
  • Regenerate the client from the updated protocol.

This covers the false-positive warning path discussed in #45592 and overlaps with the narrower mitigation in #45148. The reporter's exact trigger remains unconfirmed.

Validation

  • Client: bun test test/solid-location.test.ts test/solid-data.test.ts — 25 passed.
  • Server: bun test test/location.test.ts test/fetch.test.ts test/handler-policy.test.ts test/config.test.ts test/workerd.test.ts --timeout 30000 — 17 passed.
  • TUI: bun test test/cli/tui/data.test.tsx test/context/session-tabs.test.tsx test/component/session-tabs-status.test.tsx test/cli/tui/composer-keymap.test.tsx --timeout 30000 — 88 passed.
  • GOMAXPROCS=4 bun typecheck passed in client, protocol, server, and TUI.
  • bun run generate completed in client; git diff --check passed.

Regression coverage includes every resource in the combined sync, original-cause retention, retry/cache behavior, transport and server failures, real rendered TUI Retry clicks, directory recovery after reconnect, absent/restored/deleted directories, files, symlinks, initialization failures, authorization, and placement-specific filesystem errors. Workspace filesystem tests use an in-memory Workspace.connect adapter; real remote provisioning and bare-location workerd behavior were not exercised by those tests.

Requested by: @jlongster (James via Slack)

@github-actions

Copy link
Copy Markdown
Contributor

Automated PR Cleanup

Thank you for contributing to opencode.

Due to the high volume of PRs from users and AI agents, we periodically close older PRs using automated criteria so maintainers can focus review time on the most active and community-supported contributions.

This PR was closed because it matched the following cleanup criteria:

  • The PR was created more than 1 month ago
  • The PR had fewer than 2 positive reactions
  • Positive reactions are counted as thumbs-up, heart, celebration, or rocket reactions on the PR

PRs created within the last month are not affected by this cleanup.

If you believe this PR was closed incorrectly, or if you are still actively working on it, please leave a comment explaining why it should be reopened. A maintainer can review and reopen it if appropriate.

Thanks again for taking the time to contribute.

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.

1 participant