Skip to content

fix: scope model discovery to the selected provider - #3876

Closed
amitksingh1490 wants to merge 3 commits into
mainfrom
fix/3858-offline-provider-draft
Closed

amitksingh1490 wants to merge 3 commits into
mainfrom
fix/3858-offline-provider-draft

Conversation

@amitksingh1490

@amitksingh1490 amitksingh1490 commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Draft blocker: automated scope expansion

The locally verified implementation is commit 5b691b8d5 (four source files). After publication, autofix.ci pushed ffb16aff6, 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.

  • Thread an optional provider scope through model discovery and apply it before invoking credential refresh/model requests.
  • Use the selected provider scope for activation compatibility checks, onboarding/model selection, and explicit model validation.
  • Stop the model-picker spinner before propagating a selected-provider failure.
  • Preserve failures from the selected provider, cancellation behavior, atomic session writes, and existing unfiltered listing behavior. This does not implement the separate broader partial-success model-listing proposals.
  • Add five same-file regression tests for request isolation, selected-provider errors, missing/unconfigured targets, and unchanged unfiltered success/error behavior.

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-model and provider login healthy print Connection refused for 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 -p prompt completes with OFFLINE_PROVIDER_RECOVERY_OK from 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.
  • Changed-file rustfmt --check and git diff --check: passed.
  • cargo fmt --all -- --check: fails on the pre-existing crates/forge_main/src/info.rs doc 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

Co-authored-by: ForgeCode <noreply@forgecode.dev>
@github-actions github-actions Bot added the type: fix Iterations on existing features or infrastructure. label Sep 16, 2026
@github-actions

Copy link
Copy Markdown

Action required: PR inactive for 5 days.
Status update or closure in 10 days.

@github-actions github-actions Bot added the state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. label Sep 21, 2026
@github-actions

github-actions Bot commented Oct 1, 2026

Copy link
Copy Markdown

PR closed after 10 days of inactivity.

@github-actions github-actions Bot closed this Oct 1, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

state: inactive No current action needed/possible; issue fixed, out of scope, or superseded. type: fix Iterations on existing features or infrastructure.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant