GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(tui): only flag session location missing on LocationNotFoundError by agustif · Pull Request #55940 · anomalyco/opencode

Conversation

@agustif

@agustif agustif commented Oct 16, 2026 •
edited by opencode-agent Bot
Loading

Uh oh!

There was an error while loading. Please reload this page.

Copy link
Copy Markdown

Issue for this PR

Closes #43415 (reported as duplicate in #46322)

Type of change

  • Bug fix
  • New feature
  • Refactor / code improvement
  • Documentation

What does this PR do?

The TUI mounted the blocking "Session location unavailable" recovery dialog after transient location-sync failures (HTTP 503, timeouts, reconnect races), even though the folder still existed.

LocationProvider.sync in packages/tui/src/context/location.tsx set the location error on every sync rejection. The server only throws the typed LocationNotFoundError when the folder genuinely does not resolve (packages/server/src/location.ts); the generated client preserves _tag on declared-error rejections, and the web client (packages/app/src/workspaces/location.tsx) already gates on isLocationNotFoundError. The TUI did not, so any failed sync replaced the prompt with the recovery dialog.

The fix gates setError on isLocationNotFoundError(cause). Transient failures no longer mount recovery and self-heal through the existing re-sync triggers (location change, server.connected). Genuinely missing folders behave exactly as before.

How did you verify your code works?

Added packages/tui/test/cli/tui/location-error.test.tsx (TUI fixture harness):

  • 503 {message} rejection leaves location.error undefined (fails before the fix, passes after — confirmed via git stash)
  • 404 {_tag: LocationNotFoundError} rejection sets location.error with the directory (passes before and after)

Also ran the existing test/cli/tui/prompt-move.test.tsx (19 pass, 0 fail) and bun run typecheck (tsgo -b) in packages/tui, clean.

Screenshots / recordings

No visual change: the dialog renders exactly as before for genuinely missing folders. This change only narrows when it mounts, which the regression test above covers.

Checklist

  • I have tested my changes locally
  • I have not included unrelated changes in this PR

Added by the opencode bot (AI-generated).

Fixes #55250

Related: #49352, #54943, #55331, #55035

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@agustif
fix(tui): only flag session location missing on LocationNotFoundError
3f47f52
@github-actions github-actions Bot added the needs:compliance This means the issue will auto-close after 2 hours. label Oct 16, 2026
@github-actions

github-actions Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

The following comment was made by an LLM, it may be inaccurate:

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot removed the needs:compliance This means the issue will auto-close after 2 hours. label Oct 16, 2026
@github-actions

github-actions Bot commented Oct 16, 2026

Copy link
Copy Markdown
Contributor

Thanks for updating your PR! It now meets our contributing guidelines. 👍

agustiobvious reacted with hooray emoji
All reactions
  • 🎉 1 reaction

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

opencode-agent[bot]
opencode-agent Bot reviewed Oct 16, 2026
View reviewed changes

@opencode-agent opencode-agent Bot left a comment

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This works. Using opencode-drive with the simulated model, I made one request of the TUI's location sync fail with a 500 while the folder still existed (a test-only server patch, applied in both checkouts). The base replaced the session prompt with the false Session location unavailable dialog; with this PR the prompt stays. Screenshots are below.

The new test fails on the base and passes here. prompt-move and the test/context suites pass (94/94), and typecheck in packages/tui is clean. A missing folder still shows the dialog: location.get returns the server's typed LocationNotFoundError, which keeps its _tag through the TUI's location sync, matching how the web app already decides this.

The public API is unchanged.

One small point: unlike the web app, a failure that isn't LocationNotFoundError is now dropped and never retried. If it doesn't clear, the session can run with partly missing location data until the next reconnect or location change, with nothing shown to the user. That's still better than a false blocking dialog. #55258 adds a bounded retry for the same symptom, and the two touch the same code, so they could be combined.

Also see the inline note on the test's fixed sleep.

Fixes #55250
Related: #49352, #54943, #55331, #55035

Before

After

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
Comment thread packages/tui/test/cli/tui/location-error.test.tsx Outdated
fixture.location.set({ directory })
await fixture.app.waitFor(() => fixture.reads.includes(directory))
// Let the sync rejection settle through LocationProvider's catch.
await new Promise((resolve) => setTimeout(resolve, 100))

@opencode-agent opencode-agent Bot Oct 16, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This 100ms sleep is a timing guess: if the rejection takes longer to reach the catch, the test passes without checking anything. Could you wait until the sync has actually settled instead? For example, have the fixture record when the 503 response is served and await a microtask after that, or wait on a condition the way the not-found test does with waitFor.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@agustif agustif Oct 16, 2026

Copy link
Copy Markdown
Author

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good catch — replaced the fixed 100ms sleep with await Bun.sleep(0) after the request is observed. Yielding to the event loop guarantees the full microtask queue (fetch decode → sync rejection → provider catch) has drained before asserting, so the test can't pass vacuously. Red-green re-verified: fails on the pre-fix file, passes with the fix. Pushed as a2c34b9.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions

@opencode-agent opencode-agent Bot Oct 16, 2026

Copy link
Copy Markdown
Contributor

There was a problem hiding this comment.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, that addresses it. I ran the updated test against the base (pre-fix) code three times: the transient-failure case failed every time. So with Bun.sleep(0) after the request is seen, the assertion runs after the rejection is handled and still catches the bug.

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

All reactions
@agustif
test(tui): settle location sync deterministically instead of fixed sleep
a2c34b9
@opencode-agent opencode-agent Bot mentioned this pull request Oct 16, 2026
feat: service restart approval when agents are running #55967
Closed
3 of 6 tasks
@argszero argszero mentioned this pull request Oct 16, 2026
tui: project configuration errors are not surfaced when opening a directory #55670
Open
This was referenced Oct 16, 2026
TUI: data.location.sync() called redundantly on every set #56173
Closed
tui: "Choose directory" on a false location-unavailable prompt waits for the running step and does not clear the prompt #56958
Closed
@HootRock HootRock mentioned this pull request Oct 19, 2026
fix(tui): retry same-directory session recovery #56987
Closed
3 of 6 tasks
@opencode-agent opencode-agent Bot mentioned this pull request Oct 19, 2026
tui: false 'Session location unavailable' after restart (any transient location.sync failure) #57107
Closed
@ggrabarz ggrabarz mentioned this pull request Oct 20, 2026
fix(tui): only offer a new directory when the location is missing #57532
Closed
3 of 6 tasks
@ggrabarz

ggrabarz commented Oct 20, 2026

Copy link
Copy Markdown

Picking up the bot's suggestion from #57532 (auto-closed as a duplicate of this PR).

This PR and #55258 each cover one half of the problem. #55258 documents its own limitation: "a location that stays unreachable past the retry window (~1.5s) still surfaces the recovery prompt, and a genuinely missing directory takes that long to report."

Combining both halves — and splitting the location state into missing (the server's typed LocationNotFoundError) and error (anything else) — closes that gap: a persistent transient failure, e.g. a 503 from the plugin-activation gate while several locations activate at once, never mounts the recovery prompt. The composer stays usable and the failure is reported as location.error rather than dropped.

Two smaller things that belong with it:

  • the missing directory is compared with sameDirectory, so a Windows path that differs only in case still matches. A plain === misses a genuinely missing directory on Windows.
  • the duplicated syncInfo read is dropped — data.location.sync already reads the location before its resources (packages/client/src/solid/data.ts), so every failed sync asked the server for the location twice.

Regression tests:

  • packages/tui/test/session-location-unavailable.test.tsx drives the real app: a transient /api/model 503 is retried and the composer stays usable, a persistent 503 keeps the composer usable and the text still types, and a LocationNotFoundError still shows the recovery prompt. Reverting the source change reproduces the reported screen verbatim.
  • packages/tui/test/cli/tui/location-provider.test.tsx: a missing location is asked exactly once (retrying cannot succeed until the folder changes), while any other failure is retried and lands in error, never in missing.

If a single combined PR is preferred, the implementation is on ggrabarz:tui-location-sync (commit 91e2fb9da) and I can port the tests here instead — happy to go whichever way is easier.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

This was referenced Oct 20, 2026
fix(tui): tolerate transient failures in the post-reconnect location sync #55258
Closed
fix(tui): only offer a new directory when the location is missing #57535
Closed
@rekram1-node rekram1-node mentioned this pull request Oct 21, 2026
fix(tui): only show location unavailable when the server reports it missing #57594
Merged
@ggrabarz

ggrabarz commented Oct 21, 2026

Copy link
Copy Markdown

Merged PR #57594 supersedes this one — it landed the same behaviour (only the server's typed LocationNotFoundError marks a location missing, everything else is retried) and closed #55250 and #49352. There is nothing left to consolidate here, so this PR can be closed as already-landed.

Two things are worth adding on top of it, both of which are now open:

  • test(tui): cover the location-unavailable recovery path #57916 — regression coverage for the recovery path. fix(tui): only show location unavailable when the server reports it missing #57594 changed one production file and committed no test, so the behaviour that closed tui: false "Session location unavailable" prompt after network reconnect #55250 currently has no guard. The tests cover both halves: a location the server reports as missing is asked once and reported, a location that fails for any other reason (for example the 503 from the plugin-activation gate) is asked three times and is not reported as missing, and the blocking "Session location unavailable" prompt does not appear for a transient failure while it still appears for a genuinely missing directory. Red-green verified: reverting packages/tui/src/context/location.tsx to its state before fix(tui): only show location unavailable when the server reports it missing #57594 fails two of them.
  • feat(server): make the plugin activation budget configurable #57917 — the server's plugin-activation budget is configurable. The five-second wall in packages/server/src/location.ts is a fixed cost that has to cover a whole cold-location activation, and on a loaded machine it fires while activation is still progressing, so the request fails and the client retries against the same location. feat(server): make the plugin activation budget configurable #57917 lets a slow machine raise it with OPENCODE_PLUGIN_ACTIVATION_TIMEOUT, with the default unchanged.

No need to reconcile these with anything here — they are additive and touch different files.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions

github-actions Bot commented Nov 16, 2026

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.

All reactions

Sorry, something went wrong.

Uh oh!

There was an error while loading. Please reload this page.

@github-actions github-actions Bot closed this Nov 16, 2026
@github-actions github-actions Bot added the automated-pr-cleanup label Nov 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Reviewers

@opencode-agent opencode-agent[bot] opencode-agent[bot] left review comments

Uh oh!

There was an error while loading. Please reload this page.

Assignees

No one assigned

Labels

automated-pr-cleanup

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

tui: false "Session location unavailable" prompt after network reconnect tui: agent keeps running while user is trapped in false location-unavailable modal

Uh oh!

There was an error while loading. Please reload this page.

2 participants

@agustif @ggrabarz
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.
You are visitor 01402775 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.