Build AI methods with your coding agent, then run them anywhere: as an MCP for chatbots, as a webapp for people, or via API for your software.
Fix review agent findings: per-bundle dedup, consistent return type, HEAD-first HTTP
Louis Choquelfb264fa0eef1
diff --git a/pipelex/builder/operations/validate_ops.py b/pipelex/builder/operations/validate_ops.pyindex af1f4936f..6b2324629 100644--- a/pipelex/builder/operations/validate_ops.py+++ b/pipelex/builder/operations/validate_ops.py@@ -116,9 +116,7 @@ async def validate_bundle_content(return {"success": True,"mthds_contents": mthds_contents,- "pipelex_bundle_blueprint": blueprints[0].model_dump(mode="json")- if len(blueprints) == 1- else [b.model_dump(mode="json") for b in blueprints],+ "pipelex_bundle_blueprint": [b.model_dump(mode="json") for b in blueprints],"validated_pipes": validated_pipes,"total_pipes": len(validate_bundle_result.pipes),}diff --git a/pipelex/pipeline/pipeline_run_setup.py b/pipelex/pipeline/pipeline_run_setup.pyindex a6aa9b212..9acfaecc7 100644--- a/pipelex/pipeline/pipeline_run_setup.py+++ b/pipelex/pipeline/pipeline_run_setup.py@@ -154,25 +154,23 @@ async def pipeline_run_setup(if mthds_contents:all_blueprints = [PipelexInterpreter.make_pipelex_bundle_blueprint(mthds_content=content) for content in mthds_contents]- # Check if all bundles were already loaded from library directories- bundle_already_loaded = False+ # Filter out blueprints whose URIs are already loaded+ blueprints_to_load: list[PipelexBundleBlueprint] = list(all_blueprints)if bundle_uris:current_library = library_manager.get_library(library_id=library_id)- all_loaded = True- for uri in bundle_uris:+ blueprints_to_load = []+ for blueprint, uri in zip(all_blueprints, bundle_uris, strict=True):try:resolved_uri = Path(uri).resolve()except (OSError, RuntimeError):resolved_uri = Path(uri)- if resolved_uri not in current_library.loaded_mthds_paths:- all_loaded = False- break- bundle_already_loaded = all_loaded- if bundle_already_loaded:- log.verbose(f"All {len(bundle_uris)} bundle(s) already loaded from library directories, skipping duplicate load")+ if resolved_uri in current_library.loaded_mthds_paths:+ log.verbose(f"Bundle '{uri}' already loaded from library directories, skipping")+ else:+ blueprints_to_load.append(blueprint)- if not bundle_already_loaded:- library_manager.load_from_blueprints(library_id=library_id, blueprints=all_blueprints)+ if blueprints_to_load:+ library_manager.load_from_blueprints(library_id=library_id, blueprints=blueprints_to_load)# Find the pipe to executeif pipe_code:diff --git a/pipelex/tools/misc/http_utils.py b/pipelex/tools/misc/http_utils.pyindex 4dcc0e7b2..591c5e418 100644--- a/pipelex/tools/misc/http_utils.py+++ b/pipelex/tools/misc/http_utils.py@@ -40,8 +40,14 @@ def validate_url_resource_exists(url: str) -> None:def _validate_http_url(url: str) -> None:user_agent = get_user_agent()+ headers = {"User-Agent": user_agent}try:- with httpx.stream("GET", url, timeout=10, follow_redirects=True, headers={"User-Agent": user_agent}) as response:+ response = httpx.head(url, timeout=10, follow_redirects=True, headers=headers)+ if response.status_code == 405:+ # Server doesn't support HEAD — fall back to streaming GET (read only status, not body)+ with httpx.stream("GET", url, timeout=10, follow_redirects=True, headers=headers) as stream_response:+ stream_response.raise_for_status()+ else:response.raise_for_status()except httpx.HTTPStatusError as exc:msg = f"URL '{url}' returned HTTP {exc.response.status_code}"