fix: scope model discovery to the selected provider - #3876
Draft
amitksingh1490 wants to merge 3 commits into
Draft
amitksingh1490 wants to merge 3 commits into
amitksingh1490 wants to merge 3 commits into
Conversation
Co-authored-by: ForgeCode <noreply@forgecode.dev>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Draft blocker: automated scope expansion
The locally verified implementation is commit
5b691b8d5(four source files). After publication, autofix.ci pushedffb16aff6, changing 140 files with broad formatting/comment changes outside #3858. The latest bot head has not received the local verification described below. Do not treat the previous-head checks or Release Drafter as verification of this expanded head.Maintainer decision needed: suppress/adjust autofix for this PR so the focused four-file change can be restored without repeatedly reintroducing unrelated formatting, or explicitly accept the broader bot changes and verify that head. No repository-wide workflow changes, force-pushes, merges, or unrelated manual fixes were made. This remains a draft, not PR Ready.
Summary
Addresses #3858. Keep provider switching usable when a previously configured local provider (such as Jan.ai) is stopped.
Provider activation currently fetches models from every configured provider before filtering the result. A connection refusal from the old provider therefore blocks both login and explicit provider/model changes, even though the selected provider is healthy.
Local reproduction and CLI validation
Used disposable HOME and FORGE_CONFIG directories, fake credentials, disabled telemetry/updates, a loopback OpenAI-compatible mock, and a stopped loopback endpoint. No real user configuration or paid provider was used.
Baseline: both
config set model healthy fixture-modelandprovider login healthyprintConnection refusedfor the old provider and preserve the old session. Both misleadingly exit 0; verification checks output and persisted state, not exit status alone.Fixed debug binary: explicit switching, login retaining a compatible model, login selecting a different model, cancelling the model picker, and switching after cancellation all behave correctly. Selected-offline and invalid-model attempts preserve the previous session and report errors. A noninteractive
-pprompt completes withOFFLINE_PROVIDER_RECOVERY_OKfrom the healthy mock. Saved credential values remain unchanged.Verification status
Draft requested by the user; not marked PR Ready.
cargo build --locked -p forge_main: passed (debug, no release build).cargo test --locked -p forge_app -p forge_api -p forge_main: passed, 1,062 unit tests and one doctest; 14 doctests ignored.cargo insta test --accept --test-runner cargo-test -p forge_app -p forge_api -p forge_main: passed; no snapshots to review and no snapshot changes.rustfmt --checkandgit diff --check: passed.cargo fmt --all -- --check: fails on the pre-existingcrates/forge_main/src/info.rsdoc formatting; independently reproduced using the unchanged base-commit file. Left unrelated code untouched.cargo clippy --locked -p forge_app -p forge_api -p forge_main --all-targets -- -D warnings: passed.cargo clippy --locked --workspace --all-targets -- -D warnings: passed after supplying isolated OpenSSL development headers (no system/global configuration changes).Real Jan.ai/macOS and live OAuth-provider verification were not performed; the regression is reproduced and verified using the safe local substitute. No real provider authentication was needed for these local checks.
Related closed contributor approaches reviewed before implementation: #3685, #3691, #3273, #2936. No open duplicate found. This focused change avoids requesting unrelated models instead of silently swallowing model-list errors.
Co-Authored-By: ForgeCode noreply@forgecode.dev