Skip to content

fix: select provider sources before configuration imports - #379

Merged
Brian Krabach (bkrabach) merged 2 commits into
mainfrom
fix/provider-discovery-source-origin
Oct 22, 2026
Merged

Brian Krabach (bkrabach) merged 2 commits into
mainfrom
fix/provider-discovery-source-origin

Conversation

@bkrabach

@bkrabach Brian Krabach (bkrabach) commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Summary

Fix first-run startup when an installed provider wheel is present but runtime selects the provider from its configured Git source. Configuration-time metadata discovery previously imported the wheel first, leaving cached child modules that correctly caused Core to reject the later mixed-origin runtime load.

  • Select the effective provider source and its declared provider dependencies before configuration-time imports.
  • Make installed-package checks non-importing and build picker inventory from selected sources before considering installed-only entry points.
  • Keep explicit activated paths authoritative, preserve them through missing-SDK repair retries, and fail closed on source/origin errors without evicting modules or reinstalling a provider to hide a conflict.

Only three production files change: provider_loader.py, provider_sources.py, and provider_manager.py. Add fresh-process origin regressions, correct existing SDK-repair fixtures to fail at metadata import rather than source resolution, and record the boundary in AGENTS.md. No Core, Foundation, provider, SDK, dependency, lockfile, or default-model changes.

Verification

  • Untouched production: new discriminating origin regressions reproduced 6 failures / 1 pass before the fix.
  • Locked development environment, Python 3.13.11 / Core 1.6.1: 99 focused passed; full default suite 2,882 passed, 3 skipped, 1 expected failure, with 13 integration tests deselected by the default marker policy.
  • Separate POSIX integration selection: 13 passed.
  • Ruff 0.16.6 E4/E7/E9/F checks pass on all five changed Python files; both changed test files pass formatting; git diff --check passes.
  • Installed-wheel qualification in an isolated container: Python 3.13.16 / Core 2.0.2 / Anthropic SDK 1.17.0 / OpenAI SDK 3.36.0. Each topology had a separate interpreter and HOME. The same real first-run → environment auto-init → synchronous config resolution → full shared-root session initializer was exercised:
    • Unchanged CLI with a same-commit preinstalled Anthropic wheel reproduced the original Core child-origin rejection (actual startup failure, retained as the negative control).
    • Candidate with that preinstalled wheel passed. The wheel distribution remained installed; no uninstall or normalization was used to manufacture success.
    • Candidate with no installed provider passed.
  • A real-model smoke on the preinstalled-wheel candidate used the real session initializer and Session.execute. A genuine model-selected read-only probe tool returned an unseen synthetic marker, and the model reported it correctly. Configured Sonnet 5.5, default/unset effort, 4,096 output tokens, six iterations; configured provider retries five / SDK retries zero. Vendor response model, usage, cost, HTTP and actual retry counts were not independently measured.
  • Installed production bytes were checked against the immutable wheels after execution. The owned test container was destroyed and its absence independently verified.
  • The initial hosted run passed all six non-Windows jobs but failed both Windows rows because the new fixture serialized raw drive paths, which this resolver does not classify as local sources. The test-only correction uses the existing supported file://<native-path> spelling and adds a real local-resolver check plus DNS, external-connect, and loopback-connect denial controls. The strict audit hook, origin assertions, and all production bytes remain unchanged. Original failing results are retained; the fresh exact-head Windows matrix must pass before merge. This does not change production raw-drive-path classification.

Compatibility and limits

Selected-source/origin failures now remain explicit rather than falling back to an ambient wheel or entering dependency installation. Genuine missing-SDK import failures retain the existing repair path. Installed-only unknown providers remain supported. Core's origin guard is unchanged.

This is not a new full interactive REPL, resume, native-computer, desktop, all-provider, or Python 3.11/3.12 runtime qualification. The hosted matrix must still pass at this PR's exact head before merge. The normal host installation is not changed by publication or merge.

Review and scope

An independent source review identified two manager-path gaps; both were corrected with regression coverage before the final tests. Requested Astra and Fable second-opinion reviews will be performed against this exact candidate before admin merge. These are independent supplied-evidence reviews, not GitHub approval submissions.

No private transcripts, credentials, environment snapshots, raw runtime artifacts, or fixture corpora are included in this PR. Public content-class leak review is not applicable: this adds ordinary synthetic regression tests and existing guidance only, not a new public artifact or evidence corpus.

Generated with Amplifier

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
Generated with Amplifier

Co-Authored-By: Amplifier <240397093+microsoft-amplifier@users.noreply.github.com>
@bkrabach
Brian Krabach (bkrabach) merged commit 4801c9d into main Oct 22, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants