GeezerVison is showing github.com — fix(core): keep configured local models available without discovery by GoldArowana · Pull Request #54011 · anomalyco/opencode
Conversation
GoldArowana
commented
Oct 8, 2026
•
edited
Loading
Uh oh!
There was an error while loading. Please reload this page.
Issue for this PR
Fixes #53341
Type of change
- Bug fix
- New feature
- Refactor / code improvement
- Documentation
What does this PR do?
Explicitly configured local models can have an empty provider package while discovery times out, fails, or returns no models. Initialize the local provider defaults independently of discovery, preserving configured overrides and the existing inventory/cache behavior. Same-endpoint config reloads keep pending discovery results valid.
AI assistance was used for implementation, tests, and independent agent review.
How did you verify your code works?
Current head: 70e11f86d5a1fddc0432f1035c6395fcbcedf3aa (V2 merge commit; target branch: dev).
The 104/50 test results below were recorded for 0bbc3726de2186f32d4bde8019ce94b219a1f6f9 before the merge. They are historical validation, not validation of the current head. Post-merge local validation records could not be recovered during this evidence update.
Historical tested revision: 0bbc3726de2186f32d4bde8019ce94b219a1f6f9 (test-only revision; production code unchanged by that commit).
- Reduced
provider-local.test.ts from 310 to 109 lines. Its two regressions use an injected HTTP client and Deferred/event synchronization; the local HTTP server, polling helper, and real one-second timeout tests were removed from this file.
- The focused Ollama regression returns HTTP 503 from discovery, then checks the configured model resolves with the openai-compatible package and configured base URL. It fails against the original implementation: 0 passed, 1 failed.
- A separate deterministic regression covers adding/removing explicit configuration while discovery is pending at the same endpoint, then accepting the pending discovery result.
- Related provider/config/model tests: 104/104 passed. Same-process repeated regressions: 50/50 passed. An independent AI-agent rerun also passed 50 repeated regression executions and 104 related tests.
- Core typecheck passed. Root
bun run check and the normal pre-push hook each passed all 36 tasks.
- GitHub
check-standards and check-compliance passed for that test-only revision. At that time, the test, check, and nix-eval workflows were action_required awaiting maintainer approval, with zero jobs; those workflows had not run.
These are offline regression results. Live-provider calls, TUI validation, and a full-workspace test run were not performed for that test-only revision. The earlier full Core result below was not rerun on that test-only revision.
Historical validation before the test reduction (previous head 6eb8dd7):
- Nine local HTTP regressions fail on base
5e73d5c and pass with this fix. They cover Ollama tags/show timeouts, empty/error discovery across Ollama, LM Studio and vLLM, recovery, request endpoint/auth/model, overrides, and same-endpoint reload.
- Provider/config/model suites: 111 passed. Independent agent rerun: 9 passed. Core
bun typecheck and root bun run check passed (36 tasks).
- Full Core suite: 6,582 passed, 33 skipped, 3 failed. The exact upstream base reproduces the MCP descendant-cleanup timeout and two worktree setup failures (
bash -lc cannot find Bun). No live provider/model calls were used; this is not full-workspace test validation.
Screenshots / recordings
No 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.
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.
The fix works: with discovery failing, a configured ollama/<model> now gets the openai-compatible package and the request goes out. On the base, the session never gets as far as sending it. I checked this by driving the TUI on both branches and by running the provider tests and the core type check.
The only thing worth changing is the tests (see inline comment): 336 lines of tests for a 24-line fix, with polling and real 1-second timeouts. Please cut them down to a small, fast regression test.


Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
|
},
|
|
|
]
|
|
|
|
|
|
const eventually = <A, R>(effect: Effect.Effect<A, never, R>, predicate: (value: A) => boolean) =>
|
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 file is ~310 lines for a 24-line fix, and it depends on timing. eventually polls up to 3000× at 1 ms. The two Ollama timeout tests wait out the real 1 s discovery timeout against a live local HTTP server, which is slow and can be flaky on a loaded CI runner. Could you cut this down to one small test? For example: configure a model, have discovery return an error or no models, then check the model resolves with the openai-compatible package and the configured base URL. The timeout and same-endpoint-reload cases go through the same code path, so they can be dropped, along with the extra assertions in provider-ollama/lmstudio/vllm.test.ts unless they check something new.
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 22, 2026
|
Thanks for this. I read the diff, and it fixes the Unsupported package case when models are listed explicitly, which is the symptom in #53341.
It doesn't change the 1-second Effect.timeout in get and getJson, so discovery still gives up on endpoints slower than about a second. I reported the remote-endpoint case in #58558 (about 9s TCP connect through a security-related router, zero models and nothing logged). I don't think this PR covers it, so I've kept #58558 open as a separate issue. Is the timeout in scope here?
Two questions:
- Is the 1-second limit meant to stay? The one-second timeout tests were removed from
provider-local.test.ts, so that path is no longer covered.
- Would you accept a WARN log on discovery failure in this PR, or should that be a follow-up?
I haven't run the branch, so this is based on the diff and the PR description.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
|
The one-second Effect.timeout in get and getJson is unchanged in this PR. The real-time timeout tests were removed to address the review request for a smaller deterministic fallback regression.
This change is limited to keeping explicitly configured local models available when discovery fails or returns no models. Timeout policy and WARN logging are outside this change; #58558 can retain that separate discussion for maintainers to decide.
|
Sorry, something went wrong.
Uh oh!
There was an error while loading. Please reload this page.
This was referenced Oct 27, 2026
|
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.
|