GeezerVison is showing github.com — fix(core): keep cached MCP prompts when a refresh fails by feiiiiii5 · Pull Request #50920 · anomalyco/opencode
Conversation
feiiiiii5
commented
Sep 23, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Issue for this PR
Closes #50918 (#50918)
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
Drops the Effect.orElseSucceed(() => []) in refreshPrompts (packages/core/src/mcp/index.ts:305-312). A failed prompts/list was converted into an empty list, which was then assigned over entry.prompts and announced through PromptsChanged, so one transient server error deleted a connected server's prompts and every reader was told the list is legitimately empty (packages/core/src/plugin/command.ts:18-24 re-reads and reloads commands on that event).
refreshTools immediately above (:298-303) already propagates the failure and therefore keeps the tools it had. Removing the swallow makes prompts behave the same way: the failed listing never reaches the Effect.map that writes the cache, the callers run it through live/whenLive, which log it (failed to list MCP prompts), and status stays untouched.
How did you verify your code works?
Test first, watched it fail on the base commit, then changed the source. All runs use the repo-pinned toolchain, [email protected] (the pre-push hook requires it).
Rebased onto 328f74c21 and re-run; the counts below are from that base.
bun test test/mcp.test.ts in packages/core: with the orElseSucceed put back, 78 pass / 1 fail — keeps cached MCP prompts when a prompts refresh fails. With the change, 79 pass / 0 fail.
bun run check from the repo root: 32/32 tasks (oxlint plus the workspace typecheck).
What I did not verify: I did not drive a live session against a real MCP server whose prompts/list flakes. The user-visible step — commands reloading to empty — is a code read of the PromptsChanged subscriber above.
Out of scope on purpose: resourceCatalog swallows resources/list and templates/list the same way (:671-672), so an unavailable catalog is indistinguishable from an empty one. Reporting that needs a shape decision, so it is not in this PR.
Screenshots / recordings
Not a UI change.
Checklist
- I have tested my changes locally
- I have not included unrelated changes in this PR
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Thanks for your contribution!
This PR doesn't have a linked issue. All PRs must reference an existing issue.
Please:
- Open an issue describing the bug/feature (if one doesn't exist)
- Add
Fixes #<number> or Closes #<number> to this PR description
See CONTRIBUTING.md for details.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
The following comment was made by an LLM, it may be inaccurate:
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
Hi — three PRs of mine are sitting in the same state and I would rather ask once than three times: #50920, #51123 and #51314 are all blocked on needs:issue, and the bot comment on each says no linked issue. #51123 closes #51119 and #50920 closes #50918, so I read that as the check looking at a different branch than the one the PRs target: these target v2 while the repository default is dev, and GitHub only records closingIssuesReferences when a PR's base is the default branch.
Before I go change anything: is that the intended behaviour, or is needs:issue supposed to resolve against v2? If it is intended, then these three need a different way to be associated and I would rather know which before reworking them. If it is the branch thing, no PR change is needed and I will leave them as they are.
All three are green and small: #50920 drops one Effect.orElseSucceed(() => []) so a failed prompts/list stops overwriting the cached list (the sibling refreshTools directly above already propagates), #51123 propagates the three blocker-lookup failures instead of replacing them with undefined, and #51314 logs the missing provider/model before the title model falls back to the session model. Each has a regression test that fails on its base. I am not going to ping again after this.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
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.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
Assignees
No one assigned
Milestone
No milestone
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.
|