Retry provider registration after installing requirements#25
Merged
Conversation
A code provider whose code block imports its declared requirements at module level (e.g. "from google.oauth2 import ..." with google-api-python-client in requirements:) could never load: startup runs register_provider (which execs the code block) before run_provider_setup (which pip-installs requirements), and on failure it skipped the provider entirely — so the requirements were never installed and restarts could not self-heal. Extract the startup loop body into bootstrap_provider(): registration still runs first so slow builds never block tool advertisement, but when it fails, requirements/setup now run and registration is retried once. Covered by new TestBootstrapProvider unit tests plus an end-to-end test exec'ing a code block whose import only succeeds after the (mocked) pip install. https://claude.ai/code/session_01WnK1rtXGHDCNpsycAvxFqC
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.
Summary
Fixes a chicken-and-egg bug that made it impossible for a code provider to import its own declared
requirements:at the top of itscode:block — e.g. a Gmail provider declaringgoogle-api-python-clientand starting withfrom google.oauth2.credentials import Credentialsfailed at startup with:Root cause
At startup,
register_provider()ran beforerun_provider_setup(). For code providers, registrationexec()s the code block — running its top-level imports — before the requirements are pip-installed. On failure, the loop skipped the provider entirely, so the requirements were never installed and restarting could never self-heal.Fix
The startup loop body is extracted into
bootstrap_provider():bootstrap_provider()never raises — one bad provider still can't crash startup.Testing
TestBootstrapProviderunit tests cover the happy path, the install-then-retry path, and all failure-ordering cases (6 tests).gmail-filters.yamlin a clean environment with nogooglemodule: registration fails once, the three Google packages install, and the retry registers all four tools.https://claude.ai/code/session_01WnK1rtXGHDCNpsycAvxFqC
Generated by Claude Code