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.
feature/Drop-gateway-backend · L-260918-08feba (#1226)
Thomas Hebrardf284a14b9bd3
diff --git a/.claude/hooks/session-start.sh b/.claude/hooks/session-start.shindex a0486fcfe..c1fa51532 100755--- a/.claude/hooks/session-start.sh+++ b/.claude/hooks/session-start.sh@@ -6,7 +6,7 @@ if [ "${CLAUDE_CODE_REMOTE:-}" != "true" ]; thenexit 0fi-# Set CI to bypass the Pipelex Gateway terms acceptance check+# Set CI so the runtime boots in CI integration modeecho 'export CI=true' >> "$CLAUDE_ENV_FILE"# Install all dependencies (creates venv if needed, runs uv sync --all-extras)diff --git a/.claude/skills/add-model/SKILL.md b/.claude/skills/add-model/SKILL.mdindex 0281474d4..30823d9d1 100644--- a/.claude/skills/add-model/SKILL.md+++ b/.claude/skills/add-model/SKILL.md@@ -7,7 +7,7 @@ description: >every backend it lands on, and the changelog entry. Use when the user says "add amodel", "add GPT-X", "add Claude X", "add Gemini X", "new model", "register a model","support model X", "add model to backend", or names a model that no backend TOML- declares yet and wants it available. The Pipelex Gateway and Manifold catalogs are+ declares yet and wants it available. The Pipelex Manifold catalog isnot in this repository: in the Pipelex workspace, the workspace-level `/add-model`carries a model through them and runs this skill as its pipelex leg.---@@ -16,7 +16,7 @@ description: >A model is added once per backend that serves it. Each backend TOML under `.pipelex/inference/backends/` declares the models that backend can call, the kit copy under `pipelex/kit/configs/` is what ships in the package, and `.pipelex-dev/test_profiles.toml` decides which models the parametrized inference tests can select. Those are the files that declare a model; the steps below also write the changelog, and regenerate the goldens and references that follow from them.-Two backends are different: `pipelex_gateway` and `pipelex_manifold` take their model catalogs from the **remote config**, a versioned artifact the runtime fetches at boot from the URL in `pipelex/system/pipelex_service/pipelex_details.py` (overridable with `PIPELEX_REMOTE_CONFIG_URL`). Their local TOMLs only let a user override `sdk` and `structure_method` per model, so a model cannot be added to them from here. See step 8.+One backend is different: `pipelex_manifold` takes its model catalog from the **remote config**, a versioned artifact the runtime fetches at boot from the URL in `pipelex/system/pipelex_service/pipelex_details.py` (overridable with `PIPELEX_REMOTE_CONFIG_URL`). Its local TOML only lets a user override `sdk` and `structure_method` per model, so a model cannot be added to it from here. See step 8.## 1. Establish the facts, from the provider@@ -71,22 +71,16 @@ For an LLM, go past `TestLLMInference` and exercise what the entry declares: `Te## 7. Deck, changelog, checks-- **Deck.** Adding a model does not change the deck. Promoting it to an alias or preset in `.pipelex/inference/deck/` (`best-gpt`, `default-premium`, a preset's `model`) changes what existing methods run on, so it is a separate decision: ask, and if the answer is yes, edit the deck, then run `make ukc` again. Promote only once the gateway catalog carries the model (step 8): under the default `all_pipelex_gateway` routing, a preset or choice default reaching a handle the catalog lacks raises `GatewayUnknownModelError` at boot, and `make tb` turns red. An alias no preset or choice default reaches is not checked at all, so a dangling one ships silently: read the deck yourself rather than trusting the boot. Then grep `docs/` for the alias you moved: `docs/configuration/config-technical/inference-backend-config.md` mirrors the deck's aliases, and other pages quote single ones.+- **Deck.** Adding a model does not change the deck. Promoting it to an alias or preset in `.pipelex/inference/deck/` (`best-gpt`, `default-premium`, a preset's `model`) changes what existing methods run on, so it is a separate decision: ask, and if the answer is yes, edit the deck, then run `make ukc` again. Promote only once a shipped backend serves the model: under the default `all_enabled_backends` routing, a preset or choice default reaching a handle no enabled backend serves is dropped from the deck with a warning, and under `all_pipelex_manifold` a handle the manifold catalog lacks raises `GatewayUnknownModelError` at boot, so `make tb` turns red. An alias no preset or choice default reaches is not checked at all, so a dangling one ships silently: read the deck yourself rather than trusting the boot. Then grep `docs/` for the alias you moved: `docs/configuration/config-technical/inference-backend-config.md` mirrors the deck's aliases, and other pages quote single ones.- **Changelog.** One bullet under `## [Unreleased]` → `### Added` in `CHANGELOG.md`: the handle, the backends, what it takes and produces, and anything unusual such as a refused parameter.- **Checks.** `make tb` boots the config, which parses and validates the backends `backends.toml` enables — and only those, so an entry added to a disabled backend such as `vertexai` is never read. To validate one, enable that backend in the gitignored `.pipelex/inference/backends_override.toml` for the run, and delete the file afterwards. Then stage your changes (the drift digest reads the git index) and run `make agent-check`.-## 8. The gateway and manifold catalogs+## 8. The manifold catalog-This repository cannot add the model to `pipelex_gateway` or `pipelex_manifold`: their catalogs are published by the Pipelex team in the remote config. Tell the user so, and say which handle, model ids and capabilities the catalogs need. **In the Pipelex workspace, the workspace-level `/add-model` does that part**, and runs this skill as its pipelex leg.+This repository cannot add the model to `pipelex_manifold`: its catalog is published by the Pipelex team in the remote config. Tell the user so, and say which handle, model ids and capabilities the catalogs need. **In the Pipelex workspace, the workspace-level `/add-model` does that part**, and runs this skill as its pipelex leg.-Once a remote config carrying the model is published at the version this repository pins, regenerate the gateway model reference that ships in the package, then check it against that artifact:+Once a remote config carrying the model is published at the version this repository pins, `/test-model` on `pipelex_manifold` proves the model end to end through the service.-```bash-make ugm # update-gateway-models: rewrites pipelex_gateway_models*.md in .pipelex/ and the kit-make cgm # check-gateway-models: both copies match the published artifact-```--Then `/test-model` on `pipelex_gateway` proves the model end to end through the gateway.## Checklist@@ -97,7 +91,7 @@ Show this to the user at the end, each box ticked or explained:- [ ] Kit synced (`make ukc`, `make ccs`), and the migration goldens if `portkey.toml` moved (`make umig`, `make cmig`)- [ ] Handle in its test collection- [ ] Live tests pass on every backend in the footprint, for every capability declared-- [ ] Deck left alone, or the promotion decided by the user, made after the gateway catalog carries the model, and mirrored in `docs/`+- [ ] Deck left alone, or the promotion decided by the user, made after a shipped backend serves the model, and mirrored in `docs/`- [ ] Changelog entry under `[Unreleased]`- [ ] `make tb` and `make agent-check` green-- [ ] Gateway and manifold catalogs handed off, and `make ugm` then `make cgm` run once they are published+- [ ] Manifold catalog handed off, and `/test-model` on `pipelex_manifold` run once it is publisheddiff --git a/.claude/skills/test-model/SKILL.md b/.claude/skills/test-model/SKILL.mdindex b8b094e74..b1fc4e440 100644--- a/.claude/skills/test-model/SKILL.md+++ b/.claude/skills/test-model/SKILL.md@@ -5,7 +5,7 @@ description: >infrastructure. Handles test profile creation, fixture regeneration, andrunning the right test class for the model type (LLM, image gen, extract,search). Use when the user says "test model X", "test gpt-5.4 on openai",- "test model on gateway", "run inference test for model", "try model X on+ "test model on manifold", "run inference test for model", "try model X onbackend Y", "verify model X works", or any variation of running inferencetests against a specific model on a specific backend. Also use when the usermentions testing a model after adding it, or wants to verify a model works@@ -25,7 +25,7 @@ Gather from the user (or infer from context):| Field | Description | Example ||-------|-------------|---------|| **Model name** | The model handle as it appears in backend TOMLs | `gpt-5.6-sol` |-| **Backend** | Which backend to test on | `pipelex_gateway` |+| **Backend** | Which backend to test on | `pipelex_manifold` || **Model type** | `llm`, `img_gen`, `extract`, or `search` | `llm` |### How to determine the model type@@ -44,7 +44,7 @@ If the user says a backend name, use it directly. Common shorthand mappings:| User says | Backend name ||-----------|-------------|-| "gateway" | `pipelex_gateway` |+| "manifold" | `pipelex_manifold` || "openai" | `openai` || "azure" | `azure_openai` || "anthropic" | `anthropic` |@@ -63,7 +63,7 @@ target backend. For most backends, check the TOML file:.pipelex/inference/backends/<backend_name>.toml```-For **gateway** (`pipelex_gateway`), the model list is fetched remotely — you+For **manifold** (`pipelex_manifold`), the model list is fetched remotely — youcannot verify locally. Proceed and let the test tell you if the model isn'tavailable.diff --git a/.drift/acks/cli-docs.toml b/.drift/acks/cli-docs.tomlindex fecc34eaf..18ed09c28 100644--- a/.drift/acks/cli-docs.toml+++ b/.drift/acks/cli-docs.toml@@ -1,18 +1,17 @@contract = "cli-docs"-digest = "sha256:9ad68869227011d788deb2ece011967491b852cc3b49789247b21d4e1f242cca"-reviewed_by = "Louis Choquel"-reviewed_at = "2026-10-04T14:57:21Z"-rationale = "clean-pass: the only trigger change drops, from the emit_inputs_result docstring, its comparison with the deleted concept and pipe raw-TOML commands, with no surface change. Reviewed docs/tools/cli/ and pipelex/cli/agent_cli/CLAUDE.md: the review pass on this branch found what the previous ack missed, the Output Contract's raw-TOML bullet in docs/tools/cli/agent-cli.md and three passages of the agent-CLI guide still naming the deleted concept and pipe commands and the builder's validate ops, and this change removes them."+digest = "sha256:0c6ad1ab6e3210129c0a0b7ea1fabcc73e4b883ff8e6f8680750b50713c8a3ab"+reviewed_by = "Claude (Opus 5.5)"+reviewed_at = "2026-10-04T16:59:46Z"+rationale = "real-catch: the comment on the init backend recommendation now scopes OpenAI's one key to the language-model and image-generation tiers, since extraction and search default to their own backends; init.md said every default tier at both its backend-selection step and its global-init example, both corrected. Swept docs/tools/cli/ and pipelex/cli/agent_cli/CLAUDE.md for tier and extraction-default claims: update.md's account of managed deck files and x_custom_ overrides still holds."[trigger_files]"pipelex/cli/__init__.py" = "blob:8b137891791fe96927ad78e64b0aad7bded08bdc"-"pipelex/cli/_cli.py" = "blob:06366c8e670f003926eb5bfed75bf4f3db418835"+"pipelex/cli/_cli.py" = "blob:3f2021d5b86d6d097732b0d85cceea4d23a91927""pipelex/cli/agent_cli/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"-"pipelex/cli/agent_cli/_agent_cli.py" = "blob:7dcd54b1fceb428b30757aa19d8e5d214f49f4a8"+"pipelex/cli/agent_cli/_agent_cli.py" = "blob:9241b520ba209867c37330551101bdd5d262ac88""pipelex/cli/agent_cli/commands/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"-"pipelex/cli/agent_cli/commands/accept_gateway_terms_cmd.py" = "blob:cb8338c09a7b5dee6088551c156d69dab613213a"-"pipelex/cli/agent_cli/commands/agent_cli_factory.py" = "blob:49b8bab889d8673e7d4f1d683efe0928e43914b9"-"pipelex/cli/agent_cli/commands/agent_output.py" = "blob:7a56932e614a50c42cb029817c05e74aed3c6d9a"+"pipelex/cli/agent_cli/commands/agent_cli_factory.py" = "blob:c557214028805cd8204ee76c118fe3e4479db2ce"+"pipelex/cli/agent_cli/commands/agent_output.py" = "blob:c78a85513a6f5ce230f19f20844c6e1f1f74a107""pipelex/cli/agent_cli/commands/bundle_path_resolver.py" = "blob:a1904517c731afb72af7d49adf6d217dc50b2660""pipelex/cli/agent_cli/commands/check_model_cmd.py" = "blob:c0ba11631c3904b9c4b4529d48d5954494cc1153""pipelex/cli/agent_cli/commands/codegen/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"@@ -24,7 +23,7 @@ rationale = "clean-pass: the only trigger change drops, from the emit_inputs_res"pipelex/cli/agent_cli/commands/fix/app.py" = "blob:e6190d9bde6a05755c04bd21806f699461038ac0""pipelex/cli/agent_cli/commands/fix/bundle_cmd.py" = "blob:37b13a1ead7b55d601f53b23647c285fc85418cd""pipelex/cli/agent_cli/commands/fmt_cmd.py" = "blob:97d6fb6c328e0b718b1293bd6b73cba03edcb7dc"-"pipelex/cli/agent_cli/commands/init_cmd.py" = "blob:f10c15f5f1c220cb5f9509336258eaa2d2a11967"+"pipelex/cli/agent_cli/commands/init_cmd.py" = "blob:152be3b800cd1412e2a2257d0e8d35030cdcabba""pipelex/cli/agent_cli/commands/inputs/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391""pipelex/cli/agent_cli/commands/inputs/_inputs_core.py" = "blob:4161029643f3a302de54fa637d2676521e10d873""pipelex/cli/agent_cli/commands/inputs/app.py" = "blob:7e19284687b334c684fb03381a8d9d20af1aa152"@@ -51,7 +50,7 @@ rationale = "clean-pass: the only trigger change drops, from the emit_inputs_res"pipelex/cli/agent_cli/commands/validate/method_cmd.py" = "blob:cf841e73d6af1a7e90d5ddfadaad012928f1a3ba""pipelex/cli/agent_cli/commands/validate/pipe_cmd.py" = "blob:b5aae81bc47ed8de23a13755b2c8c2418b4b8b9a""pipelex/cli/bundle_target_resolution.py" = "blob:460aa997ea0886c6faee0f3a42bd55231c480240"-"pipelex/cli/cli_factory.py" = "blob:1f859ab3b995e1a67e5fdc812a168d56c338e970"+"pipelex/cli/cli_factory.py" = "blob:0e7e35cbf795c285a80fba6a1bbd91a183f775b6""pipelex/cli/commands/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391""pipelex/cli/commands/build/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391""pipelex/cli/commands/build/app.py" = "blob:d3205e1dc0268a9d32a517e4f9a9a3b4647e8889"@@ -75,7 +74,7 @@ rationale = "clean-pass: the only trigger change drops, from the emit_inputs_res"pipelex/cli/commands/codegen/inputs_cmd.py" = "blob:9957ee119b5d839aaa56f98444a1be3789c68f7c""pipelex/cli/commands/codegen/types_cmd.py" = "blob:b7c9c7a3664c9fbe66f9b4c3c5ebf9ea1322445c""pipelex/cli/commands/crate_loading.py" = "blob:3d7d651931ecf1a15a3e2d72411b3212b55d74ef"-"pipelex/cli/commands/doctor_cmd.py" = "blob:230c30f13e7bf19b70a6e2a03398725dcc2c422e"+"pipelex/cli/commands/doctor_cmd.py" = "blob:ad083e66e12b0a7940fd525b6a456f246ffe2ec7""pipelex/cli/commands/fix/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391""pipelex/cli/commands/fix/_diff_sandbox.py" = "blob:d39c0df92b95567f74881deb01f8c1b3119fc8ef""pipelex/cli/commands/fix/_fix_core.py" = "blob:dac7056fcaf50210c910e4cad1ba14328b7f8adc"@@ -83,21 +82,18 @@ rationale = "clean-pass: the only trigger change drops, from the emit_inputs_res"pipelex/cli/commands/fix/bundle_cmd.py" = "blob:427364cc453957dfe0cec879f019050329c13b3c""pipelex/cli/commands/graph_cmd.py" = "blob:d54737af7efc9ab9bbf3f978050d017af0e27a41""pipelex/cli/commands/init/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"-"pipelex/cli/commands/init/backends.py" = "blob:7823d8f323e826e36ca389bf3491576723786163"-"pipelex/cli/commands/init/command.py" = "blob:15bc95ae53684bef41605cabde677508bcb58934"+"pipelex/cli/commands/init/backends.py" = "blob:04a1a06f1003ed0c7157ec4ca6c8659e4e09fe6b"+"pipelex/cli/commands/init/command.py" = "blob:2aedf2b8f5b7fccf767d113650bcfba1c1a376e9""pipelex/cli/commands/init/config_files.py" = "blob:c13be6b8d2a8b211ce9ef0f4889ee131ffc3d2d8"-"pipelex/cli/commands/init/credentials.py" = "blob:7475c3082b8ee7530a76a52a8ab8bf18a7e21209"+"pipelex/cli/commands/init/credentials.py" = "blob:36dcc33599a2749b7d63bf214363a4b6fd6698e8""pipelex/cli/commands/init/ide_extension.py" = "blob:9f0ec1494c07062246ecc906bc55b7f2cf95c715"-"pipelex/cli/commands/init/routing.py" = "blob:7fe0ddc47ea9039f5f8640bfffcbdbdb118c1232"-"pipelex/cli/commands/init/telemetry.py" = "blob:da0c79bdf04b97f0655c42bc9cea98e9e40ea256"+"pipelex/cli/commands/init/routing.py" = "blob:c73927deb99804556cb545cdaa6eabf8d1fc3450"+"pipelex/cli/commands/init/telemetry.py" = "blob:17314182dbfa8e1a25f439f10eea9808b9fb6d33""pipelex/cli/commands/init/ui/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"-"pipelex/cli/commands/init/ui/backends_ui.py" = "blob:16006c2efa81640ef196986a527b629b4d91fbda"-"pipelex/cli/commands/init/ui/gateway_ui.py" = "blob:d4752deb5679d53cc21a9a4a307f2d9305e20291"+"pipelex/cli/commands/init/ui/backends_ui.py" = "blob:a5250ebf7f2865da6ca12fc292b75fa7f5e8a690""pipelex/cli/commands/init/ui/general_ui.py" = "blob:6fdc9cb429a5da261013679aae19afa10344770e""pipelex/cli/commands/init/ui/routing_ui.py" = "blob:640bd0d11d1879ead83fd9f3d1736d2735c1abfa"-"pipelex/cli/commands/init/ui/types.py" = "blob:1361f29ca95bacc90bca90ea6c0e39f44b6734ab"-"pipelex/cli/commands/login/__init__.py" = "blob:e69de29bb2d1d6434b8b29ae775ad8c2e48c5391"-"pipelex/cli/commands/login/command.py" = "blob:ace1db9879626cc1722adaac12761aadaa6b24ed"+"pipelex/cli/commands/init/ui/types.py" = "blob:e263802d8e9c9f9687435de1eb992afa5336544f""pipelex/cli/commands/migrate_cmd.py" = "blob:897f9cbf93acace8f61091a9924895f0fda76443""pipelex/cli/commands/plugins_cmd.py" = "blob:9657b713c3650ff4a929e92ae68af453d896393e""pipelex/cli/commands/resolve_cmd.py" = "blob:2928a0e26eab7983367a59a78533f6618817feba"@@ -121,7 +117,7 @@ rationale = "clean-pass: the only trigger change drops, from the emit_inputs_res"pipelex/cli/commands/validate/pipe_cmd.py" = "blob:d67267571559006459628180f2c8b216ba7fee31""pipelex/cli/commands/which_cmd.py" = "blob:68661d4bab22e2c4dab183d59bd9f2c6dd573472""pipelex/cli/deck_notice.py" = "blob:542877125e89e35b02bc969cfee952155b0d7c2c"-"pipelex/cli/error_handlers.py" = "blob:978a836fc2327e071533150a4b8e210793615bc3"+"pipelex/cli/error_handlers.py" = "blob:bef9c6c10c157eef0beaa069add4560aba49c499""pipelex/cli/exceptions.py" = "blob:1d51c3a53ddd3f6cf8de566fa2ade3fa75ab7a3a""pipelex/cli/installed_methods.py" = "blob:09197f47baf8d7251d28d148a0544b4a23ee7365""pipelex/cli/method_resolver.py" = "blob:afaf77b2d8b6a3467d6ab1f355b1ee78a71eafa7"diff --git a/.drift/acks/config-docs.toml b/.drift/acks/config-docs.tomlindex 488c876a1..fc1f132fd 100644--- a/.drift/acks/config-docs.toml+++ b/.drift/acks/config-docs.toml@@ -1,8 +1,8 @@contract = "config-docs"-digest = "sha256:5463c426f182dfc580d84505a36eed593388135d626dba5b9843de45dfa12472"+digest = "sha256:4afa250507bfc6d06733cf7fe19b4f1f692cdbb3621a3ddb726c05b84f82f9df"reviewed_by = "Claude (Opus 5.5)"-reviewed_at = "2026-10-03T14:00:06Z"-rationale = "real-catch: the review found that logging-config.md said resolved sink values exist only in the exporter or the Cloud Logging client, and log_config.py said the resolved key path goes to the client alone, while the gcp credential errors deliberately quote the resolved path beside its placeholder; both sentences now say where each resolved value goes, and the page says the doctor quotes a provider's or a sink's failure redacted with the configured extra_patterns. No config key, default or model field moved, so the migration ledgers, configs.py and config_cogt.py are unaffected."+reviewed_at = "2026-10-04T14:07:00Z"+rationale = "clean-pass: against dev, the trigger change is telemetry_config.py losing PipelexGatewayTelemetryConfig and the pipelex_gateway field; the telemetry-config ledger drops the section, telemetry-config.md documents only the user-owned streams and custom_portkey, logging-config.md lists gateway_api_key as a secret name which log_redaction.py still redacts, and configs.py and config_cogt.py carry no gateway telemetry field. The gateway sections of inference-backend-config.md remain with the docs rewrite item, as the branch's earlier ack said."[trigger_files]"pipelex/cogt/config_cogt.py" = "blob:02f71cb4a6b01aebda59c2e31f262ef9c865e17b"@@ -19,7 +19,7 @@ rationale = "real-catch: the review found that logging-config.md said resolved s"pipelex/system/configuration/config_surface.py" = "blob:96f685656a3f4355e8a073e8bf6184e020fea8f5""pipelex/system/configuration/configs.py" = "blob:3cb65cf9c3d34aef0baf92b62d8bd63e5c69d4eb""pipelex/system/configuration/pipe_func_config.py" = "blob:dc8890e914fbcdb611147e42eaa0cd87b32288a5"-"pipelex/system/telemetry/telemetry_config.py" = "blob:7070951a6d3e4c10cb7d59822ce168c6590c53be"+"pipelex/system/telemetry/telemetry_config.py" = "blob:068a785d97a2d52ee43e82e723cd944b8b6601bc""pipelex/tools/aws/aws_config.py" = "blob:c1aeafeae08d3921464db33795f11a29ff3892ba""pipelex/tools/log/log_config.py" = "blob:63dd9f81fdbafc1a095aec6cde1b047d0ebdd2d4""pipelex/tools/network/network_config.py" = "blob:e12d1d0e4a40d04859f10a77addeaf8fe2b00414"diff --git a/.drift/acks/pipelex-kernel-docs.toml b/.drift/acks/pipelex-kernel-docs.tomlindex 31da09641..e7cd0d39e 100644--- a/.drift/acks/pipelex-kernel-docs.toml+++ b/.drift/acks/pipelex-kernel-docs.toml@@ -1,8 +1,8 @@contract = "pipelex-kernel-docs"-digest = "sha256:7dc6488e6ce37ae17d2cc40cefa51884730086a4a0d7cc766128d2b108af02ae"-reviewed_by = "Louis Choquel"-reviewed_at = "2026-10-04T02:27:50Z"-rationale = "real-catch: build_judgment_material now reads a dotted input as the value at its path, keyed by its full name, as MTHDS allows; the page states it."+digest = "sha256:9def7a7729aac507aaf746de8fe79a8ea65c22d5c3d54a99347122a3d92c0357"+reviewed_by = "Claude (Opus 5.5)"+reviewed_at = "2026-10-04T16:18:57Z"+rationale = "clean-pass: the boot-contract test's docstring now says an offline boot skips the remote config fetch rather than the removed first-run gate; its calls are unchanged, and docs/under-the-hood/pipelex-kernel.md names no first-run check, onboarding flag or inference setup state, so nothing on the page moved."[trigger_files]"pipelex/kernel/__init__.py" = "blob:c4f1b0fe2ccc17db9110733f71b612f4ac1ba4ce"@@ -27,4 +27,4 @@ rationale = "real-catch: build_judgment_material now reads a dotted input as the"pipelex/kernel/search_ops.py" = "blob:f9c1dc09dd3beaf1a54ac8e3774db1d510cbdaa3""pipelex/kernel/search_results.py" = "blob:101b70dc96cc5ee1721c9f6b1cb725a5ca78ff70""pipelex/kernel/templating_style_ops.py" = "blob:395473806d600dfc4f124c07f2afebb951fc086b"-"tests/unit/pipelex/kernel/test_kernel_boot_contract.py" = "blob:21dbb38c9b38a051c00604ff4abd3cf715a29b92"+"tests/unit/pipelex/kernel/test_kernel_boot_contract.py" = "blob:39543269189511ac813fa99242b04d5c528ebfa2"diff --git a/.env.example b/.env.exampleindex 9960041c2..e4ddcfafb 100644--- a/.env.example+++ b/.env.example@@ -1,8 +1,3 @@-# [OPTIONAL] Free Pipelex Gateway API key - Get yours here: https://app.pipelex.com/-# This key gets you access to all the best models …-# … No credit card required, time-limited offer-PIPELEX_GATEWAY_API_KEY=-# [OPTIONAL] Pipelex Manifold — the Pipelex-operated inference service, currently in private beta.# The endpoint is the service ORIGIN: scheme, host and port, with no "/v1" and no trailing path.# Leave both blank unless you are in the beta: the backend ships disabled in backends.toml, anddiff --git a/.pipelex-dev/test_profiles.toml b/.pipelex-dev/test_profiles.tomlindex ae1d16f7c..8a79ec6fb 100644--- a/.pipelex-dev/test_profiles.toml+++ b/.pipelex-dev/test_profiles.toml@@ -31,7 +31,6 @@[collections.backends]# --- All Available Backends ---all = [- "pipelex_gateway","anthropic","azure_openai","bedrock",@@ -292,7 +291,7 @@ judgment_models = []################################################################################[profiles.dev]description = "Quick dev testing with fast and cheap models from key providers"-backends = ["pipelex_gateway", "internal"]+backends = ["anthropic", "openai", "google", "mistral", "linkup", "internal"]llm_models = ["claude-4.5-haiku","gpt-4o-mini",@@ -307,8 +306,8 @@ judgment_models = []################################################################################# Manifold Profile################################################################################-# The `dev` profile's shape, served by Pipelex Manifold instead of the Pipelex-# Gateway. Deliberately not a copy of `dev`: the two catalogs are allowed to+# The `dev` profile's shape, served by Pipelex Manifold instead of the BYOK+# backends. Deliberately not a copy of `dev`: the two catalogs are allowed to# diverge, so this names what the manifold section actually serves. `linkup` is# absent from it, and `@from_pdf` is not used because most of that collection is# other backends' — the manifold text extractors are named directly.@@ -367,7 +366,7 @@ judgment_models = []################################################################################[profiles.claude_latest]description = "All Claude 4.5 models"-backends = ["anthropic", "pipelex_gateway"]+backends = ["anthropic"]llm_models = ["claude-4.5-*"]img_gen_models = []extract_models = []@@ -379,7 +378,7 @@ judgment_models = []################################################################################[profiles.gpt_no_codex]description = "All GPT models except codex variants"-backends = ["openai", "pipelex_gateway"]+backends = ["openai"]llm_models = ["gpt-*", "!*-codex", "!*-codex-*"]img_gen_models = ["gpt-image-*"]extract_models = []@@ -404,31 +403,3 @@ judgment_models = [][profiles.full]description = "All available models"include_all = true--################################################################################-# All Configs GW Profile - One model per Portkey config and model type-################################################################################-[profiles.all_configs_gw]-description = "One model per Portkey config (auto-generated)"-backends = ["pipelex_gateway"]-llm_models = [- "gpt-4o-mini",- "gpt-oss-20b",- "claude-4-sonnet",- "deepseek-v3.2",- "gemini-2.5-pro",- "grok-3",-]-img_gen_models = [- "nano-banana-2",- "gpt-image-1",- "nano-banana",-]-extract_models = [- "azure-document-intelligence",- "deepseek-ocr",-]-search_models = [- "linkup-standard",-]-judgment_models = []diff --git a/.pipelex/inference/backends.toml b/.pipelex/inference/backends.tomlindex 28a5a7777..340269560 100644--- a/.pipelex/inference/backends.toml+++ b/.pipelex/inference/backends.toml@@ -10,11 +10,6 @@#####################################################################################################-[pipelex_gateway]-display_name = "⭐ Pipelex Gateway"-enabled = true # Enable after accepting terms via `pipelex init config`-api_key = "${PIPELEX_GATEWAY_API_KEY}"-# Pipelex Manifold is a closed private beta: leave it off unless you have been invited.[pipelex_manifold]display_name = "Pipelex Manifold (private beta)"diff --git a/.pipelex/inference/backends/pipelex_gateway.toml b/.pipelex/inference/backends/pipelex_gateway.tomldeleted file mode 100644index 5b02901ee..000000000--- a/.pipelex/inference/backends/pipelex_gateway.toml+++ /dev/null@@ -1,41 +0,0 @@-################################################################################-# Pipelex Gateway Local Overrides-################################################################################-#-# TELEMETRY NOTICE:-#-# Using Pipelex Gateway enables identified telemetry tied to your API key-# (hashed for security). This is independent from your telemetry.toml settings.-#-# We collect only technical data (model names, token counts, latency, error rates).-# We do NOT collect prompts, completions, pipe codes, or business data.-#-# This allows us to monitor service quality, enforce fair usage, and support you.-#-################################################################################-#-# WARNING: USE AT YOUR OWN RISK!-#-# The actual model configuration is fetched remotely from Pipelex servers.-# Any override in this file may cause unexpected behavior or failures,-# as the remote configuration may change at any time.-#-# If you must override, you may ONLY use these keys per model:-# - sdk-# - structure_method-#-# All other keys will be ignored.-#-# If you need custom configurations, consider using your own API keys-# with direct provider backends (openai, anthropic, etc.) instead.-#-# Documentation:-# https://docs.pipelex.com/latest/configuration/config-technical/inference-backend-config/-# Support: https://go.pipelex.com/discord-#-################################################################################--# Per-model overrides example:-# [gpt-4o]-# sdk = "gateway_completions"-# structure_method = "instructor/openai_tools"diff --git a/.pipelex/inference/backends/pipelex_gateway_models.md b/.pipelex/inference/backends/pipelex_gateway_models.mddeleted file mode 100644index c0acba8cf..000000000--- a/.pipelex/inference/backends/pipelex_gateway_models.md+++ /dev/null@@ -1,513 +0,0 @@-# Pipelex Gateway — Available Models-This file lists the LLMs, document extraction models, and image generation models currently available through Pipelex Gateway.-For configuration details, see the [documentation](https://docs.pipelex.com/latest/setup/configure-ai-providers/#option-1-pipelex-gateway-easiest-and-most-powerful-for-getting-started).--## Language Models (LLM)--<table>-<thead>-<tr>-<th rowspan="2">Model</th>-<th colspan="3" style="text-align:center;background-color:rgba(33,150,243,0.15)">Inputs</th>-<th colspan="2" style="text-align:center;background-color:rgba(76,175,80,0.15)">Outputs</th>-</tr>-<tr>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">text</th>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">images</th>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">pdf</th>-<th style="text-align:center;background-color:rgba(76,175,80,0.15)">text</th>-<th style="text-align:center;background-color:rgba(76,175,80,0.15)">structured</th>-</tr>-</thead>-<tbody>-<tr>-<td>claude-4-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4-sonnet</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.1-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.5-haiku</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.5-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.5-sonnet</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.6-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.6-sonnet</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.7-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.8-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-5-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-5-sonnet</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>deepseek-v3.2</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-2.5-flash</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-2.5-flash-lite</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-2.5-pro</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-3.0-flash</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-3.1-flash-lite</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-3.1-pro</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-3.5-flash</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-flash-latest</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-flash-lite-latest</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-pro-latest</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-4o</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-4o-mini</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.3-codex</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.4</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.4-mini</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.4-nano</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.4-pro</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.5</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.6-luna</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.6-sol</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.6-terra</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-oss-120b</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-oss-20b</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>grok-3</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-<tr>-<td>grok-3-mini</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-<tr>-<td>grok-4</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>grok-4-fast-non-reasoning</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>grok-4-fast-reasoning</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>kimi-k2-thinking</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>mistral-large</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>phi-4</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-<tr>-<td>phi-4-multimodal</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-<tr>-<td>qwen3-vl-235b-a22b</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-</tbody>-</table>--## Document Extraction Models--<table>-<thead>-<tr>-<th rowspan="2">Model</th>-<th colspan="3" style="text-align:center;background-color:rgba(33,150,243,0.15)">Inputs</th>-<th colspan="2" style="text-align:center;background-color:rgba(76,175,80,0.15)">Outputs</th>-</tr>-<tr>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">image</th>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">pdf</th>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">web_page</th>-<th style="text-align:center;background-color:rgba(76,175,80,0.15)">pages</th>-<th style="text-align:center;background-color:rgba(76,175,80,0.15)">captions</th>-</tr>-</thead>-<tbody>-<tr>-<td>azure-document-intelligence</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>deepseek-ocr</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-<tr>-<td>linkup-fetch</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-</tbody>-</table>---!!! info About extracted pages- Each page contains Markdown text (based on AI-interpreted layout) and optional extracted images. A single image input is treated as one page. Pipelex also wraps the `pypdfium2` library for raw text (without any AI interpretation) and images extraction and page views rendering. All these elements can be used as inputs into downstream pipes, including LLM prompts.-## Image Generation Models--<table>-<thead>-<tr>-<th rowspan="2">Model</th>-<th colspan="2" style="text-align:center;background-color:rgba(33,150,243,0.15)">Inputs</th>-<th colspan="1" style="text-align:center;background-color:rgba(76,175,80,0.15)">Outputs</th>-</tr>-<tr>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">text</th>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">images</th>-<th style="text-align:center;background-color:rgba(76,175,80,0.15)">image</th>-</tr>-</thead>-<tbody>-<tr>-<td>gpt-image-1</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-image-1-mini</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-image-1.5</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-image-2</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>nano-banana</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>nano-banana-2</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>nano-banana-2-lite</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>nano-banana-pro</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-</tbody>-</table>---> **AUTO-GENERATED FILE** - Do not edit manually.-> Last updated: 2026-09-21T10:54:05Z->-> Run `pipelex-dev update-gateway-models` or `make ugm` to regenerate.\ No newline at end of filediff --git a/.pipelex/inference/backends/pipelex_gateway_models_plain.md b/.pipelex/inference/backends/pipelex_gateway_models_plain.mddeleted file mode 100644index 9ea4543d5..000000000--- a/.pipelex/inference/backends/pipelex_gateway_models_plain.md+++ /dev/null@@ -1,195 +0,0 @@-# Pipelex Gateway — Available Models (Plain Text)--This file lists the LLMs, document extraction models, and image generation models currently available through Pipelex Gateway.-For configuration details, see the [documentation](https://docs.pipelex.com/latest/setup/configure-ai-providers/#option-1-pipelex-gateway-easiest-and-most-powerful-for-getting-started).--**Note:** This is the plain-text readable version. See `pipelex_gateway_models.md` for the HTML-styled version.--## Language Models (LLM)--- **claude-4-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4-sonnet**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.1-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.5-haiku**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.5-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.5-sonnet**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.6-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.6-sonnet**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.7-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.8-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-5-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-5-sonnet**- - inputs: text, images, pdf- - outputs: text, structured-- **deepseek-v3.2**- - inputs: text- - outputs: text, structured-- **gemini-2.5-flash**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-2.5-flash-lite**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-2.5-pro**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-3.0-flash**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-3.1-flash-lite**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-3.1-pro**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-3.5-flash**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-flash-latest**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-flash-lite-latest**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-pro-latest**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-4o**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-4o-mini**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.3-codex**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.4**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.4-mini**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.4-nano**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.4-pro**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.5**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.6-luna**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.6-sol**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.6-terra**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-oss-120b**- - inputs: text- - outputs: text, structured-- **gpt-oss-20b**- - inputs: text- - outputs: text, structured-- **grok-3**- - inputs: text- - outputs: text-- **grok-3-mini**- - inputs: text- - outputs: text-- **grok-4**- - inputs: text- - outputs: text, structured-- **grok-4-fast-non-reasoning**- - inputs: text, images- - outputs: text, structured-- **grok-4-fast-reasoning**- - inputs: text, images- - outputs: text, structured-- **kimi-k2-thinking**- - inputs: text- - outputs: text, structured-- **mistral-large**- - inputs: text, images, pdf- - outputs: text, structured-- **phi-4**- - inputs: text- - outputs: text-- **phi-4-multimodal**- - inputs: text, images- - outputs: text-- **qwen3-vl-235b-a22b**- - inputs: text, images- - outputs: text, structured--## Document Extraction Models--- **azure-document-intelligence**- - inputs: image, pdf- - outputs: pages, captions-- **deepseek-ocr**- - inputs: image- - outputs: pages-- **linkup-fetch**- - inputs: web_page- - outputs: pages---**About extracted pages:** Each page contains Markdown text (based on AI-interpreted layout) and optional extracted images. A single image input is treated as one page. Pipelex also wraps the `pypdfium2` library for raw text (without any AI interpretation) and images extraction and page views rendering. All these elements can be used as inputs into downstream pipes, including LLM prompts.--## Image Generation Models--- **gpt-image-1**- - inputs: text, images- - outputs: image-- **gpt-image-1-mini**- - inputs: text, images- - outputs: image-- **gpt-image-1.5**- - inputs: text, images- - outputs: image-- **gpt-image-2**- - inputs: text, images- - outputs: image-- **nano-banana**- - inputs: text, images- - outputs: image-- **nano-banana-2**- - inputs: text, images- - outputs: image-- **nano-banana-2-lite**- - inputs: text, images- - outputs: image-- **nano-banana-pro**- - inputs: text, images- - outputs: image---> **AUTO-GENERATED FILE** - Do not edit manually.-> Last updated: 2026-09-21T10:54:05Z->-> Run `pipelex-dev update-gateway-models` or `make ugm` to regenerate.\ No newline at end of filediff --git a/.pipelex/inference/backends/pipelex_manifold.toml b/.pipelex/inference/backends/pipelex_manifold.tomlindex 1a9adc718..d2130ec85 100644--- a/.pipelex/inference/backends/pipelex_manifold.toml+++ b/.pipelex/inference/backends/pipelex_manifold.toml@@ -12,18 +12,13 @@## TELEMETRY NOTICE:#-# Enabling pipelex_gateway alongside this backend enables identified telemetry-# from your machine, tied to your Pipelex Gateway API key (hashed for security).-# This is independent from your telemetry.toml settings.-#-# That client-side telemetry follows the gateway key and nothing else, so an-# installation running Pipelex Manifold ALONE sends none of it. Manifold is a-# Pipelex-operated service, though, so your usage of it is recorded server-side-# the way any hosted platform records the calls it serves.-#-# Either way we collect only technical data (model names, token counts, latency,-# error rates). We do NOT collect prompts, completions, pipe codes, or business-# data.+# This backend sends no telemetry from your machine: the runtime's only+# telemetry stream is the one you configure yourself in telemetry.toml.+# Manifold is a Pipelex-operated service, though, so your usage of it is+# recorded server-side the way any hosted platform records the calls it serves.+#+# We collect only technical data (model names, token counts, latency, error+# rates). We do NOT collect prompts, completions, pipe codes, or business data.## This allows us to monitor service quality, enforce fair usage, and support you.#diff --git a/.pipelex/inference/deck/3_extract_deck.toml b/.pipelex/inference/deck/3_extract_deck.tomlindex c67d393f1..c5e474a91 100644--- a/.pipelex/inference/deck/3_extract_deck.toml+++ b/.pipelex/inference/deck/3_extract_deck.toml@@ -31,13 +31,29 @@ choice_default = "@default-extract-document"####################################################################################################[extract.aliases]-default-premium = "azure-document-intelligence"-default-extract-document = "azure-document-intelligence"-default-extract-image = "azure-document-intelligence"+default-premium = "~ocr-extractor"+default-extract-document = "~document-extractor"+default-extract-image = "~ocr-extractor"default-text-from-pdf = "pypdfium2-extract-pdf"default-no-inference = "pypdfium2-extract-pdf"default-extract-web-page = "linkup-fetch"+####################################################################################################+# Waterfalls+####################################################################################################+#+# Each default resolves to the first entry an enabled backend serves: Azure Document Intelligence+# through Pipelex Manifold, then Mistral OCR with your own Mistral key. Documents fall back last to+# reading a PDF's text layer locally, which needs no key but recovers no text from a scanned page.++[extract.waterfalls]+document-extractor = [+ "azure-document-intelligence",+ "mistral-ocr",+ "pypdfium2-extract-pdf",+]+ocr-extractor = ["azure-document-intelligence", "mistral-ocr"]+##################################################################################################### Extract Presets####################################################################################################diff --git a/.pipelex/inference/deck/6_judgment_deck.toml b/.pipelex/inference/deck/6_judgment_deck.tomlindex 01e45b3c5..5fec6dd59 100644--- a/.pipelex/inference/deck/6_judgment_deck.toml+++ b/.pipelex/inference/deck/6_judgment_deck.toml@@ -26,7 +26,7 @@## There is deliberately no `choice_default` here, and that is what tells you no judgment model is# served out of the box: a judgment backend is one you bring, so a pipe names the model it judges-# with until the Pipelex Gateway serves the family. Set one here once you have a backend configured.+# with. Set one here once you have a backend configured.[judgment]diff --git a/.pipelex/inference/deck/x_custom_extract_deck.toml b/.pipelex/inference/deck/x_custom_extract_deck.tomlindex c3c3b9fcb..dab86f45c 100644--- a/.pipelex/inference/deck/x_custom_extract_deck.toml+++ b/.pipelex/inference/deck/x_custom_extract_deck.toml@@ -5,10 +5,10 @@# This file allows you to override or complete the base model decks.## ADVANCED USERS ONLY: This file is for users who bring their own API keys and connect directly-# to AI providers (Azure, Mistral, etc.) without using the Pipelex Gateway.+# to AI providers (Azure, Mistral, etc.) and want to tune their own catalog.#-# If you're using the standard Pipelex Gateway setup, you don't need to modify this file.-# The Gateway handles model routing automatically and supports all available models.+# If the shipped backend catalogs cover your needs, you don't need to modify this file.+# The routing profile picks a backend for every model the enabled backends serve.## Waterfalls are useful when using multiple backends directly - they define ordered lists# of models that are resolved at configuration time based on which backends are available.diff --git a/.pipelex/inference/deck/x_custom_llm_deck.toml b/.pipelex/inference/deck/x_custom_llm_deck.tomlindex a8aecc307..78008b421 100644--- a/.pipelex/inference/deck/x_custom_llm_deck.toml+++ b/.pipelex/inference/deck/x_custom_llm_deck.toml@@ -5,10 +5,10 @@# This file allows you to override or complete the base model decks.## ADVANCED USERS ONLY: This file is for users who bring their own API keys and connect directly-# to AI providers (OpenAI, Anthropic, Google, etc.) without using the Pipelex Gateway.+# to AI providers (OpenAI, Anthropic, Google, etc.) and want to tune their own catalog.#-# If you're using the standard Pipelex Gateway setup, you don't need to modify this file.-# The Gateway handles model routing automatically and supports all available models.+# If the shipped backend catalogs cover your needs, you don't need to modify this file.+# The routing profile picks a backend for every model the enabled backends serve.## Waterfalls are useful when using multiple backends directly - they define ordered lists# of models that are resolved at configuration time based on which backends are available.diff --git a/.pipelex/inference/routing_profiles.toml b/.pipelex/inference/routing_profiles.tomlindex 25619b1ee..c11082327 100644--- a/.pipelex/inference/routing_profiles.toml+++ b/.pipelex/inference/routing_profiles.toml@@ -12,30 +12,49 @@# which routing profile you select. See the documentation for details.# Which profile to use (change this to switch routing)-active = "all_pipelex_gateway"+active = "all_enabled_backends"-# We recommend using the "all_pipelex_gateway" profile to get a head start with all models.-# To use the Pipelex Gateway backend:-# 1. Get your API key at https://app.pipelex.com (free credits included)-# 2. Add it to your .env file: PIPELEX_GATEWAY_API_KEY=your-key-here-# 3. Run `pipelex init` and accept the Gateway terms of service+# The default profile needs no Pipelex account: it routes each model to the first enabled backend+# that serves it, in the order its `fallback_order` lists. `pipelex init` narrows this to the+# backend you configure (`all_<backend>`). The model deck's default tiers point at OpenAI models,+# which `openai` and `azure_openai` serve: with any other single backend, repoint the deck's+# aliases at models it serves in `deck/x_custom_llm_deck.toml`.# =========================================================================================# Routing Profiles# =========================================================================================-[profiles.all_pipelex_gateway]-description = "Use Pipelex Gateway for all its supported models"-default = "pipelex_gateway"--# Judgment models are brought by you rather than served by Pipelex, so they go to their own backend-# whenever it is enabled. An optional route is inert while its backend is disabled.-[profiles.all_pipelex_gateway.optional_routes]+[profiles.all_enabled_backends]+description = "Route each model to the first enabled backend that serves it, in this order"+fallback_order = [+ "openai",+ "anthropic",+ "google",+ "mistral",+ "bedrock",+ "azure_openai",+ "xai",+ "groq",+ "fal",+ "huggingface",+ "linkup",+ "openrouter",+ "portkey",+ "blackboxai",+ "minimax",+ "scaleway",+ "ollama",+ "vertexai",+ "pipelex_manifold",+]++# Judgment models are served by their own backend alone, so they go to it whenever it is enabled.+# An optional route is inert while its backend is disabled.+[profiles.all_enabled_backends.optional_routes]"jev-*" = "typesafe"-# The same model names, served by the Pipelex-operated inference service instead. Switching between-# this profile and the one above needs no other edit: a model's wire id and sdk are per-backend, so-# decks, aliases and presets keep naming the same handles.+# The Pipelex-operated inference service (private beta). A model's wire id and sdk are per-backend,+# so decks, aliases and presets keep naming the same handles whichever profile is active.[profiles.all_pipelex_manifold]description = "Use Pipelex Manifold (private beta) for all its supported models"default = "pipelex_manifold"@@ -146,7 +165,7 @@ default = "internal"# =========================================================================================[profiles.example_routing_using_patterns]description = "Example routing profile using patterns"-default = "pipelex_gateway"+default = "openrouter"[profiles.example_routing_using_patterns.routes]# Pattern matching: "model-pattern" = "backend-name"@@ -166,17 +185,17 @@ default = "pipelex_gateway"description = "Example routing profile using specific models"[profiles.example_routing_using_specific_models.routes]-"gpt-5.4-nano" = "pipelex_gateway"+"gpt-5.4-nano" = "openrouter""gpt-4o-mini" = "blackboxai""gpt-5.4-mini" = "openai""gpt-5.5" = "azure_openai"-"claude-4-sonnet" = "pipelex_gateway"+"claude-4-sonnet" = "openrouter""claude-3.7-sonnet" = "blackboxai"-"gemini-2.5-flash-lite" = "pipelex_gateway"+"gemini-2.5-flash-lite" = "openrouter""gemini-2.5-flash" = "blackboxai""gemini-2.5-pro" = "vertexai"-"grok-3" = "pipelex_gateway"+"grok-3" = "openrouter""grok-3-mini" = "xai"diff --git a/.pipelex/telemetry.toml b/.pipelex/telemetry.tomlindex 9b89befc9..62377ef9c 100644--- a/.pipelex/telemetry.toml+++ b/.pipelex/telemetry.toml@@ -10,9 +10,7 @@# Leave it commented out to inherit your global telemetry settings unchanged.# Uncomment a key (or whole section) to override it for this project only.#-# NOTE: When using Pipelex Gateway, identified telemetry is automatically enabled-# (tied to your Gateway API key, hashed for security). This is independent of the-# settings below — you can have both.+# Everything below is off unless you turn it on, and nothing here reports to Pipelex.## To disable all telemetry, set the DO_NOT_TRACK=1 environment variable.#diff --git a/.test_durations b/.test_durationsindex 8a89520a9..d3901b030 100644--- a/.test_durations+++ b/.test_durations@@ -7,7 +7,6 @@"tests/e2e/pipelex/cli/test_entry_bare_code_cmd.py::TestEntryBareCodeCommands::test_show_resolves_a_bare_code_from_another_domain": 0.4813,"tests/e2e/pipelex/cli/test_entry_bare_code_cmd.py::TestEntryBareCodeCommands::test_unknown_bare_code_still_reports_not_found": 0.5489,"tests/e2e/pipelex/cli/test_entry_bare_code_cmd.py::TestEntryBareCodeCommands::test_which_resolves_a_bare_code_from_another_domain": 3.2356,- "tests/e2e/pipelex/cli/test_init_cmd_edge_cases.py::TestEdgeCases::test_pipelex_gateway_sets_all_pipelex_gateway": 2.3299,"tests/e2e/pipelex/cli/test_init_cmd_edge_cases.py::TestEdgeCases::test_reset_all_with_flag": 1.0924,"tests/e2e/pipelex/cli/test_init_cmd_edge_cases.py::TestEdgeCases::test_single_non_pipelex_backend": 0.9706,"tests/e2e/pipelex/cli/test_init_cmd_edge_cases.py::TestEdgeCases::test_two_backends_automatic_fallback": 0.9458,@@ -24,7 +23,6 @@"tests/e2e/pipelex/cli/test_init_cmd_focused.py::TestFocusedInitialization::test_inference_with_existing_config": 1.1239,"tests/e2e/pipelex/cli/test_init_cmd_focused.py::TestFocusedInitialization::test_reconfigure_inference": 0.9538,"tests/e2e/pipelex/cli/test_init_cmd_focused.py::TestFocusedInitialization::test_reconfigure_telemetry": 0.0386,- "tests/e2e/pipelex/cli/test_init_cmd_focused.py::TestFocusedInitialization::test_reset_routing_with_pipelex_gateway": 0.1253,"tests/e2e/pipelex/cli/test_init_cmd_focused.py::TestFocusedInitialization::test_telemetry_only_initialization": 0.0184,"tests/e2e/pipelex/cli/test_init_cmd_validation.py::TestInputValidation::test_default_selection_press_enter": 0.8953,"tests/e2e/pipelex/cli/test_init_cmd_validation.py::TestInputValidation::test_invalid_backend_index_then_valid": 1.993,@@ -193,14 +191,11 @@"tests/integration/pipelex/cli/agent_cli/test_run_error_chain.py::TestRunErrorChain::test_run_error_chain_markdown": 1.5323,"tests/integration/pipelex/cli/commands/init/test_cache_priming.py::TestCachePriming::test_init_does_not_double_prime": 0.1256,"tests/integration/pipelex/cli/commands/init/test_cache_priming.py::TestCachePriming::test_init_primes_cache_when_online": 1.0514,- "tests/integration/pipelex/cli/commands/init/test_cache_priming.py::TestCachePriming::test_init_skips_priming_when_gateway_disabled": 0.0162,"tests/integration/pipelex/cli/commands/init/test_cache_priming.py::TestCachePriming::test_init_warns_when_cache_write_fails": 0.0186,- "tests/integration/pipelex/cli/commands/init/test_cache_priming.py::TestCachePriming::test_init_warns_when_cached_payload_is_malformed": 0.0211,"tests/integration/pipelex/cli/commands/init/test_cache_priming.py::TestCachePriming::test_init_warns_when_offline": 0.0218,"tests/integration/pipelex/cli/commands/init/test_cache_priming.py::TestCachePriming::test_init_warns_when_offline_with_stale_cache_present": 0.028,"tests/integration/pipelex/cli/commands/init/test_cache_priming.py::TestCachePriming::test_priming_reads_backends_toml_from_target_dir": 0.1575,"tests/integration/pipelex/cli/commands/init/test_cache_priming.py::TestCachePriming::test_priming_runs_for_a_manifold_only_installation": 0.5568,- "tests/integration/pipelex/cli/commands/init/test_cache_priming.py::TestCachePriming::test_priming_skips_when_target_dir_says_gateway_disabled": 1.1641,"tests/integration/pipelex/cli/test_advisory_warning_channels.py::TestAdvisoryWarningChannels::test_agent_cli_bundle_envelope_carries_all_three_families": 0.6051,"tests/integration/pipelex/cli/test_advisory_warning_channels.py::TestAdvisoryWarningChannels::test_agent_cli_markdown_lists_all_three_families_in_the_same_order": 1.949,"tests/integration/pipelex/cli/test_advisory_warning_channels.py::TestAdvisoryWarningChannels::test_agent_cli_markdown_renders_the_warning_under_its_heading": 1.5342,@@ -242,14 +237,10 @@"tests/integration/pipelex/cli/test_init_cmd_backend_customization.py::TestBackendCustomization::test_customize_backends_config_with_default_selection": 2.2372,"tests/integration/pipelex/cli/test_init_cmd_backend_customization.py::TestBackendCustomization::test_customize_backends_config_with_multiple_selections": 0.7301,"tests/integration/pipelex/cli/test_init_cmd_backend_customization.py::TestBackendCustomization::test_customize_backends_config_with_space_separated_input": 1.2482,- "tests/integration/pipelex/cli/test_init_cmd_backend_customization.py::TestBackendCustomization::test_customize_backends_disables_gateway_when_terms_save_raises_type_error": 1.1485,"tests/integration/pipelex/cli/test_init_cmd_backend_customization.py::TestBackendCustomization::test_customize_backends_handles_missing_file_gracefully": 0.0029,"tests/integration/pipelex/cli/test_init_cmd_backend_customization.py::TestBackendCustomization::test_init_config_copies_files_without_customizing": 0.0031,- "tests/integration/pipelex/cli/test_init_cmd_backend_customization.py::TestTermsAreAskedForAnyManagedGateway::test_declining_removes_the_manifold_service_from_the_selection": 0.6958,- "tests/integration/pipelex/cli/test_init_cmd_backend_customization.py::TestTermsAreAskedForAnyManagedGateway::test_selecting_only_the_manifold_service_records_terms_acceptance": 4.6369,"tests/integration/pipelex/cli/test_init_cmd_integration.py::TestInitCommandIntegration::test_init_config_only_focus": 0.9113,"tests/integration/pipelex/cli/test_init_cmd_integration.py::TestInitCommandIntegration::test_init_inference_only_focus": 0.8944,- "tests/integration/pipelex/cli/test_init_cmd_integration.py::TestInitCommandIntegration::test_init_pipelex_gateway_sets_all_pipelex_gateway": 1.0302,"tests/integration/pipelex/cli/test_init_cmd_integration.py::TestInitCommandIntegration::test_init_reconfigure_existing_inference": 1.0157,"tests/integration/pipelex/cli/test_init_cmd_integration.py::TestInitCommandIntegration::test_init_telemetry_only_focus": 0.0275,"tests/integration/pipelex/cli/test_init_cmd_integration.py::TestInitCommandIntegration::test_init_telemetry_project_uses_commented_template": 0.0163,@@ -355,10 +346,6 @@"tests/integration/pipelex/cogt/image/test_pipelex_storage_image_flow.py::TestPipelexStorageImageFlow::test_prep_prompt_images_batch_with_storage_uri": 0.0612,"tests/integration/pipelex/cogt/image/test_pipelex_storage_image_flow.py::TestPipelexStorageImageFlow::test_prompt_image_uri_caches_resolved": 0.1157,"tests/integration/pipelex/cogt/image/test_pipelex_storage_image_flow.py::TestPipelexStorageImageFlow::test_storage_uri_resolves_correctly": 0.0015,- "tests/integration/pipelex/cogt/model_backends/test_gateway_unknown_model.py::TestGatewayUnknownModel::test_dummy_specs_path_skips_membership_check": 0.6742,- "tests/integration/pipelex/cogt/model_backends/test_gateway_unknown_model.py::TestGatewayUnknownModel::test_known_model_loads": 0.6785,- "tests/integration/pipelex/cogt/model_backends/test_gateway_unknown_model.py::TestGatewayUnknownModel::test_unknown_model_cached_raises_with_stale_hint": 0.3715,- "tests/integration/pipelex/cogt/model_backends/test_gateway_unknown_model.py::TestGatewayUnknownModel::test_unknown_model_fresh_raises": 0.3872,"tests/integration/pipelex/cogt/test_content_generator.py::TestContentGenerator::test_make_templated_text": 0.9633,"tests/integration/pipelex/cogt/test_doc_gen_models.py::TestDocGenModels::test_a_default_under_a_key_no_step_makes_is_refused_when_the_deck_loads": 0.0727,"tests/integration/pipelex/cogt/test_doc_gen_models.py::TestDocGenModels::test_the_built_in_engine_is_the_default_for_a_pdf_without_a_template": 0.0003,@@ -1349,7 +1336,6 @@"tests/integration/pipelex/plugins/test_storage_external_plugin.py::TestStorageExternalPlugin::test_explicit_storage_provider_wins_over_config_selection": 0.9394,"tests/integration/pipelex/plugins/test_storage_external_plugin.py::TestStorageExternalPlugin::test_external_storage_method_is_discovered_and_selected_onto_the_hub": 0.7849,"tests/integration/pipelex/system/pipelex_service/test_offline_baseline.py::TestOfflineBaseline::test_byok_offline_setup_succeeds_without_fetching_remote_config": 0.9307,- "tests/integration/pipelex/system/pipelex_service/test_offline_baseline.py::TestOfflineBaseline::test_gateway_offline_without_cache_raises_remote_config_unavailable_error": 0.3003,"tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.py::TestRemoteConfigFetcher::test_cache_store_oserror_does_not_abort_fresh_fetch": 0.0029,"tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.py::TestRemoteConfigFetcher::test_codex_cloud_short_circuit_still_works": 0.0043,"tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.py::TestRemoteConfigFetcher::test_falls_back_to_cache_after_5_transient_failures": 0.0028,@@ -1358,16 +1344,11 @@"tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.py::TestRemoteConfigFetcher::test_http_error_without_cache_raises_unavailable": 0.0038,"tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.py::TestRemoteConfigFetcher::test_inner_retry_layer_still_raises_remote_config_fetch_error": 0.0035,"tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.py::TestRemoteConfigFetcher::test_network_failure_with_cache_returns_cached": 0.0037,- "tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.py::TestRemoteConfigFetcher::test_network_failure_with_invalid_cache_raises_unavailable": 0.0022,"tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.py::TestRemoteConfigFetcher::test_network_failure_without_cache_raises_unavailable": 0.0022,"tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.py::TestRemoteConfigFetcher::test_require_fresh_refuses_cache": 0.0046,"tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.py::TestRemoteConfigFetcher::test_succeeds_after_4_transient_failures_no_cache_fallback": 0.0061,"tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.py::TestRemoteConfigFetcher::test_success_returns_fresh_and_writes_cache": 1.046,"tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.py::TestRemoteConfigFetcher::test_validation_error_does_not_fall_back": 0.0022,- "tests/integration/pipelex/system/pipelex_service/test_setup_gateway_telemetry.py::TestSetupGatewayTelemetry::test_a_deployment_boot_sends_the_stream": 0.6136,- "tests/integration/pipelex/system/pipelex_service/test_setup_gateway_telemetry.py::TestSetupGatewayTelemetry::test_a_test_harness_mode_boot_keeps_the_stream_off[ci]": 0.1447,- "tests/integration/pipelex/system/pipelex_service/test_setup_gateway_telemetry.py::TestSetupGatewayTelemetry::test_a_test_harness_mode_boot_keeps_the_stream_off[pytest]": 1.1718,- "tests/integration/pipelex/system/pipelex_service/test_setup_gateway_telemetry.py::TestSetupGatewayTelemetry::test_a_unit_testing_run_mode_boot_keeps_the_stream_off": 0.1861,"tests/integration/pipelex/system/pipelex_service/test_setup_with_cache.py::TestSetupWithCache::test_byok_offline_regression_guard": 0.8641,"tests/integration/pipelex/system/pipelex_service/test_setup_with_cache.py::TestSetupWithCache::test_setup_fails_without_cache_dry_run": 0.2463,"tests/integration/pipelex/system/pipelex_service/test_setup_with_cache.py::TestSetupWithCache::test_setup_succeeds_with_stale_cache_dry_run": 0.9718,@@ -1628,8 +1609,6 @@"tests/unit/pipelex/cli/agent_cli/test_agent_error_format.py::TestAgentErrorFormat::test_agent_error_defaults_to_json": 0.8061,"tests/unit/pipelex/cli/agent_cli/test_agent_error_format.py::TestAgentErrorFormat::test_agent_error_emits_markdown_when_format_is_markdown": 0.0007,"tests/unit/pipelex/cli/agent_cli/test_agent_error_format.py::TestAgentErrorFormat::test_agent_error_markdown_renders_hint_and_details_but_omits_source": 0.1377,- "tests/unit/pipelex/cli/agent_cli/test_agent_init_managed_gateway_terms.py::TestAgentInitTermsForAnyManagedGateway::test_a_byok_only_request_records_nothing": 0.4275,- "tests/unit/pipelex/cli/agent_cli/test_agent_init_managed_gateway_terms.py::TestAgentInitTermsForAnyManagedGateway::test_a_manifold_only_request_persists_the_acceptance_it_was_given": 0.4503,"tests/unit/pipelex/cli/agent_cli/test_agent_method_ref_errors.py::TestAgentMethodRefErrors::test_inputs_method_fetch_failure_emits_json_envelope": 1.2179,"tests/unit/pipelex/cli/agent_cli/test_agent_method_ref_errors.py::TestAgentMethodRefErrors::test_run_method_fetch_failure_emits_json_envelope": 1.2404,"tests/unit/pipelex/cli/agent_cli/test_agent_method_ref_errors.py::TestAgentMethodRefErrors::test_validate_method_fetch_failure_emits_json_envelope": 1.2826,@@ -1749,13 +1728,6 @@"tests/unit/pipelex/cli/commands/fix/test_fix_bundle_human_format.py::TestFixBundleHumanFormat::test_unknown_fix_code_is_rejected_listing_known_codes": 0.0973,"tests/unit/pipelex/cli/commands/fix/test_fix_bundle_human_format.py::TestFixBundleHumanFormat::test_valid_not_runnable_with_allow_signatures_exits_zero": 0.009,"tests/unit/pipelex/cli/commands/fix/test_fix_bundle_human_format.py::TestFixBundleHumanFormat::test_valid_not_runnable_without_allow_signatures_exits_one": 0.0128,- "tests/unit/pipelex/cli/commands/login/test_login_command.py::TestLoginCommand::test_callback_handler_extracts_api_key": 0.8587,- "tests/unit/pipelex/cli/commands/login/test_login_command.py::TestLoginCommand::test_callback_handler_returns_400_for_wrong_path": 0.0033,- "tests/unit/pipelex/cli/commands/login/test_login_command.py::TestLoginCommand::test_callback_handler_returns_400_without_key": 0.0031,- "tests/unit/pipelex/cli/commands/login/test_login_command.py::TestLoginCommand::test_login_cmd_stdout_never_contains_api_key": 0.1255,- "tests/unit/pipelex/cli/commands/login/test_login_command.py::TestLoginCommand::test_save_api_key_creates_env_file": 0.0032,- "tests/unit/pipelex/cli/commands/login/test_login_command.py::TestLoginCommand::test_save_api_key_preserves_existing_entries": 0.002,- "tests/unit/pipelex/cli/commands/login/test_login_command.py::TestLoginCommand::test_save_api_key_updates_existing_key": 0.0031,"tests/unit/pipelex/cli/commands/run/test_bundle_cmd_auto_inputs.py::TestBundleCmdAutoInputs::test_auto_detects_inputs_json": 0.0037,"tests/unit/pipelex/cli/commands/run/test_bundle_cmd_auto_inputs.py::TestBundleCmdAutoInputs::test_auto_detects_inputs_toml": 0.8357,"tests/unit/pipelex/cli/commands/run/test_bundle_cmd_auto_inputs.py::TestBundleCmdAutoInputs::test_both_inputs_files_error": 0.0018,@@ -1800,8 +1772,6 @@"tests/unit/pipelex/cli/commands/test_bundle_path_resolver.py::TestHumanBundlePathResolver::test_not_a_bundle_path_exits_2_with_command_hint": 0.0954,"tests/unit/pipelex/cli/commands/test_bundle_path_resolver.py::TestHumanBundlePathResolver::test_tilde_in_library_dir_is_expanded": 0.0013,"tests/unit/pipelex/cli/commands/test_bundle_path_resolver.py::TestHumanBundlePathResolver::test_tilde_in_path_is_expanded": 0.0014,- "tests/unit/pipelex/cli/commands/test_init_agreement_any_managed_gateway.py::TestInitAgreementCoversEveryManagedGateway::test_a_manifold_only_installation_is_prompted_rather_than_told_nothing_is_needed": 0.3841,- "tests/unit/pipelex/cli/commands/test_init_agreement_any_managed_gateway.py::TestInitAgreementCoversEveryManagedGateway::test_no_managed_gateway_at_all_still_reports_nothing_to_accept": 0.5419,"tests/unit/pipelex/cli/dev/test_actions_allowlist_guard.py::TestActionsAllowlistGuard::test_a_malformed_allowlist_is_an_error[a missing key]": 0.0017,"tests/unit/pipelex/cli/dev/test_actions_allowlist_guard.py::TestActionsAllowlistGuard::test_a_malformed_allowlist_is_an_error[a mistyped flag]": 0.3472,"tests/unit/pipelex/cli/dev/test_actions_allowlist_guard.py::TestActionsAllowlistGuard::test_a_malformed_allowlist_is_an_error[an empty pattern]": 0.0024,@@ -2137,12 +2107,6 @@"tests/unit/pipelex/cli/dev/test_keyword_only_guard_single_file.py::TestKeywordOnlyGuardSingleFile::test_relative_source_path_rejects_pycache": 0.0022,"tests/unit/pipelex/cli/dev/test_keyword_only_guard_single_file.py::TestKeywordOnlyGuardSingleFile::test_single_file_matches_full_scan": 0.7853,"tests/unit/pipelex/cli/dev/test_keyword_only_guard_single_file.py::TestKeywordOnlyGuardSingleFile::test_syntax_error_file_skipped": 0.0016,- "tests/unit/pipelex/cli/dev/test_preprocess_test_models_cmd.py::TestPreprocessTestModelsCmd::test_fetch_gateway_models_propagates_fresh_refusal[gateway_error0]": 0.7919,- "tests/unit/pipelex/cli/dev/test_preprocess_test_models_cmd.py::TestPreprocessTestModelsCmd::test_fetch_gateway_models_propagates_fresh_refusal[gateway_error1]": 0.1111,- "tests/unit/pipelex/cli/dev/test_preprocess_test_models_cmd.py::TestPreprocessTestModelsCmd::test_fetch_managed_gateway_models_propagates_fresh_refusal[gateway_error0]": 0.5797,- "tests/unit/pipelex/cli/dev/test_preprocess_test_models_cmd.py::TestPreprocessTestModelsCmd::test_fetch_managed_gateway_models_propagates_fresh_refusal[gateway_error1]": 0.0008,- "tests/unit/pipelex/cli/dev/test_preprocess_test_models_cmd.py::TestPreprocessTestModelsCmd::test_fetch_managed_gateway_models_reads_each_backend_its_own_section": 0.0399,- "tests/unit/pipelex/cli/dev/test_preprocess_test_models_cmd.py::TestPreprocessTestModelsCmd::test_fetch_managed_gateway_models_skips_the_fetch_when_none_is_enabled": 0.0019,"tests/unit/pipelex/cli/dev/test_refresh_graph_ui_sri.py::TestRefreshGraphUiSri::test_rejects_malformed_versions[1.0.0 ]": 0.0032,"tests/unit/pipelex/cli/dev/test_refresh_graph_ui_sri.py::TestRefreshGraphUiSri::test_rejects_malformed_versions[1.0.0\"; import os; os.system(\"rm -rf ~\") #]": 0.0017,"tests/unit/pipelex/cli/dev/test_refresh_graph_ui_sri.py::TestRefreshGraphUiSri::test_rejects_malformed_versions[1.0.0/../../../etc/passwd]": 0.0029,@@ -2283,9 +2247,6 @@"tests/unit/pipelex/cli/dev_cli/test_projection_shaping_gate.py::TestTheShapingGateRefusesWhatTheRuntimeWouldReject::test_the_passing_count_is_kept_but_never_committed": 0.0726,"tests/unit/pipelex/cli/dev_cli/test_projection_shaping_gate.py::TestTheShapingGateRefusesWhatTheRuntimeWouldReject::test_the_refusal_carries_the_error_message_the_manifest_deliberately_omits": 0.0004,"tests/unit/pipelex/cli/dev_cli/test_projection_shaping_gate.py::TestTheShapingGateRefusesWhatTheRuntimeWouldReject::test_the_refusal_survives_the_console_that_prints_it": 0.0053,- "tests/unit/pipelex/cli/test_agent_cli_factory.py::TestMakePipelexForAgentCli::test_initialization_error_produces_json[GatewayApiKeyMissingError-exc_args2-GatewayApiKeyMissingError]": 0.0028,- "tests/unit/pipelex/cli/test_agent_cli_factory.py::TestMakePipelexForAgentCli::test_initialization_error_produces_json[GatewayDoNotTrackConflictError-exc_args3-GatewayDoNotTrackConflictError]": 0.0013,- "tests/unit/pipelex/cli/test_agent_cli_factory.py::TestMakePipelexForAgentCli::test_initialization_error_produces_json[GatewayTermsNotAcceptedError-exc_args1-GatewayTermsNotAcceptedError]": 0.0037,"tests/unit/pipelex/cli/test_agent_cli_factory.py::TestMakePipelexForAgentCli::test_initialization_error_produces_json[RemoteConfigValidationError-exc_args4-RemoteConfigValidationError]": 0.008,"tests/unit/pipelex/cli/test_agent_cli_factory.py::TestMakePipelexForAgentCli::test_initialization_error_produces_json[TelemetryConfigValidationError-exc_args0-TelemetryConfigValidationError]": 0.0034,"tests/unit/pipelex/cli/test_agent_cli_factory.py::TestMakePipelexForAgentCli::test_model_deck_preset_error_includes_structured_fields": 0.0859,@@ -2415,7 +2376,6 @@"tests/unit/pipelex/cli/test_cli_entrypoint_smoke.py::TestCliEntrypointStarts::test_subcommand_starts_and_exits_zero[args2]": 1.3568,"tests/unit/pipelex/cli/test_cli_entrypoint_smoke.py::TestCliEntrypointStarts::test_subcommand_starts_and_exits_zero[args3]": 1.2812,"tests/unit/pipelex/cli/test_cli_entrypoint_smoke.py::TestCliEntrypointStarts::test_subcommand_starts_and_exits_zero[args4]": 1.3909,- "tests/unit/pipelex/cli/test_cli_factory.py::TestCliFactory::test_first_run_catches_inference_setup_required": 0.8625,"tests/unit/pipelex/cli/test_codegen_check_cli.py::TestCodegenCheckCli::test_current_tree_is_exit_0": 0.0035,"tests/unit/pipelex/cli/test_codegen_check_cli.py::TestCodegenCheckCli::test_drifted_tree_is_exit_1": 0.0728,"tests/unit/pipelex/cli/test_codegen_check_cli.py::TestCodegenCheckCli::test_expands_home_relative_root": 0.0013,@@ -2459,11 +2419,6 @@"tests/unit/pipelex/cli/test_doctor_check_models.py::TestCheckModels::test_backend_library_error_spares_backend_named_only_in_prose": 0.0573,"tests/unit/pipelex/cli/test_doctor_check_models.py::TestCheckModels::test_backend_library_error_updates_declared_backend_report": 0.4411,"tests/unit/pipelex/cli/test_doctor_check_models.py::TestCheckModels::test_backend_library_error_updates_named_backend_report": 0.1008,- "tests/unit/pipelex/cli/test_doctor_check_models.py::TestCheckModels::test_gateway_disabled_happy_path": 0.0023,- "tests/unit/pipelex/cli/test_doctor_check_models.py::TestCheckModels::test_gateway_enabled_missing_service_config": 0.0017,- "tests/unit/pipelex/cli/test_doctor_check_models.py::TestCheckModels::test_gateway_enabled_passes_gateway_config_to_setup": 0.004,- "tests/unit/pipelex/cli/test_doctor_check_models.py::TestCheckModels::test_gateway_enabled_remote_fetch_failure": 0.0034,- "tests/unit/pipelex/cli/test_doctor_check_models.py::TestCheckModels::test_gateway_enabled_terms_not_accepted": 0.0159,"tests/unit/pipelex/cli/test_doctor_check_models.py::TestCheckModels::test_global_pins_both_documents_as_base_plus_override": 0.0026,"tests/unit/pipelex/cli/test_doctor_check_models.py::TestCheckModels::test_model_deck_validation_error": 0.0012,"tests/unit/pipelex/cli/test_doctor_cmd.py::TestDoctorLayeredResolution::test_backend_credentials_falls_back_to_global": 0.0978,@@ -2568,7 +2523,6 @@"tests/unit/pipelex/cli/test_doctor_pending_migrations.py::TestWhatTheRowReports::test_a_stale_file_is_pending_and_the_row_names_it": 0.0195,"tests/unit/pipelex/cli/test_doctor_pending_migrations.py::TestWhatTheRowReports::test_an_unexpected_bug_still_surfaces_as_itself": 0.0023,"tests/unit/pipelex/cli/test_doctor_pending_migrations.py::TestWhatTheRowReports::test_the_row_is_a_dry_run_and_leaves_the_files_exactly_as_it_found_them": 0.0185,- "tests/unit/pipelex/cli/test_error_handlers.py::TestErrorHandlers::test_handle_inference_setup_required_error_exits": 0.1505,"tests/unit/pipelex/cli/test_error_handlers.py::TestErrorHandlers::test_handle_model_availability_error_exits_and_calls_to_error_report": 0.0017,"tests/unit/pipelex/cli/test_error_handlers.py::TestErrorHandlers::test_handle_model_choice_error_exits_and_calls_to_error_report": 0.8343,"tests/unit/pipelex/cli/test_error_handlers.py::TestErrorHandlers::test_handle_model_deck_preset_error_exits_and_calls_to_error_report": 0.0052,@@ -2576,11 +2530,6 @@"tests/unit/pipelex/cli/test_error_handlers_more.py::TestErrorHandlersExtended::test_display_error_panel_full_layout": 0.8571,"tests/unit/pipelex/cli/test_error_handlers_more.py::TestErrorHandlersExtended::test_display_error_panel_multi_line_tip": 0.0021,"tests/unit/pipelex/cli/test_error_handlers_more.py::TestErrorHandlersExtended::test_display_error_panel_omits_error_block_when_none": 0.0008,- "tests/unit/pipelex/cli/test_error_handlers_more.py::TestErrorHandlersExtended::test_handle_gateway_api_key_missing_error": 0.0051,- "tests/unit/pipelex/cli/test_error_handlers_more.py::TestErrorHandlersExtended::test_handle_gateway_do_not_track_conflict_error": 0.0031,- "tests/unit/pipelex/cli/test_error_handlers_more.py::TestErrorHandlersExtended::test_handle_gateway_terms_not_accepted_error": 0.0044,- "tests/unit/pipelex/cli/test_error_handlers_more.py::TestErrorHandlersExtended::test_handle_gateway_unknown_model_error_branches_on_source[cached-cache may be stale]": 0.0045,- "tests/unit/pipelex/cli/test_error_handlers_more.py::TestErrorHandlersExtended::test_handle_gateway_unknown_model_error_branches_on_source[fresh-Check the model handle for typos]": 0.0043,"tests/unit/pipelex/cli/test_error_handlers_more.py::TestErrorHandlersExtended::test_handle_model_deck_preset_error_builds_solutions_tip": 0.0044,"tests/unit/pipelex/cli/test_error_handlers_more.py::TestErrorHandlersExtended::test_handle_model_deck_preset_error_uses_user_action_detail": 0.0043,"tests/unit/pipelex/cli/test_error_handlers_more.py::TestErrorHandlersExtended::test_handle_remote_config_unavailable_error": 0.0038,@@ -2656,11 +2605,6 @@"tests/unit/pipelex/cli/test_init_credentials.py::TestInitCredentials::test_write_env_file_sets_permissions": 0.0022,"tests/unit/pipelex/cli/test_init_credentials.py::TestInitCredentials::test_write_then_read_roundtrip": 0.0022,"tests/unit/pipelex/cli/test_init_credentials.py::TestInitCredentials::testget_required_vars_for_enabled_backends": 0.0024,- "tests/unit/pipelex/cli/test_init_gateway_terms_overrides.py::TestCheckGatewayTermsIfNeeded::test_a_gateway_disabled_in_the_merged_document_is_not_prompted": 0.0689,- "tests/unit/pipelex/cli/test_init_gateway_terms_overrides.py::TestCheckGatewayTermsIfNeeded::test_a_gateway_enabled_only_by_an_override_is_prompted_for_terms_and_warned_on_decline": 0.0051,- "tests/unit/pipelex/cli/test_init_gateway_terms_overrides.py::TestWarnIfManagedGatewayPinnedByOverride::test_it_asks_the_broad_question_so_a_manifold_pinned_on_is_named_too": 0.6002,- "tests/unit/pipelex/cli/test_init_gateway_terms_overrides.py::TestWarnIfManagedGatewayPinnedByOverride::test_names_the_override_that_still_enables_the_gateway": 0.0423,- "tests/unit/pipelex/cli/test_init_gateway_terms_overrides.py::TestWarnIfManagedGatewayPinnedByOverride::test_says_nothing_when_the_base_is_the_whole_story": 0.4329,"tests/unit/pipelex/cli/test_inputs_path_resolver.py::TestInputsPathResolver::test_is_relative_local_path[/home/user/data/invoice.pdf-False]": 0.001,"tests/unit/pipelex/cli/test_inputs_path_resolver.py::TestInputsPathResolver::test_is_relative_local_path[data/invoice.pdf-True]": 0.7919,"tests/unit/pipelex/cli/test_inputs_path_resolver.py::TestInputsPathResolver::test_is_relative_local_path[data:application/pdf;base64,AAAA-False]": 0.0006,@@ -3812,8 +3756,6 @@"tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_factory.py::TestImgGenWorkerFactory::test_missing_dependency_raises[google]": 0.0031,"tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_factory.py::TestImgGenWorkerFactory::test_missing_dependency_raises[huggingface_img_gen]": 0.0025,"tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_factory.py::TestImgGenWorkerFactory::test_routing_builds_expected_worker[blackboxai_img_gen]": 0.0019,- "tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_factory.py::TestImgGenWorkerFactory::test_routing_builds_expected_worker[gateway_completions]": 0.0035,- "tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_factory.py::TestImgGenWorkerFactory::test_routing_builds_expected_worker[gateway_img_gen]": 0.7811,"tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_factory.py::TestImgGenWorkerFactory::test_routing_builds_expected_worker[google]": 0.0033,"tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_factory.py::TestImgGenWorkerFactory::test_routing_builds_expected_worker[openai_img_gen]": 0.0027,"tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_factory.py::TestImgGenWorkerFactory::test_routing_builds_expected_worker[openrouter_img_gen]": 0.0022,@@ -3856,7 +3798,6 @@"tests/unit/pipelex/cogt/inference/test_classify_inference_error.py::TestClassifyInferenceError::test_plain_429_is_transient_for_every_provider[azure]": 0.0006,"tests/unit/pipelex/cogt/inference/test_classify_inference_error.py::TestClassifyInferenceError::test_plain_429_is_transient_for_every_provider[bedrock]": 0.0008,"tests/unit/pipelex/cogt/inference/test_classify_inference_error.py::TestClassifyInferenceError::test_plain_429_is_transient_for_every_provider[fal]": 0.0015,- "tests/unit/pipelex/cogt/inference/test_classify_inference_error.py::TestClassifyInferenceError::test_plain_429_is_transient_for_every_provider[gateway]": 0.0006,"tests/unit/pipelex/cogt/inference/test_classify_inference_error.py::TestClassifyInferenceError::test_plain_429_is_transient_for_every_provider[google]": 0.001,"tests/unit/pipelex/cogt/inference/test_classify_inference_error.py::TestClassifyInferenceError::test_plain_429_is_transient_for_every_provider[huggingface]": 0.0804,"tests/unit/pipelex/cogt/inference/test_classify_inference_error.py::TestClassifyInferenceError::test_plain_429_is_transient_for_every_provider[mistral]": 0.0004,@@ -3870,131 +3811,27 @@"tests/unit/pipelex/cogt/inference/test_error_classification_unwrap.py::TestExtractUnderlyingSdkException::test_returns_none_when_both_paths_empty": 0.0005,"tests/unit/pipelex/cogt/inference/test_error_classification_unwrap.py::TestExtractUnderlyingSdkException::test_returns_the_last_attempt_of_a_spent_retry_budget": 0.3906,"tests/unit/pipelex/cogt/inference/test_error_classification_unwrap.py::TestExtractUnderlyingSdkException::test_returns_the_sdk_exception_the_wrapper_is_chained_from": 0.0819,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestClassification::test_a_413_without_the_code_is_left_to_the_status_ladder": 0.0011,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestClassification::test_each_limit_classifies_as_a_caller_error[pig-07-413-body_too_large-content-change_input]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestClassification::test_each_limit_classifies_as_a_caller_error[pig-08-411-body_length_required-configuration-contact_support]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestClassification::test_each_limit_classifies_as_a_caller_error[pig-10-413-object_too_large-content-change_input]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestClassification::test_each_limit_classifies_as_a_caller_error[pig-11-400-body_too_deep-content-change_input]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestClassification::test_the_411_would_otherwise_read_as_a_configuration_error_with_input_advice": 0.0026,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestRenderedAdvice::test_the_detail_names_the_limit[pig-07-413-too large]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestRenderedAdvice::test_the_detail_names_the_limit[pig-08-411-Content-Length]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestRenderedAdvice::test_the_detail_names_the_limit[pig-10-413-per-file size limit]": 0.0029,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestRenderedAdvice::test_the_detail_names_the_limit[pig-11-400-deeply]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestRenderedAdvice::test_the_two_size_limits_are_told_apart": 0.0564,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_request_limit[None]": 0.001,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_request_limit[PIG-07]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_request_limit[]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_request_limit[invalid_request_error]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_request_limit[pig-01]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_request_limit[pig-09]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_each_limit_code_maps_to_its_kind[pig-07-body_too_large]": 0.4391,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_each_limit_code_maps_to_its_kind[pig-08-body_length_required]": 0.0013,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_each_limit_code_maps_to_its_kind[pig-10-object_too_large]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_each_limit_code_maps_to_its_kind[pig-11-body_too_deep]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[anthropic]": 0.001,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[azure]": 0.0002,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[bedrock]": 0.0002,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[docling]": 0.5101,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[fal]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[gateway]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[google]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[huggingface]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[linkup]": 0.0517,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[mistral]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[openai]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[pypdfium2]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeSurvivesEveryExtractHop::test_the_length_rule_arrives_on_the_substrate_too": 0.0086,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeSurvivesEveryExtractHop::test_the_portkey_substrate_discards_the_payload_and_the_code_survives_anyway": 0.0083,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeSurvivesEveryExtractHop::test_through_plain_httpx_on_the_native_routes": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeSurvivesEveryExtractHop::test_through_the_openai_substrate_that_carries_every_chat_call[body0-body_too_large]": 0.0053,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeSurvivesEveryExtractHop::test_through_the_openai_substrate_that_carries_every_chat_call[body1-body_too_deep]": 0.0044,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeSurvivesEveryExtractHop::test_through_the_portkey_substrate": 0.0265,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheCodeSurvivesEveryExtractHop::test_through_the_shared_anthropic_driver": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheSameLimitOnTheNativeRoutes::test_a_file_over_its_cap_classifies_as_too_large[pipelex_document_too_large]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheSameLimitOnTheNativeRoutes::test_a_file_over_its_cap_classifies_as_too_large[pipelex_storage_object_too_large]": 3.3873,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheSameLimitOnTheNativeRoutes::test_both_routes_give_the_caller_the_same_advice": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheSameLimitOnTheNativeRoutes::test_the_generic_type_does_not_shadow_the_contract_code": 0.0726,- "tests/unit/pipelex/cogt/inference/test_gateway_request_limits.py::TestTheSameLimitOnTheNativeRoutes::test_the_native_envelope_survives_the_portkey_substrate_too": 0.0093,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_a_412_without_a_recognized_code_still_takes_the_status_ladder": 0.0016,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_a_disabled_integration_is_an_operators_problem": 0.0007,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_a_model_not_allowed_refusal_asks_for_another_model_and_is_not_a_missing_model": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_a_plain_400_without_a_recognized_code_still_takes_the_status_ladder": 0.0003,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_a_refusal_the_caller_can_route_around_asks_them_to_change_the_model[model_not_allowed_error]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_a_refusal_the_caller_can_route_around_asks_them_to_change_the_model[pig-01]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_a_refusal_the_caller_can_route_around_asks_them_to_change_the_model[pig-05]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_a_refusal_the_caller_can_route_around_asks_them_to_change_the_model[pig-06]": 0.0004,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[model_not_allowed_error-model_not_allowed]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pig-01-unknown_model]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pig-02-disabled_integration]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pig-05-wrong_protocol]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pig-06-unserved_capability]": 0.0011,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_only_the_unknown_model_is_a_missing_model[model_not_allowed_error]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_only_the_unknown_model_is_a_missing_model[pig-01]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_only_the_unknown_model_is_a_missing_model[pig-02]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_only_the_unknown_model_is_a_missing_model[pig-05]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestClassification::test_only_the_unknown_model_is_a_missing_model[pig-06]": 0.0006,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestEndToEnd::test_a_model_not_allowed_refusal_reaches_the_caller_as_a_change_model_naming_the_handle": 0.0061,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestEndToEnd::test_a_wrong_protocol_refusal_does_not_claim_the_model_was_not_found": 0.0112,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestEndToEnd::test_an_unserved_model_reaches_the_caller_as_a_model_not_found_carrying_the_handle": 0.0095,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_an_unserved_capability_reaching_an_extract_reads_the_same": 0.001,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_every_other_member_leaves_the_handle_to_the_message[pig-01]": 0.2984,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_every_other_member_leaves_the_handle_to_the_message[pig-02]": 0.0004,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_every_other_member_leaves_the_handle_to_the_message[pig-05]": 0.0004,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_every_other_member_leaves_the_handle_to_the_message[pig-06]": 0.0004,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_no_member_renders_the_generic_action_kind_advice_either[model_not_allowed_error]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_no_member_renders_the_generic_action_kind_advice_either[pig-01]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_no_member_renders_the_generic_action_kind_advice_either[pig-02]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_no_member_renders_the_generic_action_kind_advice_either[pig-05]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_no_member_renders_the_generic_action_kind_advice_either[pig-06]": 0.0002,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[model_not_allowed_error]": 0.0018,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pig-01]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pig-02]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pig-05]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pig-06]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_the_deck_disagreement_refusals_name_the_deck": 0.0021,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_the_detail_names_the_remedy[model_not_allowed_error-does not allow the model]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_the_detail_names_the_remedy[pig-01-does not serve that model]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_the_detail_names_the_remedy[pig-02-has not enabled]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_the_detail_names_the_remedy[pig-05-not over the protocol]": 0.0011,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_the_detail_names_the_remedy[pig-06-does not serve that capability]": 0.0011,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_the_disabled_integration_blames_neither_the_prompt_nor_the_callers_key": 0.0008,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_the_model_not_allowed_advice_names_the_handle_and_not_the_wire_id": 0.0003,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_the_model_not_allowed_advice_offers_the_default_only_when_the_pipe_named_the_model": 0.0006,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_the_model_not_allowed_advice_says_who_settles_a_deck_disagreement_on_either_gateway": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestRenderedAdvice::test_the_unserved_model_and_the_wrong_protocol_are_told_apart": 0.0004,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheAdviceSurvivesThePipeBoundary::test_the_model_not_allowed_advice_reaches_the_caller_through_the_located_failure": 0.0049,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheAdviceSurvivesThePipeBoundary::test_the_unknown_model_advice_reaches_the_caller_through_the_pipe_error": 0.0473,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_routing_refusal[MODEL_NOT_ALLOWED_ERROR]": 0.0002,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_routing_refusal[None]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_routing_refusal[PIG-01]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_routing_refusal[]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_routing_refusal[invalid_request_error]": 0.0004,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_routing_refusal[model_not_allowed]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_routing_refusal[model_not_found]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_routing_refusal[pig-07]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_routing_refusal[pig-09]": 0.0012,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_routing_refusal[pig-11]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_any_other_code_is_not_a_routing_refusal[pipelex_storage_unreadable]": 0.0007,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[model_not_allowed_error-model_not_allowed]": 0.0829,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pig-01-unknown_model]": 0.4584,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pig-02-disabled_integration]": 0.0011,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pig-05-wrong_protocol]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pig-06-unserved_capability]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_every_member_is_reachable_from_a_wire_code[disabled_integration]": 0.0011,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_every_member_is_reachable_from_a_wire_code[model_not_allowed]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_every_member_is_reachable_from_a_wire_code[unknown_model]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_every_member_is_reachable_from_a_wire_code[unserved_capability]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_every_member_is_reachable_from_a_wire_code[wrong_protocol]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[anthropic]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[azure]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[bedrock]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[docling]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[fal]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[gateway]": 0.001,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[google]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[huggingface]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[linkup]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[mistral]": 0.0007,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[model_not_allowed_error-model_not_allowed-anthropic]": 0.0008,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[model_not_allowed_error-model_not_allowed-azure]": 0.0012,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[model_not_allowed_error-model_not_allowed-bedrock]": 0.0004,@@ -4007,7 +3844,6 @@"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[model_not_allowed_error-model_not_allowed-mistral]": 0.0005,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[model_not_allowed_error-model_not_allowed-openai]": 0.0004,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[model_not_allowed_error-model_not_allowed-pypdfium2]": 0.0039,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[openai]": 0.0003,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[pig-01-unknown_model-anthropic]": 0.0004,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[pig-01-unknown_model-azure]": 0.0004,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[pig-01-unknown_model-bedrock]": 0.0004,@@ -4020,177 +3856,18 @@"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[pig-01-unknown_model-mistral]": 0.0004,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[pig-01-unknown_model-openai]": 0.0007,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[pig-01-unknown_model-pypdfium2]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[pypdfium2]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeIsRecognized::test_the_table_covers_the_whole_production_map": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeSurvivesEveryExtractHop::test_the_google_hop_would_not_carry_a_gateway_code_and_nothing_reaches_it_today": 0.0004,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeSurvivesEveryExtractHop::test_the_model_not_allowed_refusal_through_every_hop[anthropic-driver]": 0.0178,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeSurvivesEveryExtractHop::test_the_model_not_allowed_refusal_through_every_hop[native-routes-httpx]": 0.0006,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeSurvivesEveryExtractHop::test_the_model_not_allowed_refusal_through_every_hop[openai-substrate]": 0.3114,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeSurvivesEveryExtractHop::test_the_model_not_allowed_refusal_through_every_hop[portkey-substrate]": 0.0529,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeSurvivesEveryExtractHop::test_the_portkey_substrate_discards_the_payload_and_the_code_survives_anyway": 0.0081,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeSurvivesEveryExtractHop::test_through_plain_httpx_on_the_native_routes": 3.4459,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeSurvivesEveryExtractHop::test_through_the_openai_substrate_that_carries_every_chat_call[pig-01-unknown_model]": 0.0054,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeSurvivesEveryExtractHop::test_through_the_openai_substrate_that_carries_every_chat_call[pig-02-disabled_integration]": 0.0099,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeSurvivesEveryExtractHop::test_through_the_openai_substrate_that_carries_every_chat_call[pig-05-wrong_protocol]": 0.0083,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeSurvivesEveryExtractHop::test_through_the_openai_substrate_that_carries_every_chat_call[pig-06-unserved_capability]": 0.0663,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeSurvivesEveryExtractHop::test_through_the_portkey_substrate": 0.013,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheCodeSurvivesEveryExtractHop::test_through_the_shared_anthropic_driver": 0.0012,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheScopeDecisionIsPinned::test_the_unmapped_routing_codes_are_not_routing_refusals[pig-03-400]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheScopeDecisionIsPinned::test_the_unmapped_routing_codes_are_not_routing_refusals[pig-04-404]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheScopeDecisionIsPinned::test_the_unmapped_routing_codes_belong_to_no_gateway_family_at_all": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_no_other_familys_code_is_a_routing_refusal[pig-07]": 3.4507,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_no_other_familys_code_is_a_routing_refusal[pig-08]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_no_other_familys_code_is_a_routing_refusal[pig-09]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_no_other_familys_code_is_a_routing_refusal[pig-10]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_no_other_familys_code_is_a_routing_refusal[pig-11]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_no_other_familys_code_is_a_routing_refusal[pipelex_document_host_refused]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_no_other_familys_code_is_a_routing_refusal[pipelex_document_too_large]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_no_other_familys_code_is_a_routing_refusal[pipelex_storage_object_too_large]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_no_other_familys_code_is_a_routing_refusal[pipelex_storage_unreadable]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_no_other_familys_code_is_a_routing_refusal[pipelex_storage_uri_invalid]": 0.0011,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_no_routing_code_belongs_to_another_family[model_not_allowed_error]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_no_routing_code_belongs_to_another_family[pig-01]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_no_routing_code_belongs_to_another_family[pig-02]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_no_routing_code_belongs_to_another_family[pig-05]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_no_routing_code_belongs_to_another_family[pig-06]": 0.0684,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestTheThreeGatewayFamiliesDoNotShadowEachOther::test_the_three_maps_are_disjoint_as_sets": 0.0002,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestWhatTheFamilyAnswersOverHTTP::test_an_unrecognized_400_still_answers_422": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestWhatTheFamilyAnswersOverHTTP::test_every_member_answers_500_rather_than_the_422_it_used_to[pig-01]": 0.001,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestWhatTheFamilyAnswersOverHTTP::test_every_member_answers_500_rather_than_the_422_it_used_to[pig-02]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestWhatTheFamilyAnswersOverHTTP::test_every_member_answers_500_rather_than_the_422_it_used_to[pig-05]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestWhatTheFamilyAnswersOverHTTP::test_every_member_answers_500_rather_than_the_422_it_used_to[pig-06]": 0.0009,"tests/unit/pipelex/cogt/inference/test_gateway_routing_refusals.py::TestWhatTheFamilyAnswersOverHTTP::test_the_model_not_allowed_refusal_answers_500_as_it_did_before": 0.0012,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_a_deployment_that_serves_no_storage_is_an_operators_problem": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_a_plain_400_without_a_recognized_code_still_takes_the_status_ladder": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_a_reference_the_caller_can_repair_asks_them_to_change_the_input[pig-09]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_a_reference_the_caller_can_repair_asks_them_to_change_the_input[pipelex_document_address_refused]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_a_reference_the_caller_can_repair_asks_them_to_change_the_input[pipelex_document_bad_data_url]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_a_reference_the_caller_can_repair_asks_them_to_change_the_input[pipelex_document_empty]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_a_reference_the_caller_can_repair_asks_them_to_change_the_input[pipelex_document_host_refused]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_a_reference_the_caller_can_repair_asks_them_to_change_the_input[pipelex_document_redirect_refused]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_a_reference_the_caller_can_repair_asks_them_to_change_the_input[pipelex_document_scheme_refused]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_a_reference_the_caller_can_repair_asks_them_to_change_the_input[pipelex_document_unreachable]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_a_reference_the_caller_can_repair_asks_them_to_change_the_input[pipelex_document_unsupported_type]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_a_reference_the_caller_can_repair_asks_them_to_change_the_input[pipelex_storage_unreadable]": 3.396,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_a_reference_the_caller_can_repair_asks_them_to_change_the_input[pipelex_storage_uri_invalid]": 0.0415,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_a_reference_the_caller_can_repair_asks_them_to_change_the_input[pipelex_unsupported_uri_scheme]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pig-09-reference_unresolved]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pipelex_document_address_refused-document_url_refused]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pipelex_document_bad_data_url-document_content_unusable]": 0.0015,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pipelex_document_empty-document_content_unusable]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pipelex_document_host_refused-document_host_refused]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pipelex_document_redirect_refused-document_url_refused]": 0.0011,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pipelex_document_scheme_refused-document_url_refused]": 0.0082,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pipelex_document_unreachable-document_unreachable]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pipelex_document_unsupported_type-document_content_unusable]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pipelex_storage_unreadable-storage_object_unreadable]": 0.0053,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pipelex_storage_uri_invalid-storage_reference_invalid]": 0.0061,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pipelex_storage_uri_unsupported-storage_not_served]": 0.0014,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestClassification::test_each_code_classifies_as_its_member_and_is_never_retried[pipelex_unsupported_uri_scheme-document_url_refused]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_a_host_refusal_reaching_an_extract_reads_the_same": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pig-09]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pipelex_document_address_refused]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pipelex_document_bad_data_url]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pipelex_document_empty]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pipelex_document_host_refused]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pipelex_document_redirect_refused]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pipelex_document_scheme_refused]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pipelex_document_unreachable]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pipelex_document_unsupported_type]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pipelex_storage_unreadable]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pipelex_storage_uri_invalid]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pipelex_storage_uri_unsupported]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_no_member_renders_the_generic_rejection_line[pipelex_unsupported_uri_scheme]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_the_detail_names_the_remedy[pig-09-could not be resolved]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_the_detail_names_the_remedy[pipelex_document_empty-fetched but cannot be used]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_the_detail_names_the_remedy[pipelex_document_host_refused-security policy]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_the_detail_names_the_remedy[pipelex_document_scheme_refused-https:// URL]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_the_detail_names_the_remedy[pipelex_document_unreachable-publicly reachable]": 0.001,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_the_detail_names_the_remedy[pipelex_storage_unreadable-does not exist or cannot be read]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_the_detail_names_the_remedy[pipelex_storage_uri_invalid-malformed]": 0.0012,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_the_detail_names_the_remedy[pipelex_storage_uri_unsupported-contact support]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_the_detail_names_the_remedy[pipelex_unsupported_uri_scheme-pipelex-storage:// reference]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_the_host_refusal_is_stated_as_a_security_policy": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_the_two_storage_reference_failures_are_told_apart": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_the_unserved_scheme_does_not_ask_the_caller_to_fix_their_input": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestRenderedAdvice::test_the_url_shape_refusals_share_one_remedy": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_any_other_code_is_not_an_unresolved_reference[None]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_any_other_code_is_not_an_unresolved_reference[PIG-09]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_any_other_code_is_not_an_unresolved_reference[]": 0.0014,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_any_other_code_is_not_an_unresolved_reference[invalid_request_error]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_any_other_code_is_not_an_unresolved_reference[pig-01]": 0.0445,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_any_other_code_is_not_an_unresolved_reference[pig-07]": 3.4602,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_any_other_code_is_not_an_unresolved_reference[pig-10]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_any_other_code_is_not_an_unresolved_reference[pipelex_storage_object_too_large]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pig-09-reference_unresolved]": 0.4955,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pipelex_document_address_refused-document_url_refused]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pipelex_document_bad_data_url-document_content_unusable]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pipelex_document_empty-document_content_unusable]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pipelex_document_host_refused-document_host_refused]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pipelex_document_redirect_refused-document_url_refused]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pipelex_document_scheme_refused-document_url_refused]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pipelex_document_unreachable-document_unreachable]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pipelex_document_unsupported_type-document_content_unusable]": 0.0011,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pipelex_storage_unreadable-storage_object_unreadable]": 0.0016,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pipelex_storage_uri_invalid-storage_reference_invalid]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pipelex_storage_uri_unsupported-storage_not_served]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_each_code_maps_to_its_member[pipelex_unsupported_uri_scheme-document_url_refused]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_every_member_is_reachable_from_a_wire_code[document_content_unusable]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_every_member_is_reachable_from_a_wire_code[document_host_refused]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_every_member_is_reachable_from_a_wire_code[document_unreachable]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_every_member_is_reachable_from_a_wire_code[document_url_refused]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_every_member_is_reachable_from_a_wire_code[reference_unresolved]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_every_member_is_reachable_from_a_wire_code[storage_not_served]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_every_member_is_reachable_from_a_wire_code[storage_object_unreadable]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_every_member_is_reachable_from_a_wire_code[storage_reference_invalid]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[anthropic]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[azure]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[bedrock]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[docling]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[fal]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[gateway]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[google]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[huggingface]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[linkup]": 0.001,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[mistral]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[openai]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_the_code_is_read_whichever_provider_reported_it[pypdfium2]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeIsRecognized::test_the_table_covers_the_whole_production_map": 0.0002,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeSurvivesEveryExtractHop::test_the_native_envelope_survives_the_portkey_substrate_too": 0.0101,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeSurvivesEveryExtractHop::test_the_portkey_substrate_discards_the_payload_and_the_code_survives_anyway": 0.0131,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeSurvivesEveryExtractHop::test_through_plain_httpx_on_the_native_routes[pipelex_document_unsupported_type-document_content_unusable]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeSurvivesEveryExtractHop::test_through_plain_httpx_on_the_native_routes[pipelex_storage_unreadable-storage_object_unreadable]": 0.0011,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeSurvivesEveryExtractHop::test_through_plain_httpx_on_the_native_routes[pipelex_storage_uri_invalid-storage_reference_invalid]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeSurvivesEveryExtractHop::test_through_the_openai_substrate_that_carries_every_chat_call": 0.0052,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeSurvivesEveryExtractHop::test_through_the_portkey_substrate": 0.0096,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheCodeSurvivesEveryExtractHop::test_through_the_shared_anthropic_driver": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_request_limit_code_is_also_an_unresolved_reference[pig-07]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_request_limit_code_is_also_an_unresolved_reference[pig-08]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_request_limit_code_is_also_an_unresolved_reference[pig-10]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_request_limit_code_is_also_an_unresolved_reference[pig-11]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_request_limit_code_is_also_an_unresolved_reference[pipelex_document_too_large]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_request_limit_code_is_also_an_unresolved_reference[pipelex_storage_object_too_large]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_unresolved_reference_code_is_also_a_request_limit[pig-09]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_unresolved_reference_code_is_also_a_request_limit[pipelex_document_address_refused]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_unresolved_reference_code_is_also_a_request_limit[pipelex_document_bad_data_url]": 0.0007,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_unresolved_reference_code_is_also_a_request_limit[pipelex_document_empty]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_unresolved_reference_code_is_also_a_request_limit[pipelex_document_host_refused]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_unresolved_reference_code_is_also_a_request_limit[pipelex_document_redirect_refused]": 0.0005,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_unresolved_reference_code_is_also_a_request_limit[pipelex_document_scheme_refused]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_unresolved_reference_code_is_also_a_request_limit[pipelex_document_unreachable]": 0.0009,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_unresolved_reference_code_is_also_a_request_limit[pipelex_document_unsupported_type]": 0.0008,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_unresolved_reference_code_is_also_a_request_limit[pipelex_storage_unreadable]": 3.4124,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_unresolved_reference_code_is_also_a_request_limit[pipelex_storage_uri_invalid]": 0.0698,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_unresolved_reference_code_is_also_a_request_limit[pipelex_storage_uri_unsupported]": 0.0004,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_no_unresolved_reference_code_is_also_a_request_limit[pipelex_unsupported_uri_scheme]": 0.0006,- "tests/unit/pipelex/cogt/inference/test_gateway_unresolved_references.py::TestTheTwoGatewayFamiliesDoNotShadowEachOther::test_the_storage_codes_are_split_between_the_two_families_on_the_same_route": 0.0559,"tests/unit/pipelex/cogt/inference/test_provider_classification_parity.py::TestProviderClassificationParity::test_every_provider_name_has_an_extract_fn": 0.8455,"tests/unit/pipelex/cogt/inference/test_provider_classification_parity.py::TestProviderClassificationParity::test_extract_fn_populates_envelope_for_each_provider[anthropic]": 0.002,"tests/unit/pipelex/cogt/inference/test_provider_classification_parity.py::TestProviderClassificationParity::test_extract_fn_populates_envelope_for_each_provider[azure]": 0.0005,"tests/unit/pipelex/cogt/inference/test_provider_classification_parity.py::TestProviderClassificationParity::test_extract_fn_populates_envelope_for_each_provider[bedrock]": 0.0004,"tests/unit/pipelex/cogt/inference/test_provider_classification_parity.py::TestProviderClassificationParity::test_extract_fn_populates_envelope_for_each_provider[docling]": 0.0011,"tests/unit/pipelex/cogt/inference/test_provider_classification_parity.py::TestProviderClassificationParity::test_extract_fn_populates_envelope_for_each_provider[fal]": 0.0003,- "tests/unit/pipelex/cogt/inference/test_provider_classification_parity.py::TestProviderClassificationParity::test_extract_fn_populates_envelope_for_each_provider[gateway]": 0.0007,"tests/unit/pipelex/cogt/inference/test_provider_classification_parity.py::TestProviderClassificationParity::test_extract_fn_populates_envelope_for_each_provider[google]": 0.0006,"tests/unit/pipelex/cogt/inference/test_provider_classification_parity.py::TestProviderClassificationParity::test_extract_fn_populates_envelope_for_each_provider[huggingface]": 0.0004,"tests/unit/pipelex/cogt/inference/test_provider_classification_parity.py::TestProviderClassificationParity::test_extract_fn_populates_envelope_for_each_provider[linkup]": 0.0006,@@ -4216,7 +3893,6 @@"tests/unit/pipelex/cogt/inference/test_provider_error_metadata.py::TestProviderErrorMetadata::test_is_quota_exhaustion_dispatches_on_provider[bedrock_plain_validation_not_quota-bedrock-Validation failed for input-400-ValidationException-False]": 0.001,"tests/unit/pipelex/cogt/inference/test_provider_error_metadata.py::TestProviderErrorMetadata::test_is_quota_exhaustion_dispatches_on_provider[bedrock_quota_by_aws_code_no_message_hint-bedrock-An error occurred-400-ServiceQuotaExceededException-True]": 0.0011,"tests/unit/pipelex/cogt/inference/test_provider_error_metadata.py::TestProviderErrorMetadata::test_is_quota_exhaustion_dispatches_on_provider[bedrock_quota_message_keyword-bedrock-Service quota exceeded for this model-400-None-True]": 0.0012,- "tests/unit/pipelex/cogt/inference/test_provider_error_metadata.py::TestProviderErrorMetadata::test_is_quota_exhaustion_dispatches_on_provider[gateway_402_is_quota-gateway-payment required-402-None-True]": 0.001,"tests/unit/pipelex/cogt/inference/test_provider_error_metadata.py::TestProviderErrorMetadata::test_is_quota_exhaustion_dispatches_on_provider[mistral_402_is_quota-mistral-payment required-402-None-True]": 0.0012,"tests/unit/pipelex/cogt/inference/test_provider_error_metadata.py::TestProviderErrorMetadata::test_is_quota_exhaustion_dispatches_on_provider[mistral_429_plain_rate_limit-mistral-too many requests-429-None-False]": 0.001,"tests/unit/pipelex/cogt/inference/test_provider_error_metadata.py::TestProviderErrorMetadata::test_is_quota_exhaustion_dispatches_on_provider[mistral_429_quota_pattern-mistral-quota exceeded-429-None-True]": 0.0013,@@ -4340,8 +4016,6 @@"tests/unit/pipelex/cogt/llm/test_llm_worker_factory.py::TestLLMWorkerFactory::test_routing_builds_expected_worker[bedrock_aioboto]": 0.0028,"tests/unit/pipelex/cogt/llm/test_llm_worker_factory.py::TestLLMWorkerFactory::test_routing_builds_expected_worker[bedrock_anthropic]": 0.0037,"tests/unit/pipelex/cogt/llm/test_llm_worker_factory.py::TestLLMWorkerFactory::test_routing_builds_expected_worker[bedrock_boto3]": 0.0044,- "tests/unit/pipelex/cogt/llm/test_llm_worker_factory.py::TestLLMWorkerFactory::test_routing_builds_expected_worker[gateway_completions]": 1.3915,- "tests/unit/pipelex/cogt/llm/test_llm_worker_factory.py::TestLLMWorkerFactory::test_routing_builds_expected_worker[gateway_responses]": 0.0027,"tests/unit/pipelex/cogt/llm/test_llm_worker_factory.py::TestLLMWorkerFactory::test_routing_builds_expected_worker[google]": 0.004,"tests/unit/pipelex/cogt/llm/test_llm_worker_factory.py::TestLLMWorkerFactory::test_routing_builds_expected_worker[mistral]": 0.0037,"tests/unit/pipelex/cogt/llm/test_llm_worker_factory.py::TestLLMWorkerFactory::test_routing_builds_expected_worker[openai]": 0.0017,@@ -4419,7 +4093,6 @@"tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_key_the_user_chose_to_have_is_still_fatal[True]": 0.1436,"tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_stale_directory_loads_the_same_models_the_current_files_would[False]": 0.5998,"tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_stale_directory_loads_the_same_models_the_current_files_would[True]": 0.2879,- "tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_a_stale_gateway_override_never_reaches_the_loader_at_all": 0.1805,"tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_it_parks_one_warning_naming_every_stale_file_and_the_remedy[False]": 0.5379,"tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_it_parks_one_warning_naming_every_stale_file_and_the_remedy[True]": 0.2515,"tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py::TestAStaleBackendDirectory::test_nothing_is_written_to_disk": 0.6424,@@ -4467,23 +4140,9 @@"tests/unit/pipelex/cogt/model_backends/test_backend_library_overrides.py::TestBackendLibraryOverrides::test_the_last_override_wins": 0.035,"tests/unit/pipelex/cogt/model_backends/test_backend_toml_path.py::TestBackendTomlPath::test_an_absolute_backend_name_stays_under_the_backends_directory": 0.1031,"tests/unit/pipelex/cogt/model_backends/test_backend_toml_path.py::TestBackendTomlPath::test_an_ordinary_backend_name_lands_beside_its_siblings": 0.7344,- "tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_defaults.py::TestGatewayUnknownDefaults::test_known_defaults_are_left_alone": 0.0003,- "tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_defaults.py::TestGatewayUnknownDefaults::test_per_model_unknown_keys_are_untouched": 0.0878,- "tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_defaults.py::TestGatewayUnknownDefaults::test_pruning_does_not_need_the_log_hub": 0.0006,"tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_defaults.py::TestGatewayUnknownDefaults::test_pruning_emits_no_record": 0.0653,- "tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_defaults.py::TestGatewayUnknownDefaults::test_the_spec_still_validates_after_pruning": 0.0005,- "tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_defaults.py::TestGatewayUnknownDefaults::test_unknown_default_key_is_dropped": 0.837,- "tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_per_model_keys.py::TestGatewayUnknownPerModelKeys::test_a_declared_field_that_used_to_ride_in_the_bag_lands_in_the_field": 0.003,- "tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_per_model_keys.py::TestGatewayUnknownPerModelKeys::test_a_header_shaped_key_becomes_a_request_header": 0.7058,- "tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_per_model_keys.py::TestGatewayUnknownPerModelKeys::test_a_header_shaped_key_the_wire_cannot_carry_is_pruned_and_the_boot_survives": 0.0017,- "tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_per_model_keys.py::TestGatewayUnknownPerModelKeys::test_a_header_shaped_key_with_a_non_string_value_is_pruned_and_the_boot_survives": 0.0026,- "tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_per_model_keys.py::TestGatewayUnknownPerModelKeys::test_a_header_value_the_wire_cannot_carry_is_pruned_and_the_boot_survives": 0.0035,- "tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_per_model_keys.py::TestGatewayUnknownPerModelKeys::test_a_non_header_key_is_pruned_and_the_boot_survives": 0.0022,- "tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_per_model_keys.py::TestGatewayUnknownPerModelKeys::test_pruning_a_per_model_key_does_not_need_the_log_hub": 0.1218,- "tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_per_model_keys.py::TestGatewayUnknownPerModelKeys::test_the_accepted_header_reaches_the_wire": 0.0058,"tests/unit/pipelex/cogt/model_backends/test_managed_backend_missing_variable.py::TestAManagedBackendMissingItsVariables::test_a_byok_backend_missing_its_variables_still_stops_the_boot": 0.001,"tests/unit/pipelex/cogt/model_backends/test_managed_backend_missing_variable.py::TestAManagedBackendMissingItsVariables::test_it_is_disabled_with_a_warning_naming_the_backend_and_the_variable": 0.5832,- "tests/unit/pipelex/cogt/model_backends/test_managed_backend_missing_variable.py::TestAManagedBackendMissingItsVariables::test_the_legacy_gateway_missing_its_key_still_stops_the_boot": 0.0011,"tests/unit/pipelex/cogt/model_backends/test_managed_backend_missing_variable.py::TestAManagedBackendWithNoPublishedSection::test_it_is_disabled_rather_than_refused": 0.0367,"tests/unit/pipelex/cogt/model_backends/test_managed_backend_missing_variable.py::TestAManagedBackendWithNoPublishedSection::test_no_managed_configs_at_all_is_the_callers_error": 0.0519,"tests/unit/pipelex/cogt/model_backends/test_model_lister_dispatch.py::TestModelListerDispatch::test_any_listed_progresses_across_sdks": 0.0039,@@ -4628,19 +4287,8 @@"tests/unit/pipelex/cogt/models/test_deck_manifest.py::TestDeckManifest::test_sync_report_no_manifest_marks_drift_as_locally_modified": 0.0036,"tests/unit/pipelex/cogt/models/test_deck_manifest.py::TestDeckManifest::test_sync_report_no_manifest_treats_matching_files_as_up_to_date": 0.0028,"tests/unit/pipelex/cogt/models/test_deck_manifest.py::TestDeckManifest::test_sync_report_up_to_date": 0.0041,- "tests/unit/pipelex/cogt/models/test_enforce_gateway_model_membership.py::TestAWaterfallSpansBackends::test_a_waterfall_no_backend_can_serve_still_raises": 0.0583,- "tests/unit/pipelex/cogt/models/test_enforce_gateway_model_membership.py::TestAWaterfallSpansBackends::test_a_waterfall_whose_working_fallback_lives_on_another_service_is_not_an_error": 0.0007,"tests/unit/pipelex/cogt/models/test_enforce_gateway_model_membership.py::TestDocumentEnginesAreNotGatewayModels::test_a_doc_gen_default_whose_engine_is_undeclared_does_not_fail_the_boot": 0.0716,- "tests/unit/pipelex/cogt/models/test_enforce_gateway_model_membership.py::TestEnforceGatewayModelMembership::test_a_handle_absent_from_the_other_service_is_not_an_error": 0.0028,- "tests/unit/pipelex/cogt/models/test_enforce_gateway_model_membership.py::TestEnforceGatewayModelMembership::test_a_handle_absent_from_the_service_it_is_routed_to_raises_naming_that_service": 0.0016,- "tests/unit/pipelex/cogt/models/test_enforce_gateway_model_membership.py::TestEnforceGatewayModelMembership::test_a_handle_routed_to_a_byok_backend_is_not_this_checks_business": 0.0027,- "tests/unit/pipelex/cogt/models/test_enforce_gateway_model_membership.py::TestEnforceGatewayModelMembership::test_each_service_carrying_what_it_is_routed_is_silent": 0.4841,- "tests/unit/pipelex/cogt/models/test_enforce_gateway_model_membership.py::TestEnforceGatewayModelMembership::test_no_live_source_skips_the_check_entirely": 0.001,- "tests/unit/pipelex/cogt/models/test_enforce_gateway_model_membership.py::TestEnforceGatewayModelMembership::test_no_managed_config_skips_the_check_entirely[None]": 0.0011,- "tests/unit/pipelex/cogt/models/test_enforce_gateway_model_membership.py::TestEnforceGatewayModelMembership::test_no_managed_config_skips_the_check_entirely[managed_gateway_configs1]": 0.0012,"tests/unit/pipelex/cogt/models/test_inference_config_overrides_end_to_end.py::TestInferenceConfigOverridesEndToEnd::test_a_project_override_wins_over_the_global_one": 0.1637,- "tests/unit/pipelex/cogt/models/test_inference_config_overrides_end_to_end.py::TestInferenceConfigOverridesEndToEnd::test_the_shipped_default_is_the_gateway": 0.664,- "tests/unit/pipelex/cogt/models/test_inference_config_overrides_end_to_end.py::TestInferenceConfigOverridesEndToEnd::test_two_global_override_files_move_the_machine_off_the_gateway_and_deleting_them_moves_it_back": 0.3326,"tests/unit/pipelex/cogt/models/test_model_deck.py::TestModelDeckGetLLMSettingWithPresets::test_get_llm_setting_with_bare_preset_name_fails": 0.124,"tests/unit/pipelex/cogt/models/test_model_deck.py::TestModelDeckGetLLMSettingWithPresets::test_get_llm_setting_with_prefixed_preset": 0.0009,"tests/unit/pipelex/cogt/models/test_model_deck.py::TestModelDeckGetOptionalInferenceModel::test_circular_alias_prevention": 0.1143,@@ -5090,20 +4738,6 @@"tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_aws[limit_exceeded-Token limit exceeded for model-True]": 0.0014,"tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_aws[quota_exceeded-Service quota exceeded for this account-True]": 0.0008,"tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_aws[unrelated_error-Access denied-False]": 0.0009,- "tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_gateway[billing_429-Billing limit exceeded-429-True]": 0.0011,- "tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_gateway[credits_exhausted_429-Credits exhausted on this key-429-True]": 0.0007,- "tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_gateway[generic_rate_limit_429-Rate limit exceeded. Please retry-429-False]": 0.0012,- "tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_gateway[insufficient_access_429_not_quota-Insufficient access privileges-429-False]": 0.0009,- "tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_gateway[insufficient_balance_429-Insufficient balance to complete request-429-True]": 0.0013,- "tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_gateway[insufficient_credits_429-Insufficient credits-429-True]": 0.0006,- "tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_gateway[insufficient_funds_429-Insufficient funds in your account-429-True]": 0.0012,- "tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_gateway[insufficient_permissions_429_not_quota-Insufficient permissions to use this model-429-False]": 0.0007,- "tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_gateway[insufficient_quota_429-insufficient_quota for this account-429-True]": 0.0006,- "tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_gateway[insufficient_role_429_not_quota-Insufficient role for the requested action-429-False]": 0.0012,- "tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_gateway[payment_required_402-Payment required-402-True]": 0.0009,- "tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_gateway[payment_required_402_any_message-random text-402-True]": 0.085,- "tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_gateway[quota_429-Your quota has been exhausted-429-True]": 0.001,- "tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_gateway[server_error_500-Internal server error-500-False]": 0.0007,"tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_google[billing_account_disabled-billing account is disabled for project-True]": 0.0008,"tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_google[billing_account_not_active-Billing account is not active-True]": 0.0009,"tests/unit/pipelex/cogt/test_error_classification.py::TestErrorClassification::test_is_quota_exhaustion_google[billing_api_not_enabled_not_quota-billing API not enabled-False]": 0.0008,@@ -6979,8 +6613,6 @@"tests/unit/pipelex/exceptions/test_class_level_metadata.py::TestClassLevelMetadata::test_error_domain[entry_pipe_not_found-exc4-input]": 0.0007,"tests/unit/pipelex/exceptions/test_class_level_metadata.py::TestClassLevelMetadata::test_error_domain[env_var_not_found-exc10-config]": 0.0009,"tests/unit/pipelex/exceptions/test_class_level_metadata.py::TestClassLevelMetadata::test_error_domain[env_var_not_found-exc13-config]": 0.0005,- "tests/unit/pipelex/exceptions/test_class_level_metadata.py::TestClassLevelMetadata::test_error_domain[gateway_terms-exc12-config]": 0.0004,- "tests/unit/pipelex/exceptions/test_class_level_metadata.py::TestClassLevelMetadata::test_error_domain[gateway_terms-exc9-config]": 0.0009,"tests/unit/pipelex/exceptions/test_class_level_metadata.py::TestClassLevelMetadata::test_error_domain[interpreter-exc3-input]": 0.001,"tests/unit/pipelex/exceptions/test_class_level_metadata.py::TestClassLevelMetadata::test_error_domain[interpreter-exc6-input]": 0.0003,"tests/unit/pipelex/exceptions/test_class_level_metadata.py::TestClassLevelMetadata::test_error_domain[pipe_execution-exc1-runtime]": 0.0008,@@ -8062,7 +7694,6 @@"tests/unit/pipelex/migration/test_migration_run.py::TestTheSchemaVersionFloor::test_a_file_declaring_exactly_the_floor_is_migrated": 0.005,"tests/unit/pipelex/migration/test_migration_run.py::TestTheSchemaVersionFloor::test_a_file_declaring_nothing_is_migrated": 0.0056,"tests/unit/pipelex/migration/test_migration_run.py::TestTheWalkIsNotRecursive::test_a_directory_no_surface_owns_is_never_entered": 0.0024,- "tests/unit/pipelex/migration/test_migration_run.py::TestTheWalkIsNotRecursive::test_the_real_gateway_backend_file_is_claimed_by_its_own_directorys_surface": 0.0032,"tests/unit/pipelex/migration/test_migration_run.py::TestTheWalkIsNotRecursive::test_the_same_file_name_at_the_top_level_is_claimed_by_the_main_configuration": 0.0022,"tests/unit/pipelex/migration/test_migration_run.py::TestWhichDirectoriesAreWalked::test_a_global_directory_that_does_not_exist_is_skipped": 0.0027,"tests/unit/pipelex/migration/test_migration_run.py::TestWhichDirectoriesAreWalked::test_a_machine_with_no_project_directory_is_an_ordinary_machine": 0.0028,@@ -9667,15 +9298,12 @@"tests/unit/pipelex/plugins/test_http_error_mapper_seam.py::TestHttpErrorMapperSeam::test_provider_resolved_lazily_not_at_registration": 0.0003,"tests/unit/pipelex/plugins/test_import_light_boot.py::TestImportLightBoot::test_building_registrar_imports_no_backend_sdk": 1.758,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[extract:docling_sdk]": 0.0006,- "tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[extract:gateway_extract]": 0.001,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[extract:linkup_fetch]": 0.0004,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[extract:mistral]": 0.001,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[extract:pypdfium2]": 0.001,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[img_gen:azure_rest_img_gen]": 0.0008,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[img_gen:blackboxai_img_gen]": 0.0009,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[img_gen:fal]": 0.0008,- "tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[img_gen:gateway_completions]": 0.0009,- "tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[img_gen:gateway_img_gen]": 0.0008,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[img_gen:google]": 0.0009,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[img_gen:huggingface_img_gen]": 0.0004,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[img_gen:openai_img_gen]": 0.0009,@@ -9686,17 +9314,13 @@"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[llm:bedrock_aioboto]": 0.0006,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[llm:bedrock_anthropic]": 0.0005,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[llm:bedrock_boto3]": 0.0018,- "tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[llm:gateway_completions]": 0.0005,- "tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[llm:gateway_responses]": 0.001,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[llm:google]": 0.0009,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[llm:mistral]": 0.0009,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[llm:openai]": 0.8573,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[llm:openai_responses]": 0.0009,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[llm:portkey_completions]": 0.0005,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[llm:portkey_responses]": 0.0011,- "tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[search:gateway_search]": 0.0016,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_backend_is_registered[search:linkup]": 0.0008,- "tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_cross_family_vendor_registers_into_all_its_families[gateway]": 0.0936,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_cross_family_vendor_registers_into_all_its_families[google]": 0.0009,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_cross_family_vendor_registers_into_all_its_families[linkup]": 0.0009,"tests/unit/pipelex/plugins/test_inference_backend_coverage.py::TestInferenceBackendCoverage::test_cross_family_vendor_registers_into_all_its_families[mistral]": 0.0008,@@ -9719,7 +9343,6 @@"tests/unit/pipelex/plugins/test_model_lister_coverage.py::TestModelListerCoverage::test_registered_sdk_resolves_to_a_lister[openai_responses]": 0.0008,"tests/unit/pipelex/plugins/test_model_lister_coverage.py::TestModelListerCoverage::test_registry_exposes_exactly_the_expected_sdks": 0.0003,"tests/unit/pipelex/plugins/test_model_lister_coverage.py::TestModelListerCoverage::test_sdk_without_a_lister_is_a_soft_miss[fal]": 0.0004,- "tests/unit/pipelex/plugins/test_model_lister_coverage.py::TestModelListerCoverage::test_sdk_without_a_lister_is_a_soft_miss[gateway_completions]": 0.0008,"tests/unit/pipelex/plugins/test_model_lister_coverage.py::TestModelListerCoverage::test_sdk_without_a_lister_is_a_soft_miss[linkup]": 0.0008,"tests/unit/pipelex/plugins/test_model_lister_coverage.py::TestModelListerCoverage::test_sdk_without_a_lister_is_a_soft_miss[totally_unknown_sdk]": 0.0971,"tests/unit/pipelex/plugins/test_pipe_func_executor_registry.py::TestPipeFuncExecutorRegistry::test_builtin_plugin_registers_only_direct": 0.0851,@@ -9997,106 +9620,6 @@"tests/unit/pipelex/providers/fal/test_fal_worker_error_handling.py::TestFalWorkerErrorHandling::test_http_error_categorization[server_error_500-500-Internal server error-transient-wait_and_retry]": 0.0424,"tests/unit/pipelex/providers/fal/test_fal_worker_error_handling.py::TestFalWorkerErrorHandling::test_missing_credentials_is_configuration[missing_fal_key-configuration-check_credentials]": 0.0529,"tests/unit/pipelex/providers/fal/test_fal_worker_error_handling.py::TestFalWorkerErrorHandling::test_timeout_error_is_transient[request_timeout-transient-wait_and_retry]": 0.0483,- "tests/unit/pipelex/providers/gateway/test_extract_gateway_metadata.py::TestExtractGatewayMetadata::test_extracts_provider_error_code_from_body": 0.0005,- "tests/unit/pipelex/providers/gateway/test_extract_gateway_metadata.py::TestExtractGatewayMetadata::test_extracts_retry_after_seconds": 0.001,- "tests/unit/pipelex/providers/gateway/test_extract_gateway_metadata.py::TestExtractGatewayMetadata::test_extracts_status_code_and_request_id": 0.7689,- "tests/unit/pipelex/providers/gateway/test_extract_gateway_metadata.py::TestExtractGatewayMetadata::test_falls_back_to_portkey_trace_id": 0.0009,- "tests/unit/pipelex/providers/gateway/test_extract_gateway_metadata.py::TestExtractGatewayMetadata::test_falls_back_to_type_when_the_body_carries_no_code": 0.3612,- "tests/unit/pipelex/providers/gateway/test_extract_gateway_metadata.py::TestExtractGatewayMetadata::test_handles_connection_error_without_response": 0.1219,- "tests/unit/pipelex/providers/gateway/test_extract_gateway_metadata.py::TestTheCodeWhenPortkeyDiscardsThePayload::test_a_dict_body_still_wins_over_the_response": 0.0679,- "tests/unit/pipelex/providers/gateway/test_extract_gateway_metadata.py::TestTheCodeWhenPortkeyDiscardsThePayload::test_a_response_that_is_not_json_leaves_the_code_unset": 0.0006,- "tests/unit/pipelex/providers/gateway/test_extract_gateway_metadata.py::TestTheCodeWhenPortkeyDiscardsThePayload::test_the_code_is_recovered_from_the_response_body": 0.0149,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_client.py::TestGatewayCompletionsClient::test_happy_path_wires_endpoint_placeholder_key_and_portkey_headers[False-false]": 0.0016,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_client.py::TestGatewayCompletionsClient::test_happy_path_wires_endpoint_placeholder_key_and_portkey_headers[True-true]": 0.0024,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_client.py::TestGatewayCompletionsClient::test_make_extras_delegates_to_gateway_factory": 0.0992,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_client.py::TestGatewayCompletionsClient::test_wrong_sdk_variant_raises_factory_error": 0.8734,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_azure_falls_back_to_choices_content": 0.0004,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_azure_page_schema_violation_is_wrapped": 0.1139,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_azure_top_level_pages_with_images": 0.0009,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_azure_without_pages_anywhere_raises": 0.0009,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_deepseek_falls_back_to_choices_content": 0.0003,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_deepseek_page_schema_violation_is_wrapped": 0.0019,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_deepseek_scaled_down_image_logs_warning_and_parses": 0.001,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_deepseek_top_level_pages_happy_path": 0.0008,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_deepseek_without_pages_anywhere_raises": 0.0009,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_dispatch_routes_each_handle_to_its_parser[azure-document-intelligence-_make_extract_output_from_response_azure]": 0.0019,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_dispatch_routes_each_handle_to_its_parser[deepseek-ocr-_make_extract_output_from_response_deepseek]": 0.0006,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_dispatch_routes_each_handle_to_its_parser[linkup-fetch-_make_extract_output_from_response_linkup_fetch]": 0.0007,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_dispatch_routes_each_handle_to_its_parser[mistral-document-ai-2505-_make_extract_output_from_response_mistral]": 0.8633,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_dispatch_unknown_handle_raises_value_error": 0.0006,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_extract_content_string_falsy_paths_return_none[content-not-a-str]": 0.0008,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_extract_content_string_falsy_paths_return_none[message-not-a-dict]": 0.0005,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_extract_pages_from_choices_content_falsy_paths_return_none[choices-not-a-list]": 0.0009,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_extract_pages_from_choices_content_falsy_paths_return_none[content-json-not-a-list]": 0.0013,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_extract_pages_from_choices_content_falsy_paths_return_none[content-malformed-json]": 0.0009,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_extract_pages_from_choices_content_falsy_paths_return_none[content-not-a-str]": 0.0007,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_extract_pages_from_choices_content_falsy_paths_return_none[empty-choices]": 0.0004,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_extract_pages_from_choices_content_falsy_paths_return_none[message-missing]": 0.0006,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_extract_pages_from_choices_content_falsy_paths_return_none[message-not-a-dict]": 0.0004,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_extract_pages_from_choices_content_falsy_paths_return_none[no-choices]": 0.0004,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_extract_pages_from_choices_content_happy_path": 0.0004,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_linkup_fetch_happy_path": 0.0009,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_linkup_fetch_invalid_fetch_result_is_wrapped[json-but-not-a-fetch-result]": 0.0009,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_linkup_fetch_invalid_fetch_result_is_wrapped[malformed-json]": 0.112,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_linkup_fetch_without_content_raises": 0.0007,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_mistral_page_schema_violation_is_wrapped": 0.0009,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_mistral_pages_with_images_corner_handling": 0.0012,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py::TestGatewayCompletionsExtractOutput::test_mistral_without_pages_raises": 4.6102,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_messages.py::TestGatewayCompletionsMessages::test_base64_document_becomes_image_url_part_with_auto_detail": 0.0028,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_messages.py::TestGatewayCompletionsMessages::test_images_become_image_url_parts[None-auto]": 0.0032,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_messages.py::TestGatewayCompletionsMessages::test_images_become_image_url_parts[high-high]": 0.0023,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_messages.py::TestGatewayCompletionsMessages::test_images_become_image_url_parts[low-low]": 0.0025,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_messages.py::TestGatewayCompletionsMessages::test_local_path_image_raises_type_error": 0.0043,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_messages.py::TestGatewayCompletionsMessages::test_non_base64_document_raises_type_error[http-url-document]": 0.0037,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_messages.py::TestGatewayCompletionsMessages::test_non_base64_document_raises_type_error[local-path-document]": 0.0971,- "tests/unit/pipelex/providers/gateway/test_gateway_completions_messages.py::TestGatewayCompletionsMessages::test_system_and_user_text": 0.818,- "tests/unit/pipelex/providers/gateway/test_gateway_extract_worker_semantic.py::TestGatewayExtractWorkerSemantic::test_genuine_not_found_404_raises_extract_model_not_found_error": 0.1999,- "tests/unit/pipelex/providers/gateway/test_gateway_extract_worker_semantic.py::TestGatewayExtractWorkerSemantic::test_status_error_carries_semantic_user_action_via_web_fetch[AuthenticationError-401-configuration-check_credentials]": 0.054,- "tests/unit/pipelex/providers/gateway/test_gateway_extract_worker_semantic.py::TestGatewayExtractWorkerSemantic::test_status_error_carries_semantic_user_action_via_web_fetch[BadRequestError-400-content-change_input]": 0.0584,- "tests/unit/pipelex/providers/gateway/test_gateway_extract_worker_semantic.py::TestGatewayExtractWorkerSemantic::test_status_error_carries_semantic_user_action_via_web_fetch[PermissionDeniedError-403-configuration-check_credentials]": 0.0522,- "tests/unit/pipelex/providers/gateway/test_gateway_extract_worker_semantic.py::TestGatewayExtractWorkerSemantic::test_status_error_carries_semantic_user_action_via_web_fetch[RateLimitError-429-transient-wait_and_retry]": 0.8031,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_extras.py::TestGatewayImgGenExtras::test_exact_size_derives_grid_cell_from_rules": 0.0012,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_extras.py::TestGatewayImgGenExtras::test_exact_size_without_rules_raises": 0.0018,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_extras.py::TestGatewayImgGenExtras::test_non_gemini_img_gen_job_gets_no_image_config": 0.1056,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_extras.py::TestGatewayImgGenExtras::test_sized_request_with_unknown_taxonomy_raises": 0.003,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_extras.py::TestGatewayImgGenExtras::test_tier_beyond_taxonomy_raises": 0.0026,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_extras.py::TestGatewayImgGenExtras::test_tier_threads_image_size_token": 0.7812,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_extras.py::TestGatewayImgGenExtras::test_tier_without_rules_raises": 0.001,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_extras.py::TestGatewayImgGenExtras::test_unset_size_omits_image_size": 0.0013,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_extras.py::TestGatewayImgGenExtras::test_unset_size_with_unknown_taxonomy_keeps_ratio_only_mapping": 0.0022,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_extras.py::TestGatewayImgGenExtras::test_unset_size_without_rules_keeps_ratio_only_mapping": 0.0071,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_edit_routing.py::TestGatewayImgGenWorkerEditRouting::test_with_input_image_but_no_generations_segment_raises": 0.1151,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_edit_routing.py::TestGatewayImgGenWorkerEditRouting::test_with_input_image_routes_to_edits_with_multipart_body": 0.7926,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_edit_routing.py::TestGatewayImgGenWorkerEditRouting::test_with_multiple_input_images_sends_bracketed_array_field_name": 0.0051,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_edit_routing.py::TestGatewayImgGenWorkerEditRouting::test_without_input_image_routes_to_generations_as_before": 0.0041,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_malformed_body.py::TestGatewayImgGenWorkerMalformedBody::test_flux_2_pro_undecodable_image_is_wrapped[corrupt-image-bytes]": 0.098,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_malformed_body.py::TestGatewayImgGenWorkerMalformedBody::test_flux_2_pro_undecodable_image_is_wrapped[invalid-base64-padding]": 0.0055,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_malformed_body.py::TestGatewayImgGenWorkerMalformedBody::test_flux_2_pro_undecodable_image_is_wrapped[unrecognized-file-type]": 0.0887,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_malformed_body.py::TestGatewayImgGenWorkerMalformedBody::test_gpt_image_malformed_size_is_wrapped[1024xfoo]": 0.0066,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_malformed_body.py::TestGatewayImgGenWorkerMalformedBody::test_gpt_image_malformed_size_is_wrapped[axb]": 0.7981,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_malformed_body.py::TestGatewayImgGenWorkerMalformedBody::test_gpt_image_malformed_size_is_wrapped[wide x tall]": 0.004,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_semantic.py::TestGatewayImgGenWorkerSemantic::test_genuine_not_found_404_raises_img_gen_model_not_found_error": 0.004,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_semantic.py::TestGatewayImgGenWorkerSemantic::test_quota_keywords_in_rate_limit_message_is_check_billing": 0.1238,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_semantic.py::TestGatewayImgGenWorkerSemantic::test_status_error_carries_semantic_user_action[AuthenticationError-401-configuration-check_credentials]": 0.0067,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_semantic.py::TestGatewayImgGenWorkerSemantic::test_status_error_carries_semantic_user_action[BadRequestError-400-content-change_input]": 0.0036,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_semantic.py::TestGatewayImgGenWorkerSemantic::test_status_error_carries_semantic_user_action[PermissionDeniedError-403-configuration-check_credentials]": 0.0025,- "tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_semantic.py::TestGatewayImgGenWorkerSemantic::test_status_error_carries_semantic_user_action[RateLimitError-429-transient-wait_and_retry]": 0.7618,- "tests/unit/pipelex/providers/gateway/test_gateway_quota_detection.py::TestGatewayQuotaDetection::test_extract_worker_propagates_quota_as_capacity": 0.1414,- "tests/unit/pipelex/providers/gateway/test_gateway_quota_detection.py::TestGatewayQuotaDetection::test_imggen_worker_propagates_rate_limit_as_transient": 0.8442,- "tests/unit/pipelex/providers/gateway/test_gateway_quota_detection.py::TestGatewayQuotaDetection::test_search_worker_propagates_auth_error_as_configuration": 0.0466,- "tests/unit/pipelex/providers/gateway/test_gateway_search_worker_semantic.py::TestGatewaySearchWorkerSemantic::test_genuine_not_found_404_raises_search_model_not_found_error": 0.1932,- "tests/unit/pipelex/providers/gateway/test_gateway_search_worker_semantic.py::TestGatewaySearchWorkerSemantic::test_status_error_carries_semantic_user_action[AuthenticationError-401-configuration-check_credentials]": 0.0426,- "tests/unit/pipelex/providers/gateway/test_gateway_search_worker_semantic.py::TestGatewaySearchWorkerSemantic::test_status_error_carries_semantic_user_action[BadRequestError-400-content-change_input]": 0.0628,- "tests/unit/pipelex/providers/gateway/test_gateway_search_worker_semantic.py::TestGatewaySearchWorkerSemantic::test_status_error_carries_semantic_user_action[PermissionDeniedError-403-configuration-check_credentials]": 0.0718,- "tests/unit/pipelex/providers/gateway/test_gateway_search_worker_semantic.py::TestGatewaySearchWorkerSemantic::test_status_error_carries_semantic_user_action[RateLimitError-429-transient-wait_and_retry]": 0.7713,- "tests/unit/pipelex/providers/gateway/test_gateway_structured_search_contract.py::TestGatewayStructuredSearchContract::test_a_bare_payload_passes_through_unwrapped": 0.0046,- "tests/unit/pipelex/providers/gateway/test_gateway_structured_search_contract.py::TestGatewayStructuredSearchContract::test_a_non_json_body_raises_a_classified_search_error": 0.0845,- "tests/unit/pipelex/providers/gateway/test_gateway_structured_search_contract.py::TestGatewayStructuredSearchContract::test_a_non_object_response_raises_a_classified_search_error": 0.0034,- "tests/unit/pipelex/providers/gateway/test_gateway_structured_search_contract.py::TestGatewayStructuredSearchContract::test_a_serialization_alias_does_not_make_a_class_own_the_envelope_names": 0.004,- "tests/unit/pipelex/providers/gateway/test_gateway_structured_search_contract.py::TestGatewayStructuredSearchContract::test_an_envelope_carrying_no_payload_raises_an_empty_result_error": 0.0024,- "tests/unit/pipelex/providers/gateway/test_gateway_structured_search_contract.py::TestGatewayStructuredSearchContract::test_an_output_class_that_declares_data_and_sources_is_not_unwrapped": 0.0036,- "tests/unit/pipelex/providers/gateway/test_gateway_structured_search_contract.py::TestGatewayStructuredSearchContract::test_an_output_class_whose_wire_names_are_aliases_is_not_unwrapped": 0.0035,- "tests/unit/pipelex/providers/gateway/test_gateway_structured_search_contract.py::TestGatewayStructuredSearchContract::test_the_relay_envelope_is_unwrapped_to_the_bare_payload": 0.8575,"tests/unit/pipelex/providers/google/test_extract_google_metadata.py::TestExtractGoogleMetadata::test_authentication_error_carries_status_code_401": 0.0008,"tests/unit/pipelex/providers/google/test_extract_google_metadata.py::TestExtractGoogleMetadata::test_body_is_the_response_details": 0.0019,"tests/unit/pipelex/providers/google/test_extract_google_metadata.py::TestExtractGoogleMetadata::test_body_without_error_or_status_yields_none_provider_error_code": 0.0004,@@ -10271,7 +9794,6 @@"tests/unit/pipelex/providers/manifold/test_extract_manifold_metadata.py::TestTheRequestIdTheManifoldPathReports::test_prefers_the_providers_own_request_id_over_any_trace_id": 1.8161,"tests/unit/pipelex/providers/manifold/test_extract_manifold_metadata.py::TestTheRequestIdTheManifoldPathReports::test_reads_the_pipelex_spelled_trace_id": 1.7887,"tests/unit/pipelex/providers/manifold/test_extract_manifold_metadata.py::TestTheRequestIdTheManifoldPathReports::test_reports_no_request_id_when_no_provider_was_reached": 1.7992,- "tests/unit/pipelex/providers/manifold/test_extract_manifold_metadata.py::TestTheRequestIdTheManifoldPathReports::test_still_reads_the_vendor_spelling_while_the_gateway_emits_it": 1.7843,"tests/unit/pipelex/providers/manifold/test_manifold_clients.py::TestManifoldCompletionsClient::test_a_handle_from_another_sdk_set_is_refused": 0.0016,"tests/unit/pipelex/providers/manifold/test_manifold_clients.py::TestManifoldCompletionsClient::test_the_client_gets_the_origin_plus_v1_and_the_token_in_the_service_header": 3.4526,"tests/unit/pipelex/providers/manifold/test_manifold_clients.py::TestManifoldImageClient::test_debug_is_read_from_the_backend_and_from_nothing_else": 0.049,@@ -10285,7 +9807,6 @@"tests/unit/pipelex/providers/manifold/test_manifold_completions_messages.py::TestManifoldCompletionsMessages::test_images_become_image_url_parts_at_the_requested_detail[high-high]": 0.0021,"tests/unit/pipelex/providers/manifold/test_manifold_completions_messages.py::TestManifoldCompletionsMessages::test_images_become_image_url_parts_at_the_requested_detail[low-low]": 0.0011,"tests/unit/pipelex/providers/manifold/test_manifold_completions_messages.py::TestManifoldCompletionsMessages::test_system_and_user_text": 0.4923,- "tests/unit/pipelex/providers/manifold/test_manifold_completions_messages.py::TestManifoldCompletionsMessagesMatchTheGatewayPath::test_both_factories_build_the_same_messages_for_the_same_prompt": 0.0516,"tests/unit/pipelex/providers/manifold/test_manifold_endpoint_rule.py::TestManifoldEndpointRule::test_a_trailing_slash_or_surrounding_space_is_forgiven[ https://manifold.example.com ]": 0.0003,"tests/unit/pipelex/providers/manifold/test_manifold_endpoint_rule.py::TestManifoldEndpointRule::test_a_trailing_slash_or_surrounding_space_is_forgiven[https://manifold.example.com///]": 0.0015,"tests/unit/pipelex/providers/manifold/test_manifold_endpoint_rule.py::TestManifoldEndpointRule::test_a_trailing_slash_or_surrounding_space_is_forgiven[https://manifold.example.com/]": 0.0034,@@ -10720,8 +10241,6 @@"tests/unit/pipelex/providers/test_plugin_pipelex_storage_images.py::TestMistralFactoryPipelexStorageSupport::test_make_mistral_image_url_with_pipelex_storage_uri": 0.0459,"tests/unit/pipelex/providers/test_plugin_pipelex_storage_images.py::TestPromptImageUtilsPipelexStorageSupport::test_prepare_prompt_image_as_base64_with_pipelex_storage_uri": 0.1709,"tests/unit/pipelex/providers/test_transport_retry_wiring.py::TestTransportRetryWiring::test_anthropic_factory_passes_max_retries": 0.8022,- "tests/unit/pipelex/providers/test_transport_retry_wiring.py::TestTransportRetryWiring::test_gateway_completions_factory_passes_max_retries": 0.0037,- "tests/unit/pipelex/providers/test_transport_retry_wiring.py::TestTransportRetryWiring::test_gateway_responses_factory_passes_max_retries": 0.1013,"tests/unit/pipelex/providers/test_transport_retry_wiring.py::TestTransportRetryWiring::test_google_factory_passes_retry_options": 0.0023,"tests/unit/pipelex/providers/test_transport_retry_wiring.py::TestTransportRetryWiring::test_mistral_factory_builds_retry_config_when_enabled": 0.0012,"tests/unit/pipelex/providers/test_transport_retry_wiring.py::TestTransportRetryWiring::test_mistral_factory_disables_retry_when_zero": 0.0019,@@ -10926,56 +10445,8 @@"tests/unit/pipelex/system/configuration/test_config_surface.py::TestStripReservedMeta::test_a_meta_table_with_other_keys_keeps_them": 0.0006,"tests/unit/pipelex/system/configuration/test_config_surface.py::TestStripReservedMeta::test_a_non_table_meta_is_left_for_validation_to_reject": 0.08,"tests/unit/pipelex/system/configuration/test_config_surface.py::TestStripReservedMeta::test_the_reserved_key_is_removed_with_its_now_empty_table": 0.8598,- "tests/unit/pipelex/system/pipelex_service/test_gateway_config_merger.py::TestGatewayConfigMerger::test_allowed_override_keys_contains_expected": 0.0013,- "tests/unit/pipelex/system/pipelex_service/test_gateway_config_merger.py::TestGatewayConfigMerger::test_deep_copy_preserves_nested_dicts": 0.0027,- "tests/unit/pipelex/system/pipelex_service/test_gateway_config_merger.py::TestGatewayConfigMerger::test_merge_allowed_override_applied": 0.0019,- "tests/unit/pipelex/system/pipelex_service/test_gateway_config_merger.py::TestGatewayConfigMerger::test_merge_defaults_override_ignored": 0.0015,- "tests/unit/pipelex/system/pipelex_service/test_gateway_config_merger.py::TestGatewayConfigMerger::test_merge_disallowed_override_ignored": 0.0015,- "tests/unit/pipelex/system/pipelex_service/test_gateway_config_merger.py::TestGatewayConfigMerger::test_merge_no_overrides": 0.0008,- "tests/unit/pipelex/system/pipelex_service/test_gateway_config_merger.py::TestGatewayConfigMerger::test_merge_unknown_model_override_ignored": 0.0016,- "tests/unit/pipelex/system/pipelex_service/test_gateway_config_merger.py::TestGatewayConfigMerger::test_merge_with_non_dict_local_override_raises": 0.001,- "tests/unit/pipelex/system/pipelex_service/test_gateway_config_merger.py::TestGatewayConfigMerger::test_merge_with_non_dict_remote_config_raises": 0.0008,- "tests/unit/pipelex/system/pipelex_service/test_gateway_terms_check.py::TestGatewayTermsCheck::test_first_run_raises_inference_setup_required": 0.0036,- "tests/unit/pipelex/system/pipelex_service/test_gateway_terms_check.py::TestGatewayTermsCheck::test_needs_inference_false_does_not_raise_when_terms_not_accepted": 0.0012,- "tests/unit/pipelex/system/pipelex_service/test_gateway_terms_check.py::TestGatewayTermsCheck::test_needs_inference_true_raises_when_terms_not_accepted": 0.0029,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestBuildManagedGatewayConfigs::test_a_section_the_artifact_does_not_carry_is_disabled_by_name": 0.003,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestBuildManagedGatewayConfigs::test_each_backend_gets_its_own_section_unmerged": 0.0012,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestBuildManagedGatewayConfigs::test_the_region_belongs_to_the_legacy_slice_alone": 0.0008,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestEnabledManagedGatewaySections::test_a_byok_backend_is_never_managed": 0.0016,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestEnabledManagedGatewaySections::test_a_disabled_backend_is_absent_reading_enabled_the_way_the_loader_does[0]": 0.004,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestEnabledManagedGatewaySections::test_a_disabled_backend_is_absent_reading_enabled_the_way_the_loader_does[false]": 0.0029,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestEnabledManagedGatewaySections::test_a_missing_file_is_no_managed_backends_rather_than_a_refusal": 0.0012,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestEnabledManagedGatewaySections::test_it_maps_each_enabled_managed_backend_to_its_section": 0.0021,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestResolveModelSpecsSection::test_a_declared_section_makes_a_backend_managed": 0.0021,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestResolveModelSpecsSection::test_an_explicit_declaration_wins_even_on_that_name": 0.0021,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestResolveModelSpecsSection::test_every_other_backend_reads_its_own_file": 0.0031,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestResolveModelSpecsSection::test_the_legacy_gateway_resolves_to_its_section_without_declaring_one": 0.0016,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestTheSectionLookupIsConfinedToTheArtifact::test_a_declared_field_that_is_not_a_spec_map_is_not_a_section": 0.0061,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestTheSectionLookupIsConfinedToTheArtifact::test_a_published_section_is_found": 0.005,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestTheSectionLookupIsConfinedToTheArtifact::test_a_pydantic_internal_is_not_a_section[model_config]": 0.0007,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestTheSectionLookupIsConfinedToTheArtifact::test_a_pydantic_internal_is_not_a_section[model_fields]": 0.0014,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestTheSectionLookupIsConfinedToTheArtifact::test_an_unknown_name_is_simply_absent": 0.0006,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestTheSectionLookupIsConfinedToTheArtifact::test_the_legacy_declared_field_is_found_too": 0.0014,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestTheTwoQuestionsAreNotTheSameQuestion::test_a_manifold_only_installation_is_managed_but_is_not_the_gateway": 0.0032,- "tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py::TestTheTwoQuestionsAreNotTheSameQuestion::test_the_common_beta_case_keeps_both": 0.0025,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_gateway_config_default_terms_not_accepted": 0.0006,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_gateway_config_terms_accepted": 0.0005,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_is_pipelex_gateway_enabled_defaults_to_enabled_when_the_key_is_absent": 0.0045,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_is_pipelex_gateway_enabled_is_false_without_a_base_file": 0.0049,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_is_pipelex_gateway_enabled_is_false_without_a_gateway_table": 0.0022,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_is_pipelex_gateway_enabled_reads_enabled_the_way_the_loader_does[\"yes\"-True]": 0.004,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_is_pipelex_gateway_enabled_reads_enabled_the_way_the_loader_does[0-False]": 0.0015,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_is_pipelex_gateway_enabled_reads_enabled_the_way_the_loader_does[1-True]": 0.0033,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_is_pipelex_gateway_enabled_reads_enabled_the_way_the_loader_does[false-False]": 0.0022,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_is_pipelex_gateway_enabled_reads_enabled_the_way_the_loader_does[true-True]": 0.0029,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_is_pipelex_gateway_enabled_reads_the_override_over_the_base[false-1-True]": 0.0101,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_is_pipelex_gateway_enabled_reads_the_override_over_the_base[false-true-True]": 0.0041,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_is_pipelex_gateway_enabled_reads_the_override_over_the_base[true-0-False]": 0.0039,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_is_pipelex_gateway_enabled_reads_the_override_over_the_base[true-false-False]": 0.0048,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_is_pipelex_gateway_enabled_refuses_an_override_that_does_not_parse_with_the_librarys_class": 0.0069,"tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_load_pipelex_service_config_if_exists_returns_config": 0.0018,"tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_load_pipelex_service_config_if_exists_returns_none": 0.0013,- "tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py::TestPipelexServiceConfig::test_pipelex_service_config_with_gateway": 0.0007,"tests/unit/pipelex/system/pipelex_service/test_remote_config.py::TestRemoteConfig::test_remote_config_empty_backend": 0.0008,"tests/unit/pipelex/system/pipelex_service/test_remote_config.py::TestRemoteConfig::test_remote_config_missing_backend_fails": 0.0005,"tests/unit/pipelex/system/pipelex_service/test_remote_config.py::TestRemoteConfig::test_remote_config_valid": 0.0005,@@ -11038,12 +10509,6 @@"tests/unit/pipelex/system/telemetry/test_exception_capture_sdk_contract.py::TestExceptionCaptureSdkContract::test_no_stream_is_sent_the_message_as_it_was_written": 0.001,"tests/unit/pipelex/system/telemetry/test_exception_capture_sdk_contract.py::TestExceptionCaptureSdkContract::test_the_live_exception_is_left_as_it_was": 0.0009,"tests/unit/pipelex/system/telemetry/test_exception_capture_sdk_contract.py::TestExceptionCaptureSdkContract::test_the_stand_in_keeps_the_class_that_failed": 0.0206,- "tests/unit/pipelex/system/telemetry/test_gateway_portkey_follows_stream.py::TestGatewayPortkeyFollowsStream::test_backend_debug_does_not_log_while_the_stream_is_off[False]": 1.1866,- "tests/unit/pipelex/system/telemetry/test_gateway_portkey_follows_stream.py::TestGatewayPortkeyFollowsStream::test_backend_debug_does_not_log_while_the_stream_is_off[True]": 0.1754,- "tests/unit/pipelex/system/telemetry/test_gateway_portkey_follows_stream.py::TestGatewayPortkeyFollowsStream::test_backend_debug_still_applies_while_the_stream_is_on": 0.0132,- "tests/unit/pipelex/system/telemetry/test_gateway_portkey_follows_stream.py::TestGatewayPortkeyFollowsStream::test_force_debug_flag_does_not_log_while_the_stream_is_off": 0.0008,- "tests/unit/pipelex/system/telemetry/test_gateway_portkey_follows_stream.py::TestGatewayPortkeyFollowsStream::test_force_tracing_flag_does_not_trace_while_the_stream_is_off": 0.0011,- "tests/unit/pipelex/system/telemetry/test_gateway_portkey_follows_stream.py::TestGatewayPortkeyFollowsStream::test_the_flags_still_apply_while_the_stream_is_on": 0.0161,"tests/unit/pipelex/system/telemetry/test_llm_span_carries_run_identity.py::TestLLMSpanIdentity::test_a_run_with_no_groups_writes_no_groups_attribute": 0.0348,"tests/unit/pipelex/system/telemetry/test_llm_span_carries_run_identity.py::TestLLMSpanIdentity::test_langfuse_gets_the_user_id_only_when_it_is_enabled": 0.2855,"tests/unit/pipelex/system/telemetry/test_llm_span_carries_run_identity.py::TestLLMSpanIdentity::test_langfuse_user_id_is_absent_when_langfuse_is_off": 0.2264,@@ -11227,15 +10692,6 @@"tests/unit/pipelex/system/test_config_resolution.py::TestConfigResolution::test_project_config_dir_when_exists": 0.002,"tests/unit/pipelex/system/test_config_resolution.py::TestConfigResolution::test_project_root_returns_none_without_markers": 0.0006,"tests/unit/pipelex/system/test_config_resolution.py::TestConfigResolution::test_project_root_returns_str_when_found": 0.0015,- "tests/unit/pipelex/system/test_integration_mode.py::TestIntegrationModeIsTestHarness::test_is_test_harness[ci-True]": 1.1793,- "tests/unit/pipelex/system/test_integration_mode.py::TestIntegrationModeIsTestHarness::test_is_test_harness[cli-False]": 0.0008,- "tests/unit/pipelex/system/test_integration_mode.py::TestIntegrationModeIsTestHarness::test_is_test_harness[docker-False]": 0.0003,- "tests/unit/pipelex/system/test_integration_mode.py::TestIntegrationModeIsTestHarness::test_is_test_harness[fastapi-False]": 0.0006,- "tests/unit/pipelex/system/test_integration_mode.py::TestIntegrationModeIsTestHarness::test_is_test_harness[mcp-False]": 0.0003,- "tests/unit/pipelex/system/test_integration_mode.py::TestIntegrationModeIsTestHarness::test_is_test_harness[n8n-False]": 0.0128,- "tests/unit/pipelex/system/test_integration_mode.py::TestIntegrationModeIsTestHarness::test_is_test_harness[pytest-True]": 1.1655,- "tests/unit/pipelex/system/test_integration_mode.py::TestIntegrationModeIsTestHarness::test_is_test_harness[python-False]": 0.0007,- "tests/unit/pipelex/system/test_integration_mode.py::TestIntegrationModeIsTestHarness::test_the_table_covers_every_mode": 0.0136,"tests/unit/pipelex/system/test_job_metadata_log_context.py::TestJobMetadataLogContext::test_an_absent_identifier_inherits_the_outer_binding": 0.2596,"tests/unit/pipelex/system/test_job_metadata_log_context.py::TestJobMetadataLogContext::test_binds_the_run_identifiers_and_the_step_identifier": 0.0779,"tests/unit/pipelex/system/test_job_metadata_log_context.py::TestJobMetadataLogContext::test_the_previous_binding_comes_back_on_return_and_on_raise": 0.0006,@@ -11572,19 +11028,6 @@"tests/unit/pipelex/test_runtime_boot_exclusivity.py::TestRuntimeBootAndPipelexAreOneProcessGlobal::test_teardown_if_needed_releases_a_bare_runtime_boot_through_the_subclass": 1.4973,"tests/unit/pipelex/test_runtime_boot_failed_boot_release.py::TestFailedBootReleasesTheTelemetrySingleton::test_a_boot_failing_after_telemetry_setup_leaves_no_telemetry_singleton": 1.9252,"tests/unit/pipelex/test_runtime_boot_failed_boot_release.py::TestFailedBootReleasesTheTelemetrySingleton::test_an_injected_telemetry_manager_that_raises_does_not_abort_the_other_releases": 1.4035,- "tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.py::TestRuntimeBootPipelexTelemetry::test_a_deployment_mode_with_every_condition_met_enables_the_stream[cli]": 0.134,- "tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.py::TestRuntimeBootPipelexTelemetry::test_a_deployment_mode_with_every_condition_met_enables_the_stream[docker]": 0.1493,- "tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.py::TestRuntimeBootPipelexTelemetry::test_a_deployment_mode_with_every_condition_met_enables_the_stream[fastapi]": 1.1716,- "tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.py::TestRuntimeBootPipelexTelemetry::test_a_deployment_mode_with_every_condition_met_enables_the_stream[mcp]": 0.0008,- "tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.py::TestRuntimeBootPipelexTelemetry::test_a_deployment_mode_with_every_condition_met_enables_the_stream[n8n]": 0.0003,- "tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.py::TestRuntimeBootPipelexTelemetry::test_a_deployment_mode_with_every_condition_met_enables_the_stream[python]": 0.0009,- "tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.py::TestRuntimeBootPipelexTelemetry::test_a_test_harness_mode_disables_the_stream_even_with_every_other_condition_met[ci]": 0.0003,- "tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.py::TestRuntimeBootPipelexTelemetry::test_a_test_harness_mode_disables_the_stream_even_with_every_other_condition_met[pytest]": 0.0008,- "tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.py::TestRuntimeBootPipelexTelemetry::test_each_condition_alone_disables_the_stream[cached-config]": 0.0005,- "tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.py::TestRuntimeBootPipelexTelemetry::test_each_condition_alone_disables_the_stream[gateway-disabled]": 0.0141,- "tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.py::TestRuntimeBootPipelexTelemetry::test_each_condition_alone_disables_the_stream[no-inference]": 1.1792,- "tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.py::TestRuntimeBootPipelexTelemetry::test_each_condition_alone_disables_the_stream[unit-testing-run-mode]": 0.0004,- "tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.py::TestRuntimeBootPipelexTelemetry::test_the_suite_boot_has_the_gateway_stream_off": 0.0137,"tests/unit/pipelex/test_runtime_boot_pre_boot_registry_read.py::TestPreBootRegistryRead::test_a_pre_boot_registry_read_does_not_starve_the_next_boot": 1.2756,"tests/unit/pipelex/test_runtime_boot_releases_boot_scoped_state.py::TestTeardownReleasesBootScopedHubState::test_teardown_clears_the_flags_a_boot_set": 1.5183,"tests/unit/pipelex/test_runtime_boot_releases_boot_scoped_state.py::TestTeardownReleasesBootScopedHubState::test_teardown_releases_the_isolated_execution_probe": 0.7272,@@ -13756,9 +13199,7 @@"tests/unit/pipelex/tools/uri/test_uri_resolver_error_handling.py::TestUriResolverErrorHandling::test_pipelex_storage_propagates_storage_errors": 0.0018,"tests/unit/pipelex/tools/uri/test_uri_resolver_error_handling.py::TestUriResolverErrorHandling::test_ssl_certificate_error_propagates": 0.0014,"tests/unit/pipelex/tools/uri/test_uri_resolver_error_handling.py::TestUriResolverErrorHandling::test_timeout_error_propagates": 0.0013,- "tests/unit/pipelex/tools/uri/test_uri_resolver_error_handling.py::TestUriResolverErrorHandling::test_various_http_status_codes_propagate[bad_gateway-502]": 0.0022,"tests/unit/pipelex/tools/uri/test_uri_resolver_error_handling.py::TestUriResolverErrorHandling::test_various_http_status_codes_propagate[bad_request-400]": 0.002,- "tests/unit/pipelex/tools/uri/test_uri_resolver_error_handling.py::TestUriResolverErrorHandling::test_various_http_status_codes_propagate[gateway_timeout-504]": 0.0942,"tests/unit/pipelex/tools/uri/test_uri_resolver_error_handling.py::TestUriResolverErrorHandling::test_various_http_status_codes_propagate[gone-410]": 0.0025,"tests/unit/pipelex/tools/uri/test_uri_resolver_error_handling.py::TestUriResolverErrorHandling::test_various_http_status_codes_propagate[internal_server_error-500]": 0.0017,"tests/unit/pipelex/tools/uri/test_uri_resolver_error_handling.py::TestUriResolverErrorHandling::test_various_http_status_codes_propagate[method_not_allowed-405]": 0.0098,@@ -13902,5 +13343,6 @@"tests/unit/repo/test_docs_cite_nothing_private.py::TestDocsCiteNothingPrivate::test_published_docs_cite_nothing_in_the_private_workspace": 0.5197,"tests/unit/repo/test_test_durations_paths.py::TestTestDurationsPaths::test_durations_file_is_committed_and_not_empty": 0.8507,"tests/unit/repo/test_test_durations_paths.py::TestTestDurationsPaths::test_every_node_id_is_rooted_in_a_test_file_path": 0.0153,- "tests/unit/repo/test_test_durations_paths.py::TestTestDurationsPaths::test_every_recorded_test_file_still_exists": 0.1253+ "tests/unit/repo/test_test_durations_paths.py::TestTestDurationsPaths::test_every_recorded_test_file_still_exists": 0.1253,+ "tests/integration/pipelex/cli/commands/init/test_cache_priming.py::TestCachePriming::test_init_warns_when_the_written_cache_does_not_read_back": 0.0211}diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 817e8327c..088af6ab0 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -2,9 +2,20 @@## [Unreleased]+### Changed++- **The default extractors are waterfalls**: `@default-extract-document` takes the first of Azure Document Intelligence, Mistral OCR and `pypdfium2-extract-pdf` that an enabled backend serves, and `@default-extract-image` and `@default-premium` the first of the two OCR models, where all three named Azure Document Intelligence, which only the Pipelex Gateway and Pipelex Manifold serve. A `PipeExtract` step naming no model therefore runs on Manifold, on Mistral OCR with your own key, or, for a PDF, on its text layer read locally, which recovers no text from a scanned page; a project's managed `3_extract_deck.toml` takes the new aliases with `pipelex update`.+### Removed- **The builder: `pipelex-agent concept`, `pipelex-agent pipe`, `pipelex build runner` and `pipelex.builder` (Breaking)**: the two agent commands that converted a JSON concept or pipe spec into MTHDS TOML, and `pipelex build runner bundle` and `pipelex build runner method`, which wrote a Python script running a pipe, are gone with the spec layer behind them, `ConceptSpec`, `PipeSpec`, `PipelexBundleSpec` and the `ConceptSpecError`, `PipeSpecError` and `PipelexBundleSpecBlueprintError` classes; write a method in MTHDS directly and check it with `pipelex validate`, and take a runner's typed structures from `pipelex build structures` or `pipelex codegen types --target python-structures`. The `pipelex.builder` package no longer exists: the modules the runtime still uses moved, `pipelex.builder.conventions` to `pipelex.pipeline.default_file_names`, `pipelex.builder.operations.models_ops` to `pipelex.cogt.models.model_listing` and `pipelex.builder.operations.inputs_ops` to `pipelex.pipeline.inputs_template`, and the others are deleted with the helpers only they used, `force_include_dirs` on `pipelex.tools.misc.file_utils.find_files_in_dir` among them, which only forced the builder package into library loading. The `circular_dependency_error` validation error type, which only the spec layer's pipe sorter raised, leaves the `error_type` registry and the API server's OpenAPI schema.+- **The Pipelex Gateway backend is gone from the runtime (Breaking)**: `pipelex_gateway` leaves the shipped `backends.toml`, its `backends/pipelex_gateway.toml` override file and the generated `pipelex_gateway_models*.md` references leave the kit, the `all_pipelex_gateway` routing profile is gone, and the `pipelex-gateway` provider plugin is deleted along with its `gateway_*` SDKs, its error classes and their docs pages. A `backends.toml` that still carries a `[pipelex_gateway]` table loads it as an unknown backend with no plugin behind it, so remove the table; a routing profile naming it must move to another backend. The shipped default routing profile is now `all_enabled_backends`, which needs no Pipelex account: it sends each model to the first enabled backend that serves it, in the order its `fallback_order` lists. `pipelex init` pre-selects OpenAI, whose one key serves every default language-model and image-generation tier of the shipped model deck, and no longer sets `all_pipelex_gateway` when several backends are chosen; `pipelex-agent init` given no backend list keeps the template's routing profile rather than demanding a `primary_backend`. The `pipelex/pipelex-api` image enables `openai` in its place and boots on `OPENAI_API_KEY`, which serves every default language-model and image-generation tier of its deck. `pipelex_manifold` and every bring-your-own-keys backend are untouched.+- **The Gateway terms of service and the first-run check are gone (Breaking)**: `GatewayTermsNotAcceptedError`, the `[agreement]` section of `pipelex_service.toml`, `pipelex init agreement` and the `pipelex-agent accept-gateway-terms` command are removed, and `pipelex-agent init` no longer reads `accept_gateway_terms` from its config. The check that stopped a live run on a Pipelex-managed backend until inference setup had been recorded is removed as well, with `InferenceSetupRequiredError`, its CLI handling and `IntegrationMode.requires_terms_acceptance`, so a server, a container or a test suite boots with no `pipelex_service.toml` at all; `pipelex-agent init` still records `[onboarding] inference_setup_completed`, which nothing reads any more. A `pipelex_service.toml` written by an earlier release keeps booting: the migration ledger carries an entry that drops the retired section, and `pipelex migrate` rewrites the file.+- **The run-scoped telemetry identity applies to the one remaining stream**: `dev` grew `TelemetryIdentity` and `RunIdentityPolicy`, which resolve who a capture is attributed to from the run in flight, and wired them through both the operator's stream and the Pipelex one. With the Pipelex stream gone, the resolution stays and the second destination does not: the exception autocapture is one client again rather than two, `_track_to_pipelex` and the Pipelex span exporter are removed, and `_forget_posthog_capture_marks` — which existed only so the second stream could capture an error the first had already stamped — goes with them.+- **The Pipelex-owned telemetry stream is gone (Breaking)**: the runtime no longer reports to Pipelex's PostHog on the Gateway's behalf, so `GatewayApiKeyMissingError`, `GatewayDoNotTrackConflictError`, `GatewayTelemetryManagerInjectedError`, `TelemetryManagerAbstract.is_pipelex_telemetry_enabled`, `IntegrationMode.is_test_harness` and the maintainer-only `[pipelex_gateway]` section of `telemetry.toml` (with its `is_pipelex_gateway_portkey_*` knobs) are removed; `TelemetryFactory.make_telemetry_manager` and `TelemetryManager` take only the user's `telemetry_config`. The user's own opt-in telemetry under `[custom_posthog]`, `[langfuse]` and `[[otlp]]` is untouched, and the telemetry ledger carries the entry that drops the retired section.+- **`pipelex login` is gone (Breaking)**: it wrote a `PIPELEX_GATEWAY_API_KEY` that nothing reads any more, and it also leaves `_CORE_COMMAND_ORDER` and the setup-command set that skips the readiness check — an order list naming a command the CLI does not register makes `pipelex --help` itself exit non-zero. The credential flow for the hosted service is rebuilt separately.+- **The `check-gateway-models` and `update-gateway-models` dev commands are gone**, with their `make ugm` / `make cgm` aliases and the `ticc` config-coverage target that ran the Gateway's Portkey configs.+- **`RemoteConfig` declares no fields of its own**: `posthog`, `backend_model_specs` and `aws_region` are no longer read, so the artifact's sections all arrive through `extra="allow"` and `GatewayConfig` drops its `aws_region`. `PipelexRoutingProfile` and `PipelexBackend.GATEWAY` are removed, `resolve_model_specs_section` no longer hands any backend a section it did not declare, and `is_pipelex_gateway_enabled` is gone — `enabled_managed_gateway_sections` is the one question the boot asks.## [v0.72.0] - 2026-10-04diff --git a/Makefile b/Makefileindex c7cd6ccbd..e670554a1 100644--- a/Makefile+++ b/Makefile@@ -127,15 +127,11 @@ make generate-error-pages - Generate one docs page per PipelexError subclassmake gep - Shorthand -> generate-error-pagesmake generate-error-identity - Regenerate the committed PipelexError wire-identity snapshotmake gei - Shorthand -> generate-error-identity-make update-gateway-models - Update gateway models reference-make ugm - Shorthand -> update-gateway-models-make check-gateway-models - Check gateway models reference is up-to-date-make cgm - Shorthand -> check-gateway-modelsmake regenerate-test-models - Regenerate test model fixtures from backend configsmake rtm - Shorthand -> regenerate-test-modelsmake insert-skeleton - Insert skeleton from $(SKELETON_DIR)-make up - Shorthand -> generate-mthds-schema update-gateway-models up-kit-configs rules+make up - Shorthand -> generate-mthds-schema up-kit-configs rulesmake cleanenv - Remove virtual envmake cleanderived - Remove extraneous compiled files, caches, logs, etc.make cleanall - Remove all -> cleanenv + cleanderived@@ -168,7 +164,6 @@ make tp - Shorthand -> test-with-printsmake tb - Shorthand -> `make test-with-prints TEST=test_boot`make test-inference - Run unit tests only for inference (with prints)make ti - Shorthand -> test-inference-make ticc - Shorthand -> test config coverage (all Portkey configs)make tip - Shorthand -> test-inference-with-prints (parallelized inference tests)make test-llm - Run unit tests only for llm (with prints)make tl - Shorthand -> test-llm@@ -246,7 +241,7 @@ export HELPcheck-ledger cl check-migration-schemas cmig up-migration-schemas up-migration-schemas-force umig umigf \generate-error-pages generate-error-pages-quiet gep \generate-error-identity generate-error-identity-quiet gei \- update-gateway-models update-gateway-models-quiet ugm check-gateway-models cgm up \+ up \test-count check-test-badge \ts-toolchain test-ts-gates ttg \serve-graph serve-graph-bg stop-graph-server view-graph sg vg \@@ -520,23 +515,6 @@ generate-error-identity-quiet: envgei: generate-error-identity@echo "> done: gei = generate-error-identity"-update-gateway-models: env- $(call PRINT_TITLE,"Updating gateway models reference")- $(VENV_PIPELEX_DEV) update-gateway-models--update-gateway-models-quiet: env- $(VENV_PIPELEX_DEV) update-gateway-models --quiet--ugm: update-gateway-models- @echo "> done: ugm = update-gateway-models"--check-gateway-models: env- $(call PRINT_TITLE,"Checking gateway models reference is up-to-date")- $(VENV_PIPELEX_DEV) check-gateway-models --quiet--cgm: check-gateway-models- @echo "> done: cgm = check-gateway-models"-sync-main-config: env$(call PRINT_TITLE,"Syncing main config to kit and project configs")$(VENV_PIPELEX_DEV) sync-main-config --quiet@@ -818,12 +796,6 @@ tip: test-inference-with-printsti: test-inference-fast@echo "> done: ti-fast = test-inference-fast"-ticc: env- $(call PRINT_TITLE,"Config coverage inference testing")- @$(VENV_PIPELEX_DEV) preprocess-test-models --generate-fixtures --profile all_configs_gw --quiet- $(VENV_PYTEST) -n auto --pipe-run-mode live -m "inference" -s -rfE -k "TestConfigCoverage" $(if $(filter 1,$(VERBOSE)),-v,$(if $(filter 2,$(VERBOSE)),-vv,$(if $(filter 3,$(VERBOSE)),-vvv,)))- @echo "> done: ticc = test-inference config coverage (all Portkey configs)"-ti-dry: env$(call PRINT_TITLE,"Unit testing")@if [ -n "$(TEST)" ]; then \@@ -1301,17 +1273,17 @@ vg: view-graphc: check-keyword-only format lint pyright mypy@echo "> done: c = check"-cc: cleanderived regenerate-test-models-quiet generate-mthds-schema-quiet generate-corpus-vocabulary-quiet update-gateway-models-quiet c- @echo "> done: cc = cleanderived regenerate-test-models generate-mthds-schema generate-corpus-vocabulary update-gateway-models format lint pyright mypy"+cc: cleanderived regenerate-test-models-quiet generate-mthds-schema-quiet generate-corpus-vocabulary-quiet c+ @echo "> done: cc = cleanderived regenerate-test-models generate-mthds-schema generate-corpus-vocabulary format lint pyright mypy"# `up-migration-schemas` is deliberately NOT part of this aggregate. Every other regenerator here# rewrites a derived artifact from a live source; the migration head golden is a *proof obligation*# the coverage gate reads, so folding it into a habitual bulk regeneration would let a removal be# erased by muscle memory. Run `make umig` on purpose, and read its diff.-up: generate-mthds-schema-quiet generate-corpus-vocabulary-quiet update-gateway-models-quiet up-kit-configs rules- @echo "> done: up = generate-mthds-schema generate-corpus-vocabulary update-gateway-models up-kit-configs rules"+up: generate-mthds-schema-quiet generate-corpus-vocabulary-quiet up-kit-configs rules+ @echo "> done: up = generate-mthds-schema generate-corpus-vocabulary up-kit-configs rules"-check: cleanderived regenerate-test-models-quiet generate-mthds-schema-quiet update-gateway-models-quiet check-unused-imports check-config-sync check-rules check-urls check-gateway-models check-mthds-schema check-ledger check-migration-schemas check-keyword-only check-hub-layering check-rich-imports check-actions-allowlist drift-check format lint pyright mypy pylint+check: cleanderived regenerate-test-models-quiet generate-mthds-schema-quiet check-unused-imports check-config-sync check-rules check-urls check-mthds-schema check-ledger check-migration-schemas check-keyword-only check-hub-layering check-rich-imports check-actions-allowlist drift-check format lint pyright mypy pylint@echo "> done: check"agent-check: fix-unused-imports fix-keyword-only format lint pyright mypy check-ledger check-keyword-only check-hub-layering check-rich-imports check-actions-allowlist drift-check api-agent-checkdiff --git a/api/.env.example b/api/.env.exampleindex 6b19dad2c..178074fa2 100644--- a/api/.env.example+++ b/api/.env.example@@ -2,16 +2,17 @@# Required# ──────────────────────────────────────────────────────────────────────────────-# Pipelex Gateway API key — used by the API to call LLMs through Pipelex's-# unified inference layer. Get one at https://app.pipelex.com (free credits-# included).+# OpenAI API key — the image enables the `openai` backend, which serves every+# default language-model and image-generation tier of the bundled model deck.#-# This is the only credential needed *if* you keep the default routing profile.-# If you switch the inference backend in your Pipelex config to use OpenAI,-# Anthropic, Azure, Bedrock, etc. directly, you'll need that backend's own env-# vars instead. See https://docs.pipelex.com for backend configuration.+# This is the only credential needed *if* you keep the bundled backends. To use+# Anthropic, Azure, Bedrock, OpenRouter, etc. instead, mount your own+# `inference/backends.toml` override enabling them and set their own env vars.+# Search (Linkup) and OCR (Mistral) need that override to enable their backend as+# well as its key. Without OCR, document extraction reads a PDF's text layer only.+# See https://docs.pipelex.com/latest/api-server/configuration/ for the details.-PIPELEX_GATEWAY_API_KEY=+OPENAI_API_KEY=# ──────────────────────────────────────────────────────────────────────────────# Authentication (optional — defaults to AUTH_MODE=none)diff --git a/api/.pipelex/inference/backends.toml b/api/.pipelex/inference/backends.tomlindex 6d5dcb985..696711e7b 100644--- a/api/.pipelex/inference/backends.toml+++ b/api/.pipelex/inference/backends.toml@@ -14,11 +14,6 @@#####################################################################################################-[pipelex_gateway]-display_name = "⭐ Pipelex Gateway"-enabled = true # Enable after accepting terms via `pipelex init config`-api_key = "${PIPELEX_GATEWAY_API_KEY}"-# Pipelex Manifold is a closed private beta: leave it off unless you have been invited.[pipelex_manifold]display_name = "Pipelex Manifold (private beta)"@@ -93,7 +88,7 @@ endpoint = "http://localhost:11434/v1"[openai]display_name = "OpenAI"-enabled = false+enabled = trueapi_key = "${OPENAI_API_KEY}"[openrouter]diff --git a/api/.pipelex/inference/backends/pipelex_gateway.toml b/api/.pipelex/inference/backends/pipelex_gateway.tomldeleted file mode 100644index 5b02901ee..000000000--- a/api/.pipelex/inference/backends/pipelex_gateway.toml+++ /dev/null@@ -1,41 +0,0 @@-################################################################################-# Pipelex Gateway Local Overrides-################################################################################-#-# TELEMETRY NOTICE:-#-# Using Pipelex Gateway enables identified telemetry tied to your API key-# (hashed for security). This is independent from your telemetry.toml settings.-#-# We collect only technical data (model names, token counts, latency, error rates).-# We do NOT collect prompts, completions, pipe codes, or business data.-#-# This allows us to monitor service quality, enforce fair usage, and support you.-#-################################################################################-#-# WARNING: USE AT YOUR OWN RISK!-#-# The actual model configuration is fetched remotely from Pipelex servers.-# Any override in this file may cause unexpected behavior or failures,-# as the remote configuration may change at any time.-#-# If you must override, you may ONLY use these keys per model:-# - sdk-# - structure_method-#-# All other keys will be ignored.-#-# If you need custom configurations, consider using your own API keys-# with direct provider backends (openai, anthropic, etc.) instead.-#-# Documentation:-# https://docs.pipelex.com/latest/configuration/config-technical/inference-backend-config/-# Support: https://go.pipelex.com/discord-#-################################################################################--# Per-model overrides example:-# [gpt-4o]-# sdk = "gateway_completions"-# structure_method = "instructor/openai_tools"diff --git a/api/.pipelex/inference/backends/pipelex_gateway_models.md b/api/.pipelex/inference/backends/pipelex_gateway_models.mddeleted file mode 100644index c0acba8cf..000000000--- a/api/.pipelex/inference/backends/pipelex_gateway_models.md+++ /dev/null@@ -1,513 +0,0 @@-# Pipelex Gateway — Available Models-This file lists the LLMs, document extraction models, and image generation models currently available through Pipelex Gateway.-For configuration details, see the [documentation](https://docs.pipelex.com/latest/setup/configure-ai-providers/#option-1-pipelex-gateway-easiest-and-most-powerful-for-getting-started).--## Language Models (LLM)--<table>-<thead>-<tr>-<th rowspan="2">Model</th>-<th colspan="3" style="text-align:center;background-color:rgba(33,150,243,0.15)">Inputs</th>-<th colspan="2" style="text-align:center;background-color:rgba(76,175,80,0.15)">Outputs</th>-</tr>-<tr>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">text</th>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">images</th>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">pdf</th>-<th style="text-align:center;background-color:rgba(76,175,80,0.15)">text</th>-<th style="text-align:center;background-color:rgba(76,175,80,0.15)">structured</th>-</tr>-</thead>-<tbody>-<tr>-<td>claude-4-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4-sonnet</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.1-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.5-haiku</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.5-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.5-sonnet</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.6-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.6-sonnet</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.7-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.8-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-5-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-5-sonnet</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>deepseek-v3.2</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-2.5-flash</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-2.5-flash-lite</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-2.5-pro</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-3.0-flash</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-3.1-flash-lite</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-3.1-pro</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-3.5-flash</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-flash-latest</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-flash-lite-latest</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-pro-latest</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-4o</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-4o-mini</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.3-codex</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.4</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.4-mini</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.4-nano</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.4-pro</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.5</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.6-luna</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.6-sol</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.6-terra</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-oss-120b</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-oss-20b</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>grok-3</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-<tr>-<td>grok-3-mini</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-<tr>-<td>grok-4</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>grok-4-fast-non-reasoning</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>grok-4-fast-reasoning</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>kimi-k2-thinking</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>mistral-large</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>phi-4</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-<tr>-<td>phi-4-multimodal</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-<tr>-<td>qwen3-vl-235b-a22b</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-</tbody>-</table>--## Document Extraction Models--<table>-<thead>-<tr>-<th rowspan="2">Model</th>-<th colspan="3" style="text-align:center;background-color:rgba(33,150,243,0.15)">Inputs</th>-<th colspan="2" style="text-align:center;background-color:rgba(76,175,80,0.15)">Outputs</th>-</tr>-<tr>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">image</th>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">pdf</th>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">web_page</th>-<th style="text-align:center;background-color:rgba(76,175,80,0.15)">pages</th>-<th style="text-align:center;background-color:rgba(76,175,80,0.15)">captions</th>-</tr>-</thead>-<tbody>-<tr>-<td>azure-document-intelligence</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>deepseek-ocr</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-<tr>-<td>linkup-fetch</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-</tbody>-</table>---!!! info About extracted pages- Each page contains Markdown text (based on AI-interpreted layout) and optional extracted images. A single image input is treated as one page. Pipelex also wraps the `pypdfium2` library for raw text (without any AI interpretation) and images extraction and page views rendering. All these elements can be used as inputs into downstream pipes, including LLM prompts.-## Image Generation Models--<table>-<thead>-<tr>-<th rowspan="2">Model</th>-<th colspan="2" style="text-align:center;background-color:rgba(33,150,243,0.15)">Inputs</th>-<th colspan="1" style="text-align:center;background-color:rgba(76,175,80,0.15)">Outputs</th>-</tr>-<tr>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">text</th>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">images</th>-<th style="text-align:center;background-color:rgba(76,175,80,0.15)">image</th>-</tr>-</thead>-<tbody>-<tr>-<td>gpt-image-1</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-image-1-mini</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-image-1.5</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-image-2</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>nano-banana</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>nano-banana-2</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>nano-banana-2-lite</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>nano-banana-pro</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-</tbody>-</table>---> **AUTO-GENERATED FILE** - Do not edit manually.-> Last updated: 2026-09-21T10:54:05Z->-> Run `pipelex-dev update-gateway-models` or `make ugm` to regenerate.\ No newline at end of filediff --git a/api/.pipelex/inference/backends/pipelex_gateway_models_plain.md b/api/.pipelex/inference/backends/pipelex_gateway_models_plain.mddeleted file mode 100644index 9ea4543d5..000000000--- a/api/.pipelex/inference/backends/pipelex_gateway_models_plain.md+++ /dev/null@@ -1,195 +0,0 @@-# Pipelex Gateway — Available Models (Plain Text)--This file lists the LLMs, document extraction models, and image generation models currently available through Pipelex Gateway.-For configuration details, see the [documentation](https://docs.pipelex.com/latest/setup/configure-ai-providers/#option-1-pipelex-gateway-easiest-and-most-powerful-for-getting-started).--**Note:** This is the plain-text readable version. See `pipelex_gateway_models.md` for the HTML-styled version.--## Language Models (LLM)--- **claude-4-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4-sonnet**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.1-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.5-haiku**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.5-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.5-sonnet**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.6-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.6-sonnet**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.7-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.8-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-5-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-5-sonnet**- - inputs: text, images, pdf- - outputs: text, structured-- **deepseek-v3.2**- - inputs: text- - outputs: text, structured-- **gemini-2.5-flash**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-2.5-flash-lite**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-2.5-pro**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-3.0-flash**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-3.1-flash-lite**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-3.1-pro**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-3.5-flash**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-flash-latest**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-flash-lite-latest**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-pro-latest**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-4o**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-4o-mini**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.3-codex**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.4**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.4-mini**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.4-nano**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.4-pro**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.5**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.6-luna**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.6-sol**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.6-terra**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-oss-120b**- - inputs: text- - outputs: text, structured-- **gpt-oss-20b**- - inputs: text- - outputs: text, structured-- **grok-3**- - inputs: text- - outputs: text-- **grok-3-mini**- - inputs: text- - outputs: text-- **grok-4**- - inputs: text- - outputs: text, structured-- **grok-4-fast-non-reasoning**- - inputs: text, images- - outputs: text, structured-- **grok-4-fast-reasoning**- - inputs: text, images- - outputs: text, structured-- **kimi-k2-thinking**- - inputs: text- - outputs: text, structured-- **mistral-large**- - inputs: text, images, pdf- - outputs: text, structured-- **phi-4**- - inputs: text- - outputs: text-- **phi-4-multimodal**- - inputs: text, images- - outputs: text-- **qwen3-vl-235b-a22b**- - inputs: text, images- - outputs: text, structured--## Document Extraction Models--- **azure-document-intelligence**- - inputs: image, pdf- - outputs: pages, captions-- **deepseek-ocr**- - inputs: image- - outputs: pages-- **linkup-fetch**- - inputs: web_page- - outputs: pages---**About extracted pages:** Each page contains Markdown text (based on AI-interpreted layout) and optional extracted images. A single image input is treated as one page. Pipelex also wraps the `pypdfium2` library for raw text (without any AI interpretation) and images extraction and page views rendering. All these elements can be used as inputs into downstream pipes, including LLM prompts.--## Image Generation Models--- **gpt-image-1**- - inputs: text, images- - outputs: image-- **gpt-image-1-mini**- - inputs: text, images- - outputs: image-- **gpt-image-1.5**- - inputs: text, images- - outputs: image-- **gpt-image-2**- - inputs: text, images- - outputs: image-- **nano-banana**- - inputs: text, images- - outputs: image-- **nano-banana-2**- - inputs: text, images- - outputs: image-- **nano-banana-2-lite**- - inputs: text, images- - outputs: image-- **nano-banana-pro**- - inputs: text, images- - outputs: image---> **AUTO-GENERATED FILE** - Do not edit manually.-> Last updated: 2026-09-21T10:54:05Z->-> Run `pipelex-dev update-gateway-models` or `make ugm` to regenerate.\ No newline at end of filediff --git a/api/.pipelex/inference/backends/pipelex_manifold.toml b/api/.pipelex/inference/backends/pipelex_manifold.tomlindex 1a9adc718..d2130ec85 100644--- a/api/.pipelex/inference/backends/pipelex_manifold.toml+++ b/api/.pipelex/inference/backends/pipelex_manifold.toml@@ -12,18 +12,13 @@## TELEMETRY NOTICE:#-# Enabling pipelex_gateway alongside this backend enables identified telemetry-# from your machine, tied to your Pipelex Gateway API key (hashed for security).-# This is independent from your telemetry.toml settings.-#-# That client-side telemetry follows the gateway key and nothing else, so an-# installation running Pipelex Manifold ALONE sends none of it. Manifold is a-# Pipelex-operated service, though, so your usage of it is recorded server-side-# the way any hosted platform records the calls it serves.-#-# Either way we collect only technical data (model names, token counts, latency,-# error rates). We do NOT collect prompts, completions, pipe codes, or business-# data.+# This backend sends no telemetry from your machine: the runtime's only+# telemetry stream is the one you configure yourself in telemetry.toml.+# Manifold is a Pipelex-operated service, though, so your usage of it is+# recorded server-side the way any hosted platform records the calls it serves.+#+# We collect only technical data (model names, token counts, latency, error+# rates). We do NOT collect prompts, completions, pipe codes, or business data.## This allows us to monitor service quality, enforce fair usage, and support you.#diff --git a/api/.pipelex/inference/deck/3_extract_deck.toml b/api/.pipelex/inference/deck/3_extract_deck.tomlindex c67d393f1..c5e474a91 100644--- a/api/.pipelex/inference/deck/3_extract_deck.toml+++ b/api/.pipelex/inference/deck/3_extract_deck.toml@@ -31,13 +31,29 @@ choice_default = "@default-extract-document"####################################################################################################[extract.aliases]-default-premium = "azure-document-intelligence"-default-extract-document = "azure-document-intelligence"-default-extract-image = "azure-document-intelligence"+default-premium = "~ocr-extractor"+default-extract-document = "~document-extractor"+default-extract-image = "~ocr-extractor"default-text-from-pdf = "pypdfium2-extract-pdf"default-no-inference = "pypdfium2-extract-pdf"default-extract-web-page = "linkup-fetch"+####################################################################################################+# Waterfalls+####################################################################################################+#+# Each default resolves to the first entry an enabled backend serves: Azure Document Intelligence+# through Pipelex Manifold, then Mistral OCR with your own Mistral key. Documents fall back last to+# reading a PDF's text layer locally, which needs no key but recovers no text from a scanned page.++[extract.waterfalls]+document-extractor = [+ "azure-document-intelligence",+ "mistral-ocr",+ "pypdfium2-extract-pdf",+]+ocr-extractor = ["azure-document-intelligence", "mistral-ocr"]+##################################################################################################### Extract Presets####################################################################################################diff --git a/api/.pipelex/inference/deck/6_judgment_deck.toml b/api/.pipelex/inference/deck/6_judgment_deck.tomlindex 01e45b3c5..5fec6dd59 100644--- a/api/.pipelex/inference/deck/6_judgment_deck.toml+++ b/api/.pipelex/inference/deck/6_judgment_deck.toml@@ -26,7 +26,7 @@## There is deliberately no `choice_default` here, and that is what tells you no judgment model is# served out of the box: a judgment backend is one you bring, so a pipe names the model it judges-# with until the Pipelex Gateway serves the family. Set one here once you have a backend configured.+# with. Set one here once you have a backend configured.[judgment]diff --git a/api/.pipelex/inference/deck/x_custom_extract_deck.toml b/api/.pipelex/inference/deck/x_custom_extract_deck.tomlindex 24fc260ee..5d4c46442 100644--- a/api/.pipelex/inference/deck/x_custom_extract_deck.toml+++ b/api/.pipelex/inference/deck/x_custom_extract_deck.toml@@ -5,10 +5,10 @@# This file allows you to override or complete the base model decks.## ADVANCED USERS ONLY: This file is for users who bring their own API keys and connect directly-# to AI providers (Azure, Mistral, etc.) without using the Pipelex Gateway.+# to AI providers (Azure, Mistral, etc.) and want to tune their own catalog.#-# If you're using the standard Pipelex Gateway setup, you don't need to modify this file.-# The Gateway handles model routing automatically and supports all available models.+# If the shipped backend catalogs cover your needs, you don't need to modify this file.+# The routing profile picks a backend for every model the enabled backends serve.## Waterfalls are useful when using multiple backends directly - they define ordered lists# of models that are resolved at configuration time based on which backends are available.diff --git a/api/.pipelex/inference/deck/x_custom_llm_deck.toml b/api/.pipelex/inference/deck/x_custom_llm_deck.tomlindex d751552d1..0c7833c63 100644--- a/api/.pipelex/inference/deck/x_custom_llm_deck.toml+++ b/api/.pipelex/inference/deck/x_custom_llm_deck.toml@@ -5,10 +5,10 @@# This file allows you to override or complete the base model decks.## ADVANCED USERS ONLY: This file is for users who bring their own API keys and connect directly-# to AI providers (OpenAI, Anthropic, Google, etc.) without using the Pipelex Gateway.+# to AI providers (OpenAI, Anthropic, Google, etc.) and want to tune their own catalog.#-# If you're using the standard Pipelex Gateway setup, you don't need to modify this file.-# The Gateway handles model routing automatically and supports all available models.+# If the shipped backend catalogs cover your needs, you don't need to modify this file.+# The routing profile picks a backend for every model the enabled backends serve.## Waterfalls are useful when using multiple backends directly - they define ordered lists# of models that are resolved at configuration time based on which backends are available.diff --git a/api/.pipelex/inference/routing_profiles.toml b/api/.pipelex/inference/routing_profiles.tomlindex 25619b1ee..c11082327 100644--- a/api/.pipelex/inference/routing_profiles.toml+++ b/api/.pipelex/inference/routing_profiles.toml@@ -12,30 +12,49 @@# which routing profile you select. See the documentation for details.# Which profile to use (change this to switch routing)-active = "all_pipelex_gateway"+active = "all_enabled_backends"-# We recommend using the "all_pipelex_gateway" profile to get a head start with all models.-# To use the Pipelex Gateway backend:-# 1. Get your API key at https://app.pipelex.com (free credits included)-# 2. Add it to your .env file: PIPELEX_GATEWAY_API_KEY=your-key-here-# 3. Run `pipelex init` and accept the Gateway terms of service+# The default profile needs no Pipelex account: it routes each model to the first enabled backend+# that serves it, in the order its `fallback_order` lists. `pipelex init` narrows this to the+# backend you configure (`all_<backend>`). The model deck's default tiers point at OpenAI models,+# which `openai` and `azure_openai` serve: with any other single backend, repoint the deck's+# aliases at models it serves in `deck/x_custom_llm_deck.toml`.# =========================================================================================# Routing Profiles# =========================================================================================-[profiles.all_pipelex_gateway]-description = "Use Pipelex Gateway for all its supported models"-default = "pipelex_gateway"--# Judgment models are brought by you rather than served by Pipelex, so they go to their own backend-# whenever it is enabled. An optional route is inert while its backend is disabled.-[profiles.all_pipelex_gateway.optional_routes]+[profiles.all_enabled_backends]+description = "Route each model to the first enabled backend that serves it, in this order"+fallback_order = [+ "openai",+ "anthropic",+ "google",+ "mistral",+ "bedrock",+ "azure_openai",+ "xai",+ "groq",+ "fal",+ "huggingface",+ "linkup",+ "openrouter",+ "portkey",+ "blackboxai",+ "minimax",+ "scaleway",+ "ollama",+ "vertexai",+ "pipelex_manifold",+]++# Judgment models are served by their own backend alone, so they go to it whenever it is enabled.+# An optional route is inert while its backend is disabled.+[profiles.all_enabled_backends.optional_routes]"jev-*" = "typesafe"-# The same model names, served by the Pipelex-operated inference service instead. Switching between-# this profile and the one above needs no other edit: a model's wire id and sdk are per-backend, so-# decks, aliases and presets keep naming the same handles.+# The Pipelex-operated inference service (private beta). A model's wire id and sdk are per-backend,+# so decks, aliases and presets keep naming the same handles whichever profile is active.[profiles.all_pipelex_manifold]description = "Use Pipelex Manifold (private beta) for all its supported models"default = "pipelex_manifold"@@ -146,7 +165,7 @@ default = "internal"# =========================================================================================[profiles.example_routing_using_patterns]description = "Example routing profile using patterns"-default = "pipelex_gateway"+default = "openrouter"[profiles.example_routing_using_patterns.routes]# Pattern matching: "model-pattern" = "backend-name"@@ -166,17 +185,17 @@ default = "pipelex_gateway"description = "Example routing profile using specific models"[profiles.example_routing_using_specific_models.routes]-"gpt-5.4-nano" = "pipelex_gateway"+"gpt-5.4-nano" = "openrouter""gpt-4o-mini" = "blackboxai""gpt-5.4-mini" = "openai""gpt-5.5" = "azure_openai"-"claude-4-sonnet" = "pipelex_gateway"+"claude-4-sonnet" = "openrouter""claude-3.7-sonnet" = "blackboxai"-"gemini-2.5-flash-lite" = "pipelex_gateway"+"gemini-2.5-flash-lite" = "openrouter""gemini-2.5-flash" = "blackboxai""gemini-2.5-pro" = "vertexai"-"grok-3" = "pipelex_gateway"+"grok-3" = "openrouter""grok-3-mini" = "xai"diff --git a/api/.pipelex/pipelex_service.toml b/api/.pipelex/pipelex_service.tomldeleted file mode 100644index afe39a2bd..000000000--- a/api/.pipelex/pipelex_service.toml+++ /dev/null@@ -1,19 +0,0 @@-####################################################################################################-# Pipelex Service Configuration-####################################################################################################-#-# This file stores settings related to Pipelex managed services.-# Currently used for Pipelex Gateway terms acceptance.-#-# Documentation: https://docs.pipelex.com-# Support: https://go.pipelex.com/discord-#-####################################################################################################--[agreement]-# Set to true after accepting Pipelex terms of service.-terms_accepted = true--# Note: when using pipelex_gateway, telemetry is enabled to monitor service usage.-# We collect technical data (model, pipe type...) and quantitative data (token counts...)-# but NOT your content, pipe codes, or output class names.diff --git a/api/.pipelex/telemetry.toml b/api/.pipelex/telemetry.tomlindex ed9a90901..0f7603300 100644--- a/api/.pipelex/telemetry.toml+++ b/api/.pipelex/telemetry.toml@@ -5,10 +5,7 @@# This file controls YOUR custom telemetry settings for observability and analytics.# Configure your own PostHog, Langfuse, or OTLP-compatible backends here.#-# NOTE: When using Pipelex Gateway, identified telemetry is automatically enabled-# (tied to your Gateway API key, hashed for security). This allows us to monitor-# service quality, enforce fair usage, and provide you with better support.-# Gateway telemetry operates independently from your settings below - you can have both!+# Everything below is off unless you turn it on, and nothing here reports to Pipelex.## To disable all telemetry, set the DO_NOT_TRACK=1 environment variable.#diff --git a/api/Dockerfile b/api/Dockerfileindex 935201269..9f6ad6c42 100644--- a/api/Dockerfile+++ b/api/Dockerfile@@ -52,7 +52,7 @@ WORKDIR /appCOPY --from=builder /app/.venv /app/.venvENV PATH="/app/.venv/bin:${PATH}"-# ─── Pipelex global config (terms acceptance, backends) ────────────────────────+# ─── Pipelex global config (backends, routing, telemetry) ──────────────────────# The server's bundled config becomes ~/.pipelex (the global config dir), and no project-level# .pipelex exists in the image, so users mounting overrides into /root/.pipelex aren't shadowed.# See docs/api-server/configuration.md at the repository root.diff --git a/api/Makefiles/Makefile.local.mk b/api/Makefiles/Makefile.local.mkindex 1f259dba8..26870fcd3 100644--- a/api/Makefiles/Makefile.local.mk+++ b/api/Makefiles/Makefile.local.mk@@ -59,7 +59,7 @@ docker-build:docker build --platform linux/amd64 -f $(CURDIR)/Dockerfile -t $(LOCAL_IMAGE) $(WORKSPACE_ROOT)# Run the API on http://localhost:8081, foreground. Reads all env from .env.-# Required: PIPELEX_GATEWAY_API_KEY (only if you use the default routing profile).+# Required: OPENAI_API_KEY (only if you keep the bundled backends).# Optional: AUTH_MODE, API_KEY, JWT_SECRET_KEY (see .env.example).docker-run: docker-build@docker rm -f $(CONTAINER_NAME) 2>/dev/null || true@@ -71,7 +71,7 @@ docker-run: docker-build# Pull and run the PUBLISHED image from Docker Hub — no local checkout/build needed.# Same env contract as docker-run (reads all env from .env).-# Required: PIPELEX_GATEWAY_API_KEY (only if you use the default routing profile).+# Required: OPENAI_API_KEY (only if you keep the bundled backends).# Optional: AUTH_MODE, API_KEY, JWT_SECRET_KEY (see .env.example).# Override the published tag with HUB_TAG, e.g. make docker-run-hub HUB_TAG=0.5.0docker-run-hub:@@ -87,7 +87,7 @@ docker-run-hub:# Boot an image and check that it serves: `/health` answers, and `/v1/version` reports this# repository's version for both the server and the pipelex it runs, which is the lockstep the release# promises. Pull-request CI runs it on the image `docker-build` made, and `deploy-docker-hub` runs it-# on the image it is about to push. The gateway key is a placeholder: boot requires one, and neither+# on the image it is about to push. The OpenAI key is a placeholder: boot requires one, and neither# route reaches a provider. SMOKE_IMAGE=<tag> names another image.SMOKE_IMAGE ?= $(LOCAL_IMAGE)SMOKE_CONTAINER ?= pipelex-api-smoke@@ -99,7 +99,7 @@ docker-smoke:@docker rm -f $(SMOKE_CONTAINER) >/dev/null 2>&1 || true@docker run --detach --platform linux/amd64 --name $(SMOKE_CONTAINER) \-p 127.0.0.1:$(SMOKE_PORT):8081 \- -e PIPELEX_GATEWAY_API_KEY=smoke-test-placeholder \+ -e OPENAI_API_KEY=smoke-test-placeholder \$(SMOKE_IMAGE) >/dev/null@healthy=""; \for attempt in $$(seq 1 $(SMOKE_TIMEOUT)); do \diff --git a/api/README.md b/api/README.mdindex 0d49a53d7..04a01e408 100644--- a/api/README.md+++ b/api/README.md@@ -43,15 +43,15 @@ It is the source-available reference implementation of the **[MTHDS Protocol](ht**Official Docker image available at:** [`pipelex/pipelex-api`](https://hub.docker.com/r/pipelex/pipelex-api)-The published image is **generic and configuration-light**: Temporal is off, no S3, no remote tracing. It boots with a single required env var (`PIPELEX_GATEWAY_API_KEY`), and you bring your own [Pipelex configuration](https://docs.pipelex.com/latest/api-server/configuration/) on top to enable storage, tracing, Temporal, or anything else.+The published image is **generic and configuration-light**: Temporal is off, no S3, no remote tracing. It boots with a single required env var (`OPENAI_API_KEY`), and you bring your own [Pipelex configuration](https://docs.pipelex.com/latest/api-server/configuration/) on top to enable storage, tracing, Temporal, or anything else.### 1. Run with Docker-The only required env var is `PIPELEX_GATEWAY_API_KEY`. Get a free key (with free credits) at https://app.pipelex.com, then run:+The only required env var is `OPENAI_API_KEY`: the image enables the `openai` backend, which serves every default language-model and image-generation tier of its model deck. To run on another provider instead, mount a backends override, as the [Configuration page](https://docs.pipelex.com/latest/api-server/configuration/) shows. Then run:```bashdocker run --name pipelex-api -p 8081:8081 \- -e PIPELEX_GATEWAY_API_KEY=your-pipelex-gateway-api-key \+ -e OPENAI_API_KEY=your-openai-api-key \pipelex/pipelex-api:latest```diff --git a/api/pipelex_api/schemas/models.py b/api/pipelex_api/schemas/models.pyindex c92ba9083..8fbf31574 100644--- a/api/pipelex_api/schemas/models.py+++ b/api/pipelex_api/schemas/models.py@@ -263,9 +263,8 @@ _ANALYTICS_GROUPS_DESCRIPTION = ('telemetry belongs to, as a mapping of group type to group key (e.g. `{"organization": "org_acme"}`). '"The runtime never reads a key by name: it carries the mapping on the run as its `extras` and stamps it on every span as ""`pipelex.run.extras`, so every OpenTelemetry exporter receives it, and the deployment's own "- "PostHog stream, in `identified` mode, forwards it as the capture's groups. What Pipelex's own Gateway telemetry "- "stream receives is the runtime's decision, not this server's: the pinned runtime attributes it the same way, "- "with the run's `user_id` and these groups. Group types are lowercase snake_case starting with a letter, at most 32 characters; group keys "+ "PostHog stream, in `identified` mode, forwards it as the capture's groups. "+ "Group types are lowercase snake_case starting with a letter, at most 32 characters; group keys ""are 1 to 128 characters from `[A-Za-z0-9_-]`; at most five entries. Omit it and the run belongs to no ""group, which is right for a single-tenant deployment.")diff --git a/api/tests/unit/test_sync_vendored_kit.py b/api/tests/unit/test_sync_vendored_kit.pyindex 82ff1eea9..620af8361 100644--- a/api/tests/unit/test_sync_vendored_kit.py+++ b/api/tests/unit/test_sync_vendored_kit.py@@ -79,9 +79,9 @@ enabled = falseassert plan.drifts == []assert plan.is_clean- def test_committed_tree_enables_the_gateway(self) -> None:+ def test_committed_tree_enables_openai(self) -> None:switches: dict[str, bool] = sync_vendored_kit.read_enabled_switches(_VENDORED_CONFIG_DIR / "inference" / "backends.toml")- assert switches["pipelex_gateway"] is True+ assert switches["openai"] is Trueassert switches["internal"] is Truedef test_a_table_without_a_switch_is_read_as_on(self, tmp_path: Path) -> None:@@ -102,10 +102,10 @@ enabled = false("backends_toml_text", "reason"),[(None, "is missing"),- ("[pipelex_gateway\nenabled = true\n", "is not valid TOML"),+ ("[acme\nenabled = true\n", "is not valid TOML"),("", "holds no backend table"),- ("[pipelex_gateway]\nenabled = 'yes'\n", "is not a boolean"),- ("[pipelex_gateway]\nenabled = true\n", "has no table for"),+ ("[openai]\nenabled = 'yes'\n", "is not a boolean"),+ ("[openai]\nenabled = true\n", "has no table for"),],)def test_sync_stops_when_the_switch_record_is_unusable(self, vendored_copy: Path, backends_toml_text: str | None, reason: str) -> None:diff --git a/docs/api-server/configuration.md b/docs/api-server/configuration.mdindex 6a0d2d00a..d3eb6639b 100644--- a/docs/api-server/configuration.md+++ b/docs/api-server/configuration.md@@ -4,18 +4,19 @@ This page covers how to configure the **Docker image** — the env vars it needsFor the syntax and meaning of Pipelex config itself (storage backends, tracing, inference routing, model decks, …), see the official Pipelex documentation: **https://docs.pipelex.com**. This page does not duplicate that.-> **The official `pipelex/pipelex-api` image is generic and orchestrator-agnostic.** It runs every pipeline **in-process** (no distributed orchestrator), with no S3, no remote tracing, and the Pipelex Gateway as the only enabled inference backend. Anything environment-specific is meant to be supplied by you, on top of the image, via a mounted `.pipelex/` override file. Distributed execution (Temporal, Mistral Workflows, …) is **not** built in — it is added by installing exactly one orchestrator plugin on top of this base to produce a deployment *flavor* (see "Execution mode" below).+> **The official `pipelex/pipelex-api` image is generic and orchestrator-agnostic.** It runs every pipeline **in-process** (no distributed orchestrator), with no S3, no remote tracing, and `openai` as the only enabled model provider. Anything environment-specific is meant to be supplied by you, on top of the image, via a mounted `.pipelex/` override file. Distributed execution (Temporal, Mistral Workflows, …) is **not** built in — it is added by installing exactly one orchestrator plugin on top of this base to produce a deployment *flavor* (see "Execution mode" below).## Environment variablesThe API reads its settings from environment variables. With Docker, the easiest way is a `.env` file:```bash-# Pipelex Gateway API key — used to call LLMs through Pipelex's inference layer.-# Required only if you keep the default routing profile. If you reconfigure-# Pipelex to call providers directly (OpenAI, Anthropic, Bedrock, …), you'll+# OpenAI API key — the image enables the openai backend, which serves every+# default language-model and image-generation tier of its model deck.+# Required only if you keep the bundled backends. If you enable other providers+# (Anthropic, Bedrock, OpenRouter, …) in a mounted backends override, you'll# need those providers' own env vars instead — see https://docs.pipelex.com.-PIPELEX_GATEWAY_API_KEY=your-pipelex-gateway-key+OPENAI_API_KEY=your-openai-api-key# Authentication for the API itself (optional — defaults to AUTH_MODE=none)AUTH_MODE=none # one of: none | api_key | jwt@@ -66,7 +67,7 @@ You have three idiomatic options. Pick whichever fits your workflow — they all```bash# .env-PIPELEX_GATEWAY_API_KEY=your-pipelex-gateway-key+OPENAI_API_KEY=your-openai-api-keyMAX_REQUEST_BODY_MIB=200AUTH_MODE=api_keyAPI_KEY=your-strong-secret@@ -80,7 +81,7 @@ docker run --name pipelex-api -p 8081:8081 --env-file .env pipelex/pipelex-api:l```bashdocker run --name pipelex-api -p 8081:8081 \- -e PIPELEX_GATEWAY_API_KEY=your-pipelex-gateway-key \+ -e OPENAI_API_KEY=your-openai-api-key \-e MAX_REQUEST_BODY_MIB=200 \pipelex/pipelex-api:latest```@@ -116,7 +117,7 @@ The Pipelex runtime loads `.toml` config files in a layered, deep-merged order.In the official Docker image, the server's `.pipelex/` directory (`api/.pipelex/` in the pipelex repository) is copied to `/root/.pipelex` at build time, and the image holds no project-level `.pipelex/`. That means **`/root/.pipelex/` is the single config dir the runtime reads from**, and any file you mount there participates in the layering above. To override anything, you only need to provide the keys you want to change — the layering does the rest.-**The inference tree the image ships is the defaults of the `pipelex` it runs.** The image is released together with `pipelex`, under the same version, and every file under `inference/backends/`, the routing profiles and the numbered model deck files are that release's defaults, unchanged, so the models an own-key backend offers are the ones that `pipelex` lists: read `api/.pipelex/inference/backends/<backend>.toml` in the pipelex repository at the image's tag to see them. Only two things are this image's own choice: the `enabled` switches in `inference/backends.toml`, which leave the Pipelex Gateway and the software-only `internal` backend on and every own-key backend off, and the `x_custom_*` deck overrides. A copy of `inference/backends.toml` you mount yourself therefore keeps the backend list of the release you took it from, so take it again when you move to a newer image.+**The inference tree the image ships is the defaults of the `pipelex` it runs.** The image is released together with `pipelex`, under the same version, and every file under `inference/backends/`, the routing profiles and the numbered model deck files are that release's defaults, unchanged, so the models an own-key backend offers are the ones that `pipelex` lists: read `api/.pipelex/inference/backends/<backend>.toml` in the pipelex repository at the image's tag to see them. Only two things are this image's own choice: the `enabled` switches in `inference/backends.toml`, which leave `openai` and the software-only `internal` backend on and every other backend off, and the `x_custom_*` deck overrides. A copy of `inference/backends.toml` you mount yourself therefore keeps the backend list of the release you took it from, so take it again when you move to a newer image. The numbered deck points its default language-model and image-generation tiers at models that only `openai` and `azure_openai` serve, so a deployment that runs on another provider also repoints those aliases in an `x_custom_llm_deck.toml` override of its own.For the schema and meaning of every key in these files, see https://docs.pipelex.com.@@ -233,7 +234,7 @@ docker run --name pipelex-api -p 8081:8081 \`.env`:```bash-PIPELEX_GATEWAY_API_KEY=your-pipelex-gateway-key+OPENAI_API_KEY=your-openai-api-key````docker-compose.yml`:diff --git a/docs/api-server/index.md b/docs/api-server/index.mdindex a57ca87fc..a3167987e 100644--- a/docs/api-server/index.md+++ b/docs/api-server/index.md@@ -42,11 +42,11 @@ Deploy the Pipelex API anywhere that runs Docker (your laptop, ECS, Cloud Run, K### 1. Run with Docker-The only required env var is `PIPELEX_GATEWAY_API_KEY`. Get a free key (with free credits) at https://app.pipelex.com — it's the default path to LLMs and gives you access to every supported model with a single credential. (If you'd rather call providers like OpenAI, Anthropic, Bedrock, or Vertex directly, you reconfigure that on the Pipelex side, not here — see https://docs.pipelex.com.)+The only required env var is `OPENAI_API_KEY`. The image enables the `openai` backend, which serves every default language-model and image-generation tier of its model deck. To call another provider instead, such as Anthropic, Bedrock, Vertex or OpenRouter, mount your own backends override, as the [Configuration](configuration.md) page shows.```bashdocker run --name pipelex-api -p 8081:8081 \- -e PIPELEX_GATEWAY_API_KEY=your-pipelex-gateway-api-key \+ -e OPENAI_API_KEY=your-openai-api-key \pipelex/pipelex-api:latest```diff --git a/docs/api-server/openapi/pipelex-api.openapi.yaml b/docs/api-server/openapi/pipelex-api.openapi.yamlindex 140447519..ed943eeed 100644--- a/docs/api-server/openapi/pipelex-api.openapi.yaml+++ b/docs/api-server/openapi/pipelex-api.openapi.yaml@@ -217,11 +217,9 @@ paths:telemetry belongs to, as a mapping of group type to group key (e.g. `{"organization": "org_acme"}`). Theruntime never reads a key by name: it carries the mapping on the run as its `extras` and stamps it onevery span as `pipelex.run.extras`, so every OpenTelemetry exporter receives it, and the deployment''s- own PostHog stream, in `identified` mode, forwards it as the capture''s groups. What Pipelex''s own Gateway- telemetry stream receives is the runtime''s decision, not this server''s: the pinned runtime attributes- it the same way, with the run''s `user_id` and these groups. Group types are lowercase snake_case starting- with a letter, at most 32 characters; group keys are 1 to 128 characters from `[A-Za-z0-9_-]`; at most- five entries. Omit it and the run belongs to no group, which is right for a single-tenant deployment.'+ own PostHog stream, in `identified` mode, forwards it as the capture''s groups. Group types are lowercase+ snake_case starting with a letter, at most 32 characters; group keys are 1 to 128 characters from `[A-Za-z0-9_-]`;+ at most five entries. Omit it and the run belongs to no group, which is right for a single-tenant deployment.'additionalProperties: truetype: objecttitle: PipelexApiExecuteRequest@@ -492,11 +490,9 @@ paths:telemetry belongs to, as a mapping of group type to group key (e.g. `{"organization": "org_acme"}`). Theruntime never reads a key by name: it carries the mapping on the run as its `extras` and stamps it onevery span as `pipelex.run.extras`, so every OpenTelemetry exporter receives it, and the deployment''s- own PostHog stream, in `identified` mode, forwards it as the capture''s groups. What Pipelex''s own Gateway- telemetry stream receives is the runtime''s decision, not this server''s: the pinned runtime attributes- it the same way, with the run''s `user_id` and these groups. Group types are lowercase snake_case starting- with a letter, at most 32 characters; group keys are 1 to 128 characters from `[A-Za-z0-9_-]`; at most- five entries. Omit it and the run belongs to no group, which is right for a single-tenant deployment.'+ own PostHog stream, in `identified` mode, forwards it as the capture''s groups. Group types are lowercase+ snake_case starting with a letter, at most 32 characters; group keys are 1 to 128 characters from `[A-Za-z0-9_-]`;+ at most five entries. Omit it and the run belongs to no group, which is right for a single-tenant deployment.'additionalProperties: truetype: objecttitle: PipelexApiStartRequestdiff --git a/docs/api-server/pipe-run.md b/docs/api-server/pipe-run.mdindex c9c9b15c6..12ab74dc0 100644--- a/docs/api-server/pipe-run.md+++ b/docs/api-server/pipe-run.md@@ -300,7 +300,7 @@ Both `/execute` and `/start` accept optional fields that describe the run's tena**`read_scope`** bounds what the run may read: every `pipelex-storage://` key the run reads, whether an input, a URL a pipe builds or an image it shows a model, must lie under it, and a scoped run reads no local path at all. It follows the same segment rule as `storage_scope`, and the storage scope must be the read scope or lie under it, since a run reads back what it writes: `org_acme` covers `org_acme/method_42/run_7`, while `org_other` does not. Omit it and the run is scoped to the caller's own id when the deployment identifies its callers, which is also where their writes land by default, and unscoped when the deployment is single-tenant. A host serving many tenants must send it: a host that sends its own `storage_scope` but no `read_scope` is refused, since that storage scope lies under no caller's id. A malformed read scope, a storage scope outside it, or the local storage scope `local` beside one is a `422` whose `error_type` is `InvalidReadScope`, answered before any method is fetched or library loaded. A read the scope does not allow is refused when the run makes it, with the `error_type` `UriReadRefusedError`, whose message says where the URL sat without quoting it. On `/execute` it is a `422`. On `/start` it is a synchronous `422` when an input breaks the rule, and a run that ends `FAILED` with that error in its completion callback when a pipe reaches for the URL during the run.-**`analytics_groups`** names the entities the run's telemetry belongs to, as a mapping of group type to group key. The runtime carries it on the run as its opaque `extras` and stamps it on every span of the run as the attribute `pipelex.run.extras`, so every OpenTelemetry exporter receives it, and the deployment's own PostHog stream, when `telemetry.toml` sets `mode = "identified"`, attaches it to each capture as PostHog groups. That is what lets a generation made for one of your customers appear inside that customer's organization instead of under one identity for the whole deployment. What Pipelex's own Gateway telemetry stream receives is the runtime's decision, not this server's; the runtime this server pins attributes that stream the same way, with the run's `user_id` and these groups. The rules are the runtime's own, imported rather than restated here:+**`analytics_groups`** names the entities the run's telemetry belongs to, as a mapping of group type to group key. The runtime carries it on the run as its opaque `extras` and stamps it on every span of the run as the attribute `pipelex.run.extras`, so every OpenTelemetry exporter receives it, and the deployment's own PostHog stream, when `telemetry.toml` sets `mode = "identified"`, attaches it to each capture as PostHog groups. That is what lets a generation made for one of your customers appear inside that customer's organization instead of under one identity for the whole deployment. The rules are the runtime's own, imported rather than restated here:- A **group type** (a key of the mapping) is lowercase snake_case starting with a letter, at most 32 characters, such as `organization`.- A **group key** (a value) is 1 to 128 characters from `A-Za-z0-9_-`. Whitespace, control characters and separators are refused, because the key is quoted into log lines and capture payloads.diff --git a/docs/configuration/config-practical/telemetry-config.md b/docs/configuration/config-practical/telemetry-config.mdindex 04806a1b7..7a5b0cf35 100644--- a/docs/configuration/config-practical/telemetry-config.md+++ b/docs/configuration/config-practical/telemetry-config.md@@ -8,11 +8,8 @@ description: "Set up custom telemetry destinations for observability data — seTelemetry configuration is stored in `.pipelex/telemetry.toml`. This file controls **your custom telemetry** destinations—where you want to send observability data for your own analytics and monitoring.-!!! info "Two Telemetry Streams"- Pipelex has two independent telemetry streams:-- 1. **Gateway Telemetry** (Pipelex-controlled): Automatic when using Pipelex Gateway, tied to your API key- 2. **Custom Telemetry** (User-controlled): Configured in this file, sent to your own backends+!!! info "One Telemetry Stream, Yours"+ The runtime has a single telemetry stream, and it is the one you configure in this file and send to your own backends. Nothing reports to Pipelex.For an overview, see [Telemetry Setup](../../setup/telemetry.md).@@ -142,7 +139,7 @@ Privacy controls for what data is included in spans sent to **your** PostHog.## Portkey SDK Configuration-The `[custom_portkey]` section configures the Portkey SDK behavior when using a custom Portkey backend (not the Pipelex Gateway).+The `[custom_portkey]` section configures the Portkey SDK behavior when using the Portkey backend.### `[custom_portkey]` Settings@@ -249,7 +246,6 @@ set DO_NOT_TRACK=1When set, this disables:- All custom telemetry (PostHog, Langfuse, OTLP)-- Gateway telemetry (note: outside a test run, Gateway won't work without telemetry — see [Telemetry Setup](../../setup/telemetry.md#1-gateway-telemetry-pipelex-controlled))---diff --git a/docs/configuration/index.md b/docs/configuration/index.mdindex ad3a7681f..a43de89c9 100644--- a/docs/configuration/index.md+++ b/docs/configuration/index.md@@ -22,7 +22,7 @@ pipelex init config --local # creates the project config at {project_root}/.pip1. By default `pipelex init config` targets the **global** `~/.pipelex/` directory; pass `--local` to create the project-level `.pipelex/` instead.2. `pipelex init config` creates a **template** configuration file with sample settings. It does not include all possible configuration options - it's meant as a starting point.3. Running `pipelex init config` will **overwrite** your existing `pipelex.toml` file without warning. Make sure to backup your configuration before running this command.- 4. Credentials (`~/.pipelex/.env`) and the Gateway service-agreement file always remain in the global `~/.pipelex/` directory regardless of `--local` — only config, inference, and telemetry files are written to the project `.pipelex/`.+ 4. Credentials (`~/.pipelex/.env`) and the onboarding state file always remain in the global `~/.pipelex/` directory regardless of `--local` — only config, inference, and telemetry files are written to the project `.pipelex/`.For a complete list of all possible configuration options, refer to the configuration group documentation below.diff --git a/docs/contribute/inference-family-surface.md b/docs/contribute/inference-family-surface.mdindex b8d99935e..dc6edad98 100644--- a/docs/contribute/inference-family-surface.md+++ b/docs/contribute/inference-family-surface.md@@ -46,7 +46,7 @@ Most of the list is enforced by the type checker: the matches over the family en4. **Configuration.** The backend's table in the kit's `backends.toml`, its model file under `backends/`, and an `all_<vendor>` routing profile — which is also what the integration combo fixtures route to — all mirrored into `.pipelex/inference/`. Its API key variable goes in `.env.example`.-5. **Silent: the default routing profile.** Under `all_pipelex_gateway` every handle routes to the gateway by default, and a handle the gateway does not serve is silently dropped from the deck — so a user who has the vendor's key still cannot use its models. Give the managed profiles an `optional_routes` entry sending the vendor's models to its backend; an optional route applies only while that backend is enabled.+5. **Silent: the routing profiles.** The default `all_enabled_backends` profile tries the backends its `fallback_order` lists first and any other enabled backend after them, so list the vendor there when it should be tried before the end. Under the managed `all_pipelex_manifold` profile every handle routes to the manifold by default, and a handle the manifold does not serve is silently dropped from the deck — so a user who has the vendor's key still cannot use its models. Give the managed profile an `optional_routes` entry sending the vendor's models to its backend; an optional route applies only while that backend is enabled.6. **Silent: the CI placeholder list.** CI runners hold no provider keys, and every test module boots live, so each variable an enabled kit backend references must be in `ENV_VAR_KEYS_WHICH_MAY_NEED_PLACEHOLDERS_IN_CI` in `pipelex/test_extras/shared_pytest_plugins.py`. `tests/unit/pipelex/test_extras/test_ci_placeholder_keys.py` fails when one is missing. The agent CLI's end-to-end tests build their own hermetic environment, with a dummy value per variable, in the `offline_subprocess_env` fixture of `tests/e2e/agent_cli/conftest.py`, and nothing checks that list: a variable missing there only makes a dry run skip the backend.diff --git a/docs/contribute/rich-imports.md b/docs/contribute/rich-imports.mdindex dd205e451..093be6115 100644--- a/docs/contribute/rich-imports.md+++ b/docs/contribute/rich-imports.md@@ -107,7 +107,7 @@ The test runs, in a subprocess, what a server does. A meta-path finder installedA subprocess is required rather than preferred: the test process has Rich loaded, since the suite installs every extra, and evicting it from `sys.modules` would leave duplicate classes behind for every later test.-Every one of those boots asks for no model specs (`needs_model_specs=False`), which is what lets the test run where inference was never set up — a CI runner — because that branch of the boot wants neither the gateway terms nor the network. `needs_inference` stays true on purpose: a keyless boot forces every run this process starts to DRY, and the dry path never prints the "Output of pipe" panel, which is the Rich reach the test is here for.+Every one of those boots asks for no model specs (`needs_model_specs=False`), which is what lets the test run where inference was never set up — a CI runner — because that branch of the boot does not reach the network. `needs_inference` stays true on purpose: a keyless boot forces every run this process starts to DRY, and the dry path never prints the "Output of pipe" panel, which is the Rich reach the test is here for.The test blocks Rich rather than checking that it is absent from an ordinary environment, because an environment is not the measure. Whether Rich is installed also depends on what the other dependencies of `pipelex` require, and some third-party packages import Rich whenever it is installed. What the runtime owns is that it never needs Rich on a server's path, and that is what the blocked run measures.diff --git a/docs/errors/gateway-api-key-missing-error.md b/docs/errors/gateway-api-key-missing-error.mddeleted file mode 100644index 4e3508676..000000000--- a/docs/errors/gateway-api-key-missing-error.md+++ /dev/null@@ -1,21 +0,0 @@-----title: "Gateway api key missing"-description: "Reference for the `GatewayApiKeyMissingError` Pipelex error class."------<!-- pipelex:generated -->--# Gateway api key missing--Raised when Pipelex Gateway is enabled but the API key is not set.--| Field | Value |-|---|---|-| `error_type` | `GatewayApiKeyMissingError` |-| `title` | Gateway api key missing |-| `type_uri` | `https://docs.pipelex.com/latest/errors/gateway-api-key-missing-error/` |-| `error_domain` | _(inherited from parent)_ |-| Defined in | `pipelex.system.pipelex_service.exceptions` |-| Parent class | [`PipelexServiceError`](pipelex-service-error.md) |--[Back to Error Reference](index.md)diff --git a/docs/errors/gateway-config-merge-error.md b/docs/errors/gateway-config-merge-error.mdindex 0179aca27..59407789f 100644--- a/docs/errors/gateway-config-merge-error.md+++ b/docs/errors/gateway-config-merge-error.md@@ -7,7 +7,7 @@ description: "Reference for the `GatewayConfigMergeError` Pipelex error class."# Gateway config merge-Raised when gateway configuration merge encounters invalid data.+Raised when merging a managed gateway's served model specs with local overrides meets invalid data.| Field | Value ||---|---|diff --git a/docs/errors/gateway-credentials-error.md b/docs/errors/gateway-credentials-error.mddeleted file mode 100644index 2c8c23124..000000000--- a/docs/errors/gateway-credentials-error.md+++ /dev/null@@ -1,19 +0,0 @@-----title: "Gateway credentials"-description: "Reference for the `GatewayCredentialsError` Pipelex error class."------<!-- pipelex:generated -->--# Gateway credentials--| Field | Value |-|---|---|-| `error_type` | `GatewayCredentialsError` |-| `title` | Gateway credentials |-| `type_uri` | `https://docs.pipelex.com/latest/errors/gateway-credentials-error/` |-| `error_domain` | _(inherited from parent)_ |-| Defined in | `pipelex.providers.gateway.gateway_exceptions` |-| Parent class | [`GatewayError`](gateway-error.md) |--[Back to Error Reference](index.md)diff --git a/docs/errors/gateway-deck-error.md b/docs/errors/gateway-deck-error.mddeleted file mode 100644index c5079dc0c..000000000--- a/docs/errors/gateway-deck-error.md+++ /dev/null@@ -1,19 +0,0 @@-----title: "Gateway deck"-description: "Reference for the `GatewayDeckError` Pipelex error class."------<!-- pipelex:generated -->--# Gateway deck--| Field | Value |-|---|---|-| `error_type` | `GatewayDeckError` |-| `title` | Gateway deck |-| `type_uri` | `https://docs.pipelex.com/latest/errors/gateway-deck-error/` |-| `error_domain` | _(inherited from parent)_ |-| Defined in | `pipelex.providers.gateway.gateway_exceptions` |-| Parent class | [`GatewayError`](gateway-error.md) |--[Back to Error Reference](index.md)diff --git a/docs/errors/gateway-do-not-track-conflict-error.md b/docs/errors/gateway-do-not-track-conflict-error.mddeleted file mode 100644index 18b83bd2c..000000000--- a/docs/errors/gateway-do-not-track-conflict-error.md+++ /dev/null@@ -1,21 +0,0 @@-----title: "Gateway do not track conflict"-description: "Reference for the `GatewayDoNotTrackConflictError` Pipelex error class."------<!-- pipelex:generated -->--# Gateway do not track conflict--Raised when DO_NOT_TRACK is set but Pipelex Gateway requires telemetry.--| Field | Value |-|---|---|-| `error_type` | `GatewayDoNotTrackConflictError` |-| `title` | Gateway do not track conflict |-| `type_uri` | `https://docs.pipelex.com/latest/errors/gateway-do-not-track-conflict-error/` |-| `error_domain` | _(inherited from parent)_ |-| Defined in | `pipelex.system.pipelex_service.exceptions` |-| Parent class | [`PipelexServiceError`](pipelex-service-error.md) |--[Back to Error Reference](index.md)diff --git a/docs/errors/gateway-error.md b/docs/errors/gateway-error.mddeleted file mode 100644index b6dc5d7bb..000000000--- a/docs/errors/gateway-error.md+++ /dev/null@@ -1,19 +0,0 @@-----title: "Gateway"-description: "Reference for the `GatewayError` Pipelex error class."------<!-- pipelex:generated -->--# Gateway--| Field | Value |-|---|---|-| `error_type` | `GatewayError` |-| `title` | Gateway |-| `type_uri` | `https://docs.pipelex.com/latest/errors/gateway-error/` |-| `error_domain` | _(inherited from parent)_ |-| Defined in | `pipelex.providers.gateway.gateway_exceptions` |-| Parent class | [`CogtError`](cogt-error.md) |--[Back to Error Reference](index.md)diff --git a/docs/errors/gateway-extract-response-error.md b/docs/errors/gateway-extract-response-error.mddeleted file mode 100644index e65634ec4..000000000--- a/docs/errors/gateway-extract-response-error.md+++ /dev/null@@ -1,19 +0,0 @@-----title: "Gateway extract response"-description: "Reference for the `GatewayExtractResponseError` Pipelex error class."------<!-- pipelex:generated -->--# Gateway extract response--| Field | Value |-|---|---|-| `error_type` | `GatewayExtractResponseError` |-| `title` | Gateway extract response |-| `type_uri` | `https://docs.pipelex.com/latest/errors/gateway-extract-response-error/` |-| `error_domain` | _(inherited from parent)_ |-| Defined in | `pipelex.providers.gateway.gateway_exceptions` |-| Parent class | [`GatewayError`](gateway-error.md) |--[Back to Error Reference](index.md)diff --git a/docs/errors/gateway-factory-error.md b/docs/errors/gateway-factory-error.mddeleted file mode 100644index 221e6f6a6..000000000--- a/docs/errors/gateway-factory-error.md+++ /dev/null@@ -1,19 +0,0 @@-----title: "Gateway factory"-description: "Reference for the `GatewayFactoryError` Pipelex error class."------<!-- pipelex:generated -->--# Gateway factory--| Field | Value |-|---|---|-| `error_type` | `GatewayFactoryError` |-| `title` | Gateway factory |-| `type_uri` | `https://docs.pipelex.com/latest/errors/gateway-factory-error/` |-| `error_domain` | _(inherited from parent)_ |-| Defined in | `pipelex.providers.gateway.gateway_exceptions` |-| Parent class | [`GatewayError`](gateway-error.md) |--[Back to Error Reference](index.md)diff --git a/docs/errors/gateway-search-empty-result-error.md b/docs/errors/gateway-search-empty-result-error.mddeleted file mode 100644index b13df259a..000000000--- a/docs/errors/gateway-search-empty-result-error.md+++ /dev/null@@ -1,19 +0,0 @@-----title: "Gateway search empty result"-description: "Reference for the `GatewaySearchEmptyResultError` Pipelex error class."------<!-- pipelex:generated -->--# Gateway search empty result--| Field | Value |-|---|---|-| `error_type` | `GatewaySearchEmptyResultError` |-| `title` | Gateway search empty result |-| `type_uri` | `https://docs.pipelex.com/latest/errors/gateway-search-empty-result-error/` |-| `error_domain` | _(inherited from parent)_ |-| Defined in | `pipelex.providers.gateway.gateway_exceptions` |-| Parent class | [`GatewayError`](gateway-error.md) |--[Back to Error Reference](index.md)diff --git a/docs/errors/gateway-search-response-error.md b/docs/errors/gateway-search-response-error.mddeleted file mode 100644index 44f8ba580..000000000--- a/docs/errors/gateway-search-response-error.md+++ /dev/null@@ -1,19 +0,0 @@-----title: "Gateway search response"-description: "Reference for the `GatewaySearchResponseError` Pipelex error class."------<!-- pipelex:generated -->--# Gateway search response--| Field | Value |-|---|---|-| `error_type` | `GatewaySearchResponseError` |-| `title` | Gateway search response |-| `type_uri` | `https://docs.pipelex.com/latest/errors/gateway-search-response-error/` |-| `error_domain` | _(inherited from parent)_ |-| Defined in | `pipelex.providers.gateway.gateway_exceptions` |-| Parent class | [`GatewayError`](gateway-error.md) |--[Back to Error Reference](index.md)diff --git a/docs/errors/gateway-telemetry-manager-injected-error.md b/docs/errors/gateway-telemetry-manager-injected-error.mddeleted file mode 100644index 5a1639f0e..000000000--- a/docs/errors/gateway-telemetry-manager-injected-error.md+++ /dev/null@@ -1,21 +0,0 @@-----title: "Gateway telemetry manager injected"-description: "Reference for the `GatewayTelemetryManagerInjectedError` Pipelex error class."------<!-- pipelex:generated -->--# Gateway telemetry manager injected--Raised when a custom TelemetryManager is injected while using Pipelex Gateway.--| Field | Value |-|---|---|-| `error_type` | `GatewayTelemetryManagerInjectedError` |-| `title` | Gateway telemetry manager injected |-| `type_uri` | `https://docs.pipelex.com/latest/errors/gateway-telemetry-manager-injected-error/` |-| `error_domain` | _(inherited from parent)_ |-| Defined in | `pipelex.system.pipelex_service.exceptions` |-| Parent class | [`PipelexServiceError`](pipelex-service-error.md) |--[Back to Error Reference](index.md)diff --git a/docs/errors/gateway-terms-not-accepted-error.md b/docs/errors/gateway-terms-not-accepted-error.mddeleted file mode 100644index 007c774ce..000000000--- a/docs/errors/gateway-terms-not-accepted-error.md+++ /dev/null@@ -1,21 +0,0 @@-----title: "Gateway terms not accepted"-description: "Reference for the `GatewayTermsNotAcceptedError` Pipelex error class."------<!-- pipelex:generated -->--# Gateway terms not accepted--Raised when Pipelex Gateway is enabled but terms are not accepted.--| Field | Value |-|---|---|-| `error_type` | `GatewayTermsNotAcceptedError` |-| `title` | Gateway terms not accepted |-| `type_uri` | `https://docs.pipelex.com/latest/errors/gateway-terms-not-accepted-error/` |-| `error_domain` | _(inherited from parent)_ |-| Defined in | `pipelex.system.pipelex_service.exceptions` |-| Parent class | [`PipelexServiceError`](pipelex-service-error.md) |--[Back to Error Reference](index.md)diff --git a/docs/errors/inference-and-providers.md b/docs/errors/inference-and-providers.mdindex 2f3f1c4b2..2175831b7 100644--- a/docs/errors/inference-and-providers.md+++ b/docs/errors/inference-and-providers.md@@ -96,13 +96,6 @@ own page. Classes are grouped by subsystem.- [`AzureCredentialsError`](azure-credentials-error.md) — Azure credentials- [`BedrockFactoryError`](bedrock-factory-error.md) — Bedrock factory- [`BedrockWorkerConfigurationError`](bedrock-worker-configuration-error.md) — Bedrock worker configuration-- [`GatewayCredentialsError`](gateway-credentials-error.md) — Gateway credentials-- [`GatewayDeckError`](gateway-deck-error.md) — Gateway deck-- [`GatewayError`](gateway-error.md) — Gateway-- [`GatewayExtractResponseError`](gateway-extract-response-error.md) — Gateway extract response-- [`GatewayFactoryError`](gateway-factory-error.md) — Gateway factory-- [`GatewaySearchEmptyResultError`](gateway-search-empty-result-error.md) — Gateway search empty result-- [`GatewaySearchResponseError`](gateway-search-response-error.md) — Gateway search response- [`GoogleImgGenWorkerError`](google-img-gen-worker-error.md) — Google img gen worker- [`GoogleLLMWorkerError`](google-llm-worker-error.md) — Google LLM worker- [`LinkupError`](linkup-error.md) — Linkupdiff --git a/docs/errors/inference-setup-required-error.md b/docs/errors/inference-setup-required-error.mddeleted file mode 100644index 288589894..000000000--- a/docs/errors/inference-setup-required-error.md+++ /dev/null@@ -1,21 +0,0 @@-----title: "Inference setup required"-description: "Reference for the `InferenceSetupRequiredError` Pipelex error class."------<!-- pipelex:generated -->--# Inference setup required--Raised when inference is requested but no inference setup has been completed.--| Field | Value |-|---|---|-| `error_type` | `InferenceSetupRequiredError` |-| `title` | Inference setup required |-| `type_uri` | `https://docs.pipelex.com/latest/errors/inference-setup-required-error/` |-| `error_domain` | _(inherited from parent)_ |-| Defined in | `pipelex.system.pipelex_service.exceptions` |-| Parent class | [`PipelexServiceError`](pipelex-service-error.md) |--[Back to Error Reference](index.md)diff --git a/docs/errors/platform-and-tooling.md b/docs/errors/platform-and-tooling.mdindex c0eae5e09..02005233f 100644--- a/docs/errors/platform-and-tooling.md+++ b/docs/errors/platform-and-tooling.md@@ -73,12 +73,7 @@ own page. Classes are grouped by subsystem.- [`EnvVarNotFoundError`](env-var-not-found-error.md) — Environment variable not set- [`FatalError`](fatal-error.md) — Fatal error- [`FuncRegistryError`](func-registry-error.md) — Func registry-- [`GatewayApiKeyMissingError`](gateway-api-key-missing-error.md) — Gateway api key missing- [`GatewayConfigMergeError`](gateway-config-merge-error.md) — Gateway config merge-- [`GatewayDoNotTrackConflictError`](gateway-do-not-track-conflict-error.md) — Gateway do not track conflict-- [`GatewayTelemetryManagerInjectedError`](gateway-telemetry-manager-injected-error.md) — Gateway telemetry manager injected-- [`GatewayTermsNotAcceptedError`](gateway-terms-not-accepted-error.md) — Gateway terms not accepted-- [`InferenceSetupRequiredError`](inference-setup-required-error.md) — Inference setup required- [`JobMetadataError`](job-metadata-error.md) — Job metadata- [`LangfuseCredentialsError`](langfuse-credentials-error.md) — Langfuse credentials- [`MissingDependencyError`](missing-dependency-error.md) — Missing dependencydiff --git a/docs/errors/remote-config-fetch-error.md b/docs/errors/remote-config-fetch-error.mdindex afc08a68b..94c2cbfda 100644--- a/docs/errors/remote-config-fetch-error.md+++ b/docs/errors/remote-config-fetch-error.md@@ -7,7 +7,7 @@ description: "Reference for the `RemoteConfigFetchError` Pipelex error class."# Remote config fetch-Raised when fetching remote configuration from PostHog fails.+Raised when fetching the Pipelex remote configuration fails.| Field | Value ||---|---|diff --git a/docs/features/document-extraction.md b/docs/features/document-extraction.mdindex 0d7929f5c..f620af740 100644--- a/docs/features/document-extraction.md+++ b/docs/features/document-extraction.md@@ -1,6 +1,6 @@---title: "Document Extraction"-description: "Multi-provider OCR and document processing with Mistral OCR, Azure Document Intelligence, docling, Deepseek-OCR, and Linkup Fetch. PDF processing, web page extraction, layout analysis, and table recognition."+description: "Multi-provider OCR and document processing with Mistral OCR, Azure Document Intelligence, docling, and Linkup Fetch. PDF processing, web page extraction, layout analysis, and table recognition."---# Document Extraction@@ -20,10 +20,13 @@ Unlike LLM APIs (partly standardized around OpenAI's completions API), the OCR l| **pypdfium2** | Built-in | Basic PDF text and image extraction without AI inference — works out of the box with no API keys || **Mistral OCR** | Cloud API | Industry-leading document understanding for media, text, tables, and equations || **docling** | Local SDK | IBM's open-source extraction library with local CPU processing and optional GPU acceleration |-| **Azure Document Intelligence** | Gateway | Enterprise-grade OCR with high accuracy for complex layouts, tables, and handwriting |-| **Deepseek-OCR** | Gateway | Open-source model optimized for markdown extraction from images |+| **Azure Document Intelligence** | Pipelex Manifold | Enterprise-grade OCR with high accuracy for complex layouts, tables, and handwriting || **Linkup Fetch** | Cloud API | Web page content extraction — fetches and extracts text from web URLs |+## The Default Extractor++A `PipeExtract` step that names no model uses `@default-extract-document`, which tries Azure Document Intelligence, then Mistral OCR, then `pypdfium2-extract-pdf`, and takes the first one an enabled backend serves. Azure Document Intelligence is served through Pipelex Manifold and Mistral OCR by the `mistral` backend with your own `MISTRAL_API_KEY`; with neither, a PDF is read locally from its text layer, which needs no key but recovers no text from a scanned page, and the run logs that it fell back. `@default-extract-image` and `@default-premium` try the two OCR models only, so they need one of those backends. Name a model in the step, or point the aliases elsewhere in `x_custom_extract_deck.toml`, to choose differently.+## Formats Each Extractor ReadsEach extract model declares the file formats it reads, and a `PipeExtract` step can only extract a file in one of those formats.@@ -33,9 +36,8 @@ Each extract model declares the file formats it reads, and a `PipeExtract` step| `pypdfium2-extract-pdf` | PDF || `docling-extract-text` | PDF, Word (`.docx`), PowerPoint (`.pptx`), Excel (`.xlsx`), HTML, Markdown (`.md`), CSV, plain text (`.txt`), WebVTT captions (`.vtt`), email messages (`.eml`) and images || Mistral OCR (`mistral-ocr` and its versions) | PDF and images |-| `azure-document-intelligence` (Pipelex Gateway) | PDF and images |-| `deepseek-ocr` (Pipelex Gateway) | Images |-| `linkup-fetch` (Pipelex Gateway) | Web pages, fetched from their URL |+| `azure-document-intelligence` (Pipelex Manifold) | PDF and images |+| `linkup-fetch` (Linkup) | Web pages, fetched from their URL |A file in a format the step's model does not read is refused before the run starts, with an input error that names the input, its format, the step, the model and the formats that model reads. Give the file in a format the model reads, or choose a model that reads it. When the step can only be reached through a condition, the run starts, and the step refuses the file the same way when it gets to it. See [File formats are checked before the run](../building-methods/concepts/native-concepts.md#file-formats-are-checked-before-the-run).diff --git a/docs/features/gateway.md b/docs/features/gateway.mddeleted file mode 100644index efd22e20a..000000000--- a/docs/features/gateway.md+++ /dev/null@@ -1,62 +0,0 @@-----title: "Pipelex Gateway & Model Access"-description: "Access 60+ AI models through the Pipelex Gateway with a single API key, or bring your own keys for direct provider access. Supports OpenAI, Anthropic, Mistral, and more."------# Pipelex Gateway & Model Access--Access AI models through the Pipelex Gateway or bring your own API keys.--## Pipelex Gateway--A fully managed infrastructure providing unified access to AI models through a single API key. The Gateway eliminates the need to manage multiple provider configurations.--- **Single API key** for all supported models-- **Remote model catalog** — always access the latest models without updating Pipelex-- **Enterprise-grade architecture** — built for reliability and scale-- **Extensive provider support** — OpenAI, Google, Anthropic, Mistral, xAI, and more--Browse all supported models in the [Gateway Models](../setup/gateway-models.md) reference.--Get your Gateway API key at [app.pipelex.com](https://app.pipelex.com/) or [join the waitlist](https://go.pipelex.com/waitlist).--## Bring Your Own Keys--Direct integration with major providers using your own API keys:--- **OpenAI** — GPT-4o, GPT-5.4, GPT-5.5, GPT-5.6, GPT-6, etc.-- **Anthropic** — Claude Opus 5, Claude Fable 5, Claude Sonnet 5, etc.-- **Google** — Gemini 2.5 Pro, Gemini 2.5 Flash, etc.-- **Mistral** — Mistral Large, Mistral Medium, etc.-- **Azure OpenAI** — Azure-hosted OpenAI models-- **Amazon Bedrock** — AWS-hosted models-- **Vertex AI** — Google Cloud-hosted models-- **xAI** — Grok models-- **Portkey** — AI gateway for routing and observability-- **OpenRouter** — Multi-provider aggregator-- **BlackboxAI** — Blackbox-hosted models-- **fal** — Image generation models--## Open-Source Models--Run open-source models through dedicated providers:--- **Ollama** — Run open-source LLMs locally (Llama, Mistral, Qwen, etc.)-- **Hugging Face Inference** — including qwen-image for text-to-image-- **Scaleway** — Deepseek R1, Llama 3.3, Qwen3, GPT-OSS-- **Groq** — Llama-4, Kimi-K2-Instruct--## Routing Profiles--Routing profiles control which backend handles each model. Define pattern-based routes, defaults, and fallback orders in `routing_profiles.toml`. Switch a pipeline from one provider to another — or from Pipelex Gateway to your own keys — without changing the method definition.--See [Configure AI Providers](../get-started/configure-ai-providers.md) for setup details.--## Offline Behavior--The Gateway fetches its model catalog from a remote config service. Pipelex stays usable when that service is briefly unreachable:--- **Gateway disabled (Bring Your Own Keys)** — no remote fetch is attempted at all. Setup, validation, and dry-runs are fully offline.-- **Gateway enabled** — Pipelex primes an on-disk copy of the remote config at `~/.pipelex/cache/remote_config.json` on every successful fetch and during `pipelex init` while online. If a later fetch fails, it falls back to this cache so setup, validation, and `--dry-run` still complete. When the cache is in use, a `RemoteConfigStale` warning is emitted (the agent CLI surfaces it on the JSON `warnings` array).--Only the actual inference call needs the network at runtime — offline support covers setup and dry-run, not live model calls. If the Gateway is enabled, the fetch fails, and no cache has ever been primed, setup raises `RemoteConfigUnavailableError`: run `pipelex init` while online to prime the cache, or disable `pipelex_gateway` for permanent offline (BYOK) operation.diff --git a/docs/features/index.md b/docs/features/index.mdindex a2fca32a4..afcd415ab 100644--- a/docs/features/index.md+++ b/docs/features/index.md@@ -39,10 +39,6 @@ This section covers all Pipelex capabilities, organized by area.<div class="grid cards" markdown>-- **[Pipelex Gateway & Model Access](gateway.md)**-- Unified access to 60+ AI models through a single API key, or bring your own keys for direct provider access. Open-source model support via Hugging Face, Scaleway, and Groq.-- **[LLM Integration](llm-integration.md)**Text generation, structured outputs, vision language models, templating styles, system prompt inheritance, and model presets.diff --git a/docs/get-started/configure-ai-providers.md b/docs/get-started/configure-ai-providers.mdindex 532f0794f..0a71d112d 100644--- a/docs/get-started/configure-ai-providers.md+++ b/docs/get-started/configure-ai-providers.md@@ -32,7 +32,7 @@ Get **free credits** for testing and development with a single API key for LLMs,3. Run `pipelex init` and accept the Gateway terms of service when prompted.-That's it! Your pipelines can now access any supported LLM. See [Gateway Available Models](../setup/gateway-models.md) for the full list.+That's it! Your pipelines can now access any supported LLM. See [Inference Backend Configuration](../configuration/config-technical/inference-backend-config.md) for the backends and models available.!!! info "Terms of Service & Telemetry"When using Pipelex Gateway, you'll be prompted to accept our terms of service. By using the Gateway, identified telemetry is automatically enabled (tied to your hashed API key) to help us monitor service quality and enforce fair usage.diff --git a/docs/migration-ledger.md b/docs/migration-ledger.mdindex 44e78d0f3..533d19311 100644--- a/docs/migration-ledger.md+++ b/docs/migration-ledger.md@@ -33,7 +33,7 @@ The tier set is **open**. Environment and run-mode names are dynamic, so the tie> **A file is claimed by the pair (directory, name).** Only the surfaces that own the directory a file sits in may claim it; among those, exact filenames claim before globs, and a file matched by any of their exact patterns is excluded from all of their globs. A file claimed by two globs, or by two exact names, in the same directory, is a registry error.-Both halves earn their place on a real file. Without the name half, `pipelex_service.toml` is both the base file of one surface and a match for another's `pipelex_*.toml`. Without the directory half, `inference/backends/pipelex_gateway.toml` is a `pipelex_*.toml` match as well — and it is an inference backend definition, so the main configuration's ledger would be replayed over it and rewrite it. Either way, which ledger runs over a file would become an accident of iteration order.+Both halves earn their place on a real file. Without the name half, `pipelex_service.toml` is both the base file of one surface and a match for another's `pipelex_*.toml`. Without the directory half, `inference/backends/pipelex_manifold.toml` is a `pipelex_*.toml` match as well — and it is an inference backend definition, so the main configuration's ledger would be replayed over it and rewrite it. Either way, which ledger runs over a file would become an accident of iteration order.The same scoping applies to what the registry refuses. A base file and a glob are claims over one directory's listing, so two surfaces collide on a spelling only when they own the same directory — `*.toml` is the natural glob for any surface that owns a directory of its own, and the second such surface must not have to narrow it for the registry's bookkeeping.diff --git a/docs/setup/gateway-models.md b/docs/setup/gateway-models.mddeleted file mode 100644index 45d9019ac..000000000--- a/docs/setup/gateway-models.md+++ /dev/null@@ -1,7 +0,0 @@-----title: Gateway Available Models-description: "Browse every AI model available through the Pipelex gateway — from GPT and Claude to Gemini and open-source, ready for your executable AI methods."--------8<-- ".pipelex/inference/backends/pipelex_gateway_models.md"-diff --git a/docs/tools/cli/agent-cli.md b/docs/tools/cli/agent-cli.mdindex 3c5796d79..9a2bfb855 100644--- a/docs/tools/cli/agent-cli.md+++ b/docs/tools/cli/agent-cli.md@@ -181,12 +181,12 @@ JSON commands return the result object directly. They are not wrapped in a `stat"success": true,"target_dir": "/path/to/.pipelex","warnings": [- { "type": "RemoteConfigStale", "message": "Using a cached gateway config; run `pipelex init` while online to refresh." }+ { "type": "RemoteConfigStale", "message": "The Pipelex-managed gateway backends are running off a cached remote config (snapshot: 2026-10-01T09:30:00+00:00). Run `pipelex init` while online to refresh." }]}```-`RemoteConfigStale` is emitted when the gateway is enabled but the remote config service is unreachable and Pipelex falls back to its on-disk cache (offline mode).+`RemoteConfigStale` is emitted when a Pipelex-managed gateway backend is enabled but the remote config service is unreachable and Pipelex falls back to its on-disk cache (offline mode).Do not confuse this setup-warning shape with the `warnings` array on the `validate` envelope — validate warnings are advisory lint items that reuse the validation-error item shape (see "Advisory warnings on validate" above).diff --git a/docs/tools/cli/init.md b/docs/tools/cli/init.mdindex 02a0b902f..40b985577 100644--- a/docs/tools/cli/init.md+++ b/docs/tools/cli/init.md@@ -13,7 +13,7 @@ pipelex init [FOCUS]pipelex init --local [FOCUS]```-By default, `pipelex init` writes to the global config directory at `~/.pipelex/`. Use `--local` to create a project-level `.pipelex/` directory at the detected project root. Credentials and Gateway service terms always remain in the global `~/.pipelex/` directory regardless of `--local`.+By default, `pipelex init` writes to the global config directory at `~/.pipelex/`. Use `--local` to create a project-level `.pipelex/` directory at the detected project root. Credentials always remain in the global `~/.pipelex/` directory regardless of `--local`.!!! note "Config updates not yet supported"The `pipelex init` command always performs a full reset of the configuration. Incremental config updates will be supported in a future release.@@ -22,7 +22,6 @@ By default, `pipelex init` writes to the global config directory at `~/.pipelex/- `FOCUS` - What to initialize (optional):- `all` (default) - Initialize everything- - `agreement` - Review or accept Pipelex Gateway terms- `config` - Only configuration files- `credentials` - Prompt for missing credentials only- `inference` - Only inference backend setup@@ -49,9 +48,6 @@ pipelex init inference# Reconfigure telemetry settingspipelex init telemetry--# Review the Pipelex service terms-pipelex init agreement```## What Gets Initialized@@ -78,7 +74,7 @@ This command creates or resets a Pipelex config directory with:When you run `pipelex init`, Pipelex can guide you through:1. **Config reset** - Recreate the selected config files-2. **Backend selection** - Choose which AI providers to enable+2. **Backend selection** - Choose which AI providers to enable. The prompt pre-selects OpenAI, whose one key serves every default language-model and image-generation tier of the shipped model deck3. **Credential prompts** - Fill in missing keys when relevant4. **Routing configuration** - Set up how models are routed to backends5. **Telemetry setup** - Configure observability and analytics@@ -101,8 +97,7 @@ pipelex-agent init [--config/-c JSON] [--global/-g]```json{"backends": ["openai", "anthropic"],- "primary_backend": "openai",- "accept_gateway_terms": true+ "primary_backend": "openai"}```@@ -110,9 +105,8 @@ All fields are optional:| Field | Type | Description ||-------|------|-------------|-| `backends` | `list[str]` | Backend keys to enable (e.g. `openai`, `anthropic`, `pipelex_gateway`, `pipelex_manifold`). Omit to keep template defaults. |-| `primary_backend` | `str` | Required only when 2+ backends are selected and `pipelex_gateway` is not among them. |-| `accept_gateway_terms` | `bool` | Required when any Pipelex-managed gateway backend (`pipelex_gateway`, `pipelex_manifold`) is in backends. The terms are the Pipelex service's, so one acceptance covers every managed backend. |+| `backends` | `list[str]` | Backend keys to enable (e.g. `openai`, `anthropic`, `openrouter`, `pipelex_manifold`). Omit to keep the template's enabled backends and its routing profile, which sends each model to the first of them that serves it. |+| `primary_backend` | `str` | Required when 2+ backends are named. Named without `backends`, it routes the template's backends to it first. |Telemetry is not configured via `--config`: init seeds a `telemetry.toml` from a template (a global init writes an active one; a project init drops a commented-out one).@@ -122,8 +116,8 @@ Telemetry is not configured via `--config`: init seeds a `telemetry.toml` from a# Initialize with OpenAI backend (project-level)pipelex-agent init --config '{"backends": ["openai"]}'-# Initialize globally with gateway-pipelex-agent init -g --config '{"backends": ["pipelex_gateway"], "accept_gateway_terms": true}'+# Initialize globally with OpenAI, whose one key serves every default language-model and image-generation tier of the model deck+pipelex-agent init -g --config '{"backends": ["openai"]}'```## Related Configurationdiff --git a/docs/tools/cli/update.md b/docs/tools/cli/update.mdindex e5650ef0f..b2634628f 100644--- a/docs/tools/cli/update.md+++ b/docs/tools/cli/update.md@@ -15,7 +15,7 @@ When a new `pipelex` release ships changes to the model deck — new models, new## When to run it-Pipelex prints a one-line yellow advisory on most CLI invocations when it detects that the installed deck is older than the running package, or when no deck manifest is present yet (it is suppressed for `login`, `init`, `doctor`, `update`, and `which`):+Pipelex prints a one-line yellow advisory on most CLI invocations when it detects that the installed deck is older than the running package, or when no deck manifest is present yet (it is suppressed for `init`, `doctor`, `update`, `migrate`, and `which`):```text⚠ Pipelex model deck may be out of date — run pipelex update to refreshdiff --git a/docs/under-the-hood/error-model.md b/docs/under-the-hood/error-model.mdindex 4a0a8c67d..2a3c516d7 100644--- a/docs/under-the-hood/error-model.md+++ b/docs/under-the-hood/error-model.md@@ -380,7 +380,7 @@ Two of the gateway's routing codes are deliberately **not** in the family, becau| Code | HTTP | Why it stays with the status ladder ||---|---|---|-| `pig-03` | 400 | "the client tried to route" — a refused `x-portkey-*` header, the `?model=` query form, a `@<slug>/<model>` virtual-key model, or a path and body naming different models. No client that talks to a Pipelex-operated gateway today sends one, so reaching it means a client bug rather than a caller's or an operator's mistake. Two limits on that: `tests/unit/pipelex/providers/manifold/test_manifold_clients.py` pins the manifold clients against the four steering headers *by name* while the gateway refuses on an allow-list, so a `portkey_ai` release sending some other `x-portkey-*` header would turn every request into a `pig-03` with that test still green; and the gateway img-gen worker does send `x-portkey-config`, which Portkey's cloud reads and one of our gateways refuses — harmless while `pipelex_gateway` keeps its default endpoint, a client bug the day it names one of ours. |+| `pig-03` | 400 | "the client tried to route" — a refused `x-portkey-*` header, the `?model=` query form, a `@<slug>/<model>` virtual-key model, or a path and body naming different models. No client that talks to a Pipelex-operated gateway today sends one, so reaching it means a client bug rather than a caller's or an operator's mistake. Two limits on that: `tests/unit/pipelex/providers/manifold/test_manifold_clients.py` pins the manifold clients against the four steering headers *by name* while the gateway refuses on an allow-list, so a `portkey_ai` release sending some other `x-portkey-*` header would turn every request into a `pig-03` with that test still green; and the manifold image path still travels on `portkey_ai`, the one client that could start sending such a header. || `pig-04` | 404 | "this gateway does not serve `<method> <path>`" — the proxy policy refusing a path only the catch-all could answer, unreachable while the runtime calls only the routes the gateway mounts. Being a 404 the ladder reads it as model-not-found, which is wrong in kind — but a served-path drift is a deployment bug to surface loudly rather than a verdict to soften. |`pig-05` is mapped but not reachable from today's runtime: it is raised only on a native Google protocol path (`/v1/<v1|v1alpha|v1beta>/models/<model>:generateContent`, or its `streamGenerateContent` twin, under the gateway's own `/v1` prefix), and no worker speaks that protocol to the gateway — both service plugins build their LLM workers on the OpenAI substrate, and the manifold's native client serves only the `/v1/pipelex/*` extract and search routes. The entry costs nothing and is right the day such a path is wired. One trap waits there, pinned by a test rather than left to be discovered: Google's Extract hop reads the symbolic `status` a Google error carries (`RESOURCE_EXHAUSTED` and friends), and the gateway's envelope has no `error.status` — only a top-level `status: "failure"`, which that hop returns as though it were a provider code. A native Google path needs that hop taught the gateway's envelope first.@@ -482,7 +482,7 @@ The agent CLI (`pipelex-agent`) emits a structured error to **stderr**, markdown| Command | Error output ||---------|--------------|| `run`, `validate`, `init`, `models`, `check-model`, `doctor` | Markdown (default) or JSON via `--error-format` (or via `--format`, which `--error-format` inherits) |-| `inputs`, `accept-gateway-terms` | JSON only |+| `inputs` | JSON only || `fmt`, `lint` | Native `plxt` output (subprocess passthrough); falls back to JSON only when the `plxt` binary itself is missing |The human CLI (`pipelex`) renders a Rich error panel — red banner, structured fields, the `user_action` tip, doc/Discord links — through the shared `display_error_panel()` helper in `pipelex/cli/error_handlers.py`.diff --git a/docs/under-the-hood/init-cli-flows.md b/docs/under-the-hood/init-cli-flows.mdindex b59f77a42..3000ac931 100644--- a/docs/under-the-hood/init-cli-flows.md+++ b/docs/under-the-hood/init-cli-flows.md@@ -31,7 +31,6 @@ These two categories are managed by separate steps. `init_config()` copies only| `pipelex init inference` | `inference` | Interactive backend selection + routing || `pipelex init routing` | `routing` | Routing profile customization only || `pipelex init telemetry` | `telemetry` | Telemetry config template copy |-| `pipelex init agreement` | `agreement` | Gateway terms acceptance (no reset) || `pipelex init credentials` | `credentials` | Credential setup for enabled backends |All commands except `agreement` and `credentials` perform a **full reset** (overwrite existing files) — every setting in the file is replaced by the template's. That is why init is not the answer to a configuration file that has fallen behind the current schema: [`pipelex migrate`](../tools/cli/migrate.md) rewrites such a file in place and keeps what is in it.@@ -54,10 +53,9 @@ All commands except `agreement` and `credentials` perform a **full reset** (over| `routing_profiles.toml` | Inference step | Project or global | `.pipelex/inference/routing_profiles.toml` || `telemetry.toml` | Telemetry step | Project or global | `.pipelex/telemetry.toml` || `.env` | Credentials step | **Always global** | `~/.pipelex/.env` (mode 0600) |-| `pipelex_service.toml` | Gateway terms acceptance | **Always global** | `~/.pipelex/pipelex_service.toml` |!!! info "Project vs global"- Most files are written to the target directory chosen at init time (project `.pipelex/` or global `~/.pipelex/`). The exceptions are `.env` (credentials) and `pipelex_service.toml`, which are **always** written to and read from `~/.pipelex/` — see [Gateway Terms: Always Global](#gateway-terms-always-global).+ Most files are written to the target directory chosen at init time (project `.pipelex/` or global `~/.pipelex/`). The exception is `.env` (credentials), which is **always** written to and read from `~/.pipelex/`.---@@ -86,12 +84,11 @@ flowchart TDDETECT -- "No (first time)" --> FORCE_INF[Force needs_inference = True]DETECT -- Yes --> CHK_INF{check_inference<br/>in focus?}CHK_INF -- Yes --> FORCE_INF- CHK_INF -- No --> GW_CHK[Check gateway terms]+ CHK_INF -- No --> S2S1 -- No --> S2FORCE_INF --> S2- GW_CHK --> S2S2{needs_inference?}S2 -- Yes --> COPY_INF["Copy inference templates<br/>(backends, deck, routing)"]@@ -190,13 +187,6 @@ This handles two scenarios:| `not backends_existed_before` | First-time setup (no inference yet) | Force inference step regardless of focus || `check_inference and backends_exists_now` | Inference in focus + existing config | Re-run inference (reset) |-When inference is **not** forced and backends already exist, service terms are still checked. The question is the broad one — is *any* Pipelex-managed gateway backend enabled — because the terms are the Pipelex service's rather than one dialect's, and it is read off the merged backends document pinned to the target directory (`enabled_managed_gateway_sections(config_dir=…)`), so a managed backend switched on only by that directory's `backends_override.toml` is prompted for terms too. Declining writes `enabled = false` into the base for every managed backend, and `warn_if_managed_gateway_pinned_by_override` names the ones an override still keeps on:--```python-if not needs_inference and backends_existed_before:- _check_gateway_terms_if_needed(console, backends_toml_path)-```-### Step 2: Inference StepWhen `needs_inference` is `True` and `reset` is `True`, the inference step copies its own template files independently:@@ -208,7 +198,7 @@ When `needs_inference` is `True` and `reset` is `True`, the inference step copieThen runs interactive customization:-1. `customize_backends_config()` — prompts user to select backends, handles gateway terms, and suggests IDE extension installation via `suggest_extension_install_if_needed()`+1. `customize_backends_config()` — prompts user to select backends and suggests IDE extension installation via `suggest_extension_install_if_needed()`2. `customize_routing_profile()` — auto-configures routing based on selected backends (**only when `check_routing` is `False`**, i.e. when routing is not the specific focus)When `focus=routing`, the inference step skips routing entirely because Step 3 handles it as a standalone operation.@@ -234,19 +224,18 @@ Copies a telemetry template and prints instructions. No interactive prompts. Whi## Scenario Matrix-| Scenario | Focus | Config Step | Inference Step | Credentials | Routing Step | Gateway Terms | Telemetry Step |-|----------|-------|:-----------:|:--------------:|:-----------:|:------------:|:-------------:|:--------------:|-| Fresh project, full init | `all` | Copies config files | Copies templates + interactive selection | Prompted | Auto (part of inference) | Via `customize_backends_config` | Copies template |-| Fresh project, config only | `config` | Copies config files | Forced (first-time detected) | Prompted | Auto (part of inference) | Via `customize_backends_config` | Skipped |-| Existing project, full re-init | `all` | Overwrites config files | Resets templates + interactive selection | Prompted | Auto (part of inference) | Via `customize_backends_config` | Overwrites template |-| Existing project, config only | `config` | Overwrites config files | Skipped (backends already exist) | Prompted | Skipped | `_check_gateway_terms_if_needed` | Skipped |-| Existing project, inference only | `inference` | Skipped | Resets templates + interactive selection | Prompted | Auto (part of inference) | Via `customize_backends_config` | Skipped |-| Existing project, routing only | `routing` | Skipped | Skipped | Skipped | Resets template + interactive selection | Skipped | Skipped |-| Existing project, credentials only | `credentials` | Skipped | Skipped | Prompted | Skipped | Skipped | Skipped |-| Gateway terms only | `agreement` | Skipped | Skipped | Skipped | Skipped | Direct acceptance | Skipped |+| Scenario | Focus | Config Step | Inference Step | Credentials | Routing Step | Telemetry Step |+|----------|-------|:-----------:|:--------------:|:-----------:|:------------:|:--------------:|+| Fresh project, full init | `all` | Copies config files | Copies templates + interactive selection | Prompted | Auto (part of inference) | Copies template |+| Fresh project, config only | `config` | Copies config files | Forced (first-time detected) | Prompted | Auto (part of inference) | Skipped |+| Existing project, full re-init | `all` | Overwrites config files | Resets templates + interactive selection | Prompted | Auto (part of inference) | Overwrites template |+| Existing project, config only | `config` | Overwrites config files | Skipped (backends already exist) | Prompted | Skipped | Skipped |+| Existing project, inference only | `inference` | Skipped | Resets templates + interactive selection | Prompted | Auto (part of inference) | Skipped |+| Existing project, routing only | `routing` | Skipped | Skipped | Skipped | Resets template + interactive selection | Skipped |+| Existing project, credentials only | `credentials` | Skipped | Skipped | Prompted | Skipped | Skipped |!!! warning "Config-Only on Existing Project"- Running `pipelex init config` on a project that already has `inference/backends.toml` will overwrite config files (`pipelex.toml`, etc.) but will **not** touch the inference setup. Gateway terms are still checked via `_check_gateway_terms_if_needed`. The user's backend selection and routing are preserved.+ Running `pipelex init config` on a project that already has `inference/backends.toml` will overwrite config files (`pipelex.toml`, etc.) but will **not** touch the inference setup. The user's backend selection and routing are preserved.---@@ -264,7 +253,7 @@ Copies a telemetry template and prints instructions. No interactive prompts. Whi| `inference/deck/*.toml` | Inference step | Model deck definitions || `inference/routing_profiles.toml` | Inference step | Routing profile definitions || `telemetry.toml` | Telemetry step | Telemetry export configuration |-| `pipelex_service.toml` | Agreement step | Gateway service terms tracking |+| `pipelex_service.toml` | `pipelex-agent init` | The inference setup state that `pipelex-agent init` records |### Skip Lists@@ -344,39 +333,6 @@ This means a project-level file **wins** over the global one, but only if it act----## Gateway Terms: Always Global--`pipelex_service.toml` is **always** written to and read from `~/.pipelex/`, never from a project directory. This is an intentional invariant.--**Why:** Gateway terms are a user-level agreement, not a per-project setting. Accepting terms once should apply everywhere.--### Write Locations--All writers explicitly target `config_manager.global_config_dir`:--| Context | Module | `mkdir` before write? |-|---------|--------|-----------------------|-| Interactive init (config step) | `init/command.py` → `_check_gateway_terms_if_needed()` | Yes |-| Interactive backends | `init/backends.py` → `customize_backends_config()` | Yes |-| Agreement step | `init/command.py` → `_init_agreement()` | Yes (in `update_service_terms_acceptance`) |-| Agent CLI | `agent_cli/commands/init_cmd.py` → `_configure_backends()` | Yes |--### Read Locations--| Context | Module | How |-|---------|--------|-----|-| Doctor | `doctor_cmd.py` → `check_models()` | `load_pipelex_service_config_if_exists(config_dir=global_config_dir)` |-| Runtime | `runtime_boot.py` setup | `load_pipelex_service_config_if_exists(config_dir=global_config_dir)` |--### Rules--- **`mkdir` before writing**: All write paths ensure the config directory exists before writing. Some callers call `global_config_dir.mkdir(parents=True, exist_ok=True)` explicitly, and `update_service_terms_acceptance()` itself ensures the directory exists, so every path is protected.-- **Git-ignored**: `pipelex_service.toml` is in `GIT_IGNORED_CONFIG_FILES`, so it is never copied by `init_config()` and never synced to a project directory.--**Source:** `pipelex/system/pipelex_service/pipelex_service_agreement.py`, `pipelex/system/pipelex_service/pipelex_service_config.py`------## Agent CLI Init`pipelex-agent init` is the non-interactive counterpart to `pipelex init`. It runs the same steps but takes all inputs from a JSON config argument instead of interactive prompts.@@ -400,9 +356,8 @@ If no project root is found and `--global` is not set, the command fails with an| Field | Type | Purpose ||-------|------|---------|-| `backends` | `list[str]` | Backend keys to enable (e.g. `"openai"`, `"anthropic"`, `"pipelex_gateway"`) |-| `primary_backend` | `str` | Required when 2+ backends selected and `pipelex_gateway` is not among them |-| `accept_gateway_terms` | `bool` | Sets gateway terms acceptance; when omitted, nothing is written and any existing acceptance state is left untouched |+| `backends` | `list[str]` | Backend keys to enable (e.g. `"openai"`, `"anthropic"`, `"openrouter"`). Omitted, the template's enabled set and its routing profile are kept |+| `primary_backend` | `str` | Required when 2+ backends are named. Named without `backends`, it routes the template's enabled set to it first |### Flow@@ -414,12 +369,9 @@ flowchart TDSTEP1 --> STEP15["Step 1.5: Copy inference templates<br/>(backends.toml, backends/*, deck/*, routing_profiles.toml)"]STEP15 --> STEP16["Step 1.6: Copy telemetry template<br/>(global: active defaults; project: commented-out)"]STEP16 --> STEP2["Step 2: Configure backends<br/>Enable requested backends in backends.toml"]- STEP2 --> GW{pipelex_gateway<br/>in backends?}- GW -- Yes --> TERMS["Write gateway terms to ~/.pipelex/<br/>(always global; skipped if accept_gateway_terms omitted)"]- GW -- No --> STEP3- TERMS --> STEP3["Step 3: Configure routing<br/>Auto-derive routing profile"]+ STEP2 --> STEP3["Step 3: Configure routing<br/>Auto-derive routing profile<br/>(the template's, when the config names neither field)"]STEP3 --> STEP4["Step 4: Mark inference setup completed<br/>(written to ~/.pipelex/)"]- STEP4 --> STEP5["Step 5: Prime remote-config cache<br/>(no-op if gateway disabled or terms not accepted)"]+ STEP4 --> STEP5["Step 5: Prime remote-config cache<br/>(no-op when no managed gateway is enabled)"]STEP5 --> OUTPUT["Output result<br/>(Markdown, or JSON via --format json)"]```@@ -431,7 +383,6 @@ flowchart TD| Aspect | `pipelex init` | `pipelex-agent init` ||--------|---------------|---------------------|| Prompts | Interactive (Rich prompts) | None — all input from `--config` JSON |-| Gateway terms | Prompted interactively | From `accept_gateway_terms` field in config || Output | Rich console output | Markdown by default (`agent_success_formatted()` / `agent_error()`), structured JSON via `--format json` || Credentials | Prompted interactively | Not configured — use `pipelex-agent doctor` or `pipelex init credentials` || Focus dispatch | Supports individual focus (`config`, `inference`, etc.) | Runs config, inference, routing, telemetry (no credentials) |@@ -453,12 +404,11 @@ flowchart TD| `check_telemetry_config()` | `resolve_config_file()` | Layered resolution (project > global) || `check_backend_credentials()` | `backends_file_paths()` | Reads the merged backends document: the base `backends.toml` wherever it lives, plus the personal `backends_override.toml` at each tier || `check_backend_files()` | `resolve_config_file()` for `inference/backends/`, `backends_file_paths()` for the enabled-backend list | Finds `inference/backends/` wherever it lives, and reads the merged backends document to decide which backends to probe |-| `check_models()` gateway terms | `global_config_dir` | **Always global** — reads from `~/.pipelex/` || `check_pending_migrations()` | none | **Both directories, always** — see below |`check_pending_migrations()` is the one check that takes no `config_dir` at all, and that is deliberate. Every other row reports on a *file* and is scoped to the directory the doctor was pointed at, `--global` included. That one reports on a *command* — it is `pipelex migrate`'s own dry run — and `pipelex migrate` has no `--global`: it walks the global `~/.pipelex/` and the project `.pipelex/` both. Scoping the row narrower would name a command that then rewrites a file the row never mentioned. Every file it reports is named with its full path, so the wider scope stays legible.-`check_backend_files()` loads the backend library once per enabled backend, and loads it with `lenient=True`. The row reports on file shape — an unknown key, a spec that is not a table, a missing per-backend file — so a backend whose gateway model specs were not handed to the loader (the probe fetches nothing) or whose credentials do not resolve is skipped rather than reported: those are the Models row's and the Credentials row's findings. Without leniency the shipped defaults, which enable `pipelex_gateway` and ship its override file, would be reported as a backend-configuration error, and because the loader stops at the first backend it cannot load, a malformed file listed after the gateway in `backends.toml` would go unreported. Every probe sees that same first failure, so a failure is charged to the backend the error declares (`backend_name`, stamped by the loader on every error about one backend) or, for an error that declares none, to the backend whose file it names — never to a backend whose name merely appears in the message's prose. `check_models()` attributes the same way and for the same reason: its own load is strict and reaches backends the probe skipped leniently, so it can be the first thing to name a broken backend, and it writes into the very reports this row produced.+`check_backend_files()` loads the backend library once per enabled backend, and loads it with `lenient=True`. The row reports on file shape — an unknown key, a spec that is not a table, a missing per-backend file — so a backend whose gateway model specs were not handed to the loader (the probe fetches nothing) or whose credentials do not resolve is skipped rather than reported: those are the Models row's and the Credentials row's findings. Without leniency the shipped defaults, which ship the manifold backend's override file, would be reported as a backend-configuration error, and because the loader stops at the first backend it cannot load, a malformed file listed after the manifold in `backends.toml` would go unreported. Every probe sees that same first failure, so a failure is charged to the backend the error declares (`backend_name`, stamped by the loader on every error about one backend) or, for an error that declares none, to the backend whose file it names — never to a backend whose name merely appears in the message's prose. `check_models()` attributes the same way and for the same reason: its own load is strict and reaches backends the probe skipped leniently, so it can be the first thing to name a broken backend, and it writes into the very reports this row produced.### Fix Targetingdiff --git a/docs/under-the-hood/log-sink-plugins.md b/docs/under-the-hood/log-sink-plugins.mdindex d65f4d6dd..1bf119210 100644--- a/docs/under-the-hood/log-sink-plugins.md+++ b/docs/under-the-hood/log-sink-plugins.md@@ -47,7 +47,7 @@ teardownLogging is configured as soon as the configuration is read, in `RuntimeBoot.__init__`, so that everything the boot says afterwards is a record on a module-named logger at the configured level. The sink, though, is a plugin capability, and plugin discovery runs a little later, in `setup()`, once the boot knows which built-ins and which entry-point groups it reads. Rather than choose a default renderer for that window, `configure` installs a **holding handler** that keeps every record, and `install_sink` replays them through the selected sink's handler the moment it is installed, in the order they were emitted. A boot's own lines are therefore rendered by the sink the configuration chose, never dropped and never written in a shape nothing chose.-The sink is the second capability resolved out of the registrar, right after the secrets provider and ahead of telemetry and storage, so that every later line of the boot goes through it while its own settings can still name a secret: an OTLP collector's bearer token, the path of the service-account key the `gcp` sink reads. Building the provider first costs nothing in kind, because the holding handler already covers the window: what the provider logs is held like every line before it, and the remote-config fetch and plugin discovery were in that window already. A boot that dies before the sink is installed, on the gateway terms gate or on a secrets provider that cannot be built for instance, releases its process globals through `log.reset()`, which closes the holding handler: what it still holds gets the stdlib's last-resort treatment: every held record reaches stderr, since each passed the level the configuration set, and the redaction processor runs over each one first, behind the guard a sink's handler would have put it behind. The only built-in secrets provider, `env`, does no I/O and logs nothing, so in practice only an external secrets plugin can fail there.+The sink is the second capability resolved out of the registrar, right after the secrets provider and ahead of telemetry and storage, so that every later line of the boot goes through it while its own settings can still name a secret: an OTLP collector's bearer token, the path of the service-account key the `gcp` sink reads. Building the provider first costs nothing in kind, because the holding handler already covers the window: what the provider logs is held like every line before it, and the remote-config fetch and plugin discovery were in that window already. A boot that dies before the sink is installed, on a failed remote-config fetch or on a secrets provider that cannot be built for instance, releases its process globals through `log.reset()`, which closes the holding handler: what it still holds gets the stdlib's last-resort treatment: every held record reaches stderr, since each passed the level the configuration set, and the redaction processor runs over each one first, behind the guard a sink's handler would have put it behind. The only built-in secrets provider, `env`, does no I/O and logs nothing, so in practice only an external secrets plugin can fail there.This is the usual order elsewhere. Spring Boot resolves its configuration, vault-backed properties included, before it initialises logging and replays what was logged meanwhile; ASP.NET Core reads Key Vault as a configuration source before logging is configured, with a bootstrap logger covering the gap.diff --git a/docs/under-the-hood/test-profile-configuration.md b/docs/under-the-hood/test-profile-configuration.mdindex 89c94144c..cdad2d391 100644--- a/docs/under-the-hood/test-profile-configuration.md+++ b/docs/under-the-hood/test-profile-configuration.md@@ -44,7 +44,7 @@ The configuration lives in `.pipelex-dev/test_profiles.toml`:################################################################################[collections.backends]-all = ["pipelex_gateway", "anthropic", "openai", "google", ...]+all = ["anthropic", "openai", "google", ...][collections.llm]anthropic = ["claude-3-haiku", "claude-4-opus", "claude-4.5-sonnet", ...]@@ -65,7 +65,7 @@ from_image = ["docling-extract-text", "mistral-ocr", "deepseek-ocr", ...][profiles.dev]description = "Quick dev testing with fast and cheap models"-backends = ["pipelex_gateway", "internal"]+backends = ["anthropic", "openai", "google", "mistral", "linkup", "internal"]llm_models = ["claude-4.5-haiku", "gpt-4o-mini", "gemini-2.5-flash-lite"]img_gen_models = ["gpt-image-1-mini"]extract_models = ["@from_pdf"]@@ -122,7 +122,7 @@ Quick development testing with fast, cheap models from key providers.```toml[profiles.dev]-backends = ["pipelex_gateway", "internal"]+backends = ["anthropic", "openai", "google", "mistral", "linkup", "internal"]llm_models = ["claude-4.5-haiku", "gpt-4o-mini", "gemini-2.5-flash-lite"]img_gen_models = ["gpt-image-1-mini"]extract_models = ["@from_pdf"]@@ -211,9 +211,9 @@ This file contains:from tests.integration.pipelex.fixtures.model_combo import ModelComboLLM_COMBOS: list[ModelCombo] = [- ModelCombo("claude-4.5-haiku", "pipelex_gateway"),- ModelCombo("gemini-2.5-flash-lite", "pipelex_gateway"),- ModelCombo("gpt-4o-mini", "pipelex_gateway"),+ ModelCombo("claude-4.5-haiku", "anthropic"),+ ModelCombo("gemini-2.5-flash-lite", "google"),+ ModelCombo("gpt-4o-mini", "openai"),]IMG_GEN_COMBOS: list[ModelCombo] = [...]@@ -300,7 +300,7 @@ This is useful for:# Add a personal profile[profiles.my_local]description = "My local testing profile"-backends = ["pipelex_gateway"]+backends = ["pipelex_manifold"]llm_models = ["claude-4.5-sonnet", "gpt-4o"]img_gen_models = []extract_models = []diff --git a/docs/under-the-hood/writing-an-inference-plugin.md b/docs/under-the-hood/writing-an-inference-plugin.mdindex e1938cd65..9b0c903ae 100644--- a/docs/under-the-hood/writing-an-inference-plugin.md+++ b/docs/under-the-hood/writing-an-inference-plugin.md@@ -258,10 +258,10 @@ display_name = "Hello (plugin example)"enabled = true```-Finally, `routing_profiles.toml` routes the model to that backend. The file already has a table for the profile its `active` key names, here the default `[profiles.all_pipelex_gateway]`, so add one line inside that table rather than a second copy of it, which TOML refuses:+Finally, `routing_profiles.toml` routes the model to that backend. The file already has an optional-routes table for the profile its `active` key names, here the default `[profiles.all_enabled_backends.optional_routes]`, so add one line inside that table rather than a second copy of it, which TOML refuses:```toml-optional_routes = { "hello-1" = "hello" }+"hello-1" = "hello"```An optional route applies only while its backend is enabled, so turning the `hello` backend off leaves the profile valid. If you would rather not edit the tracked `backends.toml` and `routing_profiles.toml`, the same entries can go in the personal override files beside them, each under its table's header, as [Personal overrides](../configuration/config-technical/inference-backend-config.md#personal-overrides) explains.diff --git a/mkdocs.yml b/mkdocs.ymlindex 2872f72cb..e14fe360a 100644--- a/mkdocs.yml+++ b/mkdocs.yml@@ -79,7 +79,6 @@ plugins:'home/1-features/cost-tracking.md': 'features/cost-tracking.md''home/1-features/document-extraction.md': 'features/document-extraction.md''home/1-features/execution-graph.md': 'features/execution-graph.md'- 'home/1-features/gateway.md': 'features/gateway.md''home/1-features/image-generation.md': 'features/image-generation.md''home/1-features/index.md': 'features/index.md''home/1-features/llm-integration.md': 'features/llm-integration.md'@@ -138,7 +137,6 @@ plugins:'cookbook/cv-batch-screening.md': 'get-started/cv-batch-screening.md''cookbook/using-inference-plugins.md': 'under-the-hood/writing-an-inference-plugin.md''home/5-setup/configure-ai-providers.md': 'get-started/configure-ai-providers.md'- 'home/5-setup/gateway-models.md': 'setup/gateway-models.md''home/5-setup/index.md': 'get-started/quick-start.md''home/5-setup/project-organization.md': 'get-started/quick-start.md''home/5-setup/telemetry.md': 'setup/telemetry.md'@@ -236,7 +234,6 @@ plugins:- features/concepts.md: "Concepts & Structured Types"- features/pipe-operators.md: "Pipe Operators"- features/pipeline-orchestration.md: "Pipeline Orchestration"- - features/gateway.md: "Pipelex Gateway & Model Access"- features/llm-integration.md: "LLM Integration"- features/document-extraction.md: "Document Extraction"- features/image-generation.md: "Image Generation"@@ -322,7 +319,6 @@ plugins:- tools/logging.md: "Logging"- analytics/data-extraction.md: "Observer Data Extraction"- setup/telemetry.md: "Telemetry"- - setup/gateway-models.md: "Gateway Available Models"Advanced:- advanced/index.md: "Advanced Customizations Overview"- advanced/secrets-provider-injection.md: "Secrets Provider"@@ -459,7 +455,6 @@ nav:- Pipe Operators: features/pipe-operators.md- Pipeline Orchestration: features/pipeline-orchestration.md- AI Capabilities:- - Pipelex Gateway & Model Access: features/gateway.md- LLM Integration: features/llm-integration.md- Document Extraction: features/document-extraction.md- Image Generation: features/image-generation.md@@ -529,7 +524,6 @@ nav:- Durable Execution: reliability/durable-execution.md- Distributed Execution: distributed-execution/index.md- Reference:- - Gateway Available Models: setup/gateway-models.md- CLI Reference:- Overview: tools/cli/index.md- Init: tools/cli/init.mddiff --git a/pipelex/cli/_cli.py b/pipelex/cli/_cli.pyindex 06366c8e6..3f2021d5b 100644--- a/pipelex/cli/_cli.py+++ b/pipelex/cli/_cli.py@@ -12,7 +12,6 @@ from pipelex.cli.commands.fix.app import fix_appfrom pipelex.cli.commands.graph_cmd import graph_appfrom pipelex.cli.commands.init.command import init_cmdfrom pipelex.cli.commands.init.ui.types import InitFocus-from pipelex.cli.commands.login.command import login_cmdfrom pipelex.cli.commands.migrate_cmd import migrate_cmdfrom pipelex.cli.commands.plugins_cmd import plugins_appfrom pipelex.cli.commands.resolve_cmd import resolve_cmd@@ -30,7 +29,6 @@ from pipelex.tools.misc.package_utils import get_package_version# Core commands in display order (natural ordering doesn't work between Typer groups and commands)._CORE_COMMAND_ORDER: list[str] = [- "login","init","doctor","update",@@ -153,7 +151,7 @@ def app_callback(""")# Skip checks if no command is being run (e.g., just --help) or if running setup/diagnostic commands- if ctx.invoked_subcommand is None or ctx.invoked_subcommand in {"login", "init", "doctor", "update", "migrate", "which"}:+ if ctx.invoked_subcommand is None or ctx.invoked_subcommand in {"init", "doctor", "update", "migrate", "which"}:return# Check system readiness (dependencies and venv for dev installs)@@ -163,18 +161,12 @@ def app_callback(warn_if_deck_stale()[email protected](name="login", help="Log in to Pipelex Gateway via the browser and save your API key")-def login_command() -> None:- """Open the browser to authenticate and save your Pipelex Gateway API key."""- login_cmd()--@app.command(name="init", help="Initialize Pipelex configuration, backends, credentials, routing, and telemetry")def init_command(focus: Annotated[InitFocus,typer.Argument(- help="What to initialize: 'all' (default), 'config', 'credentials', 'inference', 'routing', 'telemetry', or 'agreement'",+ help="What to initialize: 'all' (default), 'config', 'credentials', 'inference', 'routing', or 'telemetry'",),] = InitFocus.ALL,local: Annotated[@@ -196,8 +188,6 @@ def init_command(routing Reset routing profiletelemetry Reset telemetry preferences-- agreement Review/accept Pipelex Gateway terms of service"""init_cmd(focus=focus, local=local)diff --git a/pipelex/cli/agent_cli/CLAUDE.md b/pipelex/cli/agent_cli/CLAUDE.mdindex a1658c1b6..152fc0c80 100644--- a/pipelex/cli/agent_cli/CLAUDE.md+++ b/pipelex/cli/agent_cli/CLAUDE.md@@ -11,7 +11,7 @@ Two independent options control the two output streams:Only the error format is backed by a module-level `ContextVar` in `agent_output.py` (`_agent_cli_error_format`). The reason: `agent_error()` is called from sites that don't see the Typer option — factory init failures (`agent_cli_factory.py`), the unknown-command handler in `PipelexAgentCLI.get_command`, runner validation in the app callback, and any future site in shared library/runtime code. The ContextVar lets all of them honor `--error-format` (or `--format`'s inherited value) for free. JSON is the default so errors raised before any command opts in stay machine-parseable.-`fmt`, `lint`, `accept-gateway-terms` are **always JSON / raw passthrough** — they have neither `--format` nor `--error-format`. Their errors keep flowing through the ContextVar's JSON default.+`fmt` and `lint` are **always JSON / raw passthrough** — they have neither `--format` nor `--error-format`. Their errors keep flowing through the ContextVar's JSON default.`inputs` is a deliberate deviation: its `--format` takes `json|toml` (an `InputsTemplateFormat`, NOT the `markdown|json` `CliOutputFormat` pair) because it selects the **template serialization**, not a presentation style. `json` (default) keeps the structured success envelope; `toml` prints the raw TOML template to stdout. A pipe with no inputs prints a TOML comment line in `toml` mode (valid TOML, loads back as an empty dict). `inputs` still has no `--error-format` — its errors keep flowing through the ContextVar's JSON default.@@ -82,7 +82,7 @@ commands/| Command | Does ||---------|------|-| `init` | Initializes Pipelex configuration (non-interactive). Defaults to project `.pipelex/` at detected project root. Use `--global`/`-g` to target `~/.pipelex/`. Accepts `--config`/`-c` with inline JSON or file path for backends, routing (via `primary_backend`), and gateway terms; telemetry is seeded from a template, not `--config`. `--format markdown\|json` (success, default: markdown) + `--error-format markdown\|json` (errors, defaults to `--format`'s value). |+| `init` | Initializes Pipelex configuration (non-interactive). Defaults to project `.pipelex/` at detected project root. Use `--global`/`-g` to target `~/.pipelex/`. Accepts `--config`/`-c` with inline JSON or file path for backends and routing (via `primary_backend`); telemetry is seeded from a template, not `--config`. `--format markdown\|json` (success, default: markdown) + `--error-format markdown\|json` (errors, defaults to `--format`'s value). || `run` | Executes a pipeline (pipe\|bundle\|method subcommands), returns main_stuff + working_memory. Graph visualizations on by default (`--no-graph` to disable). `--format markdown\|json` (success, default: markdown) + `--error-format markdown\|json` (errors, defaults to `--format`'s value). || `validate` | Dry-runs pipes/bundles/methods (pipe\|bundle\|method subcommands), returns validation status per pipe. Bundle subcommand supports `--graph` for graph visualization (with `--graph-format` for the graph renderer). `--format markdown\|json` (success, default: markdown) + `--error-format markdown\|json` (errors, defaults to `--format`'s value). || `fix` | Applies deterministic safe fixes to a bundle file or directory (`fix bundle`) and re-validates until valid, out of fixes, or max iterations. Supports `--allow-signatures`, `--select`, `--ignore`, `--max-iterations`, and `-L/--library-dir`. `--format markdown\|json` (success, default: markdown) + `--error-format markdown\|json` (errors, defaults to `--format`'s value). |diff --git a/pipelex/cli/agent_cli/_agent_cli.py b/pipelex/cli/agent_cli/_agent_cli.pyindex 7dcd54b1f..9241b520b 100644--- a/pipelex/cli/agent_cli/_agent_cli.py+++ b/pipelex/cli/agent_cli/_agent_cli.py@@ -8,7 +8,6 @@ from mthds.runners.types import RunnerTypefrom typer.core import TyperGroupfrom typing_extensions import override-from pipelex.cli.agent_cli.commands.accept_gateway_terms_cmd import agent_accept_gateway_terms_cmdfrom pipelex.cli.agent_cli.commands.agent_cli_factory import silence_logging_for_agent_clifrom pipelex.cli.agent_cli.commands.agent_output import CliOutputFormat, agent_error, set_agent_cli_error_formatfrom pipelex.cli.agent_cli.commands.check_model_cmd import agent_check_model_cmd@@ -43,7 +42,6 @@ class PipelexAgentCLI(TyperGroup):"codegen","models","check-model",- "accept-gateway-terms","migrate","doctor",]@@ -105,7 +103,7 @@ def app_callback(Free-floating logs would corrupt those channels, so Python's logging system iscut off process-wide via ``silence_logging_for_agent_cli`` as the very firstaction in this callback — covering every subcommand invocation (including ones- like ``init`` and ``accept-gateway-terms`` that bypass+ like ``init`` that bypass``make_pipelex_for_agent_cli``). The ``--version`` eager option short-circuitsbefore this body runs, but its callback only does ``typer.echo`` + ``Exit`` andtouches no log path. For verbose debugging, use the human ``pipelex`` CLI instead.@@ -142,6 +140,5 @@ app.add_typer(inputs_app, name="inputs", help="Generate example input JSON for aapp.add_typer(codegen_app, name="codegen", help="Project the crate into typed artifacts (types) and check drift offline (check)")app.command(name="models", help="List available model presets, aliases, and waterfalls")(agent_models_cmd)app.command(name="check-model", help="Check if a model reference is valid and suggest alternatives")(agent_check_model_cmd)-app.command(name="accept-gateway-terms", help="Accept Pipelex Gateway terms and mark inference setup complete")(agent_accept_gateway_terms_cmd)app.command(name="migrate", help="Migrate this machine's Pipelex configuration files to the current schema")(agent_migrate_cmd)app.command(name="doctor", help="Check Pipelex configuration health and auto-fix issues")(agent_doctor_cmd)diff --git a/pipelex/cli/agent_cli/commands/accept_gateway_terms_cmd.py b/pipelex/cli/agent_cli/commands/accept_gateway_terms_cmd.pydeleted file mode 100644index cb8338c09..000000000--- a/pipelex/cli/agent_cli/commands/accept_gateway_terms_cmd.py+++ /dev/null@@ -1,40 +0,0 @@-"""Agent CLI command to accept Pipelex Gateway terms and mark inference setup complete."""--import typer--from pipelex.cli.agent_cli.commands.agent_output import agent_error, agent_success-from pipelex.system.configuration.config_loader import config_manager-from pipelex.system.pipelex_service.pipelex_service_agreement import (- update_inference_setup_completed,- update_service_terms_acceptance,-)---def agent_accept_gateway_terms_cmd() -> None:- """Accept Pipelex Gateway terms and mark inference setup as completed.-- Records the user's acceptance of the Pipelex Gateway Terms of Service- and Privacy Policy, and marks inference setup as completed so the- first-run onboarding flow does not trigger again.- """- try:- config_dir = config_manager.global_config_dir- config_dir.mkdir(parents=True, exist_ok=True)- update_service_terms_acceptance(accepted=True, config_dir=config_dir)- update_inference_setup_completed(completed=True, config_dir=config_dir)- agent_success(- {- "success": True,- "terms_accepted": True,- "inference_setup_completed": True,- }- )- except typer.Exit:- raise- except Exception as exc: # ruff: ignore[blind-except]- # Agent CLI command boundary: agent_error() (NoReturn) converts any unexpected failure into the structured error payload.- agent_error(- f"Failed to accept gateway terms: {exc}",- error_type=type(exc).__name__,- cause=exc,- )diff --git a/pipelex/cli/agent_cli/commands/agent_cli_factory.py b/pipelex/cli/agent_cli/commands/agent_cli_factory.pyindex 49b8bab88..c55721402 100644--- a/pipelex/cli/agent_cli/commands/agent_cli_factory.py+++ b/pipelex/cli/agent_cli/commands/agent_cli_factory.py@@ -8,18 +8,12 @@ from pathlib import Pathfrom types import MappingProxyTypefrom typing import Any-import typer-from pipelex.cli.agent_cli.commands.agent_output import agent_error, record_setup_warningfrom pipelex.cogt.exceptions import GatewayUnknownModelError, ModelDeckPresetValidatonErrorfrom pipelex.pipelex import Pipelexfrom pipelex.runtime_hub import RuntimeHubfrom pipelex.system.console_target import ConsoleTargetfrom pipelex.system.pipelex_service.exceptions import (- GatewayApiKeyMissingError,- GatewayDoNotTrackConflictError,- GatewayTermsNotAcceptedError,- InferenceSetupRequiredError,RemoteConfigStaleWarning,RemoteConfigUnavailableError,RemoteConfigValidationError,@@ -111,7 +105,7 @@ def silence_logging_for_agent_cli() -> None:Idempotent. The primary call site is ``app_callback`` in``pipelex.cli.agent_cli._agent_cli`` — Typer routes every ``pipelex-agent``subcommand through that callback, so the cutoff is armed before any command body- runs (including commands like ``init`` and ``accept-gateway-terms`` that bypass+ runs (including commands like ``init`` that bypass``make_pipelex_for_agent_cli``). The additional invocations at the top of``make_pipelex_for_agent_cli`` and ``agent_doctor_cmd`` are belt-and-bracesdefense for direct library callers that bypass the Typer entry point (and for@@ -175,10 +169,6 @@ def make_pipelex_for_agent_cli(exceptions but routes them through ``agent_error()`` so the outputis always machine-parseable JSON on stderr.- One intentional exception: ``InferenceSetupRequiredError`` prints- human-readable markdown to stdout and exits 0, so the calling agent- can display setup guidance directly.-Stdout / stderr contract: every ``pipelex-agent`` invocation reserves stdoutexclusively for the structured success envelope (JSON via ``--format json``, ormarkdown via ``--format markdown``) emitted by ``agent_success`` /@@ -199,15 +189,14 @@ def make_pipelex_for_agent_cli(Args:library_dirs: Optional library directories to use for the Pipelex instance.- needs_inference: When False, skip inference setup (credentials, gateway, telemetry).+ needs_inference: When False, skip inference setup (credentials, managed gateways, telemetry).needs_model_specs: When True, load real model specs even without inference.Returns:Initialized Pipelex instance.Raises:- typer.Exit: If initialization fails (after printing JSON error to stderr),- or if inference setup is required (after printing markdown to stdout).+ typer.Exit: If initialization fails (after printing JSON error to stderr)."""# Process-global logging cutoff, BEFORE Pipelex.make can trigger any third-party# log line (anthropic/httpx/botocore credential probes, telemetry setup, etc.).@@ -227,25 +216,8 @@ def make_pipelex_for_agent_cli(for item in caught:if issubclass(item.category, RemoteConfigStaleWarning):record_setup_warning({"type": "RemoteConfigStale", "message": str(item.message)})- except InferenceSetupRequiredError:- print(- "# First-time inference setup required\n"- "\n"- "This looks like your first time running a method with live inference.\n"- "You need to configure an inference backend before running.\n"- "\n"- "Use `/mthds-runner-setup` for guided setup, "- "or run `pipelex-agent init` with appropriate backend configuration."- )- raise typer.Exit(0) from Noneexcept TelemetryConfigValidationError as exc:agent_error(exc.message, error_type="TelemetryConfigValidationError", cause=exc)- except GatewayTermsNotAcceptedError as exc:- agent_error(exc.message, error_type="GatewayTermsNotAcceptedError", cause=exc)- except GatewayApiKeyMissingError as exc:- agent_error(exc.message, error_type="GatewayApiKeyMissingError", cause=exc)- except GatewayDoNotTrackConflictError as exc:- agent_error(exc.message, error_type="GatewayDoNotTrackConflictError", cause=exc)except RemoteConfigUnavailableError as exc:agent_error(exc.message, error_type="RemoteConfigUnavailableError", cause=exc)except RemoteConfigValidationError as exc:diff --git a/pipelex/cli/agent_cli/commands/agent_output.py b/pipelex/cli/agent_cli/commands/agent_output.pyindex 7a56932e6..c78a85513 100644--- a/pipelex/cli/agent_cli/commands/agent_output.py+++ b/pipelex/cli/agent_cli/commands/agent_output.py@@ -13,9 +13,8 @@ Two independent format axes:``ContextVar``. JSON is the default so any error raised before a command optsin stays machine-parseable.-Commands that don't accept ``--format`` (``inputs``, ``fmt``, ``lint``,-``accept-gateway-terms``) never touch the ContextVar and therefore emit JSON-errors via the default.+Commands that don't accept ``--format`` (``inputs``, ``fmt``, ``lint``) never+touch the ContextVar and therefore emit JSON errors via the default."""import sys@@ -187,15 +186,13 @@ AGENT_ERROR_HINTS: dict[str, str] = {"False means the migration would write nothing and its 'plans' name what to correct by hand. ""Without a 'migration' field, correct the telemetry.toml settings named in the message."),- "GatewayTermsNotAcceptedError": "Run 'pipelex init config' to accept gateway terms, or disable pipelex_gateway in backends.toml",- "GatewayApiKeyMissingError": "Set the PIPELEX_GATEWAY_API_KEY environment variable, or disable pipelex_gateway in backends.toml",- "GatewayDoNotTrackConflictError": "Unset the DO_NOT_TRACK environment variable, or disable pipelex_gateway in backends.toml","BinaryNotFoundError": "Install pipelex-tools: uv tool install pipelex-tools","RemoteConfigUnavailableError": (- "Run `pipelex init` while online to prime the cache, or disable pipelex_gateway in backends.toml to operate offline (BYOK)"+ "Run `pipelex init` while online to prime the cache, or disable the Pipelex-managed gateway backends in backends.toml "+ "to operate offline (BYOK)"),"RemoteConfigValidationError": (- "This is a server-side issue; report it on Discord/GitHub. Disable pipelex_gateway in backends.toml as a workaround"+ "This is a server-side issue; report it on Discord/GitHub. Disable the Pipelex-managed gateway backends in backends.toml as a workaround"),"GatewayUnknownModelError": ("The deck references a model the gateway doesn't expose. If the source is `cached`, run `pipelex init` while online to refresh; "@@ -491,7 +488,7 @@ def agent_error(message: str, *, error_type: str, cause: BaseException | None =def agent_success(result: dict[str, Any]) -> None:"""Print a structured JSON success result to stdout.- Any pending setup warnings (e.g. stale gateway cache) recorded via ``record_setup_warning``+ Any pending setup warnings (e.g. a stale remote-config cache) recorded via ``record_setup_warning``are drained into a top-level ``warnings`` array on the envelope so machine consumers cansurface them without parsing stderr. Callers may pre-populate ``result["warnings"]`` (mustbe a list) — the captured ones are appended. The caller's ``result`` dict is NOT mutated;diff --git a/pipelex/cli/agent_cli/commands/init_cmd.py b/pipelex/cli/agent_cli/commands/init_cmd.pyindex f10c15f5f..152be3b80 100644--- a/pipelex/cli/agent_cli/commands/init_cmd.py+++ b/pipelex/cli/agent_cli/commands/init_cmd.py@@ -18,15 +18,10 @@ from pipelex.cli.commands.init.backends import get_selected_backend_keys, updatefrom pipelex.cli.commands.init.command import attempt_prime_remote_config_cachefrom pipelex.cli.commands.init.config_files import init_configfrom pipelex.cli.commands.init.ui.backends_ui import get_backend_options_from_toml-from pipelex.cogt.model_backends.backend import MANAGED_GATEWAY_BACKEND_NAMES, PipelexBackend-from pipelex.cogt.model_routing.routing_profile import PipelexRoutingProfilefrom pipelex.cogt.models.deck_manifest import stamp_kit_manifestsfrom pipelex.kit.paths import get_kit_configs_dirfrom pipelex.system.configuration.config_loader import config_manager-from pipelex.system.pipelex_service.pipelex_service_agreement import (- update_inference_setup_completed,- update_service_terms_acceptance,-)+from pipelex.system.pipelex_service.pipelex_service_onboarding import update_inference_setup_completedfrom pipelex.system.telemetry.telemetry_config import TELEMETRY_CONFIG_FILE_NAME, TELEMETRY_PROJECT_TEMPLATE_FILE_NAMEfrom pipelex.tools.misc.toml_utils import load_toml_with_tomlkit, save_toml_to_path@@ -215,15 +210,6 @@ def _configure_backends(update_backends_in_toml(toml_doc, selected_indices=selected_indices, backend_options=backend_options)save_toml_to_path(toml_doc, path=backends_toml_path)- # Any managed gateway backend puts this installation behind the service terms — the same- # question the boot asks. Asked the gateway-only way, `accept_gateway_terms` was silently- # dropped for a manifold-only request and the next inference boot refused to start.- if any(backend_name in requested_backends for backend_name in MANAGED_GATEWAY_BACKEND_NAMES):- accept_terms = config.get("accept_gateway_terms")- if accept_terms is not None:- config_manager.global_config_dir.mkdir(parents=True, exist_ok=True)- update_service_terms_acceptance(accepted=accept_terms, config_dir=config_manager.global_config_dir)-return requested_backends@@ -232,7 +218,7 @@ def _configure_routing(selected_backend_keys: list[str], *, config: dict[str, AnArgs:selected_backend_keys: List of enabled backend keys.- config: Parsed config dict with optional 'primary_backend' key.+ config: Parsed config dict with optional 'backends' and 'primary_backend' keys.target_dir: Target config directory.Returns:@@ -245,13 +231,12 @@ def _configure_routing(selected_backend_keys: list[str], *, config: dict[str, Antoml_doc = load_toml_with_tomlkit(routing_profiles_toml_path)- # Case 1: pipelex_gateway is enabled → use all_pipelex_gateway- if PipelexBackend.GATEWAY in selected_backend_keys:- toml_doc["active"] = PipelexRoutingProfile.ALL_PIPELEX_GATEWAY- save_toml_to_path(toml_doc, path=routing_profiles_toml_path)- return PipelexRoutingProfile.ALL_PIPELEX_GATEWAY+ # Template defaults with no primary named: the template's own profile already routes among+ # every backend the template enables, so it stays active.+ if config.get("backends") is None and config.get("primary_backend") is None:+ return str(toml_doc["active"])- # Case 2: Only one backend → use all_{backend_key}+ # Case 1: Only one backend → use all_{backend_key}if len(selected_backend_keys) == 1:backend_key = selected_backend_keys[0]profile_name = f"all_{backend_key}"@@ -271,13 +256,12 @@ def _configure_routing(selected_backend_keys: list[str], *, config: dict[str, Ansave_toml_to_path(toml_doc, path=routing_profiles_toml_path)return profile_name- # Case 3: Multiple backends (no pipelex_gateway) → need primary_backend+ # Case 2: Multiple backends → need primary_backendprimary_backend: str | None = config.get("primary_backend")if primary_backend is None:agent_error(- f"primary_backend is required when multiple backends are selected ({', '.join(selected_backend_keys)}) "- "and pipelex_gateway is not among them",+ f"primary_backend is required when multiple backends are selected ({', '.join(selected_backend_keys)})",error_type="ArgumentError",)@@ -324,11 +308,11 @@ def agent_init_cmd("-c",help=("Inline JSON string or path to a JSON file. "- 'Schema: {"backends": list[str], "primary_backend": str, "accept_gateway_terms": bool}. '+ 'Schema: {"backends": list[str], "primary_backend": str}. '"All fields are optional. "- "backends: backend keys to enable (e.g. 'openai', 'anthropic', 'pipelex_gateway'). Omit to keep template defaults. "- "primary_backend: required only when 2+ backends are selected and pipelex_gateway is not among them. "- "accept_gateway_terms: true/false, required when pipelex_gateway is in backends."+ "backends: backend keys to enable (e.g. 'openai', 'anthropic', 'openrouter'). Omit to keep template defaults "+ "and the template's routing profile. "+ "primary_backend: required when 2+ backends are named."),),] = None,@@ -361,15 +345,14 @@ def agent_init_cmd(Config JSON schema::{- "backends": ["pipelex_gateway", "openai"],- "accept_gateway_terms": true,+ "backends": ["openrouter", "openai"],"primary_backend": "openai"}- - backends: list of backend keys to enable. Omit to keep all template defaults.- - accept_gateway_terms: sets gateway terms acceptance (true/false).- - primary_backend: required when 2+ backends are selected and pipelex_gateway- is not among them. Auto-derived when only 1 backend or pipelex_gateway is present.+ - backends: list of backend keys to enable. Omit to keep all template defaults and the+ template's routing profile, which routes among every backend it enables.+ - primary_backend: required when 2+ backends are named. Auto-derived when only+ 1 backend is selected. Named alone, it keeps the template's backends and routes to it first.Telemetry: global init seeds an active `telemetry.toml` template with all destinationsoff; project init drops in a commented-out template that inherits the user's global@@ -409,10 +392,10 @@ def agent_init_cmd(update_inference_setup_completed(completed=True, config_dir=config_manager.global_config_dir)# Step 5: Prime the remote-config cache so subsequent offline dry-runs can fall back.- # No-op when gateway is disabled or terms have not been accepted; surfaces failure as- # structured fields on the success envelope rather than crashing init. We forward the- # init target directory so the gateway-enabled check inspects the backends.toml we- # just wrote, not a sibling layered config.+ # No-op when no managed gateway backend is enabled; surfaces failure as structured+ # fields on the success envelope rather than crashing init. We forward the init target+ # directory so the managed-gateway check inspects the backends.toml we just wrote, not a+ # sibling layered config.priming_result = attempt_prime_remote_config_cache(target_config_dir=target_dir)result_payload: dict[str, Any] = {"success": True,diff --git a/pipelex/cli/cli_factory.py b/pipelex/cli/cli_factory.pyindex 1f859ab3b..0e7e35cbf 100644--- a/pipelex/cli/cli_factory.py+++ b/pipelex/cli/cli_factory.py@@ -4,11 +4,7 @@ from pathlib import Pathfrom pipelex.cli.error_handlers import (ErrorContext,- handle_gateway_api_key_missing_error,- handle_gateway_do_not_track_conflict_error,- handle_gateway_terms_not_accepted_error,handle_gateway_unknown_model_error,- handle_inference_setup_required_error,handle_model_deck_preset_error,handle_remote_config_unavailable_error,handle_remote_config_validation_error,@@ -17,10 +13,6 @@ from pipelex.cli.error_handlers import (from pipelex.cogt.exceptions import GatewayUnknownModelError, ModelDeckPresetValidatonErrorfrom pipelex.pipelex import Pipelexfrom pipelex.system.pipelex_service.exceptions import (- GatewayApiKeyMissingError,- GatewayDoNotTrackConflictError,- GatewayTermsNotAcceptedError,- InferenceSetupRequiredError,RemoteConfigUnavailableError,RemoteConfigValidationError,)@@ -44,7 +36,7 @@ def make_pipelex_for_cli(Args:context: The CLI context for error messages.library_dirs: The library directories to use for the Pipelex instance.- needs_inference: When False, skip inference setup (credentials, gateway, telemetry).+ needs_inference: When False, skip inference setup (credentials, managed gateways, telemetry).boot_orchestrator: When provided, boots this process under the orchestrator plugin of this name.needs_model_specs: When True, load real model specs even without inference.@@ -62,16 +54,8 @@ def make_pipelex_for_cli(boot_orchestrator=boot_orchestrator,needs_model_specs=needs_model_specs,)- except InferenceSetupRequiredError as exc:- handle_inference_setup_required_error(exc)except TelemetryConfigValidationError as exc:handle_telemetry_config_validation_error(exc)- except GatewayTermsNotAcceptedError as exc:- handle_gateway_terms_not_accepted_error(exc)- except GatewayApiKeyMissingError as exc:- handle_gateway_api_key_missing_error(exc)- except GatewayDoNotTrackConflictError as exc:- handle_gateway_do_not_track_conflict_error(exc)except RemoteConfigUnavailableError as exc:handle_remote_config_unavailable_error(exc)except RemoteConfigValidationError as exc:diff --git a/pipelex/cli/commands/doctor_cmd.py b/pipelex/cli/commands/doctor_cmd.pyindex 230c30f13..ad083e66e 100644--- a/pipelex/cli/commands/doctor_cmd.py+++ b/pipelex/cli/commands/doctor_cmd.py@@ -71,7 +71,6 @@ from pipelex.system.pipelex_service.exceptions import (from pipelex.system.pipelex_service.managed_gateway_configs import build_managed_gateway_configsfrom pipelex.system.pipelex_service.pipelex_service_config import (enabled_managed_gateway_sections,- load_pipelex_service_config_if_exists,)from pipelex.system.pipelex_service.remote_config_fetcher import RemoteConfigFetcherfrom pipelex.system.telemetry.telemetry_config import TELEMETRY_CONFIG_FILE_NAME, TelemetryConfig@@ -1470,12 +1469,11 @@ def check_models(return False, msg, backend_file_reports# Fetch the managed gateways' model specs if any managed gateway backend is enabled.- # Probe the same backends document / pipelex_service.toml the doctor is reporting on- # (project-vs-global) instead of always defaulting to the global path — otherwise- # --global on a machine with a project-local backends.toml would mis-report gateway- # state because the layered `config_manager.backends_file_paths()` would still resolve- # its base to the project file.- service_config_dir = config_dir if config_dir is not None else config_manager.global_config_dir+ # Probe the same backends document the doctor is reporting on (project-vs-global) instead+ # of always defaulting to the global path — otherwise --global on a machine with a+ # project-local backends.toml would mis-report the managed-gateway state because the+ # layered `config_manager.backends_file_paths()` would still resolve its base to the+ # project file.managed_gateway_configs: dict[str, GatewayConfig] | None = Nonegateway_config_source: RemoteConfigSource | None = Nonetry:@@ -1483,11 +1481,6 @@ def check_models(except InferenceBackendLibraryValidationError as exc:return False, f"Error checking models: {exc}", backend_file_reportsif managed_gateway_sections:- pipelex_service_config = load_pipelex_service_config_if_exists(config_dir=service_config_dir)- if pipelex_service_config is None:- return False, "Pipelex Gateway is enabled but service configuration is missing", backend_file_reports- if not pipelex_service_config.agreement.terms_accepted:- return False, "Pipelex Gateway is enabled but terms have not been accepted", backend_file_reportstry:result = RemoteConfigFetcher.fetch_remote_config()gateway_config_source = result.source@@ -1496,7 +1489,7 @@ def check_models(managed_gateway_sections=managed_gateway_sections,)except (RemoteConfigUnavailableError, RemoteConfigValidationError) as exc:- return False, f"Failed to fetch Pipelex Gateway remote configuration: {exc}", backend_file_reports+ return False, f"Failed to fetch the Pipelex remote configuration: {exc}", backend_file_reports# When --global (config_dir set), pin every path so layered config_manager.X# resolution doesn't silently fall back to the project-local files. The two documentsdiff --git a/pipelex/cli/commands/init/backends.py b/pipelex/cli/commands/init/backends.pyindex 7823d8f32..04a1a06f1 100644--- a/pipelex/cli/commands/init/backends.py+++ b/pipelex/cli/commands/init/backends.py@@ -8,9 +8,7 @@ the tracked file on save; the merged view is the runtime's and the doctor's, notfrom pathlib import Pathfrom typing import Any-from rich.console import Consolefrom rich.markup import escape-from tomlkit.exceptions import TOMLKitErrorfrom pipelex import logfrom pipelex.cli.commands.init.ide_extension import suggest_extension_install_if_needed@@ -21,18 +19,10 @@ from pipelex.cli.commands.init.ui.backends_ui import (get_currently_enabled_backends,prompt_backend_select,)-from pipelex.cli.commands.init.ui.gateway_ui import (- display_gateway_accepted_message,- display_gateway_declined_message,- prompt_gateway_acceptance,-)-from pipelex.cogt.model_backends.backend import MANAGED_GATEWAY_BACKEND_NAMESfrom pipelex.kit.paths import get_kit_configs_dirfrom pipelex.runtime_hub import get_consolefrom pipelex.system.configuration.config_loader import config_manager-from pipelex.system.pipelex_service.pipelex_service_agreement import update_service_terms_acceptance-from pipelex.system.pipelex_service.pipelex_service_config import enabled_managed_gateway_sections-from pipelex.tools.misc.toml_utils import describe_toml_base_and_overrides, load_toml_from_path, load_toml_with_tomlkit, save_toml_to_path+from pipelex.tools.misc.toml_utils import load_toml_from_path, load_toml_with_tomlkit, save_toml_to_pathdef update_backends_in_toml(toml_doc: Any, *, selected_indices: list[int], backend_options: list[tuple[str, str]]) -> None:@@ -80,63 +70,6 @@ def get_selected_backend_keys(backends_toml_path: Path) -> list[str]:return selected_backends-def warn_if_managed_gateway_pinned_by_override(*, console: Console, backends_toml_path: Path) -> bool:- """After a disabling write to the base: say so when an override still enables a managed backend.-- Every writer here edits the base ``backends.toml``, while the runtime reads that file with the- personal ``backends_override.toml`` files merged over it. Disabling the managed gateway backends- in the base after the terms were declined is therefore a no-op when an override pins- ``enabled = true``, and the next boot refuses for the declined terms with nothing to say about- why the flip did not take. This names the files that were read so the user edits the right one.-- It asks the broad question rather than the gateway-only one for the reason the write above is- broad: the terms are the Pipelex service's, so any managed backend an override pins back on puts- the installation behind them again.-- Args:- console: Where the warning goes.- backends_toml_path: The base file that was just written, ``<config dir>/inference/backends.toml``.-- Returns:- True when a managed gateway backend is still enabled by the merged document, False otherwise.- """- config_dir = backends_toml_path.parent.parent- still_enabled = sorted(enabled_managed_gateway_sections(config_dir=config_dir))- if not still_enabled:- return False- description = describe_toml_base_and_overrides(paths=config_manager.backends_file_paths(config_dir=config_dir))- console.print(- f"[yellow]⚠ A Pipelex-managed gateway backend is still enabled by a personal override: "- f"{escape(', '.join(still_enabled))} in {escape(description)}. "- "Disable it there too, or the next boot will refuse because the terms were declined.[/yellow]"- )- return True---def disable_managed_gateway_backends(backends_toml_path: Path) -> None:- """Disable every Pipelex-managed gateway backend in backends.toml.-- Declining the service terms, or failing to record acceptance, has to leave *no* managed backend- enabled: the terms are the Pipelex service's terms rather than one dialect's, so a boot that- reaches the service through any of them is refused for want of the same acceptance.-- Args:- backends_toml_path: Path to the backends.toml file.- """- if not backends_toml_path.exists():- return-- toml_doc = load_toml_with_tomlkit(backends_toml_path)-- disabled_any = False- for backend_name in MANAGED_GATEWAY_BACKEND_NAMES:- if backend_name in toml_doc:- toml_doc[backend_name]["enabled"] = False # type: ignore[index]- disabled_any = True- if disabled_any:- save_toml_to_path(toml_doc, path=backends_toml_path)--def customize_backends_config(*, is_first_time_setup: bool = False, target_config_dir: Path | None = None) -> None:"""Interactively customize which inference backends are enabled in backends.toml.@@ -161,9 +94,10 @@ def customize_backends_config(*, is_first_time_setup: bool = False, target_confi# Get currently enabled backends to show user their current selectioncurrently_enabled = get_currently_enabled_backends(backends_toml_path, backend_options=backend_options)- # If this is first-time setup, ignore what's in the template (all enabled)- # and use only pipelex_gateway as the default- if is_first_time_setup or (currently_enabled and len(currently_enabled) == len(backend_options)):+ # A first-time setup, or a file still enabling exactly what the template enables, is not a+ # selection anybody made: pre-select the recommended backend instead of the template's set.+ template_enabled = get_currently_enabled_backends(template_backends_path, backend_options=backend_options)+ if is_first_time_setup or currently_enabled == template_enabled:currently_enabled = []# Load the backends.toml file@@ -172,36 +106,20 @@ def customize_backends_config(*, is_first_time_setup: bool = False, target_confi# UI: Display panel and get user selectionconsole.print(build_backend_selection_panel(backend_options, currently_enabled=currently_enabled, is_first_time_setup=is_first_time_setup))- selected_indices, selected_backends = prompt_backend_select(+ selected_indices, _ = prompt_backend_select(console=console,backend_options=backend_options,currently_enabled=currently_enabled,is_first_time_setup=is_first_time_setup,)- # Suggest IDE extension install after backend selection, before gateway terms+ # Suggest IDE extension install after backend selectiontry:suggest_extension_install_if_needed(console=console)except EOFError as exc:# No stdin available for the install prompt — skip the optional IDE extension suggestion.log.debug(f"IDE extension suggestion skipped: {exc}")- # Any managed gateway backend puts this installation behind the service terms, so the- # prompt asks the same question the boot does rather than the narrower gateway-only one.- gateway_terms_accepted: bool | None = None- if any(backend_name in selected_backends for backend_name in MANAGED_GATEWAY_BACKEND_NAMES):- gateway_accepted = prompt_gateway_acceptance(console=console)-- if gateway_accepted:- display_gateway_accepted_message(console=console)- gateway_terms_accepted = True- else:- display_gateway_declined_message(console=console)- gateway_terms_accepted = False-- # Declining removes every managed backend, not only the one that raised the prompt.- selected_indices = [idx for idx in selected_indices if backend_options[idx][0] not in MANAGED_GATEWAY_BACKEND_NAMES]-# Business logic: Update and save backends.toml first (local operation)update_backends_in_toml(toml_doc, selected_indices=selected_indices, backend_options=backend_options)save_toml_to_path(toml_doc, path=backends_toml_path)@@ -209,30 +127,6 @@ def customize_backends_config(*, is_first_time_setup: bool = False, target_confi# UI: Display confirmationdisplay_selected_backends(console=console, selected_indices=selected_indices, backend_options=backend_options)- # Save gateway terms acceptance to global config (separate from backends save)- if gateway_terms_accepted is not None:- try:- global_config_dir = config_manager.global_config_dir- global_config_dir.mkdir(parents=True, exist_ok=True)- update_service_terms_acceptance(accepted=gateway_terms_accepted, config_dir=global_config_dir)- except (OSError, TOMLKitError, TypeError) as terms_exc:- # TypeError: a malformed service-config TOML (e.g. a scalar [agreement]) makes the- # terms writer's dict assignment raise TypeError rather than a TOMLKitError.- log.warning(f"Could not save gateway terms acceptance to global config: {terms_exc}")- if gateway_terms_accepted:- # A managed backend is enabled in backends.toml but terms are not recorded —- # the runtime will fail. Disable them as a safety measure.- try:- disable_managed_gateway_backends(backends_toml_path)- console.print("[yellow]⚠ Could not save gateway terms. Gateway has been disabled to prevent errors.[/yellow]")- warn_if_managed_gateway_pinned_by_override(console=console, backends_toml_path=backends_toml_path)- except (OSError, TOMLKitError, TypeError) as disable_exc:- log.warning(f"Could not disable gateway backend: {disable_exc}")- console.print(- "[red]⚠ Could not save gateway terms or disable gateway. Please manually disable pipelex_gateway in backends.toml.[/red]"- )- console.print("[dim]Re-run 'pipelex init' to set up gateway again.[/dim]")-except Exception as exc: # ruff: ignore[blind-except]# Command-level boundary: backend customization is optional during init — any failure is reported and init continues.console.print(f"[yellow]⚠ Warning: Failed to customize backends: {escape(str(exc))}[/yellow]")diff --git a/pipelex/cli/commands/init/command.py b/pipelex/cli/commands/init/command.pyindex 15bc95ae5..2aedf2b8f 100644--- a/pipelex/cli/commands/init/command.py+++ b/pipelex/cli/commands/init/command.py@@ -4,27 +4,19 @@ import shutilfrom pathlib import Pathimport typer-from pydantic import BaseModel, ConfigDict, ValidationError+from pydantic import BaseModel, ConfigDictfrom rich.console import Consolefrom rich.markup import escapefrom rich.prompt import Confirmfrom pipelex.cli.commands.init.backends import (customize_backends_config,- disable_managed_gateway_backends,get_selected_backend_keys,- warn_if_managed_gateway_pinned_by_override,)from pipelex.cli.commands.init.config_files import init_configfrom pipelex.cli.commands.init.credentials import prompt_credentialsfrom pipelex.cli.commands.init.routing import customize_routing_profilefrom pipelex.cli.commands.init.telemetry import setup_telemetry-from pipelex.cli.commands.init.ui.gateway_ui import (- build_gateway_terms_panel,- display_gateway_accepted_message,- display_gateway_declined_message,- prompt_gateway_acceptance,-)from pipelex.cli.commands.init.ui.general_ui import build_initialization_panelfrom pipelex.cli.commands.init.ui.types import InitFocusfrom pipelex.cogt.models.deck_manifest import stamp_kit_manifests@@ -32,11 +24,7 @@ from pipelex.kit.paths import get_kit_configs_dirfrom pipelex.runtime_hub import get_consolefrom pipelex.system.configuration.config_loader import config_managerfrom pipelex.system.pipelex_service.exceptions import RemoteConfigUnavailableError-from pipelex.system.pipelex_service.pipelex_service_agreement import update_service_terms_acceptance-from pipelex.system.pipelex_service.pipelex_service_config import (- enabled_managed_gateway_sections,- load_pipelex_service_config_if_exists,-)+from pipelex.system.pipelex_service.pipelex_service_config import enabled_managed_gateway_sectionsfrom pipelex.system.pipelex_service.remote_config_cache import RemoteConfigCachefrom pipelex.system.pipelex_service.remote_config_fetcher import RemoteConfigFetcherfrom pipelex.system.telemetry.telemetry_config import TELEMETRY_CONFIG_FILE_NAME@@ -49,8 +37,7 @@ class CachePrimingResult(BaseModel):afterwards. ``error_message`` is populated when the fetch was attempted but failed (offline atinit time) *or* when the fetch succeeded but the cache could not be persisted, read back, orvalidated as a usable ``RemoteConfig`` (e.g. a read-only or full cache directory). ``None``- means priming was skipped (no managed gateway backend enabled, or terms not accepted) or that- it succeeded.+ means priming was skipped (no managed gateway backend enabled) or that it succeeded."""model_config = ConfigDict(extra="forbid", strict=True)@@ -66,13 +53,11 @@ def attempt_prime_remote_config_cache(*, target_config_dir: Path | None = None)machine (`pipelex-agent init`) surfaces can decide how to surface failure (Rich warning vsstructured JSON field).- Skipped (``primed=False, error_message=None``) when:- - no managed gateway backend is enabled in ``backends.toml`` (BYOK has nothing to cache), or- - the service terms have not been accepted (we cannot fetch without consent).+ Skipped (``primed=False, error_message=None``) when no managed gateway backend is enabled in+ ``backends.toml``: BYOK has nothing to cache.- The question is the boot's — *any* managed gateway backend — rather than the Portkey-cloud- one's, because what gets cached is the single published configuration carrying every managed- backend's section: a manifold-only installation has exactly as much to cache as a gateway one.+ The question is the boot's — *any* managed gateway backend — because what gets cached is the+ single published configuration carrying every managed backend's section.Always passes ``require_fresh=True`` to the fetcher: priming's only job is to write a freshcache, so silently accepting an existing cached fallback would be a misleading success. When@@ -90,16 +75,11 @@ def attempt_prime_remote_config_cache(*, target_config_dir: Path | None = None)gateway backend is enabled. ``pipelex init`` and ``pipelex init --local`` targetdifferent ``.pipelex/`` directories — using the layered/project-preferred config herewould let priming branch on the wrong file. ``None`` (default) falls back to the layered- document. The terms-acceptance check always reads the *global* ``pipelex_service.toml``- by design.+ document."""if not enabled_managed_gateway_sections(config_dir=target_config_dir):return CachePrimingResult(primed=False)- service_config = load_pipelex_service_config_if_exists(config_dir=config_manager.global_config_dir)- if service_config is None or not service_config.agreement.terms_accepted:- return CachePrimingResult(primed=False)-try:RemoteConfigFetcher.fetch_remote_config(require_fresh=True)except RemoteConfigUnavailableError as exc:@@ -107,17 +87,10 @@ def attempt_prime_remote_config_cache(*, target_config_dir: Path | None = None)# A successful fetch does NOT guarantee a usable cache. ``RemoteConfigFetcher`` treats the# cache write as opportunistic and swallows OSErrors (read-only / full cache dir) with only a- # stderr warning. And even when a file is written, ``RemoteConfigCache.load()`` validates only- # the cache *wrapper* — a malformed inner ``raw_config`` would still pass it but break later- # offline runs (see the matching check in ``RemoteConfigFetcher.fetch_remote_config``). Verify- # both: the wrapper loads AND its payload re-validates as a ``RemoteConfig``. Otherwise priming- # would misreport success and later offline runs would hit ``RemoteConfigUnavailableError``.+ # stderr warning, so read the cache back: a wrapper that loads holds the payload as a JSON+ # object, which is all a ``RemoteConfig`` needs. Otherwise priming would misreport success and+ # later offline runs would hit ``RemoteConfigUnavailableError``.cached = RemoteConfigCache.load()- if cached is not None:- try:- cached.to_remote_config()- except ValidationError:- cached = Noneif cached is None:msg = (f"Remote config was fetched but the cache at {RemoteConfigCache.cache_path()} "@@ -143,50 +116,6 @@ def prime_remote_config_cache(*, console: Console, target_config_dir: Path | Nonconsole.print("[dim]Re-run 'pipelex init' while online to prime the cache for offline dry-runs.[/dim]")-def _check_gateway_terms_if_needed(*, console: Console, backends_toml_path: Path) -> None:- """Check if gateway is enabled and terms not yet accepted, then prompt for acceptance.-- This is called after init_config() to ensure users who have gateway enabled- in their existing backends.toml are prompted to accept terms when pipelex_service.toml- is first created.-- Args:- console: Rich Console instance for user interaction.- backends_toml_path: Path to backends.toml file.- """- # Check if backends.toml exists and gateway is enabled. Enabled means enabled in the merged- # document pinned to this directory — a gateway switched on only by that directory's- # `backends_override.toml` needs the terms as much as one switched on in the base.- if not backends_toml_path.exists():- return-- # Any managed gateway backend puts this installation behind the service terms — the same- # question the boot asks. Asking only about the Portkey-cloud one leaves a manifold-only- # install unable to record acceptance through any supported step.- if not enabled_managed_gateway_sections(config_dir=backends_toml_path.parent.parent):- return-- # Gateway is enabled - check if terms are already accepted (always global)- pipelex_service_config = load_pipelex_service_config_if_exists(config_dir=config_manager.global_config_dir)- if pipelex_service_config is not None and pipelex_service_config.agreement.terms_accepted:- return-- # Gateway is enabled but terms not accepted - prompt user- gateway_accepted = prompt_gateway_acceptance(console=console)-- config_manager.global_config_dir.mkdir(parents=True, exist_ok=True)- if gateway_accepted:- display_gateway_accepted_message(console=console)- update_service_terms_acceptance(accepted=True, config_dir=config_manager.global_config_dir)- else:- display_gateway_declined_message(console=console)- update_service_terms_acceptance(accepted=False, config_dir=config_manager.global_config_dir)- # Actually disable the managed gateway backends in backends.toml — and say so if an- # override still pins one on- disable_managed_gateway_backends(backends_toml_path)- warn_if_managed_gateway_pinned_by_override(console=console, backends_toml_path=backends_toml_path)--def determine_needs(*,reset: bool,@@ -269,8 +198,6 @@ def confirm_initialization(console.print("\n[yellow]Initialization cancelled.[/yellow]")if needs_config or needs_inference or needs_routing or needs_telemetry:match focus:- case InitFocus.AGREEMENT:- init_cmd_str = "pipelex init agreement"case InitFocus.ALL:init_cmd_str = "pipelex init"case InitFocus.CONFIG | InitFocus.CREDENTIALS | InitFocus.INFERENCE | InitFocus.ROUTING | InitFocus.TELEMETRY:@@ -334,11 +261,6 @@ def execute_initialization(if not backends_existed_before or (check_inference and backends_exists_now):needs_inference = True- # If we're NOT going to run customize_backends_config (which handles gateway terms),- # we need to check if gateway is enabled and terms not accepted- if not needs_inference and backends_existed_before:- _check_gateway_terms_if_needed(console=console, backends_toml_path=backends_toml_path)-# Determine if this is truly a first-time setupfirst_time_setup = is_first_time_backends_setup@@ -424,68 +346,14 @@ def execute_initialization(setup_telemetry(console=console, telemetry_config_path=telemetry_config_path, for_project=for_project)# Step 5: Prime the remote-config cache so dry-runs and validate can fall back offline.- # No-op when gateway is disabled or terms have not been accepted. We forward- # ``target_config_dir`` so the gateway-enabled check inspects the directory we just- # initialized (matters for ``--local`` vs default init).+ # No-op when no managed gateway backend is enabled. We forward ``target_config_dir`` so the+ # managed-gateway check inspects the directory we just initialized (matters for ``--local``+ # vs default init).prime_remote_config_cache(console=console, target_config_dir=target_config_dir)console.print()-def _init_agreement(*, console: Console) -> None:- """Handle the agreement-only initialization flow.-- This prompts the user to accept the Pipelex service terms without resetting any configuration,- and it is the human CLI's only way to record acceptance after the fact. It therefore asks the- same question the boot asks — is ANY managed gateway backend enabled — rather than the narrower- gateway-only one, which would report that nothing is needed on an installation the boot refuses- to start for want of exactly this.-- Args:- console: Rich Console instance for user interaction.- """- if not enabled_managed_gateway_sections():- console.print()- console.print("[green]✓ No Pipelex-managed gateway backend is enabled.[/green]")- console.print("[dim]No terms acceptance is required.[/dim]")- console.print()- return-- # Check current terms acceptance status (always global)- pipelex_service_config = load_pipelex_service_config_if_exists(config_dir=config_manager.global_config_dir)-- if pipelex_service_config is not None and pipelex_service_config.agreement.terms_accepted:- console.print()- console.print("[green]✓ Pipelex Gateway terms have already been accepted.[/green]")- console.print()- return-- # Show the terms panel and prompt for acceptance- console.print()- console.print(build_gateway_terms_panel())- console.print()-- accepted = Confirm.ask(- "[bold]Do you accept the Pipelex Gateway terms of service?[/bold]",- console=console,- default=True,- )-- if accepted:- display_gateway_accepted_message(console=console)- update_service_terms_acceptance(accepted=True, config_dir=config_manager.global_config_dir)- else:- display_gateway_declined_message(console=console)- update_service_terms_acceptance(accepted=False, config_dir=config_manager.global_config_dir)- # Disable the gateway since terms were declined- backends_toml_path = config_manager.pipelex_config_dir / "inference" / "backends.toml"- if backends_toml_path.exists():- disable_managed_gateway_backends(backends_toml_path)- warn_if_managed_gateway_pinned_by_override(console=console, backends_toml_path=backends_toml_path)-- console.print()--def init_cmd(focus: InitFocus = InitFocus.ALL,*,@@ -498,17 +366,12 @@ def init_cmd(of the configuration, overwriting any existing files.Args:- focus: What to initialize - 'all', 'agreement', 'config', 'credentials', 'inference', 'routing', or 'telemetry'+ focus: What to initialize - 'all', 'config', 'credentials', 'inference', 'routing', or 'telemetry'skip_confirmation: If True, skip the confirmation prompt (used when called from doctor --fix)local: If True, create project-level .pipelex/ at the detected project root. Otherwise, create global ~/.pipelex/."""console = get_console()- # Handle agreement-only flow separately (no reset needed)- if focus == InitFocus.AGREEMENT:- _init_agreement(console=console)- return-# Handle credentials-only flow separately (no reset needed)if focus == InitFocus.CREDENTIALS:backends_toml_path = config_manager.pipelex_config_dir / "inference" / "backends.toml"diff --git a/pipelex/cli/commands/init/credentials.py b/pipelex/cli/commands/init/credentials.pyindex 7475c3082..36dcc3359 100644--- a/pipelex/cli/commands/init/credentials.py+++ b/pipelex/cli/commands/init/credentials.py@@ -10,7 +10,6 @@ from rich.markup import escapefrom rich.prompt import Promptfrom pipelex.system.configuration.config_loader import config_manager-from pipelex.system.pipelex_service.pipelex_details import PipelexDetailsfrom pipelex.tools.misc.dict_utils import extract_vars_from_strings_recursivefrom pipelex.tools.misc.toml_utils import load_toml_from_path@@ -135,8 +134,6 @@ def prompt_credentials(*, console: Console, backends_toml_path: Path) -> None:collected_count = 0for var_name, backend_names in sorted(missing_vars.items()):backends_str = ", ".join(backend_names)- if var_name == PipelexDetails.PIPELEX_GATEWAY_API_KEY_VAR:- console.print(" [dim]Get a free API key at[/dim] [cyan]https://app.pipelex.com[/cyan]")value = Prompt.ask(f" [bold]{escape(var_name)}[/bold] [dim](required by {escape(backends_str)})[/dim]", default="", console=console, password=True)diff --git a/pipelex/cli/commands/init/routing.py b/pipelex/cli/commands/init/routing.pyindex 7fe0ddc47..c73927deb 100644--- a/pipelex/cli/commands/init/routing.py+++ b/pipelex/cli/commands/init/routing.py@@ -15,8 +15,6 @@ from pipelex.cli.commands.init.ui.routing_ui import (prompt_fallback_order,prompt_primary_backend,)-from pipelex.cogt.model_backends.backend import PipelexBackend-from pipelex.cogt.model_routing.routing_profile import PipelexRoutingProfilefrom pipelex.kit.paths import get_kit_configs_dirfrom pipelex.runtime_hub import get_consolefrom pipelex.system.configuration.config_loader import config_manager@@ -51,14 +49,7 @@ def customize_routing_profile(selected_backend_keys: list[str], *, target_configtemplate_backends_path = Path(str(get_kit_configs_dir() / "inference" / "backends.toml"))backend_options = get_backend_options_from_toml(template_backends_path, existing_path=backends_toml_path)- # Case 1: pipelex_gateway is enabled - use all_pipelex_gateway- if PipelexBackend.GATEWAY in selected_backend_keys:- toml_doc["active"] = PipelexRoutingProfile.ALL_PIPELEX_GATEWAY- save_toml_to_path(toml_doc, path=routing_profiles_toml_path)- display_routing_profile_result(console=console, profile_name=PipelexRoutingProfile.ALL_PIPELEX_GATEWAY, created=False)- return-- # Case 2: Only one backend selected - use all_{backend_key} profile+ # Case 1: Only one backend selected - use all_{backend_key} profileif len(selected_backend_keys) == 1:backend_key = selected_backend_keys[0]profile_name = f"all_{backend_key}"@@ -92,7 +83,7 @@ def customize_routing_profile(selected_backend_keys: list[str], *, target_configdisplay_routing_profile_result(console=console, profile_name=profile_name, created=not profile_exists)return- # Case 3: Multiple backends (no pipelex_gateway) - create/update custom_routing profile+ # Case 2: Multiple backends - create/update custom_routing profileconsole.print()console.print("[cyan]Setting up routing for multiple backends...[/cyan]")console.print()diff --git a/pipelex/cli/commands/init/telemetry.py b/pipelex/cli/commands/init/telemetry.pyindex da0c79bdf..17314182d 100644--- a/pipelex/cli/commands/init/telemetry.py+++ b/pipelex/cli/commands/init/telemetry.py@@ -41,6 +41,3 @@ def setup_telemetry(*, console: Console, telemetry_config_path: Path, for_projecconsole.print("[dim] • \\[posthog] - Send traces to your own PostHog project[/dim]")console.print("[dim] • \\[langfuse] - Enable Langfuse LLM observability[/dim]")console.print("[dim] • \\[\\[otlp]] - Add custom OpenTelemetry exporters[/dim]")- console.print()- console.print("[dim]💡 Note: If you use Pipelex Gateway, separate telemetry is sent to Pipelex[/dim]")- console.print("[dim]servers regardless of these settings.[/dim]")diff --git a/pipelex/cli/commands/init/ui/backends_ui.py b/pipelex/cli/commands/init/ui/backends_ui.pyindex 16006c2ef..a5250ebf7 100644--- a/pipelex/cli/commands/init/ui/backends_ui.py+++ b/pipelex/cli/commands/init/ui/backends_ui.py@@ -13,6 +13,10 @@ from pipelex.tools.misc.exceptions import TomlErrorfrom pipelex.tools.misc.string_utils import snake_to_capitalize_first_letterfrom pipelex.tools.misc.toml_utils import load_toml_from_path+# The backend `pipelex init` pre-selects: the one key that serves every default language-model and image-generation tier+# of the shipped model deck.+RECOMMENDED_INIT_BACKEND = "openai"+def get_backend_options_from_toml(template_path: Path, *, existing_path: Path | None = None) -> list[tuple[str, str]]:"""Get backend options dynamically from TOML files.@@ -58,6 +62,25 @@ def get_backend_options_from_toml(template_path: Path, *, existing_path: Path |return backend_options+def default_backend_index(*, backend_options: list[tuple[str, str]]) -> int:+ """The 0-based index of the backend a first-time setup pre-selects.++ OpenAI serves every default language-model and image-generation tier of the shipped model deck,+ so the recommended setup runs the deck's defaults on one key, with no Pipelex account. Falls back+ to the first option when the template does not list it.++ Args:+ backend_options: List of tuples (backend_key, display_name).++ Returns:+ The index of the recommended backend in ``backend_options``.+ """+ for index, (backend_key, _) in enumerate(backend_options):+ if backend_key == RECOMMENDED_INIT_BACKEND:+ return index+ return 0++def get_currently_enabled_backends(backends_toml_path: Path, *, backend_options: list[tuple[str, str]]) -> list[int]:"""Get list of currently enabled backend indices from existing backends.toml.@@ -140,7 +163,7 @@ def build_backend_selection_panel(description = Text("Select which inference backends you have access to.\n""Enter numbers separated by commas or spaces (e.g., '1,5,6' or '1 5 6'), 'a' for all.\n"- "Press Enter for the recommended default (1).",+ f"Press Enter for the recommended default ({default_backend_index(backend_options=backend_options) + 1}).",style="dim",)@@ -171,14 +194,14 @@ def prompt_backend_select(Raises:typer.Exit: If user chooses to quit."""- # Determine default based on current selection or fallback to first option (pipelex_gateway)+ # Determine default based on current selection, or fall back to the recommended backendif currently_enabled and not is_first_time_setup:default_indices = sorted(currently_enabled)default_str = ",".join(str(i + 1) for i in default_indices)else:- # For first-time setup or no current selection, default to pipelex_gateway (index 0)- default_indices = [0]- default_str = "1"+ # For first-time setup or no current selection, default to the recommended backend+ default_indices = [default_backend_index(backend_options=backend_options)]+ default_str = str(default_indices[0] + 1)selected_indices: list[int] = []while True:diff --git a/pipelex/cli/commands/init/ui/gateway_ui.py b/pipelex/cli/commands/init/ui/gateway_ui.pydeleted file mode 100644index d4752deb5..000000000--- a/pipelex/cli/commands/init/ui/gateway_ui.py+++ /dev/null@@ -1,144 +0,0 @@-"""UI components for Pipelex Gateway terms acceptance flow."""--from rich.console import Console, Group-from rich.panel import Panel-from rich.prompt import Confirm-from rich.text import Text--from pipelex.urls import URLs---def build_gateway_terms_panel() -> Panel:- """Build a Rich Panel explaining Pipelex Gateway terms and telemetry.-- Returns:- A Panel containing the gateway terms explanation.- """- title_text = Text("Pipelex Gateway Terms of Service", style="bold yellow")-- intro = Text(- "You have selected Pipelex Gateway as an inference backend.\nBy using Pipelex Gateway, you agree to the following terms:\n",- style="white",- )-- telemetry_header = Text("\n📊 Identified Telemetry Requirement\n", style="bold cyan")-- telemetry_explanation = Text(- "When using Pipelex Gateway, identified telemetry is automatically enabled.\n"- "Your usage is associated with your Gateway API key (hashed for security).\n\n"- "This is independent from your telemetry.toml settings and allows us to:\n"- " • Monitor and improve service quality\n"- " • Enforce fair usage limits and prevent abuse\n"- " • Provide you with usage insights and better support\n\n"- "We collect ONLY technical and quantitative data:\n",- style="white",- )-- collected_items = Text(- " ✓ Model names used (e.g., gpt-4o, claude-3.7-sonnet) and parameters\n"- " ✓ Pipe types (e.g., PipeLLM, PipeSequence, etc.)\n"- " ✓ Token counts (input/output)\n"- " ✓ Latency metrics\n"- " ✓ Error rates (without error details)\n",- style="green",- )-- not_collected = Text(- "\nWe do NOT collect:\n",- style="white",- )-- not_collected_items = Text(- " ✗ Your prompts or completions\n ✗ Your pipe codes or output class names\n ✗ File contents or business data\n",- style="red",- )-- optional_note = Text(- "\n💡 This is Optional\n",- style="bold cyan",- )-- optional_explanation = Text(- "Using Pipelex Gateway is entirely optional. If you prefer not to use our gateway:\n"- " • Disable pipelex_gateway in your backends configuration in .pipelex/inference/backends.toml\n"- " • Use your own API keys with direct provider backends (openai, anthropic, azure, bedrock, etc.)\n"- " • No telemetry will be sent to Pipelex servers\n",- style="white",- )-- links = Text(- f"\n📚 Documentation: {URLs.documentation}\n🔒 Privacy Policy: {URLs.privacy_policy}\n💬 Questions? Join Discord: {URLs.discord}\n",- style="dim",- )-- content = Group(- intro,- telemetry_header,- telemetry_explanation,- collected_items,- not_collected,- not_collected_items,- optional_note,- optional_explanation,- links,- )-- return Panel(- content,- title=title_text,- border_style="yellow",- padding=(1, 2),- )---def prompt_gateway_acceptance(*, console: Console) -> bool:- """Prompt the user to accept Pipelex Gateway terms.-- Args:- console: Rich Console instance for user interaction.-- Returns:- True if user accepts, False if declined.- """- console.print()- console.print(build_gateway_terms_panel())- console.print()-- return Confirm.ask(- "[bold]Do you accept the Pipelex Gateway terms of service?[/bold]",- console=console,- default=True,- )---def display_gateway_declined_message(*, console: Console) -> None:- """Display message when user declines gateway terms.-- Args:- console: Rich Console instance for output.- """- console.print()- console.print("[yellow]⚠ Pipelex Gateway terms not accepted.[/yellow]")- console.print()- console.print("Pipelex Gateway has been disabled in your backends configuration.")- console.print()- console.print("[bold yellow]⚠ Important:[/bold yellow] If your routing profile uses pipelex_gateway as its default backend,")- console.print(" you will need to reconfigure your routing profile.")- console.print(" Run [cyan]pipelex init routing[/cyan] to select a different default backend.")- console.print()- console.print("[bold]Alternative options:[/bold]")- console.print(" • Use your own API keys with direct provider backends")- console.print(" • Available backends: openai, anthropic, google, bedrock, etc.")- console.print()- console.print(f"[dim]Need help? Visit {URLs.documentation} or join {URLs.discord}[/dim]")---def display_gateway_accepted_message(*, console: Console) -> None:- """Display confirmation message when user accepts gateway terms.-- Args:- console: Rich Console instance for output.- """- console.print()- console.print("[green]✓ Pipelex Gateway terms accepted.[/green]")- console.print("[dim]Identified telemetry (tied to your API key) will be enabled for service monitoring.[/dim]")diff --git a/pipelex/cli/commands/init/ui/types.py b/pipelex/cli/commands/init/ui/types.pyindex 1361f29ca..e263802d8 100644--- a/pipelex/cli/commands/init/ui/types.py+++ b/pipelex/cli/commands/init/ui/types.py@@ -7,7 +7,6 @@ class InitFocus(StrEnum):"""Focus options for initialization."""ALL = "all"- AGREEMENT = "agreement"CONFIG = "config"CREDENTIALS = "credentials"INFERENCE = "inference"diff --git a/pipelex/cli/commands/login/__init__.py b/pipelex/cli/commands/login/__init__.pydeleted file mode 100644index e69de29bb..000000000diff --git a/pipelex/cli/commands/login/command.py b/pipelex/cli/commands/login/command.pydeleted file mode 100644index ace1db987..000000000--- a/pipelex/cli/commands/login/command.py+++ /dev/null@@ -1,120 +0,0 @@-"""Browser-based CLI authentication for Pipelex Gateway."""--from __future__ import annotations--import threading-import webbrowser-from functools import partial-from http.server import BaseHTTPRequestHandler, HTTPServer-from urllib.parse import parse_qs, urlparse--from typing_extensions import override--from pipelex.cli.commands.init.credentials import get_global_env_path, read_env_file, write_env_file-from pipelex.runtime_hub import get_console-from pipelex.urls import URLs--LOGIN_TIMEOUT_SECONDS = 120-PIPELEX_GATEWAY_API_KEY_VAR = "PIPELEX_GATEWAY_API_KEY"---class CallbackHandler(BaseHTTPRequestHandler):- """HTTP handler that receives the API key callback from the browser."""-- def __init__(self, result: dict[str, str | None], *args: object, **kwargs: object) -> None:- self._result = result- super().__init__(*args, **kwargs) # type: ignore[arg-type]-- def do_GET(self) -> None: # pylint: disable=invalid-name- """Handle GET /callback?api_key=xxx."""- parsed = urlparse(self.path)- params = parse_qs(parsed.query)- api_key_list = params.get("api_key", [])-- if parsed.path == "/callback" and api_key_list:- self._result["api_key"] = api_key_list[0]- self._send_success_page()- else:- self._send_error_page()-- def _send_success_page(self) -> None:- self.send_response(200)- self.send_header("Content-Type", "text/html")- self.end_headers()- html = (- "<html><body style='font-family:system-ui;text-align:center;padding:60px'>"- "<h1>Logged in successfully!</h1>"- "<p>You can close this tab and return to your terminal.</p>"- "</body></html>"- )- self.wfile.write(html.encode())-- def _send_error_page(self) -> None:- self.send_response(400)- self.send_header("Content-Type", "text/html")- self.end_headers()- html = (- "<html><body style='font-family:system-ui;text-align:center;padding:60px'>"- "<h1>Authentication failed</h1>"- "<p>Missing API key parameter. Please try again.</p>"- "</body></html>"- )- self.wfile.write(html.encode())-- @override- def log_message(self, format: str, *args: object) -> None:- """Suppress default HTTP server logging."""---def login_cmd() -> None:- """Open the browser for Pipelex Gateway login and save the API key."""- console = get_console()-- result: dict[str, str | None] = {"api_key": None}- handler_cls = partial(CallbackHandler, result)-- server = HTTPServer(("127.0.0.1", 0), handler_cls) # type: ignore[arg-type]- port = server.server_address[1]-- auth_url = f"{URLs.app_cli_auth}?callback_port={port}"-- console.print("\n[bold]Opening browser for login...[/bold]")- console.print(f"[dim]If it doesn't open, visit: {auth_url}[/dim]\n")-- webbrowser.open(auth_url)-- server.timeout = LOGIN_TIMEOUT_SECONDS- server_thread = threading.Thread(target=serve_until_callback, args=(server,), kwargs={"result": result}, daemon=True)- server_thread.start()- server_thread.join(timeout=LOGIN_TIMEOUT_SECONDS)-- server.server_close()-- if result["api_key"]:- save_api_key(result["api_key"])- console.print("[bold green]Logged in successfully![/bold green]")- console.print(f"[dim]API key saved to {get_global_env_path()}[/dim]\n")- else:- console.print("[bold red]Login timed out.[/bold red]")- console.print(f"[dim]No response received within {LOGIN_TIMEOUT_SECONDS}s.[/dim]")- console.print("[dim]You can try again with: pipelex login[/dim]")- console.print(f"[dim]Or visit {URLs.app_cli_auth} to generate your API key manually.[/dim]\n")- raise SystemExit(1)---def serve_until_callback(server: HTTPServer, *, result: dict[str, str | None]) -> None:- """Handle requests until we get the API key or timeout."""- try:- while result["api_key"] is None:- server.handle_request()- except OSError:- # Socket closed by main thread after timeout — expected during shutdown.- pass---def save_api_key(api_key: str) -> None:- """Write the API key to ~/.pipelex/.env."""- env_path = get_global_env_path()- entries = read_env_file(env_path)- entries[PIPELEX_GATEWAY_API_KEY_VAR] = api_key- write_env_file(env_path, entries=entries)diff --git a/pipelex/cli/dev_cli/_dev_cli.py b/pipelex/cli/dev_cli/_dev_cli.pyindex 1d6487853..f22ea2d40 100644--- a/pipelex/cli/dev_cli/_dev_cli.py+++ b/pipelex/cli/dev_cli/_dev_cli.py@@ -12,7 +12,6 @@ from typing_extensions import overridefrom pipelex.cli.dev_cli.commands.check_actions_allowlist_cmd import check_actions_allowlist_cmdfrom pipelex.cli.dev_cli.commands.check_config_sync_cmd import LeadingConfig, check_config_sync_cmd-from pipelex.cli.dev_cli.commands.check_gateway_models_cmd import check_gateway_models_cmdfrom pipelex.cli.dev_cli.commands.check_hub_layering_cmd import check_hub_layering_cmdfrom pipelex.cli.dev_cli.commands.check_keyword_only_cmd import check_keyword_only_cmdfrom pipelex.cli.dev_cli.commands.check_ledger_cmd import check_ledger_cmd@@ -35,7 +34,6 @@ from pipelex.cli.dev_cli.commands.subject_grant_cmd import subject_grant_cmdfrom pipelex.cli.dev_cli.commands.sync_kit_configs_cmd import sync_kit_configs_cmdfrom pipelex.cli.dev_cli.commands.sync_main_config_cmd import SyncTarget, sync_main_config_cmdfrom pipelex.cli.dev_cli.commands.trace_input_semantics_cmd import trace_input_semantics_cmd-from pipelex.cli.dev_cli.commands.update_gateway_models_cmd import update_gateway_models_cmdfrom pipelex.cli.dev_cli.commands.update_migration_schemas_cmd import update_migration_schemas_cmdfrom pipelex.runtime_hub import get_consolefrom pipelex.tools.misc.package_utils import get_package_version@@ -50,7 +48,6 @@ class PipelexDevCLI(TyperGroup):return ["check-actions-allowlist","check-config-sync",- "check-gateway-models","check-hub-layering","check-keyword-only","check-ledger",@@ -73,7 +70,6 @@ class PipelexDevCLI(TyperGroup):"sync-kit-configs","sync-main-config","trace-input-semantics",- "update-gateway-models","update-migration-schemas",]@@ -275,27 +271,6 @@ def generate_mthds_schema_command(sys.exit(1)[email protected](name="check-gateway-models", help="Verify that gateway models reference is up-to-date")-def check_gateway_models_command(- show_diff: Annotated[bool, typer.Option("--show-diff/--no-diff", help="Show differences if found")] = True,- quiet: Annotated[bool, typer.Option("--quiet", "-q", help="Output only a single validation line")] = False,-) -> None:- """Verify that the Pipelex Gateway models reference file is up-to-date."""- try:- check_gateway_models_cmd(show_diff=show_diff, quiet=quiet)- except (typer.Exit, typer.Abort):- # Typer control-flow exits carry an intended exit code — not a failure. Let them through.- raise- except Exception: # ruff: ignore[blind-except]- # Dev CLI command root: print a traceback for any unexpected failure and exit non-zero.- console = get_console()- console.print()- console.print("[bold red]Unexpected error occurred[/bold red]")- console.print()- console.print(Traceback())- sys.exit(1)--@app.command(name="check-mthds-schema", help="Verify that MTHDS JSON Schema is up-to-date")def check_mthds_schema_command(show_diff: Annotated[bool, typer.Option("--show-diff/--no-diff", help="Show differences if found")] = True,@@ -633,26 +608,6 @@ def refresh_graph_ui_sri_command(sys.exit(1)[email protected](name="update-gateway-models", help="Update the gateway models reference file")-def update_gateway_models_command(- quiet: Annotated[bool, typer.Option("--quiet", "-q", help="Output only a single validation line")] = False,-) -> None:- """Update the Pipelex Gateway models reference file from remote config."""- try:- update_gateway_models_cmd(quiet=quiet)- except (typer.Exit, typer.Abort):- # Typer control-flow exits carry an intended exit code — not a failure. Let them through.- raise- except Exception: # ruff: ignore[blind-except]- # Dev CLI command root: print a traceback for any unexpected failure and exit non-zero.- console = get_console()- console.print()- console.print("[bold red]Unexpected error occurred[/bold red]")- console.print()- console.print(Traceback())- sys.exit(1)--@app.command(name="store-test-durations", help="Refresh the .test_durations map pytest-split uses to balance the CI shards")def store_test_durations_command(markers: Annotated[diff --git a/pipelex/cli/dev_cli/commands/check_gateway_models_cmd.py b/pipelex/cli/dev_cli/commands/check_gateway_models_cmd.pydeleted file mode 100644index c3e0b075a..000000000--- a/pipelex/cli/dev_cli/commands/check_gateway_models_cmd.py+++ /dev/null@@ -1,213 +0,0 @@-"""Command to verify the Pipelex Gateway models reference files are up-to-date."""--from __future__ import annotations--import sys-from difflib import unified_diff-from typing import TYPE_CHECKING--from rich.markup import escape-from rich.panel import Panel--from pipelex.cli.dev_cli.commands.gateway_models_generator import (- fetch_gateway_model_specs,- generate_reference_markdown,- generate_reference_pure_markdown,- normalize_for_comparison,-)-from pipelex.cli.dev_cli.commands.update_gateway_models_cmd import gateway_models_reference_files-from pipelex.runtime_hub import get_console-from pipelex.system.pipelex_service.exceptions import RemoteConfigUnavailableError, RemoteConfigValidationError--if TYPE_CHECKING:- from pathlib import Path-- from rich.console import Console---def check_gateway_models_cmd(*, show_diff: bool = True, quiet: bool = False) -> None:- """Verify that the Pipelex Gateway models reference files are up-to-date.-- Compares the existing reference files — both the .pipelex/ copies and the- packaged kit/configs/ copies — against the current remote config.-- Args:- show_diff: If True, display the differences when found.- quiet: If True, output only a single validation line (for use in Make targets).- """- console = get_console()-- if not quiet:- console.print()- console.print("[bold]Checking Pipelex Gateway models reference files...[/bold]")- console.print()-- reference_files = gateway_models_reference_files()- all_paths: list[Path] = [path for pair in reference_files for path in pair]-- # Check that every reference file exists- missing_files = [str(path) for path in all_paths if not path.exists()]- if missing_files:- if quiet:- console.print("[red]✗ Gateway models check: FAILED[/red] - Reference file(s) do not exist")- else:- files_list = "\n".join(f" - {path}" for path in missing_files)- error_panel = Panel(- f"[red]✗[/red] Reference file(s) do not exist:\n\n[dim]{files_list}[/dim]",- title="[bold red]Gateway Models Check: FAILED[/bold red]",- border_style="red",- padding=(1, 2),- )- console.print(error_panel)- console.print()- console.print("[bold yellow]Recommended Action:[/bold yellow]")- console.print(" Run: [cyan]make update-gateway-models[/cyan] or [cyan]make ugm[/cyan]")- console.print()- sys.exit(1)-- # Fetch remote config- try:- model_specs = fetch_gateway_model_specs()- except RemoteConfigUnavailableError as exc:- if quiet:- console.print(f"[red]✗ Gateway models check: FAILED[/red] - {escape(str(exc))}")- else:- error_panel = Panel(- f"[red]✗[/red] Failed to fetch remote configuration\n\n[dim]{escape(str(exc))}[/dim]",- title="[bold red]Gateway Models Check: FAILED[/bold red]",- border_style="red",- padding=(1, 2),- )- console.print(error_panel)- console.print()- sys.exit(1)- except RemoteConfigValidationError as exc:- if quiet:- console.print(f"[red]✗ Gateway models check: FAILED[/red] - {escape(str(exc))}")- else:- error_panel = Panel(- f"[red]✗[/red] Invalid remote configuration\n\n[dim]{escape(str(exc))}[/dim]",- title="[bold red]Gateway Models Check: FAILED[/bold red]",- border_style="red",- padding=(1, 2),- )- console.print(error_panel)- console.print()- sys.exit(1)-- # Generate expected content for both file variants- expected_html_content = generate_reference_markdown(model_specs)- expected_plain_content = generate_reference_pure_markdown(model_specs)- expected_html_normalized = normalize_for_comparison(expected_html_content)- expected_plain_normalized = normalize_for_comparison(expected_plain_content)-- # Compare every reference file against the expected content (ignoring the- # timestamp line). Collect out-of-date files and the diffs to display.- out_of_date_files: list[str] = []- pending_diffs: list[tuple[str, str, str]] = []- try:- for html_path, plain_path in reference_files:- existing_html_content = html_path.read_text(encoding="utf-8")- existing_plain_content = plain_path.read_text(encoding="utf-8")- if normalize_for_comparison(existing_html_content) != expected_html_normalized:- out_of_date_files.append(str(html_path))- pending_diffs.append((str(html_path), existing_html_content, expected_html_content))- if normalize_for_comparison(existing_plain_content) != expected_plain_normalized:- out_of_date_files.append(str(plain_path))- pending_diffs.append((str(plain_path), existing_plain_content, expected_plain_content))- except OSError as exc:- # Handle race condition where a file is deleted after the exists() check- # or other filesystem errors (permissions, etc.)- if quiet:- console.print(f"[red]✗ Gateway models check: FAILED[/red] - File system error: {escape(str(exc))}")- else:- error_panel = Panel(- f"[red]✗[/red] File system error while reading reference files\n\n[dim]{escape(str(exc))}[/dim]",- title="[bold red]Gateway Models Check: FAILED[/bold red]",- border_style="red",- padding=(1, 2),- )- console.print(error_panel)- console.print()- sys.exit(1)-- if not out_of_date_files:- # No differences found in any file- if quiet:- console.print("[green]✓ Gateway models check: PASSED[/green]")- else:- files_block = "\n".join(f"[dim] - {path}[/dim]" for path in all_paths)- success_panel = Panel(- f"[green]✓[/green] Reference files are up-to-date!\n\n{files_block}",- title="[bold green]Gateway Models Check: PASSED[/bold green]",- border_style="green",- padding=(1, 2),- )- console.print(success_panel)- console.print()- else:- # Differences found in at least one file- if quiet:- console.print("[red]✗ Gateway models check: FAILED[/red] - Reference file(s) out of date")- else:- files_list = "\n".join(f" - {path}" for path in out_of_date_files)- error_panel = Panel(- f"[red]✗[/red] Reference file(s) are [bold]OUT OF DATE[/bold]!\n\n"- f"[dim]The following files do not match the remote configuration:\n{files_list}[/dim]",- title="[bold red]Gateway Models Check: FAILED[/bold red]",- border_style="red",- padding=(1, 2),- )- console.print(error_panel)- console.print()-- if show_diff:- for path_str, existing_content, expected_content in pending_diffs:- console.print(f"[bold]Differences in {path_str}:[/bold]")- _display_diff(existing=existing_content, expected=expected_content, console=console)-- console.print("[bold yellow]Recommended Action:[/bold yellow]")- console.print(" Run: [cyan]make update-gateway-models[/cyan] or [cyan]make ugm[/cyan]")- console.print()-- sys.exit(1)---def _display_diff(*, existing: str, expected: str, console: Console) -> None:- """Display a simplified diff between existing and expected content.-- Args:- existing: Current file content.- expected: Expected file content.- console: Rich console for output.- """- existing_lines = existing.splitlines(keepends=True)- expected_lines = expected.splitlines(keepends=True)-- diff = list(- unified_diff(- existing_lines,- expected_lines,- fromfile="existing (on disk)",- tofile="expected (from remote)",- lineterm="",- )- )-- if diff:- console.print("[bold]Differences:[/bold]")- console.print()- for line in diff[:50]: # Limit output to first 50 lines- line = line.rstrip("\n")- escaped_line = escape(line)- if line.startswith("+") and not line.startswith("+++"):- console.print(f"[green]{escaped_line}[/green]")- elif line.startswith("-") and not line.startswith("---"):- console.print(f"[red]{escaped_line}[/red]")- elif line.startswith("@@"):- console.print(f"[cyan]{escaped_line}[/cyan]")- else:- console.print(escaped_line)- if len(diff) > 50:- console.print(f"[dim]... and {len(diff) - 50} more lines[/dim]")- console.print()diff --git a/pipelex/cli/dev_cli/commands/gateway_models_generator.py b/pipelex/cli/dev_cli/commands/gateway_models_generator.pydeleted file mode 100644index d637d2008..000000000--- a/pipelex/cli/dev_cli/commands/gateway_models_generator.py+++ /dev/null@@ -1,327 +0,0 @@-"""Generator for Pipelex Gateway models reference file."""--from __future__ import annotations--from datetime import UTC, datetime-from operator import itemgetter-from typing import TYPE_CHECKING, Any, cast--from pipelex.system.pipelex_service.remote_config_fetcher import RemoteConfigFetcher-from pipelex.urls import URLs--if TYPE_CHECKING:- from pipelex.cogt.model_backends.model_spec_factory import BackendModelSpecs--# Fields to include in the reference (excluding sensitive/internal details)-REFERENCE_FIELDS = frozenset({"model_type", "inputs", "outputs"})--# Model type display names and order-MODEL_TYPE_SECTIONS = {- "llm": "Language Models (LLM)",- "text_extractor": "Document Extraction Models",- "img_gen": "Image Generation Models",-}--# Preferred column order for inputs and outputs (columns not listed will be appended alphabetically)-PREFERRED_INPUT_ORDER = ["text", "images", "image", "pdf"]-PREFERRED_OUTPUT_ORDER = ["text", "structured", "image", "pages"]---def normalize_for_comparison(content: str) -> str:- """Remove timestamp line for comparison since it changes every generation."""- lines = content.split("\n")- return "\n".join(line for line in lines if not line.startswith("> Last updated:"))---def fetch_gateway_model_specs() -> BackendModelSpecs:- """Fetch model specifications from Pipelex Gateway remote config.-- Uses ``require_fresh=True`` so a stale cache never gets baked into the committed- reference docs this command regenerates.-- Returns:- Dictionary of model specifications.-- Raises:- RemoteConfigUnavailableError: If the network is unreachable (cache fallback is- explicitly refused here).- RemoteConfigValidationError: If the remote config is invalid.- """- result = RemoteConfigFetcher.fetch_remote_config(require_fresh=True)- return dict(result.config.backend_model_specs)---def extract_reference_data(model_specs: BackendModelSpecs) -> dict[str, list[dict[str, Any]]]:- """Extract and organize model data for the reference file.-- Args:- model_specs: Raw model specifications from remote config.-- Returns:- Dictionary mapping model_type to list of model info dicts.- """- # Get defaults for fallback values- defaults = model_specs.get("defaults", {})- default_model_type = defaults.get("model_type", "llm")-- # Group models by type- models_by_type: dict[str, list[dict[str, Any]]] = {- "llm": [],- "text_extractor": [],- "img_gen": [],- }-- for model_name, spec in model_specs.items():- # Skip defaults and non-dict entries- if model_name == "defaults" or not isinstance(spec, dict):- continue-- # Skip .rules sub-sections (e.g., "flux-pro.rules")- if ".rules" in model_name:- continue-- # Cast spec for type checking (we verified it's a dict above)- spec_dict = cast("dict[str, Any]", spec)-- # Determine model type- model_type: str = spec_dict.get("model_type", default_model_type)-- # Extract reference fields- model_info: dict[str, Any] = {- "name": model_name,- "inputs": spec_dict.get("inputs", []),- "outputs": spec_dict.get("outputs", []),- }-- # Add to appropriate group- if model_type in models_by_type:- models_by_type[model_type].append(model_info)-- # Sort models alphabetically within each type- for model_list in models_by_type.values():- model_list.sort(key=itemgetter("name"))-- return models_by_type---def generate_pure_markdown_list(models: list[dict[str, Any]]) -> str:- """Generate a pure Markdown bullet list for a list of models (no HTML/tables).-- Args:- models: List of model info dictionaries.-- Returns:- Pure Markdown bullet list string.- """- if not models:- return "_No models available in this category._\n"-- lines: list[str] = []- for model in models:- name: str = model.get("name", "")- inputs: list[str] = model.get("inputs", [])- outputs: list[str] = model.get("outputs", [])-- # Sort inputs and outputs using preferred order- def sort_by_preferred(items: list[str], *, preferred: list[str]) -> list[str]:- item_set = set(items)- ordered = [col for col in preferred if col in item_set]- remaining = sorted(item_set - set(preferred))- return ordered + remaining-- sorted_inputs = sort_by_preferred(inputs, preferred=PREFERRED_INPUT_ORDER)- sorted_outputs = sort_by_preferred(outputs, preferred=PREFERRED_OUTPUT_ORDER)-- inputs_str = ", ".join(sorted_inputs) if sorted_inputs else "none"- outputs_str = ", ".join(sorted_outputs) if sorted_outputs else "none"-- lines.append(f"- **{name}**")- lines.append(f" - inputs: {inputs_str}")- lines.append(f" - outputs: {outputs_str}")-- return "\n".join(lines) + "\n"---def generate_markdown_table(models: list[dict[str, Any]]) -> str:- """Generate an HTML table for a list of models with grouped input/output headers.-- Args:- models: List of model info dictionaries.-- Returns:- HTML table string.- """- if not models:- return "_No models available in this category._\n"-- # Collect all unique input and output types across all models- all_inputs: set[str] = set()- all_outputs: set[str] = set()- for model in models:- all_inputs.update(model.get("inputs", []))- all_outputs.update(model.get("outputs", []))-- # Sort columns using preferred order, with any unlisted columns appended alphabetically- def sort_by_preferred(items: set[str], *, preferred: list[str]) -> list[str]:- ordered = [col for col in preferred if col in items]- remaining = sorted(items - set(preferred))- return ordered + remaining-- input_cols = sort_by_preferred(all_inputs, preferred=PREFERRED_INPUT_ORDER)- output_cols = sort_by_preferred(all_outputs, preferred=PREFERRED_OUTPUT_ORDER)-- # Background colors for visual separation (semi-transparent for dark/light mode compatibility)- input_bg = "background-color:rgba(33,150,243,0.15)" # Semi-transparent blue- output_bg = "background-color:rgba(76,175,80,0.15)" # Semi-transparent green-- # Build HTML table- lines = ["<table>", "<thead>"]-- # First header row with grouped columns (Model + Inputs span + Outputs span)- lines.append("<tr>")- lines.append('<th rowspan="2">Model</th>')- if input_cols:- lines.append(f'<th colspan="{len(input_cols)}" style="text-align:center;{input_bg}">Inputs</th>')- if output_cols:- lines.append(f'<th colspan="{len(output_cols)}" style="text-align:center;{output_bg}">Outputs</th>')- lines.append("</tr>")-- # Second header row with individual column names- lines.append("<tr>")- for inp in input_cols:- lines.append(f'<th style="text-align:center;{input_bg}">{inp}</th>')- for out in output_cols:- lines.append(f'<th style="text-align:center;{output_bg}">{out}</th>')- lines.append("</tr>")-- lines.append("</thead>")- lines.append("<tbody>")-- # Data rows- for model in models:- model_inputs = set(model.get("inputs", []))- model_outputs = set(model.get("outputs", []))- name = model.get("name", "")-- lines.append("<tr>")- lines.append(f"<td>{name}</td>")- for inp in input_cols:- check = "✅" if inp in model_inputs else "❌"- lines.append(f'<td style="text-align:center;{input_bg}">{check}</td>')- for out in output_cols:- check = "✅" if out in model_outputs else "❌"- lines.append(f'<td style="text-align:center;{output_bg}">{check}</td>')- lines.append("</tr>")-- lines.append("</tbody>")- lines.append("</table>")-- return "\n".join(lines) + "\n"---def generate_reference_markdown(model_specs: BackendModelSpecs) -> str:- """Generate the complete Markdown reference file content.-- Args:- model_specs: Raw model specifications from remote config.-- Returns:- Complete Markdown content for the reference file.- """- models_by_type = extract_reference_data(model_specs)- timestamp = datetime.now(UTC).strftime("%Y-%m-%dT%H:%M:%SZ")-- sections = [- "# Pipelex Gateway — Available Models",- "This file lists the LLMs, document extraction models, and image generation models currently available through Pipelex Gateway.",- f"For configuration details, see the [documentation]({URLs.gateway_docs}).",- "",- ]-- # Add LLM section- sections.append("## Language Models (LLM)")- sections.append("")- sections.append(generate_markdown_table(models_by_type["llm"]))-- # Add document extractor section- sections.append("## Document Extraction Models")- sections.append("")- sections.append(generate_markdown_table(models_by_type["text_extractor"]))- sections.append("")- sections.append(- "!!! info About extracted pages\n"- " Each page contains Markdown text (based on AI-interpreted layout) and optional extracted images. "- "A single image input is treated as one page. Pipelex also wraps the `pypdfium2` library for raw text "- "(without any AI interpretation) and images extraction and page views rendering. "- "All these elements can be used as inputs into downstream pipes, including LLM prompts."- )-- # Add image generation section- sections.append("## Image Generation Models")- sections.append("")- sections.append(generate_markdown_table(models_by_type["img_gen"]))-- # Add auto-generated notice at the bottom- sections.append("")- sections.append("> **AUTO-GENERATED FILE** - Do not edit manually.")- sections.append(f"> Last updated: {timestamp}")- sections.append(">")- sections.append("> Run `pipelex-dev update-gateway-models` or `make ugm` to regenerate.")-- return "\n".join(sections)---def generate_reference_pure_markdown(model_specs: BackendModelSpecs) -> str:- """Generate a pure Markdown reference file content (no HTML, plain text readable).-- Args:- model_specs: Raw model specifications from remote config.-- Returns:- Complete pure Markdown content for the reference file.- """- models_by_type = extract_reference_data(model_specs)- timestamp = datetime.now(UTC).strftime("%Y-%m-%dT%H:%M:%SZ")-- sections = [- "# Pipelex Gateway — Available Models (Plain Text)",- "",- "This file lists the LLMs, document extraction models, and image generation models currently available through Pipelex Gateway.",- f"For configuration details, see the [documentation]({URLs.gateway_docs}).",- "",- "**Note:** This is the plain-text readable version. See `pipelex_gateway_models.md` for the HTML-styled version.",- "",- ]-- # Add LLM section- sections.append("## Language Models (LLM)")- sections.append("")- sections.append(generate_pure_markdown_list(models_by_type["llm"]))-- # Add document extractor section- sections.append("## Document Extraction Models")- sections.append("")- sections.append(generate_pure_markdown_list(models_by_type["text_extractor"]))- sections.append("")- sections.append(- "**About extracted pages:** "- "Each page contains Markdown text (based on AI-interpreted layout) and optional extracted images. "- "A single image input is treated as one page. Pipelex also wraps the `pypdfium2` library for raw text "- "(without any AI interpretation) and images extraction and page views rendering. "- "All these elements can be used as inputs into downstream pipes, including LLM prompts."- )-- # Add image generation section- sections.append("")- sections.append("## Image Generation Models")- sections.append("")- sections.append(generate_pure_markdown_list(models_by_type["img_gen"]))-- # Add auto-generated notice at the bottom- sections.append("")- sections.append("> **AUTO-GENERATED FILE** - Do not edit manually.")- sections.append(f"> Last updated: {timestamp}")- sections.append(">")- sections.append("> Run `pipelex-dev update-gateway-models` or `make ugm` to regenerate.")-- return "\n".join(sections)diff --git a/pipelex/cli/dev_cli/commands/generate_error_pages_cmd.py b/pipelex/cli/dev_cli/commands/generate_error_pages_cmd.pyindex 066e2c767..6181b600a 100644--- a/pipelex/cli/dev_cli/commands/generate_error_pages_cmd.py+++ b/pipelex/cli/dev_cli/commands/generate_error_pages_cmd.py@@ -20,9 +20,8 @@ def generate_error_pages_cmd(*, output: Path | None = None, quiet: bool = False)dev CLI commands and to surface config / setup errors loudly), then calls:func:`generate_error_pages`. Inference is never invoked here — the command onlyintrospects ``PipelexError`` subclasses and writes markdown — so the bootstrap- must skip the inference-setup / gateway-terms checks; otherwise CI environments- with no configured backend (e.g. the docs deploy job) hit- ``InferenceSetupRequiredError``. The underlying discovery rglobs every+ skips the inference setup, which a CI environment with no configured backend+ (e.g. the docs deploy job) could not complete. The underlying discovery rglobs every``exceptions.py`` / ``*_exceptions.py`` via :func:`iter_pipelex_error_subclasses`— no manual import or class-list update is needed when a new error class lands.Pages already carrying ``<!-- pipelex:authored -->`` are preserved so hand-editeddiff --git a/pipelex/cli/dev_cli/commands/preprocess_test_models_cmd.py b/pipelex/cli/dev_cli/commands/preprocess_test_models_cmd.pyindex 2ccb767db..9c5121ddf 100644--- a/pipelex/cli/dev_cli/commands/preprocess_test_models_cmd.py+++ b/pipelex/cli/dev_cli/commands/preprocess_test_models_cmd.py@@ -109,10 +109,9 @@ def _fetch_managed_gateway_models() -> dict[str, dict[str, list[str]]]:"""Fetch model handles for every enabled managed gateway backend, grouped by model type.A *managed gateway backend* is one that declares a `model_specs_section`, and there can be more- than one of them — the Portkey-cloud `pipelex_gateway` and `pipelex_manifold` today. Which- section a backend reads is its own declaration, so this asks `enabled_managed_gateway_sections`- rather than naming any backend here: hardcoding one name is exactly what kept this command- blind to the second gateway.+ than one of them — `pipelex_manifold` today. Which section a backend reads is its own+ declaration, so this asks `enabled_managed_gateway_sections` rather than naming any backend+ here: hardcoding one name is exactly what would keep this command blind to the next one.Returns:Dictionary mapping backend name to its {model_type: [model handles]}. Empty when no manageddiff --git a/pipelex/cli/dev_cli/commands/update_gateway_models_cmd.py b/pipelex/cli/dev_cli/commands/update_gateway_models_cmd.pydeleted file mode 100644index 922e13bf1..000000000--- a/pipelex/cli/dev_cli/commands/update_gateway_models_cmd.py+++ /dev/null@@ -1,155 +0,0 @@-"""Command to update the Pipelex Gateway models reference files."""--from __future__ import annotations--import sys-from pathlib import Path--from rich.markup import escape-from rich.panel import Panel--from pipelex.cli.dev_cli.commands.gateway_models_generator import (- fetch_gateway_model_specs,- generate_reference_markdown,- generate_reference_pure_markdown,- normalize_for_comparison,-)-from pipelex.runtime_hub import get_console-from pipelex.system.pipelex_service.exceptions import RemoteConfigUnavailableError, RemoteConfigValidationError--# The reference files live in two places that must stay identical: the repo's-# own .pipelex/ (which `check-gateway-models` verifies) and the packaged kit-# configs (shipped to users via `pipelex init config`). The generator writes-# both copies — the kit-config sync excludes these auto-generated files, so the-# generator is the only thing keeping the packaged copy fresh.-GATEWAY_MODELS_REFERENCE_DIRS: tuple[Path, ...] = (- Path(".pipelex/inference/backends"),- Path("pipelex/kit/configs/inference/backends"),-)-GATEWAY_MODELS_HTML_FILENAME = "pipelex_gateway_models.md"-GATEWAY_MODELS_PLAIN_FILENAME = "pipelex_gateway_models_plain.md"---def gateway_models_reference_files() -> list[tuple[Path, Path]]:- """Return the (html_path, plain_path) reference file pairs to keep in sync."""- return [- (reference_dir / GATEWAY_MODELS_HTML_FILENAME, reference_dir / GATEWAY_MODELS_PLAIN_FILENAME)- for reference_dir in GATEWAY_MODELS_REFERENCE_DIRS- ]---def _all_references_up_to_date(- reference_files: list[tuple[Path, Path]],- *,- expected_html: str,- expected_plain: str,-) -> bool:- """Whether every reference file already matches the expected content (ignoring timestamps)."""- expected_html_normalized = normalize_for_comparison(expected_html)- expected_plain_normalized = normalize_for_comparison(expected_plain)- for html_path, plain_path in reference_files:- if not (html_path.exists() and plain_path.exists()):- return False- try:- existing_html = html_path.read_text(encoding="utf-8")- existing_plain = plain_path.read_text(encoding="utf-8")- except OSError:- return False # File disappeared or is unreadable — fall through and rewrite- if normalize_for_comparison(existing_html) != expected_html_normalized:- return False- if normalize_for_comparison(existing_plain) != expected_plain_normalized:- return False- return True---def update_gateway_models_cmd(*, quiet: bool = False) -> None:- """Update the Pipelex Gateway models reference files.-- Fetches the current model specifications from the remote config and- generates updated Markdown reference files in both the .pipelex/ and the- packaged kit/configs/ locations.-- Args:- quiet: If True, output only a single validation line (for use in Make targets).- """- console = get_console()-- if not quiet:- console.print()- console.print("[bold]Updating Pipelex Gateway models reference...[/bold]")- console.print()-- # Fetch remote config- try:- model_specs = fetch_gateway_model_specs()- except RemoteConfigUnavailableError as exc:- if quiet:- console.print(f"[red]✗ Gateway models update: FAILED[/red] - {escape(str(exc))}")- else:- error_panel = Panel(- f"[red]✗[/red] Failed to fetch remote configuration\n\n[dim]{escape(str(exc))}[/dim]",- title="[bold red]Gateway Models Update: FAILED[/bold red]",- border_style="red",- padding=(1, 2),- )- console.print(error_panel)- console.print()- sys.exit(1)- except RemoteConfigValidationError as exc:- if quiet:- console.print(f"[red]✗ Gateway models update: FAILED[/red] - {escape(str(exc))}")- else:- error_panel = Panel(- f"[red]✗[/red] Invalid remote configuration\n\n[dim]{escape(str(exc))}[/dim]",- title="[bold red]Gateway Models Update: FAILED[/bold red]",- border_style="red",- padding=(1, 2),- )- console.print(error_panel)- console.print()- sys.exit(1)-- # Generate markdown content (HTML-styled and pure markdown versions)- markdown_content = generate_reference_markdown(model_specs)- plain_markdown_content = generate_reference_pure_markdown(model_specs)-- # Count models for reporting- model_count = sum(1 for key in model_specs if key != "defaults" and ".rules" not in key and isinstance(model_specs[key], dict))-- reference_files = gateway_models_reference_files()- all_paths = [path for pair in reference_files for path in pair]- files_block = "\n".join(f"[dim] - {path}[/dim]" for path in all_paths)-- # Skip writing if every reference file is already current (ignoring the- # timestamp line) — avoids noisy diffs in PRs.- if _all_references_up_to_date(reference_files, expected_html=markdown_content, expected_plain=plain_markdown_content):- if quiet:- console.print(f"[green]✓ Gateway models update: UP-TO-DATE[/green] ({model_count} models, no changes)")- else:- up_to_date_panel = Panel(- f"[green]✓[/green] Reference files are already up-to-date (skipped write)\n\n{files_block}\n[dim]Models: {model_count}[/dim]",- title="[bold green]Gateway Models Update: UP-TO-DATE[/bold green]",- border_style="green",- padding=(1, 2),- )- console.print(up_to_date_panel)- console.print()- return-- # Write both reference files into each reference directory.- for html_path, plain_path in reference_files:- html_path.parent.mkdir(parents=True, exist_ok=True)- html_path.write_text(markdown_content, encoding="utf-8")- plain_path.write_text(plain_markdown_content, encoding="utf-8")-- if quiet:- console.print(f"[green]✓ Gateway models update: PASSED[/green] ({model_count} models)")- else:- success_panel = Panel(- f"[green]✓[/green] Reference files updated successfully!\n\n{files_block}\n[dim]Models: {model_count}[/dim]",- title="[bold green]Gateway Models Update: PASSED[/bold green]",- border_style="green",- padding=(1, 2),- )- console.print(success_panel)- console.print()diff --git a/pipelex/cli/error_handlers.py b/pipelex/cli/error_handlers.pyindex 978a836fc..bef9c6c10 100644--- a/pipelex/cli/error_handlers.py+++ b/pipelex/cli/error_handlers.py@@ -17,10 +17,6 @@ from pipelex.pipeline.exceptions import ValidateBundleErrorfrom pipelex.pipeline.validation_render import build_fix_command, count_applicable_fixes, suggested_fix_label, validation_item_titlefrom pipelex.runtime_hub import get_consolefrom pipelex.system.pipelex_service.exceptions import (- GatewayApiKeyMissingError,- GatewayDoNotTrackConflictError,- GatewayTermsNotAcceptedError,- InferenceSetupRequiredError,RemoteConfigUnavailableError,RemoteConfigValidationError,)@@ -403,32 +399,6 @@ def handle_validate_bundle_error(raise typer.Exit(1) from exc-def handle_inference_setup_required_error(exc: InferenceSetupRequiredError) -> NoReturn:- """Handle and display InferenceSetupRequiredError with first-run guidance.-- This error occurs on first run when no inference backend has been configured yet.-- Args:- exc: The inference setup required error exception- """- console = get_console()- print_traceback_if_requested(console=console)- console.print("\n[bold yellow]⚠ First-time inference setup required[/bold yellow]\n")-- console.print(- "This looks like your first time running a method with live inference.\nYou need to configure an inference backend before running.\n"- )-- console.print("[bold green]💡 To get started:[/bold green]")- console.print(" • Run [cyan]pipelex init config[/cyan] for interactive setup")- console.print(" • Or run [cyan]pipelex-agent init[/cyan] with backend configuration")- console.print()-- console.print(f"[dim]For more information: {URLs.documentation}[/dim]")- console.print(f"[dim]Join our Discord for help: {URLs.discord}[/dim]\n")- raise typer.Exit(1) from exc--def handle_telemetry_config_validation_error(exc: TelemetryConfigValidationError) -> NoReturn:"""Handle and display TelemetryConfigValidationError, saying whether the file is old or wrong.@@ -470,96 +440,10 @@ def handle_telemetry_config_validation_error(exc: TelemetryConfigValidationErrorraise typer.Exit(1) from exc-def handle_gateway_terms_not_accepted_error(exc: GatewayTermsNotAcceptedError) -> NoReturn:- """Handle and display GatewayTermsNotAcceptedError with user-friendly guidance.-- This error occurs when Pipelex Gateway is enabled but the user hasn't- accepted the terms of service yet.-- Args:- exc: The gateway terms not accepted error exception- """- console = get_console()- print_traceback_if_requested(console=console)- console.print("\n[bold red]❌ Pipelex Gateway terms not accepted[/bold red]\n")-- console.print("[bold yellow]⚠ Action Required:[/bold yellow] Pipelex Gateway is enabled but you haven't accepted\nthe terms of service yet.\n")-- console.print("[bold green]💡 To fix:[/bold green] Run [cyan]pipelex init config[/cyan] to configure your backends and accept the terms\n")-- console.print("[dim]Alternatively, you can:[/dim]")- console.print("[dim] • Disable pipelex_gateway in .pipelex/inference/backends.toml[/dim]")- console.print("[dim] • Use your own API keys with direct provider backends[/dim]")- console.print()-- console.print(f"[dim]For more information: {URLs.gateway_docs}[/dim]")- console.print(f"[dim]Join our Discord for help: {URLs.discord}[/dim]\n")- raise typer.Exit(1) from exc---def handle_gateway_api_key_missing_error(exc: GatewayApiKeyMissingError) -> NoReturn:- """Handle and display GatewayApiKeyMissingError with user-friendly guidance.-- This error occurs when Pipelex Gateway is enabled but the PIPELEX_GATEWAY_API_KEY- environment variable is not set.-- Args:- exc: The gateway API key missing error exception- """- console = get_console()- print_traceback_if_requested(console=console)- console.print("\n[bold red]❌ Pipelex Gateway API key not set[/bold red]\n")-- console.print("[bold yellow]⚠ Action Required:[/bold yellow] Pipelex Gateway is enabled but the API key\nenvironment variable is not set.\n")-- console.print("[bold green]💡 To fix:[/bold green]")- console.print(f" • Get your API key at: [cyan]{URLs.app_cli_auth}[/cyan]")- console.print(" • Set the [cyan]PIPELEX_GATEWAY_API_KEY[/cyan] environment variable")- console.print()-- console.print("[dim]Alternatively, you can:[/dim]")- console.print("[dim] • Disable pipelex_gateway in .pipelex/inference/backends.toml[/dim]")- console.print("[dim] • Use your own API keys with direct provider backends[/dim]")- console.print()-- console.print(f"[dim]For more information: {URLs.gateway_docs}[/dim]")- console.print(f"[dim]Join our Discord for help: {URLs.discord}[/dim]\n")- raise typer.Exit(1) from exc---def handle_gateway_do_not_track_conflict_error(exc: GatewayDoNotTrackConflictError) -> NoReturn:- """Handle and display GatewayDoNotTrackConflictError with user-friendly guidance.-- This error occurs when Pipelex Gateway is enabled but the user has set- a DO_NOT_TRACK environment variable, which conflicts with gateway's telemetry requirement.-- Args:- exc: The gateway do not track conflict error exception- """- console = get_console()- print_traceback_if_requested(console=console)- console.print("\n[bold red]❌ Pipelex Gateway requires telemetry[/bold red]\n")-- console.print(- "[bold yellow]⚠ Conflict:[/bold yellow] Pipelex Gateway requires telemetry for service monitoring,\n"- "but you have set DO_NOT_TRACK. We respect your privacy preference.\n"- )-- console.print("[bold green]💡 To fix, choose one option:[/bold green]")- console.print(" • [cyan]Unset[/cyan] the DO_NOT_TRACK environment variable to use Gateway")- console.print(" • [cyan]Or[/cyan] disable pipelex_gateway in .pipelex/inference/backends.toml")- console.print(" and use your own API keys with direct provider backends")- console.print()-- console.print(f"[dim]For more information: {URLs.gateway_docs}[/dim]")- console.print(f"[dim]Join our Discord for help: {URLs.discord}[/dim]\n")- raise typer.Exit(1) from exc--def handle_remote_config_validation_error(exc: RemoteConfigValidationError) -> NoReturn:"""Handle and display RemoteConfigValidationError with user-friendly guidance.- This error occurs when Pipelex Gateway remote configuration was fetched but+ This error occurs when the Pipelex remote configuration was fetched butthe data is malformed or doesn't match the expected schema.Args:@@ -567,10 +451,10 @@ def handle_remote_config_validation_error(exc: RemoteConfigValidationError) -> N"""console = get_console()print_traceback_if_requested(console=console)- console.print("\n[bold red]❌ Pipelex Gateway configuration is invalid[/bold red]\n")+ console.print("\n[bold red]❌ The Pipelex remote configuration is invalid[/bold red]\n")console.print(- "[bold yellow]⚠ Server Issue:[/bold yellow] The Pipelex Gateway configuration was received but\n"+ "[bold yellow]⚠ Server Issue:[/bold yellow] The Pipelex remote configuration was received but\n""couldn't be validated. This is a server-side issue that we need to fix.\n")@@ -585,29 +469,29 @@ def handle_remote_config_validation_error(exc: RemoteConfigValidationError) -> Nconsole.print()console.print("[dim]In the meantime, you can:[/dim]")- console.print("[dim] • Disable pipelex_gateway in .pipelex/inference/backends.toml[/dim]")+ console.print("[dim] • Disable the Pipelex-managed gateway backends in .pipelex/inference/backends.toml[/dim]")console.print("[dim] • Use your own API keys with direct provider backends[/dim]")console.print()- console.print(f"[dim]For more information: {URLs.gateway_docs}[/dim]\n")+ console.print(f"[dim]For more information: {URLs.backend_provider_docs}[/dim]\n")raise typer.Exit(1) from excdef handle_remote_config_unavailable_error(exc: RemoteConfigUnavailableError) -> NoReturn:"""Handle and display RemoteConfigUnavailableError with user-friendly guidance.- Raised when a fresh fetch failed AND no usable cached fallback exists. The gateway- is enabled but we have neither network nor a primed local cache.+ Raised when a fresh fetch failed AND no usable cached fallback exists. A Pipelex-managed+ gateway backend is enabled but we have neither network nor a primed local cache.Args:exc: The remote config unavailable error exception"""console = get_console()print_traceback_if_requested(console=console)- console.print("\n[bold red]❌ Pipelex Gateway is unreachable and no cached config is available[/bold red]\n")+ console.print("\n[bold red]❌ The Pipelex remote configuration is unreachable and no cached config is available[/bold red]\n")console.print(- "[bold yellow]⚠ Offline + Cold Cache:[/bold yellow] Pipelex Gateway requires a config\n"+ "[bold yellow]⚠ Offline + Cold Cache:[/bold yellow] A Pipelex-managed gateway backend requires a config\n""either fetched fresh or restored from a local cache, but neither is available.\n")@@ -617,11 +501,11 @@ def handle_remote_config_unavailable_error(exc: RemoteConfigUnavailableError) ->console.print("[bold green]💡 To fix:[/bold green]")console.print(" • Reconnect to the network and run [cyan]pipelex init[/cyan] to prime the cache")console.print(- " • Or disable [cyan]pipelex_gateway[/cyan] in [cyan].pipelex/inference/backends.toml[/cyan] for permanent offline (BYOK) operation"+ " • Or disable the Pipelex-managed gateway backends in [cyan].pipelex/inference/backends.toml[/cyan] for permanent offline (BYOK) operation")console.print()- console.print(f"[dim]For more information: {URLs.gateway_docs}[/dim]")+ console.print(f"[dim]For more information: {URLs.backend_provider_docs}[/dim]")console.print(f"[dim]Join our Discord for help: {URLs.discord}[/dim]\n")raise typer.Exit(1) from exc@@ -634,8 +518,8 @@ def handle_gateway_unknown_model_error(exc: GatewayUnknownModelError) -> NoReturremediation on the provenance of the gateway config.**The backend is named rather than assumed.** More than one managed gateway can be live at- once, so telling the user to disable `pipelex_gateway` when it was the other service that could- not serve the handle would send them to fix the wrong line of their configuration.+ once, so telling the user to disable one when it was another service that could not serve the+ handle would send them to fix the wrong line of their configuration.Args:exc: The gateway unknown model error exception@@ -661,6 +545,6 @@ def handle_gateway_unknown_model_error(exc: GatewayUnknownModelError) -> NoReturconsole.print(f" • Or disable [cyan]{backend_name}[/cyan] in [cyan].pipelex/inference/backends.toml[/cyan] to operate offline (BYOK)")console.print()- console.print(f"[dim]For more information: {URLs.gateway_docs}[/dim]")+ console.print(f"[dim]For more information: {URLs.backend_provider_docs}[/dim]")console.print(f"[dim]Join our Discord for help: {URLs.discord}[/dim]\n")raise typer.Exit(1) from excdiff --git a/pipelex/cogt/inference/error_classification.py b/pipelex/cogt/inference/error_classification.pyindex eab0cac73..fceb27d1b 100644--- a/pipelex/cogt/inference/error_classification.py+++ b/pipelex/cogt/inference/error_classification.py@@ -241,9 +241,8 @@ class GatewayRoutingRefusal(StrEnum):change, the code is not. All but one are the gateway's ``pig-`` codes, at HTTP400. ``MODEL_NOT_ALLOWED`` is keyed on the code of the Portkey substrate thegateway is built on, which answers it at HTTP 412 from the middleware the- gateway vendors; Portkey's cloud answers it the same way, for the integrations- ``pipelex_gateway`` reaches by default and for a caller's own workspace behind- the ``portkey`` backend alike.+ gateway vendors; Portkey's cloud answers it the same way for a caller's own+ workspace behind the ``portkey`` backend."""#: ``pig-01`` at HTTP 400 — the request body names one that no integration@@ -306,9 +305,8 @@ class GatewayRoutingRefusal(StrEnum):# **``model_not_allowed_error`` is the one code outside that namespace**, and it is# matched on the code alone for a reason of its own: it is the code of Portkey, the# substrate the gateway is built on, and no model vendor uses it. Portkey's cloud-# emits it for the integrations ``pipelex_gateway`` reaches and for a caller's own-# workspace behind the ``portkey`` backend alike, and so does the middleware the-# manifold vendors from it. The refusal means the same thing and calls for the same+# emits it for a caller's own workspace behind the ``portkey`` backend, and so does+# the middleware the manifold vendors from it. The refusal means the same thing and calls for the same# move whichever of them raised it, so only the advice has to hold for both. Both# raise sites answer 412, so checking the status too would add nothing. It arrives with# the code in ``type`` and ``code`` null, and every Extract hop recovers it from@@ -330,10 +328,8 @@ class GatewayRoutingRefusal(StrEnum):# the manifold clients against the four steering headers by name, while the# gateway refuses on an *allow*-list — so a ``portkey_ai`` release that starts# sending some other ``x-portkey-*`` header turns every request into a-# ``pig-03`` with that test still green. And ``gateway_img_gen_worker.py`` does-# send ``x-portkey-config`` on every image call, which Portkey's cloud reads and-# a Pipelex-operated gateway refuses: harmless while ``pipelex_gateway`` keeps-# its default endpoint, and a client bug the day that backend names one of ours.+# ``pig-03`` with that test still green. The manifold image path still travels+# on ``portkey_ai``, which is the one client that could start doing so.# - ``pig-04`` ("this gateway does not serve ``<method> <path>``") is the proxy# policy refusing a path only the catch-all could answer, and it is a 404, so the# ladder already reads it as model-not-found — wrong in kind, but unreachablediff --git a/pipelex/cogt/model_backends/backend.py b/pipelex/cogt/model_backends/backend.pyindex 089a18fc4..85cb03b83 100644--- a/pipelex/cogt/model_backends/backend.py+++ b/pipelex/cogt/model_backends/backend.py@@ -8,31 +8,21 @@ from pipelex.cogt.model_backends.model_spec import InferenceModelSpecfrom pipelex.system.configuration.config_model import ConfigModelfrom pipelex.tools.typing.pydantic_utils import empty_dict_factory_of, empty_list_factory_of-# The remote-config section the legacy gateway backend's specs come from. It is spelled here as a-# *compatibility default* rather than only in the shipped `backends.toml`, and the distinction-# matters: `backends.toml` is the user's own file on disk, written before this field existed and-# never rewritten by an upgrade, so a declaration that does not name a section has to keep meaning-# what it always meant. Every new managed backend states its section explicitly.-LEGACY_GATEWAY_MODEL_SPECS_SECTION = "backend_model_specs"--# The section the manifold dialect's catalog is published under, beside the legacy one in the same-# artifact. Named here so the kit config, the fetcher's dummy and the tests cannot drift apart on a-# string literal.+# The section the manifold dialect's catalog is published under in the Pipelex service's artifact.+# Named here so the kit config, the fetcher's dummy and the tests cannot drift apart on a string+# literal.MANIFOLD_MODEL_SPECS_SECTION = "manifold_model_specs"class PipelexBackend(StrEnum):"""Special Pipelex-managed inference backends."""- GATEWAY = "pipelex_gateway"MANIFOLD = "pipelex_manifold"INTERNAL = "internal" # Software-only backend, runs locally without AI@propertydef display_name(self) -> str:match self:- case PipelexBackend.GATEWAY:- return "Pipelex Gateway"case PipelexBackend.MANIFOLD:return "Pipelex Manifold"case PipelexBackend.INTERNAL:@@ -46,7 +36,7 @@ class PipelexBackend(StrEnum):# it exists for the callers that hold only a backend name and no configuration — an inference worker# asserting a provider behaviour that follows from running behind our gateway codebase, for instance.# Wherever the configuration is in hand, the declared section is the authority.-MANAGED_GATEWAY_BACKEND_NAMES: tuple[str, ...] = (PipelexBackend.GATEWAY, PipelexBackend.MANIFOLD)+MANAGED_GATEWAY_BACKEND_NAMES: tuple[str, ...] = (PipelexBackend.MANIFOLD,)def resolve_model_specs_section(*, backend_name: str, declared_section: str | None) -> str | None:@@ -55,17 +45,10 @@ def resolve_model_specs_section(*, backend_name: str, declared_section: str | No**Declaring a section is what makes a backend a managed gateway backend**: its model specsarrive from the Pipelex service's published artifact rather than from a local per-backend TOML.A backend with no section resolves to `None` and loads its specs from its own file, which is- every BYOK backend and the internal one.-- The one name that resolves to a section it did not declare is `pipelex_gateway`, and only- because its declarations predate the field — see `LEGACY_GATEWAY_MODEL_SPECS_SECTION`. An- explicit declaration always wins, including on that name.+ every BYOK backend and the internal one. No name resolves to a section it did not declare."""- if declared_section is not None:- return declared_section- if backend_name == PipelexBackend.GATEWAY:- return LEGACY_GATEWAY_MODEL_SPECS_SECTION- return None+ del backend_name # every managed backend declares its section; the name carries no default+ return declared_sectionclass InferenceBackend(ConfigModel):diff --git a/pipelex/cogt/model_backends/backend_credentials.py b/pipelex/cogt/model_backends/backend_credentials.pyindex a5cf35436..a05d77c3a 100644--- a/pipelex/cogt/model_backends/backend_credentials.py+++ b/pipelex/cogt/model_backends/backend_credentials.py@@ -1,4 +1,3 @@-from pipelex.cogt.model_backends.backend import PipelexBackendfrom pipelex.system.configuration.config_model import ConfigModelfrom pipelex.tools.secrets.env_secrets_provider import EnvSecretsProviderfrom pipelex.tools.secrets.secrets_provider_abstract import SecretsProviderAbstract@@ -53,16 +52,12 @@ class BackendCredentialsErrorMsgFactory:rf" Add 'enabled = false' under '\[{backend_name}]' in '.pipelex/inference/backends.toml'" + "\n")- # Add pitch for Pipelex Gateway and BYOK (Bring Your Own Keys)+ # Point at the BYOK (Bring Your Own Keys) setuperror_msg += (- f"\n💡 Tip: Get a free {PipelexBackend.GATEWAY.display_name} API key!\n"- f" With {PipelexBackend.GATEWAY.display_name}, you get unified access to multiple AI providers\n"- " (OpenAI, Anthropic, Google, Mistral, etc.) with a single API key.\n"- " Check the project's 'README.md' for details on obtaining your key.\n"- "\n🔑 Or bring your own keys:\n"+ "\n🔑 Bring your own keys:\n"" Set your own provider keys (OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_API_KEY,\n"- " MISTRAL_API_KEY, AZURE_API_KEY, etc.) and enable the corresponding backends\n"- " in '.pipelex/inference/backends.toml'.\n"+ " MISTRAL_API_KEY, AZURE_API_KEY, OPENROUTER_API_KEY, etc.) and enable the corresponding\n"+ " backends in '.pipelex/inference/backends.toml'.\n")return error_msg@@ -136,16 +131,12 @@ class BackendCredentialsErrorMsgFactory:for backend_name in backend_names:error_msg += rf" - Add 'enabled = false' under '\[{backend_name}]'" + "\n"- # Add pitch for Pipelex Gateway and BYOK (Bring Your Own Keys)+ # Point at the BYOK (Bring Your Own Keys) setuperror_msg += (- f"\n💡 Tip: Get a free {PipelexBackend.GATEWAY.display_name} API key!\n"- f" With {PipelexBackend.GATEWAY.display_name}, you get unified access to multiple AI providers\n"- " (OpenAI, Anthropic, Google, Mistral, etc.) with a single API key.\n"- " Check the project's 'README.md' for details on obtaining your key.\n"- "\n🔑 Or bring your own keys:\n"+ "\n🔑 Bring your own keys:\n"" Set your own provider keys (OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_API_KEY,\n"- " MISTRAL_API_KEY, AZURE_API_KEY, etc.) and enable the corresponding backends\n"- " in '.pipelex/inference/backends.toml'.\n"+ " MISTRAL_API_KEY, AZURE_API_KEY, OPENROUTER_API_KEY, etc.) and enable the corresponding\n"+ " backends in '.pipelex/inference/backends.toml'.\n")return error_msgdiff --git a/pipelex/cogt/model_backends/backend_library.py b/pipelex/cogt/model_backends/backend_library.pyindex 514416d15..29f6cccdf 100644--- a/pipelex/cogt/model_backends/backend_library.py+++ b/pipelex/cogt/model_backends/backend_library.py@@ -204,14 +204,9 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):backend_name=backend_name,declared_section=declared_model_specs_section,)- # **The tolerance below keys on the DECLARATION, not on the resolved section**, and the- # two come apart on exactly one name. `pipelex_gateway` is handed a section by- # compatibility default so a `backends.toml` written before the field keeps working, so- # it is managed without declaring anything — and keying on managed-ness would hand it a- # tolerance it never had: an unset `PIPELEX_GATEWAY_API_KEY` would stop being a boot- # failure with a remediation message and become a silently missing backend, which is the- # behaviour delta on the Portkey-cloud path this work must not make. A declaration is- # something only the kit writes, and only for a backend it also ships disabled.+ # **The tolerance below keys on the DECLARATION.** A declaration is something only the+ # kit writes, and only for a backend it also ships disabled, so it is the one signal that+ # an installation may legitimately carry a managed backend without its variables.tolerates_missing_variables = declared_model_specs_section is not Nonetry:inference_backend_blueprint_dict = apply_to_strings_recursive(@@ -244,12 +239,10 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):# joined never reaches here at all: a disabled backend is skipped above, and the# one loader that asks for disabled backends asks leniently.)#- # Every other backend keeps today's fatal boot — `pipelex_gateway` included,- # since it declares no section — because widening this would mean a user who- # typos ANTHROPIC_API_KEY or PIPELEX_GATEWAY_API_KEY stops getting a boot- # failure and starts getting a silently missing backend that resurfaces much- # later as a model-resolution error, a behaviour delta on paths this work must- # not touch.+ # Every other backend keeps today's fatal boot, because widening this would mean+ # a user who typos ANTHROPIC_API_KEY stops getting a boot failure and starts+ # getting a silently missing backend that resurfaces much later as a+ # model-resolution error.log.warning(f"Backend '{backend_name}' is disabled: it is a Pipelex-managed gateway backend and the variable "f"'{var_not_found_exc.var_name}' it needs is not set. Set it to enable this backend, or set "@@ -322,11 +315,6 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):# it skipped. Disabled here, quietly, because that warning was already said.log.verbose(f"Skipping backend '{backend_name}': the Pipelex configuration carries no '{model_specs_section}' section")continue- # Only when the artifact actually carried one. The manifold service is built- # without a region on purpose: nothing on its path reads it back, because its- # Bedrock credentials live gateway-side.- if gateway_config.aws_region is not None:- extra_config["aws_region"] = gateway_config.aws_regionmodel_spec_source = ModelSpecSource.REMOTE_GATEWAYmodel_specs_dict, backend_config_source = self._load_gateway_model_specs(gateway_config=gateway_config,@@ -483,9 +471,9 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):**One file, and only a local one.** The helper deep-merges the paths it is given, which isright for a tier stack and wrong here — backend files are independent documents that share no- keys, so they are replayed one at a time. And the gateway backend is left out on purpose:+ keys, so they are replayed one at a time. And a managed gateway backend is left out on purpose:`GatewayConfigMerger` ignores a local `[defaults]` outright and keeps only `sdk` and- `structure_method` from a per-model override, so a stale key in `pipelex_gateway.toml` is+ `structure_method` from a per-model override, so a stale key in `pipelex_manifold.toml` isfiltered out before any spec is built and can never be what refused the load. `pipelexmigrate` still repairs that file on disk — the surface claims every `*.toml` in the directory— but at boot there is nothing there to carry forward.@@ -528,10 +516,10 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):backends_dir_path: str,substitute_vars_with_provider: Any,) -> tuple[BackendModelSpecs, str]:- """Load model specs for pipelex_gateway from remote config.+ """Load a managed gateway backend's model specs from the remote config.Args:- gateway_config: Gateway configuration for Pipelex Gateway backend.+ gateway_config: The backend's slice of the fetched artifact.backend_name: Name the backend library gives this gateway backend.backends_dir_path: Path to directory containing local override file.substitute_vars_with_provider: Function to substitute variables.@@ -543,9 +531,8 @@ class InferenceBackendLibrary(RootModel[InferenceBackendLibraryRoot]):InferenceBackendCredentialsError: If variable substitution fails."""# Load local overrides if they exist. The path follows the *backend's own name*, so- # `backends/pipelex_manifold.toml` overrides the manifold backend exactly as- # `backends/pipelex_gateway.toml` overrides the legacy one — and neither can reach the- # other's models. Built through the shared helper for the reason its docstring gives: a+ # `backends/pipelex_manifold.toml` overrides the manifold backend and no other managed+ # backend's models. Built through the shared helper for the reason its docstring gives: a# backend name is an unvalidated top-level TOML key, and a quoted absolute-path key would# otherwise escape the backends directory.path_to_local_overrides = str(backend_toml_path(backends_dir_path=backends_dir_path, backend_name=backend_name))diff --git a/pipelex/cogt/model_backends/gateway_config.py b/pipelex/cogt/model_backends/gateway_config.pyindex 2084803a8..d31a7b3c8 100644--- a/pipelex/cogt/model_backends/gateway_config.py+++ b/pipelex/cogt/model_backends/gateway_config.py@@ -11,21 +11,13 @@ class GatewayConfig(BaseModel):There is one of these per declared managed backend, built from that backend's named section ofthe single fetched artifact. They are held in a `dict[backend_name, GatewayConfig]` rather than- merged, because the two services are two services: a handle that one serves and the other does+ merged, because two managed services are two services: a handle that one serves and another doesnot is a legitimate configuration, not a conflict to resolve."""model_config = ConfigDict(extra="forbid")model_specs: BackendModelSpecs = Field(description="Model specifications for this managed gateway (model_name -> spec dict)")- aws_region: str | None = Field(- default=None,- description=(- "AWS region, threaded into the backend's extra_config. Optional because it is a top-level key of the artifact rather than "- "a property of a section, and only a direct-SDK Bedrock backend ever reads it back — nothing on the manifold path does, "- "because Bedrock credentials live gateway-side. A managed config built without one simply contributes no region."- ),- )def drop_unknown_gateway_defaults(*, gateway_model_specs: BackendModelSpecs) -> BackendModelSpecs:diff --git a/pipelex/cogt/model_routing/routing_profile.py b/pipelex/cogt/model_routing/routing_profile.pyindex b30790a30..0a5dc8007 100644--- a/pipelex/cogt/model_routing/routing_profile.py+++ b/pipelex/cogt/model_routing/routing_profile.py@@ -1,5 +1,3 @@-from enum import StrEnum-from pydantic import Fieldfrom pipelex.cogt.model_routing.routing_models import BackendMatchForModel, BackendMatchingMethod@@ -7,12 +5,6 @@ from pipelex.system.configuration.config_model import ConfigModelfrom pipelex.tools.misc.string_utils import matches_wildcard_pattern-class PipelexRoutingProfile(StrEnum):- """Special Pipelex routing profiles."""-- ALL_PIPELEX_GATEWAY = "all_pipelex_gateway"--class RoutingProfile(ConfigModel):"""Configuration for model routing to backends."""diff --git a/pipelex/cogt/models/model_deck.py b/pipelex/cogt/models/model_deck.pyindex 2d5706f3e..ba3b0f0ea 100644--- a/pipelex/cogt/models/model_deck.py+++ b/pipelex/cogt/models/model_deck.py@@ -29,7 +29,6 @@ from pipelex.cogt.llm.llm_setting import (LLMSettingChoices,LLMSettingChoicesDefaults,)-from pipelex.cogt.model_backends.backend import PipelexBackendfrom pipelex.cogt.model_backends.model_spec import InferenceModelSpecfrom pipelex.cogt.model_backends.model_type import ModelTypefrom pipelex.cogt.models.exceptions import ModelReferenceParseError@@ -38,8 +37,6 @@ from pipelex.cogt.search.search_setting import SearchModelChoice, SearchSettingfrom pipelex.system.configuration.config_model import ConfigModelfrom pipelex.system.exceptions import ConfigValidationErrorfrom pipelex.system.runtime import ProblemReaction-from pipelex.tools.misc.exceptions import TomlError-from pipelex.tools.misc.toml_utils import load_toml_from_path_if_existsfrom pipelex.urls import URLsLLM_PRESET_DISABLED = "disabled"@@ -907,32 +904,6 @@ class ModelDeck(ConfigModel):"""Return the set of backend names that have at least one model enabled."""return {model.backend_name for model in self.inference_models.values()}- def _is_model_available_in_backend(self, model_handle: str, *, backend_name: str) -> bool | None:- """Check if a model is available from a specific backend.-- This is a low-level check that reads the backend TOML file directly,- so it works even if the backend is disabled. Best-effort: returns False- if the file can't be read or parsed.-- Args:- model_handle: The model handle/name to check for- backend_name: The backend name (e.g., 'bedrock')-- Returns:- True if the model is defined in the backend's TOML file, False otherwise- """- backend_file_path = f".pipelex/inference/backends/{backend_name}.toml"- try:- backend_toml = load_toml_from_path_if_exists(backend_file_path)- if backend_toml is None:- return None- # Check if model_handle exists as a top-level key (section) in the TOML- # Exclude special sections like 'defaults'- return model_handle in backend_toml and model_handle != "defaults"- except (TomlError, OSError):- # Best-effort: an unreadable or malformed backend TOML is treated as "model not found"- return None-def _resolve_waterfall(self,waterfall_name: str,@@ -967,21 +938,7 @@ class ModelDeck(ConfigModel):f"and the method might fail due to feature limitations such as context window size, etc. "f"Consider getting access to '{ideal_model_handle}'.")- enabled_backends = self._get_enabled_backends()- if PipelexBackend.GATEWAY not in enabled_backends and self._is_model_available_in_backend(- model_handle=ideal_model_handle, backend_name=PipelexBackend.GATEWAY- ):- msg += (- f" Note that many high quality models such as '{ideal_model_handle}' are available "- f"from the {PipelexBackend.GATEWAY.display_name} "- f"and you can get free credits to try them out."- )- msg += (- f"\nPlease see our docs for more details about setting up "- f"{PipelexBackend.GATEWAY.display_name} or other inference backends:\n{URLs.backend_provider_docs}"- )- else:- msg += f" Please see our docs for more details about setting up inference backends:\n{URLs.backend_provider_docs}"+ msg += f" Please see our docs for more details about setting up inference backends:\n{URLs.backend_provider_docs}"log.info(msg)# Mark this warning as logged for this waterfall_nameself._logged_fallback_warnings.add(waterfall_name)diff --git a/pipelex/kit/configs/inference/backends.toml b/pipelex/kit/configs/inference/backends.tomlindex 28a5a7777..340269560 100644--- a/pipelex/kit/configs/inference/backends.toml+++ b/pipelex/kit/configs/inference/backends.toml@@ -10,11 +10,6 @@#####################################################################################################-[pipelex_gateway]-display_name = "⭐ Pipelex Gateway"-enabled = true # Enable after accepting terms via `pipelex init config`-api_key = "${PIPELEX_GATEWAY_API_KEY}"-# Pipelex Manifold is a closed private beta: leave it off unless you have been invited.[pipelex_manifold]display_name = "Pipelex Manifold (private beta)"diff --git a/pipelex/kit/configs/inference/backends/pipelex_gateway.toml b/pipelex/kit/configs/inference/backends/pipelex_gateway.tomldeleted file mode 100644index 5b02901ee..000000000--- a/pipelex/kit/configs/inference/backends/pipelex_gateway.toml+++ /dev/null@@ -1,41 +0,0 @@-################################################################################-# Pipelex Gateway Local Overrides-################################################################################-#-# TELEMETRY NOTICE:-#-# Using Pipelex Gateway enables identified telemetry tied to your API key-# (hashed for security). This is independent from your telemetry.toml settings.-#-# We collect only technical data (model names, token counts, latency, error rates).-# We do NOT collect prompts, completions, pipe codes, or business data.-#-# This allows us to monitor service quality, enforce fair usage, and support you.-#-################################################################################-#-# WARNING: USE AT YOUR OWN RISK!-#-# The actual model configuration is fetched remotely from Pipelex servers.-# Any override in this file may cause unexpected behavior or failures,-# as the remote configuration may change at any time.-#-# If you must override, you may ONLY use these keys per model:-# - sdk-# - structure_method-#-# All other keys will be ignored.-#-# If you need custom configurations, consider using your own API keys-# with direct provider backends (openai, anthropic, etc.) instead.-#-# Documentation:-# https://docs.pipelex.com/latest/configuration/config-technical/inference-backend-config/-# Support: https://go.pipelex.com/discord-#-################################################################################--# Per-model overrides example:-# [gpt-4o]-# sdk = "gateway_completions"-# structure_method = "instructor/openai_tools"diff --git a/pipelex/kit/configs/inference/backends/pipelex_gateway_models.md b/pipelex/kit/configs/inference/backends/pipelex_gateway_models.mddeleted file mode 100644index c0acba8cf..000000000--- a/pipelex/kit/configs/inference/backends/pipelex_gateway_models.md+++ /dev/null@@ -1,513 +0,0 @@-# Pipelex Gateway — Available Models-This file lists the LLMs, document extraction models, and image generation models currently available through Pipelex Gateway.-For configuration details, see the [documentation](https://docs.pipelex.com/latest/setup/configure-ai-providers/#option-1-pipelex-gateway-easiest-and-most-powerful-for-getting-started).--## Language Models (LLM)--<table>-<thead>-<tr>-<th rowspan="2">Model</th>-<th colspan="3" style="text-align:center;background-color:rgba(33,150,243,0.15)">Inputs</th>-<th colspan="2" style="text-align:center;background-color:rgba(76,175,80,0.15)">Outputs</th>-</tr>-<tr>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">text</th>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">images</th>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">pdf</th>-<th style="text-align:center;background-color:rgba(76,175,80,0.15)">text</th>-<th style="text-align:center;background-color:rgba(76,175,80,0.15)">structured</th>-</tr>-</thead>-<tbody>-<tr>-<td>claude-4-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4-sonnet</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.1-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.5-haiku</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.5-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.5-sonnet</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.6-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.6-sonnet</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.7-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-4.8-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-5-opus</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>claude-5-sonnet</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>deepseek-v3.2</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-2.5-flash</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-2.5-flash-lite</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-2.5-pro</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-3.0-flash</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-3.1-flash-lite</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-3.1-pro</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-3.5-flash</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-flash-latest</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-flash-lite-latest</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gemini-pro-latest</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-4o</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-4o-mini</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.3-codex</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.4</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.4-mini</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.4-nano</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.4-pro</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.5</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.6-luna</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.6-sol</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-5.6-terra</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-oss-120b</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-oss-20b</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>grok-3</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-<tr>-<td>grok-3-mini</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-<tr>-<td>grok-4</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>grok-4-fast-non-reasoning</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>grok-4-fast-reasoning</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>kimi-k2-thinking</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>mistral-large</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>phi-4</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-<tr>-<td>phi-4-multimodal</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-<tr>-<td>qwen3-vl-235b-a22b</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-</tbody>-</table>--## Document Extraction Models--<table>-<thead>-<tr>-<th rowspan="2">Model</th>-<th colspan="3" style="text-align:center;background-color:rgba(33,150,243,0.15)">Inputs</th>-<th colspan="2" style="text-align:center;background-color:rgba(76,175,80,0.15)">Outputs</th>-</tr>-<tr>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">image</th>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">pdf</th>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">web_page</th>-<th style="text-align:center;background-color:rgba(76,175,80,0.15)">pages</th>-<th style="text-align:center;background-color:rgba(76,175,80,0.15)">captions</th>-</tr>-</thead>-<tbody>-<tr>-<td>azure-document-intelligence</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>deepseek-ocr</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-<tr>-<td>linkup-fetch</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">❌</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">❌</td>-</tr>-</tbody>-</table>---!!! info About extracted pages- Each page contains Markdown text (based on AI-interpreted layout) and optional extracted images. A single image input is treated as one page. Pipelex also wraps the `pypdfium2` library for raw text (without any AI interpretation) and images extraction and page views rendering. All these elements can be used as inputs into downstream pipes, including LLM prompts.-## Image Generation Models--<table>-<thead>-<tr>-<th rowspan="2">Model</th>-<th colspan="2" style="text-align:center;background-color:rgba(33,150,243,0.15)">Inputs</th>-<th colspan="1" style="text-align:center;background-color:rgba(76,175,80,0.15)">Outputs</th>-</tr>-<tr>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">text</th>-<th style="text-align:center;background-color:rgba(33,150,243,0.15)">images</th>-<th style="text-align:center;background-color:rgba(76,175,80,0.15)">image</th>-</tr>-</thead>-<tbody>-<tr>-<td>gpt-image-1</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-image-1-mini</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-image-1.5</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>gpt-image-2</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>nano-banana</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>nano-banana-2</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>nano-banana-2-lite</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-<tr>-<td>nano-banana-pro</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(33,150,243,0.15)">✅</td>-<td style="text-align:center;background-color:rgba(76,175,80,0.15)">✅</td>-</tr>-</tbody>-</table>---> **AUTO-GENERATED FILE** - Do not edit manually.-> Last updated: 2026-09-21T10:54:05Z->-> Run `pipelex-dev update-gateway-models` or `make ugm` to regenerate.\ No newline at end of filediff --git a/pipelex/kit/configs/inference/backends/pipelex_gateway_models_plain.md b/pipelex/kit/configs/inference/backends/pipelex_gateway_models_plain.mddeleted file mode 100644index 9ea4543d5..000000000--- a/pipelex/kit/configs/inference/backends/pipelex_gateway_models_plain.md+++ /dev/null@@ -1,195 +0,0 @@-# Pipelex Gateway — Available Models (Plain Text)--This file lists the LLMs, document extraction models, and image generation models currently available through Pipelex Gateway.-For configuration details, see the [documentation](https://docs.pipelex.com/latest/setup/configure-ai-providers/#option-1-pipelex-gateway-easiest-and-most-powerful-for-getting-started).--**Note:** This is the plain-text readable version. See `pipelex_gateway_models.md` for the HTML-styled version.--## Language Models (LLM)--- **claude-4-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4-sonnet**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.1-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.5-haiku**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.5-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.5-sonnet**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.6-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.6-sonnet**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.7-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-4.8-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-5-opus**- - inputs: text, images, pdf- - outputs: text, structured-- **claude-5-sonnet**- - inputs: text, images, pdf- - outputs: text, structured-- **deepseek-v3.2**- - inputs: text- - outputs: text, structured-- **gemini-2.5-flash**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-2.5-flash-lite**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-2.5-pro**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-3.0-flash**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-3.1-flash-lite**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-3.1-pro**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-3.5-flash**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-flash-latest**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-flash-lite-latest**- - inputs: text, images, pdf- - outputs: text, structured-- **gemini-pro-latest**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-4o**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-4o-mini**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.3-codex**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.4**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.4-mini**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.4-nano**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.4-pro**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.5**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.6-luna**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.6-sol**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-5.6-terra**- - inputs: text, images, pdf- - outputs: text, structured-- **gpt-oss-120b**- - inputs: text- - outputs: text, structured-- **gpt-oss-20b**- - inputs: text- - outputs: text, structured-- **grok-3**- - inputs: text- - outputs: text-- **grok-3-mini**- - inputs: text- - outputs: text-- **grok-4**- - inputs: text- - outputs: text, structured-- **grok-4-fast-non-reasoning**- - inputs: text, images- - outputs: text, structured-- **grok-4-fast-reasoning**- - inputs: text, images- - outputs: text, structured-- **kimi-k2-thinking**- - inputs: text- - outputs: text, structured-- **mistral-large**- - inputs: text, images, pdf- - outputs: text, structured-- **phi-4**- - inputs: text- - outputs: text-- **phi-4-multimodal**- - inputs: text, images- - outputs: text-- **qwen3-vl-235b-a22b**- - inputs: text, images- - outputs: text, structured--## Document Extraction Models--- **azure-document-intelligence**- - inputs: image, pdf- - outputs: pages, captions-- **deepseek-ocr**- - inputs: image- - outputs: pages-- **linkup-fetch**- - inputs: web_page- - outputs: pages---**About extracted pages:** Each page contains Markdown text (based on AI-interpreted layout) and optional extracted images. A single image input is treated as one page. Pipelex also wraps the `pypdfium2` library for raw text (without any AI interpretation) and images extraction and page views rendering. All these elements can be used as inputs into downstream pipes, including LLM prompts.--## Image Generation Models--- **gpt-image-1**- - inputs: text, images- - outputs: image-- **gpt-image-1-mini**- - inputs: text, images- - outputs: image-- **gpt-image-1.5**- - inputs: text, images- - outputs: image-- **gpt-image-2**- - inputs: text, images- - outputs: image-- **nano-banana**- - inputs: text, images- - outputs: image-- **nano-banana-2**- - inputs: text, images- - outputs: image-- **nano-banana-2-lite**- - inputs: text, images- - outputs: image-- **nano-banana-pro**- - inputs: text, images- - outputs: image---> **AUTO-GENERATED FILE** - Do not edit manually.-> Last updated: 2026-09-21T10:54:05Z->-> Run `pipelex-dev update-gateway-models` or `make ugm` to regenerate.\ No newline at end of filediff --git a/pipelex/kit/configs/inference/backends/pipelex_manifold.toml b/pipelex/kit/configs/inference/backends/pipelex_manifold.tomlindex 1a9adc718..d2130ec85 100644--- a/pipelex/kit/configs/inference/backends/pipelex_manifold.toml+++ b/pipelex/kit/configs/inference/backends/pipelex_manifold.toml@@ -12,18 +12,13 @@## TELEMETRY NOTICE:#-# Enabling pipelex_gateway alongside this backend enables identified telemetry-# from your machine, tied to your Pipelex Gateway API key (hashed for security).-# This is independent from your telemetry.toml settings.-#-# That client-side telemetry follows the gateway key and nothing else, so an-# installation running Pipelex Manifold ALONE sends none of it. Manifold is a-# Pipelex-operated service, though, so your usage of it is recorded server-side-# the way any hosted platform records the calls it serves.-#-# Either way we collect only technical data (model names, token counts, latency,-# error rates). We do NOT collect prompts, completions, pipe codes, or business-# data.+# This backend sends no telemetry from your machine: the runtime's only+# telemetry stream is the one you configure yourself in telemetry.toml.+# Manifold is a Pipelex-operated service, though, so your usage of it is+# recorded server-side the way any hosted platform records the calls it serves.+#+# We collect only technical data (model names, token counts, latency, error+# rates). We do NOT collect prompts, completions, pipe codes, or business data.## This allows us to monitor service quality, enforce fair usage, and support you.#diff --git a/pipelex/kit/configs/inference/deck/3_extract_deck.toml b/pipelex/kit/configs/inference/deck/3_extract_deck.tomlindex c67d393f1..c5e474a91 100644--- a/pipelex/kit/configs/inference/deck/3_extract_deck.toml+++ b/pipelex/kit/configs/inference/deck/3_extract_deck.toml@@ -31,13 +31,29 @@ choice_default = "@default-extract-document"####################################################################################################[extract.aliases]-default-premium = "azure-document-intelligence"-default-extract-document = "azure-document-intelligence"-default-extract-image = "azure-document-intelligence"+default-premium = "~ocr-extractor"+default-extract-document = "~document-extractor"+default-extract-image = "~ocr-extractor"default-text-from-pdf = "pypdfium2-extract-pdf"default-no-inference = "pypdfium2-extract-pdf"default-extract-web-page = "linkup-fetch"+####################################################################################################+# Waterfalls+####################################################################################################+#+# Each default resolves to the first entry an enabled backend serves: Azure Document Intelligence+# through Pipelex Manifold, then Mistral OCR with your own Mistral key. Documents fall back last to+# reading a PDF's text layer locally, which needs no key but recovers no text from a scanned page.++[extract.waterfalls]+document-extractor = [+ "azure-document-intelligence",+ "mistral-ocr",+ "pypdfium2-extract-pdf",+]+ocr-extractor = ["azure-document-intelligence", "mistral-ocr"]+##################################################################################################### Extract Presets####################################################################################################diff --git a/pipelex/kit/configs/inference/deck/6_judgment_deck.toml b/pipelex/kit/configs/inference/deck/6_judgment_deck.tomlindex 01e45b3c5..5fec6dd59 100644--- a/pipelex/kit/configs/inference/deck/6_judgment_deck.toml+++ b/pipelex/kit/configs/inference/deck/6_judgment_deck.toml@@ -26,7 +26,7 @@## There is deliberately no `choice_default` here, and that is what tells you no judgment model is# served out of the box: a judgment backend is one you bring, so a pipe names the model it judges-# with until the Pipelex Gateway serves the family. Set one here once you have a backend configured.+# with. Set one here once you have a backend configured.[judgment]diff --git a/pipelex/kit/configs/inference/deck/x_custom_extract_deck.toml b/pipelex/kit/configs/inference/deck/x_custom_extract_deck.tomlindex 24fc260ee..5d4c46442 100644--- a/pipelex/kit/configs/inference/deck/x_custom_extract_deck.toml+++ b/pipelex/kit/configs/inference/deck/x_custom_extract_deck.toml@@ -5,10 +5,10 @@# This file allows you to override or complete the base model decks.## ADVANCED USERS ONLY: This file is for users who bring their own API keys and connect directly-# to AI providers (Azure, Mistral, etc.) without using the Pipelex Gateway.+# to AI providers (Azure, Mistral, etc.) and want to tune their own catalog.#-# If you're using the standard Pipelex Gateway setup, you don't need to modify this file.-# The Gateway handles model routing automatically and supports all available models.+# If the shipped backend catalogs cover your needs, you don't need to modify this file.+# The routing profile picks a backend for every model the enabled backends serve.## Waterfalls are useful when using multiple backends directly - they define ordered lists# of models that are resolved at configuration time based on which backends are available.diff --git a/pipelex/kit/configs/inference/deck/x_custom_llm_deck.toml b/pipelex/kit/configs/inference/deck/x_custom_llm_deck.tomlindex d751552d1..0c7833c63 100644--- a/pipelex/kit/configs/inference/deck/x_custom_llm_deck.toml+++ b/pipelex/kit/configs/inference/deck/x_custom_llm_deck.toml@@ -5,10 +5,10 @@# This file allows you to override or complete the base model decks.## ADVANCED USERS ONLY: This file is for users who bring their own API keys and connect directly-# to AI providers (OpenAI, Anthropic, Google, etc.) without using the Pipelex Gateway.+# to AI providers (OpenAI, Anthropic, Google, etc.) and want to tune their own catalog.#-# If you're using the standard Pipelex Gateway setup, you don't need to modify this file.-# The Gateway handles model routing automatically and supports all available models.+# If the shipped backend catalogs cover your needs, you don't need to modify this file.+# The routing profile picks a backend for every model the enabled backends serve.## Waterfalls are useful when using multiple backends directly - they define ordered lists# of models that are resolved at configuration time based on which backends are available.diff --git a/pipelex/kit/configs/inference/routing_profiles.toml b/pipelex/kit/configs/inference/routing_profiles.tomlindex 25619b1ee..c11082327 100644--- a/pipelex/kit/configs/inference/routing_profiles.toml+++ b/pipelex/kit/configs/inference/routing_profiles.toml@@ -12,30 +12,49 @@# which routing profile you select. See the documentation for details.# Which profile to use (change this to switch routing)-active = "all_pipelex_gateway"+active = "all_enabled_backends"-# We recommend using the "all_pipelex_gateway" profile to get a head start with all models.-# To use the Pipelex Gateway backend:-# 1. Get your API key at https://app.pipelex.com (free credits included)-# 2. Add it to your .env file: PIPELEX_GATEWAY_API_KEY=your-key-here-# 3. Run `pipelex init` and accept the Gateway terms of service+# The default profile needs no Pipelex account: it routes each model to the first enabled backend+# that serves it, in the order its `fallback_order` lists. `pipelex init` narrows this to the+# backend you configure (`all_<backend>`). The model deck's default tiers point at OpenAI models,+# which `openai` and `azure_openai` serve: with any other single backend, repoint the deck's+# aliases at models it serves in `deck/x_custom_llm_deck.toml`.# =========================================================================================# Routing Profiles# =========================================================================================-[profiles.all_pipelex_gateway]-description = "Use Pipelex Gateway for all its supported models"-default = "pipelex_gateway"--# Judgment models are brought by you rather than served by Pipelex, so they go to their own backend-# whenever it is enabled. An optional route is inert while its backend is disabled.-[profiles.all_pipelex_gateway.optional_routes]+[profiles.all_enabled_backends]+description = "Route each model to the first enabled backend that serves it, in this order"+fallback_order = [+ "openai",+ "anthropic",+ "google",+ "mistral",+ "bedrock",+ "azure_openai",+ "xai",+ "groq",+ "fal",+ "huggingface",+ "linkup",+ "openrouter",+ "portkey",+ "blackboxai",+ "minimax",+ "scaleway",+ "ollama",+ "vertexai",+ "pipelex_manifold",+]++# Judgment models are served by their own backend alone, so they go to it whenever it is enabled.+# An optional route is inert while its backend is disabled.+[profiles.all_enabled_backends.optional_routes]"jev-*" = "typesafe"-# The same model names, served by the Pipelex-operated inference service instead. Switching between-# this profile and the one above needs no other edit: a model's wire id and sdk are per-backend, so-# decks, aliases and presets keep naming the same handles.+# The Pipelex-operated inference service (private beta). A model's wire id and sdk are per-backend,+# so decks, aliases and presets keep naming the same handles whichever profile is active.[profiles.all_pipelex_manifold]description = "Use Pipelex Manifold (private beta) for all its supported models"default = "pipelex_manifold"@@ -146,7 +165,7 @@ default = "internal"# =========================================================================================[profiles.example_routing_using_patterns]description = "Example routing profile using patterns"-default = "pipelex_gateway"+default = "openrouter"[profiles.example_routing_using_patterns.routes]# Pattern matching: "model-pattern" = "backend-name"@@ -166,17 +185,17 @@ default = "pipelex_gateway"description = "Example routing profile using specific models"[profiles.example_routing_using_specific_models.routes]-"gpt-5.4-nano" = "pipelex_gateway"+"gpt-5.4-nano" = "openrouter""gpt-4o-mini" = "blackboxai""gpt-5.4-mini" = "openai""gpt-5.5" = "azure_openai"-"claude-4-sonnet" = "pipelex_gateway"+"claude-4-sonnet" = "openrouter""claude-3.7-sonnet" = "blackboxai"-"gemini-2.5-flash-lite" = "pipelex_gateway"+"gemini-2.5-flash-lite" = "openrouter""gemini-2.5-flash" = "blackboxai""gemini-2.5-pro" = "vertexai"-"grok-3" = "pipelex_gateway"+"grok-3" = "openrouter""grok-3-mini" = "xai"diff --git a/pipelex/kit/configs/pipelex_service.toml b/pipelex/kit/configs/pipelex_service.tomlindex a12571dd1..e08cfd6fb 100644--- a/pipelex/kit/configs/pipelex_service.toml+++ b/pipelex/kit/configs/pipelex_service.toml@@ -2,22 +2,13 @@# Pipelex Service Configuration#####################################################################################################-# This file stores settings related to Pipelex managed services.-# Currently used for Pipelex Gateway terms acceptance.+# This file records the state of your Pipelex setup on this machine.## Documentation: https://docs.pipelex.com# Support: https://go.pipelex.com/discord#####################################################################################################-[agreement]-# Set to true after accepting Pipelex terms of service.-terms_accepted = false--# Note: when using pipelex_gateway, telemetry is enabled to monitor service usage.-# We collect technical data (model, pipe type...) and quantitative data (token counts...)-# but NOT your content, pipe codes, or output class names.-[onboarding]-# Set to true after completing inference setup (gateway or BYOK).+# Set to true after completing inference setup.inference_setup_completed = falsediff --git a/pipelex/kit/configs/telemetry.project.toml b/pipelex/kit/configs/telemetry.project.tomlindex 9b89befc9..62377ef9c 100644--- a/pipelex/kit/configs/telemetry.project.toml+++ b/pipelex/kit/configs/telemetry.project.toml@@ -10,9 +10,7 @@# Leave it commented out to inherit your global telemetry settings unchanged.# Uncomment a key (or whole section) to override it for this project only.#-# NOTE: When using Pipelex Gateway, identified telemetry is automatically enabled-# (tied to your Gateway API key, hashed for security). This is independent of the-# settings below — you can have both.+# Everything below is off unless you turn it on, and nothing here reports to Pipelex.## To disable all telemetry, set the DO_NOT_TRACK=1 environment variable.#diff --git a/pipelex/kit/configs/telemetry.toml b/pipelex/kit/configs/telemetry.tomlindex 56271ec7d..9663affa5 100644--- a/pipelex/kit/configs/telemetry.toml+++ b/pipelex/kit/configs/telemetry.toml@@ -5,10 +5,7 @@# This file controls YOUR custom telemetry settings for observability and analytics.# Configure your own PostHog, Langfuse, or OTLP-compatible backends here.#-# NOTE: When using Pipelex Gateway, identified telemetry is automatically enabled-# (tied to your Gateway API key, hashed for security). This allows us to monitor-# service quality, enforce fair usage, and provide you with better support.-# Gateway telemetry operates independently from your settings below - you can have both!+# Everything below is off unless you turn it on, and nothing here reports to Pipelex.## To disable all telemetry, set the DO_NOT_TRACK=1 environment variable.#diff --git a/pipelex/kit/deck_variants/multi_provider/3_extract_deck.toml b/pipelex/kit/deck_variants/multi_provider/3_extract_deck.tomlindex c67d393f1..c5e474a91 100644--- a/pipelex/kit/deck_variants/multi_provider/3_extract_deck.toml+++ b/pipelex/kit/deck_variants/multi_provider/3_extract_deck.toml@@ -31,13 +31,29 @@ choice_default = "@default-extract-document"####################################################################################################[extract.aliases]-default-premium = "azure-document-intelligence"-default-extract-document = "azure-document-intelligence"-default-extract-image = "azure-document-intelligence"+default-premium = "~ocr-extractor"+default-extract-document = "~document-extractor"+default-extract-image = "~ocr-extractor"default-text-from-pdf = "pypdfium2-extract-pdf"default-no-inference = "pypdfium2-extract-pdf"default-extract-web-page = "linkup-fetch"+####################################################################################################+# Waterfalls+####################################################################################################+#+# Each default resolves to the first entry an enabled backend serves: Azure Document Intelligence+# through Pipelex Manifold, then Mistral OCR with your own Mistral key. Documents fall back last to+# reading a PDF's text layer locally, which needs no key but recovers no text from a scanned page.++[extract.waterfalls]+document-extractor = [+ "azure-document-intelligence",+ "mistral-ocr",+ "pypdfium2-extract-pdf",+]+ocr-extractor = ["azure-document-intelligence", "mistral-ocr"]+##################################################################################################### Extract Presets####################################################################################################diff --git a/pipelex/kit/paths.py b/pipelex/kit/paths.pyindex 73dc6d20b..9588dbe12 100644--- a/pipelex/kit/paths.py+++ b/pipelex/kit/paths.py@@ -3,7 +3,7 @@ from importlib.resources.abc import Traversable# Git-ignored config files that should not be synced between .pipelex and kit/configs.# These are personal override files that differ per developer/environment:-# - pipelex_service.toml: Contains terms_accepted (False for new users, True for devs)+# - pipelex_service.toml: Contains the onboarding state of this machine (False for new users, True for devs)# - pipelex_override.toml: Personal config overrides# - telemetry_override.toml: Personal telemetry settings# - inference/backends_override.toml, inference/routing_profiles_override.toml: personal@@ -24,8 +24,6 @@ GIT_IGNORED_CONFIG_FILES: frozenset[str] = frozenset("backends_override.toml","routing_profiles_override.toml","telemetry.project.toml",- "pipelex_gateway_models.md", # Auto-generated from remote config- "pipelex_gateway_models_plain.md", # Auto-generated from remote config# Custom deck files differ intentionally: kit templates have waterfalls# commented out, while .pipelex/ has them active for tests"x_custom_llm_deck.toml",diff --git a/pipelex/migration/goldens/pipelex-service-config/[email protected] b/pipelex/migration/goldens/pipelex-service-config/[email protected]new file mode 100644index 000000000..5a65cc004--- /dev/null+++ b/pipelex/migration/goldens/pipelex-service-config/[email protected]@@ -0,0 +1,2 @@+[onboarding]+inference_setup_completed = falsediff --git a/pipelex/migration/goldens/pipelex-service-config/[email protected] b/pipelex/migration/goldens/pipelex-service-config/[email protected]new file mode 100644index 000000000..eddf68cc0--- /dev/null+++ b/pipelex/migration/goldens/pipelex-service-config/[email protected]@@ -0,0 +1,18 @@+{+ "surface_id": "pipelex-service-config",+ "schema_version": 2,+ "document_root_is_open": false,+ "paths": {+ "onboarding": {+ "value_type": "table",+ "required": false,+ "open_node": false+ },+ "onboarding.inference_setup_completed": {+ "value_type": "bool",+ "required": false,+ "default": false,+ "open_node": false+ }+ }+}diff --git a/pipelex/migration/goldens/telemetry-config/[email protected] b/pipelex/migration/goldens/telemetry-config/[email protected]new file mode 100644index 000000000..bc3f3c406--- /dev/null+++ b/pipelex/migration/goldens/telemetry-config/[email protected]@@ -0,0 +1,33 @@+otlp = []++[custom_posthog]+mode = "off"+endpoint = "https://us.i.posthog.com"+geoip = true+debug = false+redact_properties = []++[custom_posthog.tracing]+enabled = false++[custom_posthog.tracing.capture]+content = false+pipe_codes = false+output_class_names = false++[custom_portkey]+force_debug_enabled = false+force_tracing_enabled = false++[langfuse]+enabled = false++[telemetry_allowed_modes]+ci = false+cli = true+docker = true+fastapi = true+mcp = true+n8n = true+pytest = false+python = falsediff --git a/pipelex/migration/goldens/telemetry-config/[email protected] b/pipelex/migration/goldens/telemetry-config/[email protected]new file mode 100644index 000000000..30b628a64--- /dev/null+++ b/pipelex/migration/goldens/telemetry-config/[email protected]@@ -0,0 +1,165 @@+{+ "surface_id": "telemetry-config",+ "schema_version": 3,+ "document_root_is_open": false,+ "paths": {+ "custom_portkey": {+ "value_type": "table",+ "required": false,+ "open_node": false+ },+ "custom_portkey.force_debug_enabled": {+ "value_type": "bool",+ "required": false,+ "default": false,+ "open_node": false+ },+ "custom_portkey.force_tracing_enabled": {+ "value_type": "bool",+ "required": false,+ "default": false,+ "open_node": false+ },+ "custom_posthog": {+ "value_type": "table",+ "required": false,+ "open_node": false+ },+ "custom_posthog.api_key": {+ "value_type": "str",+ "required": false,+ "open_node": false+ },+ "custom_posthog.debug": {+ "value_type": "bool",+ "required": false,+ "default": false,+ "open_node": false+ },+ "custom_posthog.endpoint": {+ "value_type": "str",+ "required": false,+ "default": "https://us.i.posthog.com",+ "open_node": false+ },+ "custom_posthog.geoip": {+ "value_type": "bool",+ "required": false,+ "default": true,+ "open_node": false+ },+ "custom_posthog.mode": {+ "value_type": "enum",+ "required": false,+ "enum_members": [+ "anonymous",+ "identified",+ "off"+ ],+ "default": "off",+ "open_node": false+ },+ "custom_posthog.redact_properties": {+ "value_type": "list[str]",+ "required": false,+ "default": [],+ "open_node": false+ },+ "custom_posthog.tracing": {+ "value_type": "table",+ "required": false,+ "open_node": false+ },+ "custom_posthog.tracing.capture": {+ "value_type": "table",+ "required": false,+ "open_node": false+ },+ "custom_posthog.tracing.capture.content": {+ "value_type": "bool",+ "required": false,+ "default": false,+ "open_node": false+ },+ "custom_posthog.tracing.capture.content_max_length": {+ "value_type": "int",+ "required": false,+ "open_node": false+ },+ "custom_posthog.tracing.capture.output_class_names": {+ "value_type": "bool",+ "required": false,+ "default": false,+ "open_node": false+ },+ "custom_posthog.tracing.capture.pipe_codes": {+ "value_type": "bool",+ "required": false,+ "default": false,+ "open_node": false+ },+ "custom_posthog.tracing.enabled": {+ "value_type": "bool",+ "required": false,+ "default": false,+ "open_node": false+ },+ "custom_posthog.user_id": {+ "value_type": "str",+ "required": false,+ "open_node": false+ },+ "langfuse": {+ "value_type": "table",+ "required": false,+ "open_node": false+ },+ "langfuse.enabled": {+ "value_type": "bool",+ "required": false,+ "default": false,+ "open_node": false+ },+ "langfuse.endpoint": {+ "value_type": "str",+ "required": false,+ "open_node": false+ },+ "langfuse.public_key": {+ "value_type": "str",+ "required": false,+ "open_node": false+ },+ "langfuse.secret_key": {+ "value_type": "str",+ "required": false,+ "open_node": false+ },+ "otlp": {+ "value_type": "list[table]",+ "required": false,+ "default": [],+ "open_node": false+ },+ "telemetry_allowed_modes": {+ "value_type": "dict[str, bool]",+ "required": false,+ "default": {+ "ci": false,+ "cli": true,+ "docker": true,+ "fastapi": true,+ "mcp": true,+ "n8n": true,+ "pytest": false,+ "python": false+ },+ "open_node": true+ },+ "telemetry_allowed_modes.*": {+ "value_type": "bool",+ "required": true,+ "open_node": false+ }+ }+}diff --git a/pipelex/migration/ledgers/pipelex-service-config.toml b/pipelex/migration/ledgers/pipelex-service-config.tomlindex a6c7411e7..82f7f9be2 100644--- a/pipelex/migration/ledgers/pipelex-service-config.toml+++ b/pipelex/migration/ledgers/pipelex-service-config.toml@@ -1,4 +1,4 @@-# The migration ledger for the Pipelex service agreement and onboarding state.+# The migration ledger for the Pipelex service onboarding state.## This surface has no tier files: there is one `pipelex_service.toml` per configuration directory# and nothing layers over it.@@ -7,7 +7,28 @@[surface]id = "pipelex-service-config"-title = "Pipelex service agreement and onboarding state"+title = "Pipelex service onboarding state"base_file = "pipelex_service.toml"-current_schema_version = 1+current_schema_version = 2min_supported_schema_version = 0++[[migration]]+id = "pipelex-service-config@2"+to_schema_version = 2+introduced_in = "0.73.0"+breaking = true+safety = "safe"+title = "Drop the [agreement] section with the Pipelex Gateway"+description = """+The Pipelex Gateway backend left the runtime, and with it the terms of service a user accepted to \+use it. `[agreement]` recorded that acceptance and nothing reads it any more, so a file written \+by an earlier release loses the section; `[onboarding]` is untouched.+"""+guidance = """+Nothing to decide: the terms of service belonged to the Pipelex Gateway backend, which no longer+exists in the runtime. Your inference setup state under `[onboarding]` is kept as it was.+"""++[[migration.ops]]+kind = "delete_table"+table_path = ["agreement"]diff --git a/pipelex/migration/ledgers/telemetry-config.toml b/pipelex/migration/ledgers/telemetry-config.tomlindex 70a5e0b14..aedcf13f9 100644--- a/pipelex/migration/ledgers/telemetry-config.toml+++ b/pipelex/migration/ledgers/telemetry-config.toml@@ -7,7 +7,7 @@ id = "telemetry-config"title = "Telemetry destinations and capture settings"base_file = "telemetry.toml"tier_glob = "telemetry_*.toml"-current_schema_version = 2+current_schema_version = 3min_supported_schema_version = 0[[migration]]@@ -121,3 +121,25 @@ key = "dry_mode_enabled"kind = "delete_key"table_path = []key = "verbose_enabled"++[[migration]]+id = "telemetry-config@3"+to_schema_version = 3+introduced_in = "0.73.0"+breaking = true+safety = "safe"+title = "Drop the maintainer-only [pipelex_gateway] telemetry section"+description = """+The Pipelex Gateway backend left the runtime, and with it the telemetry stream that reported to \+Pipelex on its behalf. `[pipelex_gateway]` was the maintainer-only override of that stream's PostHog \+and Portkey settings, and nothing reads it any more, so a file carrying it loses the section; every \+user-facing destination (`[custom_posthog]`, `[langfuse]`, `[[otlp]]`) is untouched.+"""+guidance = """+Nothing to decide: the section only ever existed in a maintainer's personal `telemetry_override.toml`,+and the stream it configured no longer exists. Your own telemetry destinations are kept as they were.+"""++[[migration.ops]]+kind = "delete_table"+table_path = ["pipelex_gateway"]diff --git a/pipelex/migration/run.py b/pipelex/migration/run.pyindex 8dcdb7892..b5f6e5290 100644--- a/pipelex/migration/run.py+++ b/pipelex/migration/run.py@@ -22,7 +22,7 @@ user would be told one thing by their boot and another by their tool.> `inference/deck/` — is never entered at all.>> **A file is claimed by the pair (directory, name), never by its name alone.**-> `.pipelex/inference/backends/pipelex_gateway.toml` is the specimen: its name matches the+> `.pipelex/inference/backends/pipelex_manifold.toml` is the specimen: its name matches the> `pipelex-config` tier glob `pipelex_*.toml` exactly, and the directory it sits in is what says> it belongs to `inference-backend` instead. Depth used to be what protected it, back when no> surface owned a subdirectory; now the claim rule is.diff --git a/pipelex/migration/surfaces.py b/pipelex/migration/surfaces.pyindex 38fcff0d8..068e99cde 100644--- a/pipelex/migration/surfaces.py+++ b/pipelex/migration/surfaces.py@@ -37,8 +37,8 @@ from pipelex.system.configuration.config_surface import (TELEMETRY_CONFIG_SURFACE_ID,)from pipelex.system.configuration.configs import PipelexConfig-from pipelex.system.pipelex_service.pipelex_service_agreement import PIPELEX_SERVICE_CONFIG_FILE_NAMEfrom pipelex.system.pipelex_service.pipelex_service_config import PipelexServiceConfig+from pipelex.system.pipelex_service.pipelex_service_onboarding import PIPELEX_SERVICE_CONFIG_FILE_NAMEfrom pipelex.system.telemetry.telemetry_config import TELEMETRY_CONFIG_FILE_NAME, TelemetryConfigfrom pipelex.tools.misc.toml_utils import load_toml_from_path@@ -132,7 +132,7 @@ class Surface(BaseModel):Empty for a surface that lives directly in `~/.pipelex/` or `.pipelex/`. A surface that owns asubdirectory owns it *one level deep and to the exclusion of every other surface*, which is- what makes `inference/backends/pipelex_gateway.toml` safe: its name matches the main+ what makes `inference/backends/pipelex_manifold.toml` safe: its name matches the mainconfiguration's tier glob exactly, and only the directory it sits in says it is not a`pipelex.toml` tier file."""@@ -473,7 +473,7 @@ class SurfaceRegistry(BaseModel):Both halves are load-bearing and each answers a real collision. Without the *name* rule,`pipelex_service.toml` is both the base file of one surface and a match for another's- `pipelex_*.toml`. Without the *directory* rule, `inference/backends/pipelex_gateway.toml`+ `pipelex_*.toml`. Without the *directory* rule, `inference/backends/pipelex_manifold.toml`is a `pipelex_*.toml` match too — and it is an inference backend definition, so the mainconfiguration's ledger would be replayed over it and rewrite it.diff --git a/pipelex/pipelex.py b/pipelex/pipelex.pyindex 32b67b09d..51d336b56 100644--- a/pipelex/pipelex.py+++ b/pipelex/pipelex.py@@ -265,7 +265,7 @@ class Pipelex(RuntimeBoot):needs_inference: When False, forces every run THIS process initiates to DRY mode(applied at runtime_hub.resolve_run_mode_for_boot, which every run-params factorycalls: operators dispatch normally and the cogt leaf mocks) and loads backends leniently- (skipping those with missing credentials). This skips gateway terms check and model+ (skipping those with missing credentials). This skips the remote config fetch and modeldeck validation. Useful for commands like validate/show that don't call inferenceAPIs. Generator selection stays backend-keyed. Submitter-side contract only: it doesnot constrain work this process executes as a Temporal worker.@@ -275,7 +275,7 @@ class Pipelex(RuntimeBoot):the matching plugin gates on its own name.needs_model_specs: When True, load real model specs even if needs_inferenceis False. When None (default), follows needs_inference. Useful for validate- commands that need gateway-provided model specs without enabling full inference.+ commands that need the managed gateways' model specs without enabling full inference.class_registry: Custom class registry for dynamic loadingsecrets_provider: Custom secrets/credentials providerstorage_provider: Custom storage backend@@ -297,7 +297,7 @@ class Pipelex(RuntimeBoot):to this directory (package defaults + this directory) instead of followingproject/global layering. Note the limit: it scopes *that load* and nothing else. Theinference files — backends, routing profiles and the model deck — still resolve through- the layered paths, and the gateway consent/onboarding state is read from the global+ the layered paths, and the onboarding state is read from the globalconfig dir outright. So this does not fully isolate a boot from the surroundingproject.config_overrides: Optional dict deep-merged on top of all TOML config layersdiff --git a/pipelex/providers/builtins.py b/pipelex/providers/builtins.pyindex 4b0ec9058..0cfd655ce 100644--- a/pipelex/providers/builtins.py+++ b/pipelex/providers/builtins.py@@ -6,7 +6,6 @@ from pipelex.providers.bedrock.bedrock_plugin import BedrockPluginfrom pipelex.providers.blackboxai.blackboxai_plugin import BlackboxaiPluginfrom pipelex.providers.docling.docling_plugin import DoclingPluginfrom pipelex.providers.fal.fal_plugin import FalPlugin-from pipelex.providers.gateway.gateway_plugin import GatewayPluginfrom pipelex.providers.google.google_plugin import GooglePluginfrom pipelex.providers.huggingface.huggingface_plugin import HuggingFacePluginfrom pipelex.providers.linkup.linkup_plugin import LinkupPlugin@@ -41,7 +40,6 @@ KERNEL_BUILTIN_PLUGINS: list[PipelexPlugin] = [StoragePlugin(),SecretsPlugin(),OpenAIPlugin(),- GatewayPlugin(),ManifoldPlugin(),PortkeyPlugin(),AnthropicPlugin(),diff --git a/pipelex/providers/gateway/__init__.py b/pipelex/providers/gateway/__init__.pydeleted file mode 100644index e69de29bb..000000000diff --git a/pipelex/providers/gateway/gateway_completions_factory.py b/pipelex/providers/gateway/gateway_completions_factory.pydeleted file mode 100644index 8f71763ce..000000000--- a/pipelex/providers/gateway/gateway_completions_factory.py+++ /dev/null@@ -1,372 +0,0 @@-from __future__ import annotations--import json-from typing import TYPE_CHECKING, Any, cast--from portkey_ai import (- createHeaders, # type: ignore[reportUnknownVariableType]-)-from pydantic import ValidationError-from typing_extensions import override--from pipelex import log-from pipelex.cogt.document.prompt_document_utils import prep_prompt_documents-from pipelex.cogt.extract.bounding_box import BoundingBox-from pipelex.cogt.extract.extract_output import ExtractedImageFromPage, ExtractOutput, Page-from pipelex.cogt.image.prompt_image import PromptImageDetail-from pipelex.cogt.image.prompt_image_utils import prep_prompt_images-from pipelex.config import get_config-from pipelex.providers.gateway.gateway_constants import GatewayOpenAISdkVariant-from pipelex.providers.gateway.gateway_exceptions import GatewayExtractResponseError, GatewayFactoryError-from pipelex.providers.gateway.gateway_factory import GatewayFactory-from pipelex.providers.gateway.gateway_protocols import GatewayExtractProtocol-from pipelex.providers.gateway.gateway_schemas import GatewayExtractPageAzure, GatewayExtractPageDeepseek, GatewayExtractPageMistral-from pipelex.providers.gateway.gateway_search_schemas import GatewayFetchResultResponse-from pipelex.providers.openai.openai_completions_factory import OpenAICompletionsFactory-from pipelex.tools.uri.prepared_file import PreparedFileBase64, PreparedFileHttpUrl, PreparedFileLocalPath--if TYPE_CHECKING:- # Deferred imports: avoid pulling heavy SDK at module-load time- import openai- from openai.types.chat import ChatCompletionMessageParam- from portkey_ai.api_resources.utils import GenericResponse-- from pipelex.cogt.inference.inference_job_abstract import InferenceJobAbstract- from pipelex.cogt.llm.llm_job import LLMJob- from pipelex.cogt.model_backends.backend import InferenceBackend- from pipelex.cogt.model_backends.model_spec import InferenceModelSpec- from pipelex.plugins.model_handle import ModelHandle---class GatewayCompletionsFactory(OpenAICompletionsFactory):- @override- async def make_simple_messages(- self,- llm_job: LLMJob,- ) -> list[ChatCompletionMessageParam]:- """Override to use image_url format for documents which Portkey/Gateway translates correctly."""- # Deferred imports: avoid pulling heavy SDK at module-load time- from openai.types.chat import ( # ruff: ignore[import-outside-top-level]- ChatCompletionContentPartImageParam,- ChatCompletionContentPartParam,- ChatCompletionContentPartTextParam,- ChatCompletionSystemMessageParam,- ChatCompletionUserMessageParam,- )- from openai.types.chat.chat_completion_content_part_image_param import ImageURL as OpenAIImageURL # ruff: ignore[import-outside-top-level]-- llm_prompt = llm_job.llm_prompt- messages: list[ChatCompletionMessageParam] = []- user_contents: list[ChatCompletionContentPartParam] = []- if system_content := llm_prompt.system_text:- messages.append(ChatCompletionSystemMessageParam(role="system", content=system_content))- if user_prompt_text := llm_prompt.user_text:- user_part_text = ChatCompletionContentPartTextParam(text=user_prompt_text, type="text")- user_contents.append(user_part_text)- if llm_prompt.user_images:- detail = llm_job.job_params.image_detail or PromptImageDetail.AUTO- prepped_images = await prep_prompt_images(prompt_images=llm_prompt.user_images, is_http_url_enabled=self.is_http_url_enabled)- for prepped_image in prepped_images:- url: str- match prepped_image:- case PreparedFileHttpUrl():- url = prepped_image.url- case PreparedFileBase64():- url = prepped_image.as_data_url()- case PreparedFileLocalPath():- msg = "PreparedFileLocalPath is not supported for images - should be converted to base64"- raise TypeError(msg)-- image_url_obj = OpenAIImageURL(url=url, detail=detail.as_openai_detail)- image_param = ChatCompletionContentPartImageParam(image_url=image_url_obj, type="image_url")- user_contents.append(image_param)-- # Handle documents using image_url format with data URL - Portkey/Gateway translates this correctly- # Documents must always be base64 encoded for the image_url format- if llm_prompt.user_documents:- prepped_documents = await prep_prompt_documents(prompt_documents=llm_prompt.user_documents, is_http_url_enabled=False)- for prepped_document in prepped_documents:- match prepped_document:- case PreparedFileBase64():- # Use image_url format with data URL - Portkey translates this to provider-specific format- doc_url = prepped_document.as_data_url()- image_url_obj = OpenAIImageURL(url=doc_url, detail="auto")- doc_param = ChatCompletionContentPartImageParam(image_url=image_url_obj, type="image_url")- user_contents.append(doc_param)- case PreparedFileHttpUrl() | PreparedFileLocalPath():- msg = f"{type(prepped_document).__name__} is not supported for documents - should be converted to base64"- raise TypeError(msg)-- messages.append(ChatCompletionUserMessageParam(role="user", content=user_contents))- return messages-- @classmethod- def make_portkey_openai_client_for_completions(- cls,- model_handle: ModelHandle,- *,- backend: InferenceBackend,- ) -> openai.AsyncOpenAI:- # Deferred import: avoid pulling heavy SDK at module-load time- import openai # ruff: ignore[import-outside-top-level]-- is_debug_enabled = GatewayFactory.is_debug_enabled(backend=backend)- endpoint = GatewayFactory.get_endpoint(backend=backend)- api_key = GatewayFactory.get_api_key(backend=backend)-- if not GatewayOpenAISdkVariant.is_completions(model_handle.sdk):- msg = f"ModelHandle '{model_handle}' is not supported by '{cls.__name__}'"- raise GatewayFactoryError(msg)-- return openai.AsyncOpenAI(- base_url=endpoint,- # Auth is handled via Portkey headers (x-portkey-api-key, x-portkey-config),- # not the OpenAI Authorization header. The SDK rejects an empty api_key since- # 2.34.0, so we pass a non-empty placeholder; the gateway ignores it.- api_key="unused-auth-via-portkey-headers",- # Tier 1 transport retry: set explicitly from config rather than inheriting the SDK default,- # so a transport_max_retries override applies to the gateway LLM path too (matches PortkeyCompletionsFactory).- max_retries=get_config().inference.transport_max_retries,- default_headers=createHeaders(- api_key=api_key,- strict_open_ai_compliance=False,- debug=is_debug_enabled,- ), # type: ignore[call-overload]- )-- @classmethod- def make_extract_output_from_response(- cls,- *,- inference_model: InferenceModelSpec,- response: GenericResponse,- ) -> ExtractOutput:- extract_protocol = GatewayExtractProtocol.make_from_model_handle(model_handle=inference_model.name)- match extract_protocol:- case GatewayExtractProtocol.MISTRAL_DOC_AI:- return cls._make_extract_output_from_response_mistral(response=response)- case GatewayExtractProtocol.AZURE_DOC_INTEL:- return cls._make_extract_output_from_response_azure(response=response)- case GatewayExtractProtocol.DEEPSEEK_OCR:- return cls._make_extract_output_from_response_deepseek(response=response)- case GatewayExtractProtocol.LINKUP_FETCH:- return cls._make_extract_output_from_response_linkup_fetch(response=response)-- @classmethod- def _extract_pages_from_choices_content(- cls,- response: GenericResponse,- ) -> list[dict[str, Any]] | None:- """Try to extract pages from choices[0].message.content (JSON string).-- When Portkey proxies the response, custom top-level fields like `pages` are stripped.- The relay also puts pages in choices[0].message.content as a JSON string, which is- preserved because it's a standard OpenAI chat completion field.- """- try:- response_dict: dict[str, Any] = response.model_dump(serialize_as_any=True)- choices = response_dict.get("choices")- if not choices or not isinstance(choices, list) or len(choices) == 0: # pyright: ignore[reportUnknownArgumentType]- return None- first_choice = cast("dict[str, Any]", choices[0])- message_raw: Any = first_choice.get("message")- if not message_raw or not isinstance(message_raw, dict):- return None- message_dict = cast("dict[str, Any]", message_raw)- content: Any = message_dict.get("content")- if not content or not isinstance(content, str):- return None- parsed_content = json.loads(content)- if isinstance(parsed_content, list):- return cast("list[dict[str, Any]]", parsed_content)- return None- except (json.JSONDecodeError, KeyError, IndexError, TypeError, AttributeError):- return None-- @classmethod- def _make_extract_output_from_response_azure(- cls,- response: GenericResponse,- ) -> ExtractOutput:- response_page_dicts: list[dict[str, Any]]- if hasattr(response, "pages"):- response_page_dicts = cast("list[dict[str, Any]]", response.pages) # pyright: ignore[reportUnknownMemberType, reportAttributeAccessIssue]- elif (fallback_pages := cls._extract_pages_from_choices_content(response=response)) is not None:- response_page_dicts = fallback_pages- else:- msg = "Gateway extract response does not have pages (neither as top-level field nor in choices[0].message.content)"- raise GatewayExtractResponseError(msg)- try:- pages: dict[int, Page] = {}- for response_page_dict in response_page_dicts:- response_page = GatewayExtractPageAzure.model_validate(response_page_dict)- page_index = response_page.index- extracted_page_text = response_page.markdown- extracted_page_images = response_page.images- page_images: list[ExtractedImageFromPage] = []- for extracted_page_image in extracted_page_images:- extracted_image = ExtractedImageFromPage(- size=None,- base64_str=extracted_page_image.base64_str,- mime_type=extracted_page_image.mime_type,- caption=extracted_page_image.caption,- bounding_box=extracted_page_image.bounding_box,- )- page_images.append(extracted_image)- pages[page_index] = Page(- text=extracted_page_text,- extracted_images=page_images,- )- return ExtractOutput(pages=pages)- except (TypeError, ValidationError) as exc:- msg = f"Error parsing Gateway extract response from pages using Azure schema: {exc}"- raise GatewayExtractResponseError(msg) from exc-- @classmethod- def _make_extract_output_from_response_mistral(- cls,- response: GenericResponse,- ) -> ExtractOutput:- if not hasattr(response, "pages"):- msg = "Gateway extract response does not have pages"- raise GatewayExtractResponseError(msg)- try:- response_page_dicts = cast("list[dict[str, Any]]", response.pages) # pyright: ignore[reportUnknownMemberType, reportAttributeAccessIssue]- pages: dict[int, Page] = {}- for response_page_dict in response_page_dicts:- response_page = GatewayExtractPageMistral.model_validate(response_page_dict)- page_index = response_page.index- extracted_page_text = response_page.markdown- extracted_page_images = response_page.images- page_images: list[ExtractedImageFromPage] = []- for extracted_page_image in extracted_page_images:- prefixed_base64 = extracted_page_image.image_base64- if not prefixed_base64:- continue- bounding_box: BoundingBox | None = None- if (- extracted_page_image.top_left_x is not None- and extracted_page_image.top_left_y is not None- and extracted_page_image.bottom_right_x is not None- and extracted_page_image.bottom_right_y is not None- ):- bounding_box = BoundingBox.make_from_two_corners(- top_left_x=cast("float", extracted_page_image.top_left_x),- top_left_y=cast("float", extracted_page_image.top_left_y),- bottom_right_x=cast("float", extracted_page_image.bottom_right_x),- bottom_right_y=cast("float", extracted_page_image.bottom_right_y),- )- extracted_image = ExtractedImageFromPage(- size=None,- actual_url_or_prefixed_base64=prefixed_base64,- caption=extracted_page_image.image_annotation,- bounding_box=bounding_box,- )- page_images.append(extracted_image)- pages[page_index] = Page(- text=extracted_page_text,- extracted_images=page_images,- )- return ExtractOutput(pages=pages)- except (TypeError, ValidationError) as exc:- msg = f"Error parsing Gateway extract response from pages using Mistral schema: {exc}"- raise GatewayExtractResponseError(msg) from exc-- @classmethod- def _make_extract_output_from_response_deepseek(- cls,- response: GenericResponse,- ) -> ExtractOutput:- response_page_dicts: list[dict[str, Any]]- if hasattr(response, "pages"):- response_page_dicts = cast("list[dict[str, Any]]", response.pages) # pyright: ignore[reportUnknownMemberType, reportAttributeAccessIssue]- elif (fallback_pages := cls._extract_pages_from_choices_content(response=response)) is not None:- response_page_dicts = fallback_pages- else:- msg = "Gateway extract response does not have pages (neither as top-level field nor in choices[0].message.content)"- raise GatewayExtractResponseError(msg)- try:- pages: dict[int, Page] = {}- for response_page_dict in response_page_dicts:- response_page = GatewayExtractPageDeepseek.model_validate(response_page_dict)- page_index = response_page.index- if response_page.source_image_info and response_page.source_image_info.scaled_down:- original = response_page.source_image_info.original- processed = response_page.source_image_info.processed- log.warning(- f"Extract page [{page_index}]: image was scaled down from {original.width}x{original.height} "- f"({original.bytes / 1024:.1f} KB) to {processed.width}x{processed.height} ({processed.bytes / 1024:.1f} KB)"- )- extracted_page_text = response_page.markdown- pages[page_index] = Page(- text=extracted_page_text,- extracted_images=[],- )- return ExtractOutput(pages=pages)- except (TypeError, ValidationError) as exc:- msg = f"Error parsing Gateway extract response from pages using Deepseek schema: {exc}"- raise GatewayExtractResponseError(msg) from exc-- @classmethod- def _make_extract_output_from_response_linkup_fetch(- cls,- response: GenericResponse,- ) -> ExtractOutput:- content_str = cls._extract_content_string_from_response(response=response)- if content_str is None:- msg = "Gateway fetch response does not contain content in choices[0].message.content"- raise GatewayExtractResponseError(msg)- try:- fetch_result = GatewayFetchResultResponse.model_validate_json(content_str)- except (ValidationError, ValueError) as exc:- msg = f"Error parsing Gateway fetch response as GatewayFetchResultResponse: {exc}"- raise GatewayExtractResponseError(msg) from exc-- extracted_images: list[ExtractedImageFromPage] = []- if fetch_result.images:- for image in fetch_result.images:- extracted_images.append(- ExtractedImageFromPage(- size=None,- actual_url=image.url,- mime_type=None,- caption=image.alt or None,- )- )-- page = Page(- text=fetch_result.markdown,- raw_html=fetch_result.raw_html,- extracted_images=extracted_images,- )- return ExtractOutput(pages={0: page})-- @classmethod- def _extract_content_string_from_response(- cls,- response: GenericResponse,- ) -> str | None:- """Extract the string content from choices[0].message.content."""- try:- response_dict: dict[str, Any] = response.model_dump(serialize_as_any=True)- choices = response_dict.get("choices")- if not choices or not isinstance(choices, list) or len(choices) == 0: # pyright: ignore[reportUnknownArgumentType]- return None- first_choice = cast("dict[str, Any]", choices[0])- message_raw: Any = first_choice.get("message")- if not message_raw or not isinstance(message_raw, dict):- return None- message_dict = cast("dict[str, Any]", message_raw)- content: Any = message_dict.get("content")- if not content or not isinstance(content, str):- return None- content_str: str = content- return content_str- except (KeyError, IndexError, TypeError, AttributeError):- return None-- @override- def make_extras(- self, inference_model: InferenceModelSpec, *, inference_job: InferenceJobAbstract, output_desc: str- ) -> tuple[dict[str, str], dict[str, Any]]:- return GatewayFactory.make_extras(inference_model=inference_model, inference_job=inference_job, output_desc=output_desc)diff --git a/pipelex/providers/gateway/gateway_constants.py b/pipelex/providers/gateway/gateway_constants.pydeleted file mode 100644index 0ae068b43..000000000--- a/pipelex/providers/gateway/gateway_constants.py+++ /dev/null@@ -1,30 +0,0 @@-from enum import StrEnum---class GatewayOpenAISdkVariant(StrEnum):- GATEWAY_COMPLETIONS = "gateway_completions"- GATEWAY_RESPONSES = "gateway_responses"-- @classmethod- def is_completions(cls, sdk: str) -> bool:- try:- variant = cls(sdk)- except ValueError:- return False- match variant:- case cls.GATEWAY_COMPLETIONS:- return True- case cls.GATEWAY_RESPONSES:- return False-- @classmethod- def is_responses(cls, sdk: str) -> bool:- try:- variant = cls(sdk)- except ValueError:- return False- match variant:- case cls.GATEWAY_COMPLETIONS:- return False- case cls.GATEWAY_RESPONSES:- return Truediff --git a/pipelex/providers/gateway/gateway_deck.py b/pipelex/providers/gateway/gateway_deck.pydeleted file mode 100644index 925151a4e..000000000--- a/pipelex/providers/gateway/gateway_deck.py+++ /dev/null@@ -1,18 +0,0 @@-from pipelex import log-from pipelex.config import get_config-from pipelex.providers.gateway.gateway_exceptions import GatewayDeckError-from pipelex.providers.portkey.portkey_constants import PortkeyHeaderKey---class GatewayDeck:- @classmethod- def get_config_id(cls, headers: dict[str, str]) -> str:- config_id = headers.get(PortkeyHeaderKey.CONFIG)- if not config_id:- msg = f"Could not get '{PortkeyHeaderKey.CONFIG}' field from headers"- raise GatewayDeckError(msg)- config_id_substitutions = get_config().inference.gateway_test.config_id_substitutions- if config_id_substitutions and (substitute := config_id_substitutions.get(config_id)) and substitute != config_id:- log.warning(f"Substituting config ID '{config_id}' with '{substitute}'")- return substitute- return config_iddiff --git a/pipelex/providers/gateway/gateway_exceptions.py b/pipelex/providers/gateway/gateway_exceptions.pydeleted file mode 100644index a448666ac..000000000--- a/pipelex/providers/gateway/gateway_exceptions.py+++ /dev/null@@ -1,29 +0,0 @@-from pipelex.cogt.exceptions import CogtError---class GatewayError(CogtError):- pass---class GatewayFactoryError(GatewayError):- pass---class GatewayCredentialsError(GatewayError):- pass---class GatewayDeckError(GatewayError):- pass---class GatewayExtractResponseError(GatewayError):- pass---class GatewaySearchResponseError(GatewayError):- pass---class GatewaySearchEmptyResultError(GatewayError):- passdiff --git a/pipelex/providers/gateway/gateway_extract_worker.py b/pipelex/providers/gateway/gateway_extract_worker.pydeleted file mode 100644index 0445b3858..000000000--- a/pipelex/providers/gateway/gateway_extract_worker.py+++ /dev/null@@ -1,237 +0,0 @@-import asyncio-from typing import Any--from portkey_ai import AsyncPortkey-from portkey_ai.api_resources import exceptions as portkey_exceptions-from portkey_ai.api_resources.utils import GenericResponse-from typing_extensions import override--from pipelex import log-from pipelex.cogt.exceptions import ExtractCapabilityError, SdkTypeError-from pipelex.cogt.extract.exceptions import ExtractInputError-from pipelex.cogt.extract.extract_job import ExtractJob-from pipelex.cogt.extract.extract_output import ExtractOutput-from pipelex.cogt.extract.extract_worker_abstract import ExtractWorkerAbstract-from pipelex.cogt.inference.error_classification import extract_gateway_metadata-from pipelex.cogt.inference.error_classify import classify_inference_error-from pipelex.cogt.inference.error_render import InferenceErrorFamily, render_inference_error-from pipelex.cogt.inference.inference_constants import InferenceOutputType-from pipelex.cogt.model_backends.model_spec import InferenceModelSpec-from pipelex.cogt.usage.token_category import TokenCategory-from pipelex.providers.gateway.gateway_completions_factory import GatewayCompletionsFactory-from pipelex.providers.gateway.gateway_deck import GatewayDeck-from pipelex.providers.gateway.gateway_factory import GatewayFactory-from pipelex.providers.gateway.gateway_protocols import GatewayExtractProtocol-from pipelex.providers.gateway.gateway_search_schemas import GatewayFetchRequestParams-from pipelex.reporting.reporting_protocol import ReportingProtocol-from pipelex.runtime_hub import get_storage_provider-from pipelex.tools.uri.uri_base64 import make_base64_url_from_any_uri---class GatewayExtractWorker(ExtractWorkerAbstract):- def __init__(- self,- sdk_instance: Any,- extra_config: dict[str, Any],- inference_model: InferenceModelSpec,- reporting_delegate: ReportingProtocol | None = None,- ):- super().__init__(- extra_config=extra_config,- inference_model=inference_model,- reporting_delegate=reporting_delegate,- )-- if not isinstance(sdk_instance, AsyncPortkey):- msg = f"Provided extraction sdk_instance for {self.__class__.__name__} is not of type Portkey: it's a '{type(sdk_instance)}'"- raise SdkTypeError(msg)-- self.portkey_client: AsyncPortkey = sdk_instance-- @override- def teardown(self):- """Close the portkey client's underlying httpx connection pool.-- The httpx client holds TCP connections bound to a specific event loop.- If the worker is reused across event loop boundaries (e.g. between test- modules with different class-scoped loops), stale connections cause- 'Event loop is closed' errors. Closing prevents this.- """- try:- httpx_client = getattr(self.portkey_client, "_client", None)- if httpx_client is not None and hasattr(httpx_client, "is_closed") and not httpx_client.is_closed:- try:- loop = asyncio.get_running_loop()- task = loop.create_task(httpx_client.aclose())- task.add_done_callback(- lambda task_result: (- log.debug(f"Portkey httpx client cleanup error: {task_result.exception()}")- if not task_result.cancelled() and task_result.exception()- else None- )- )- except RuntimeError:- # No running event loop, best-effort sync close- try:- asyncio.run(httpx_client.aclose())- except Exception as exc: # ruff: ignore[blind-except]- # Best-effort: asyncio.run() runs aclose(), whose failure surface is not enumerable; teardown must never fail.- log.debug(f"Error closing portkey httpx client during teardown: {exc}")- except Exception as exc: # ruff: ignore[blind-except]- # Best-effort cleanup boundary: teardown must never fail, whatever client/event-loop close throws.- log.debug(f"Error during GatewayExtractWorker teardown: {exc}")-- @override- async def _extract_pages(- self,- extract_job: ExtractJob,- ) -> ExtractOutput:- extract_protocol = GatewayExtractProtocol.make_from_model_handle(model_handle=self.inference_model.name)- match extract_protocol:- case GatewayExtractProtocol.LINKUP_FETCH:- return await self._extract_web_fetch(extract_job=extract_job)- case GatewayExtractProtocol.MISTRAL_DOC_AI | GatewayExtractProtocol.AZURE_DOC_INTEL | GatewayExtractProtocol.DEEPSEEK_OCR:- return await self._extract_document(extract_job=extract_job)-- async def _extract_document(- self,- extract_job: ExtractJob,- ) -> ExtractOutput:- # max_nb_images: None=unlimited, 0=no images, N=limit to N images- max_nb_images = extract_job.job_params.max_nb_images- should_include_images = max_nb_images is None or max_nb_images > 0-- storage = get_storage_provider()-- if image_uri := extract_job.extract_input.image_uri:- base64_url = await make_base64_url_from_any_uri(uri=image_uri, storage_provider=storage)- # Images (as input) don't have embedded images to extract- extract_output = await self._extract_base64_url(- extract_job=extract_job,- base64_url=base64_url,- should_include_images=False,- )-- elif document_uri := extract_job.extract_input.document_uri:- if extract_job.job_params.should_caption_images and not self.inference_model.is_caption_supported_for_extract:- msg = f"Captioning is not supported by '{self.inference_model.tag}'."- raise ExtractCapabilityError(msg)- base64_url = await make_base64_url_from_any_uri(uri=document_uri, storage_provider=storage)- extract_output = await self._extract_base64_url(- extract_job=extract_job,- base64_url=base64_url,- should_include_images=should_include_images,- )- else:- msg = "No image nor document URI provided in ExtractJob"- raise ExtractInputError(msg)- return extract_output-- async def _extract_web_fetch(- self,- extract_job: ExtractJob,- ) -> ExtractOutput:- """Extract content from a web page via the gateway's linkup-fetch endpoint."""- document_uri = extract_job.extract_input.document_uri- if not document_uri:- msg = "GatewayExtractWorker (linkup-fetch) requires a document_uri (web URL) in ExtractInput"- raise ExtractInputError(msg)-- job_params = extract_job.job_params- max_nb_images = job_params.max_nb_images- extract_images = max_nb_images is None or max_nb_images > 0-- fetch_params = GatewayFetchRequestParams(- url=document_uri,- render_js=job_params.render_js,- include_raw_html=job_params.include_raw_html,- extract_images=extract_images,- )-- config_id = GatewayDeck.get_config_id(headers=self.inference_model.extra_headers or {})- log.dev(f"Web fetch via gateway config '{config_id}' for URL: {document_uri}")-- messages: list[dict[str, str]] = [{"role": "user", "content": fetch_params.model_dump_json()}]-- try:- response = await self.portkey_client.with_options(config=config_id).post( # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType]- "/chat/completions",- model=self.inference_model.model_id,- messages=messages,- )- except portkey_exceptions.APIError as sdk_exc:- metadata = extract_gateway_metadata(sdk_exc)- classification = classify_inference_error(metadata)- raise render_inference_error(- metadata=metadata,- classification=classification,- family=InferenceErrorFamily.EXTRACT,- model_desc=self.inference_model.desc,- model_handle=self.inference_model.name,- ) from sdk_exc-- if not isinstance(response, GenericResponse):- msg = "Response is not of type GenericResponse"- raise TypeError(msg)-- extract_output = GatewayCompletionsFactory.make_extract_output_from_response(inference_model=self.inference_model, response=response)-- # Apply image limit (factory just parses, worker applies limits)- if max_nb_images is not None and extract_output.pages:- for page in extract_output.pages.values():- page.extracted_images = page.extracted_images[:max_nb_images]-- # Per-request cost model: costs are defined per million, so 1 request = 1_000_000- if extract_tokens_usage := extract_job.job_report.extract_tokens_usage:- extract_tokens_usage.nb_tokens_by_category = {- TokenCategory.INPUT: 1_000_000,- TokenCategory.OUTPUT: 1_000_000,- }-- return extract_output-- async def _extract_base64_url(- self,- extract_job: ExtractJob,- *,- base64_url: str,- should_include_images: bool = False,- ) -> ExtractOutput:- config_id = GatewayDeck.get_config_id(headers=self.inference_model.extra_headers or {})- log.dev(f"Extracting using config '{config_id}' with should_include_images: {should_include_images}")-- extra_headers, extra_body = GatewayFactory.make_extras(- inference_model=self.inference_model, inference_job=extract_job, output_desc=InferenceOutputType.PAGES- )- # Encode document/image as an image_url content part inside messages.- # Portkey forwards messages but strips custom top-level fields like document/image.- if extra_body.get("messages"):- first_msg = extra_body["messages"][0]- text_content = first_msg["content"]- first_msg["content"] = [- {"type": "text", "text": text_content},- {"type": "image_url", "image_url": {"url": base64_url}},- ]- try:- response = await self.portkey_client.with_options(config=config_id).post( # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType]- "/chat/completions",- model=self.inference_model.model_id,- headers=extra_headers,- **extra_body,- )- except portkey_exceptions.APIError as sdk_exc:- metadata = extract_gateway_metadata(sdk_exc)- classification = classify_inference_error(metadata)- raise render_inference_error(- metadata=metadata,- classification=classification,- family=InferenceErrorFamily.EXTRACT,- model_desc=self.inference_model.desc,- model_handle=self.inference_model.name,- ) from sdk_exc-- if not isinstance(response, GenericResponse):- msg = "Response is not of type GenericResponse"- raise TypeError(msg)-- return GatewayCompletionsFactory.make_extract_output_from_response(inference_model=self.inference_model, response=response)diff --git a/pipelex/providers/gateway/gateway_factory.py b/pipelex/providers/gateway/gateway_factory.pydeleted file mode 100644index 92c9be398..000000000--- a/pipelex/providers/gateway/gateway_factory.py+++ /dev/null@@ -1,138 +0,0 @@-from __future__ import annotations--import random-from typing import TYPE_CHECKING, Any--from portkey_ai import (- PORTKEY_GATEWAY_URL,- AsyncPortkey,-)--from pipelex import log-from pipelex.cogt.extract.extract_job import ExtractJob-from pipelex.cogt.img_gen.img_gen_gemini_mapping import ImgGenGeminiMapping-from pipelex.cogt.img_gen.img_gen_job import ImgGenJob-from pipelex.cogt.inference.inference_constants import InferenceOutputType-from pipelex.cogt.llm.llm_job import LLMJob-from pipelex.providers.gateway.gateway_exceptions import GatewayCredentialsError-from pipelex.providers.gateway.gateway_protocols import GatewayExtractProtocol-from pipelex.providers.gateway.gateway_schemas import GatewayExtractRequestParams-from pipelex.providers.portkey.portkey_constants import PortkeyHeaderKey-from pipelex.runtime_hub import get_telemetry_manager-from pipelex.system.telemetry.otel_constants import OTelConstants--if TYPE_CHECKING:- from pipelex.cogt.img_gen.img_gen_job_components import ImgGenJobParams- from pipelex.cogt.inference.inference_job_abstract import InferenceJobAbstract- from pipelex.cogt.model_backends.backend import InferenceBackend- from pipelex.cogt.model_backends.model_spec import InferenceModelSpec---class GatewayFactory:- @classmethod- def is_debug_enabled(cls, backend: InferenceBackend) -> bool:- is_debug_configured = backend.extra_config.get("debug", False)- return get_telemetry_manager().is_pipelex_gateway_portkey_logging_enabled(is_debug_configured=is_debug_configured)-- @classmethod- def get_endpoint(cls, backend: InferenceBackend) -> str:- return backend.endpoint or PORTKEY_GATEWAY_URL-- @classmethod- def get_api_key(cls, backend: InferenceBackend) -> str:- if not backend.api_key:- msg = "Portkey API key is not set"- raise GatewayCredentialsError(msg)- return backend.api_key-- @classmethod- def make_portkey_client(- cls,- backend: InferenceBackend,- ) -> AsyncPortkey:- is_debug_enabled = cls.is_debug_enabled(backend=backend)- endpoint = cls.get_endpoint(backend=backend)- api_key = cls.get_api_key(backend=backend)- log.verbose(f"Making Portkey client with endpoint: {endpoint}, debug: {is_debug_enabled}")-- return AsyncPortkey(- base_url=endpoint,- api_key=api_key,- debug=is_debug_enabled,- )-- @classmethod- def _make_gemini_image_config(cls, inference_model: InferenceModelSpec, *, job_params: ImgGenJobParams) -> dict[str, str]:- """Build the gemini `image_config` extra-body block, honoring the portable size.-- Any requested size (tier or exact) resolves through the model's taxonomy rules and- their published grids — same validation as the native Google worker, never a silent- forward of an unsupported size. An unset size omits `image_size` entirely so the- provider applies its own default (the 1K class); when the model has no usable taxonomy- (rules missing, or a remotely-fetched spec carrying a taxonomy string that predates- this factory), that no-size case abstains like the support checks and keeps the plain- ratio-only mapping.- """- if job_params.size is None:- taxonomy = ImgGenGeminiMapping.optional_img_gen_taxonomy(inference_model)- if taxonomy is None:- return {"aspect_ratio": ImgGenGeminiMapping.aspect_ratio_literal(job_params.aspect_ratio)}- else:- taxonomy = ImgGenGeminiMapping.img_gen_taxonomy(inference_model)- resolved = ImgGenGeminiMapping.resolve_image_config(- taxonomy,- aspect_ratio=job_params.aspect_ratio,- size=job_params.size,- model_name=inference_model.name,- )- image_config: dict[str, str] = {"aspect_ratio": resolved.aspect_ratio}- if resolved.image_size is not None:- image_config["image_size"] = resolved.image_size- return image_config-- @classmethod- def make_extras(- cls, inference_model: InferenceModelSpec, *, inference_job: InferenceJobAbstract, output_desc: str- ) -> tuple[dict[str, str], dict[str, Any]]:- extra_headers: dict[str, str] = {}- extra_body: dict[str, Any] = {}- if inference_model.extra_headers:- extra_headers.update(inference_model.extra_headers)- if not extra_headers.get(PortkeyHeaderKey.CONFIG) and not extra_headers.get(PortkeyHeaderKey.PROVIDER):- extra_headers[PortkeyHeaderKey.PROVIDER] = inference_model.backend_name-- if isinstance(inference_job, ExtractJob):- # Derive boolean from max_nb_images: None/positive = True, 0 = False- max_nb_images = inference_job.job_params.max_nb_images- should_include_images = max_nb_images is None or max_nb_images > 0- extract_protocol = GatewayExtractProtocol.make_from_model_handle(model_handle=inference_model.name)- match extract_protocol:- case GatewayExtractProtocol.MISTRAL_DOC_AI:- extra_body["include_image_base64"] = should_include_images- case GatewayExtractProtocol.AZURE_DOC_INTEL:- request_params = GatewayExtractRequestParams(should_include_images=should_include_images)- messages_azure: list[dict[str, str]] = [{"role": "user", "content": request_params.model_dump_json()}]- extra_body["messages"] = messages_azure- case GatewayExtractProtocol.DEEPSEEK_OCR:- messages_deepseek: list[dict[str, str]] = [{"role": "user", "content": "Convert the document to markdown."}]- extra_body["messages"] = messages_deepseek- case GatewayExtractProtocol.LINKUP_FETCH:- pass # Fetch params are built directly in GatewayExtractWorker._extract_web_fetch- elif isinstance(inference_job, LLMJob) and inference_model.model_id.lower().startswith("mistral-") and inference_job.job_params.seed is None:- # Mistral models really want non-null seed- extra_body["seed"] = random.randint(0, 1000000)- elif isinstance(inference_job, ImgGenJob) and inference_model.model_id.startswith("gemini"):- extra_body["image_config"] = cls._make_gemini_image_config(inference_model, job_params=inference_job.job_params)- # OTel-correlated Portkey tracing (only when enabled and OTel context available)- if get_telemetry_manager().is_pipelex_gateway_portkey_tracing_enabled() and (otel_context := inference_job.job_metadata.otel_context):- # Use OTel trace_id and span_id for correlation- extra_headers[PortkeyHeaderKey.TRACE_ID] = f"{otel_context.trace_id:032x}"- extra_headers[PortkeyHeaderKey.SPAN_ID] = f"{otel_context.span_id:016x}"-- # Build span name with redacted output class name (consistent with Pipelex telemetry policy)- # Pipelex services always redact sensitive data to protect user privacy- unit_job_id = inference_job.job_metadata.unit_job_id or "unknown"- display_output = output_desc if output_desc == InferenceOutputType.TEXT else OTelConstants.OUTPUT_CLASS_REDACTED- extra_headers[PortkeyHeaderKey.SPAN_NAME] = f"{unit_job_id} -> {display_output}"-- return extra_headers, extra_bodydiff --git a/pipelex/providers/gateway/gateway_img_gen_worker.py b/pipelex/providers/gateway/gateway_img_gen_worker.pydeleted file mode 100644index 188d0f93b..000000000--- a/pipelex/providers/gateway/gateway_img_gen_worker.py+++ /dev/null@@ -1,419 +0,0 @@-from __future__ import annotations--import base64-import io-import json-from typing import TYPE_CHECKING, Any--import httpx-from PIL import Image-from portkey_ai import AsyncPortkey--# The vendored openai package is the one AsyncPortkey.openai_client is built from, so the-# exceptions it raises are the vendored classes (not the real `openai` package's) — there is-# no public re-export of them in portkey_ai.-from portkey_ai._vendor import openai as portkey_vendored_openai # ruff: ignore[import-private-name]-from portkey_ai.api_resources import exceptions as portkey_exceptions-from portkey_ai.api_resources.utils import GenericResponse-from pydantic import ValidationError-from typing_extensions import override--from pipelex.cogt.exceptions import ImgGenGenerationError, ImgGenParameterError, InferenceErrorCategory, SdkTypeError-from pipelex.cogt.image.generated_image import GeneratedImageRawDetails-from pipelex.cogt.image.image_size import ImageSize-from pipelex.cogt.img_gen.img_gen_args_factory import ImageFileTuple, ImgGenArgsFactory-from pipelex.cogt.img_gen.img_gen_worker_abstract import ImgGenWorkerAbstract-from pipelex.cogt.inference.error_classification import UserAction, UserActionKind, extract_gateway_metadata-from pipelex.cogt.inference.error_classify import classify_inference_error-from pipelex.cogt.inference.error_render import InferenceErrorFamily, render_inference_error-from pipelex.cogt.usage.token_category import NbTokensByCategoryDict, TokenCategory-from pipelex.providers.fal.fal_poller import FalPoller-from pipelex.providers.gateway.gateway_deck import GatewayDeck-from pipelex.providers.gateway.gateway_schemas import GatewayImgGenAzureFlux2Pro, GatewayImgGenAzureGptImage-from pipelex.providers.portkey.portkey_constants import PortkeyHeaderKey-from pipelex.tools.misc.exceptions import FileTypeError-from pipelex.tools.misc.filetype_utils import detect_file_type_from_bytes-from pipelex.tools.misc.image_utils import ImageFormat-from pipelex.tools.typing.pydantic_utils import format_pydantic_validation_error--if TYPE_CHECKING:- from pipelex.cogt.img_gen.img_gen_job import ImgGenJob- from pipelex.cogt.model_backends.model_spec import InferenceModelSpec- from pipelex.reporting.reporting_protocol import ReportingProtocol---class GatewayImgGenWorker(ImgGenWorkerAbstract):- def __init__(- self,- sdk_instance: Any,- inference_model: InferenceModelSpec,- reporting_delegate: ReportingProtocol | None = None,- ):- super().__init__(inference_model=inference_model, reporting_delegate=reporting_delegate)-- if not isinstance(sdk_instance, AsyncPortkey):- msg = f"Provided ImgGen sdk_instance for {self.__class__.__name__} is not of type portkey_ai.AsyncPortkey: it's a '{type(sdk_instance)}'"- raise SdkTypeError(msg)-- self.portkey_client: AsyncPortkey = sdk_instance-- @override- async def _gen_image(- self,- img_gen_job: ImgGenJob,- ) -> GeneratedImageRawDetails:- one_image_list = await self._gen_image_list(img_gen_job=img_gen_job, nb_images=1)- return one_image_list[0]-- @override- async def _gen_image_list(- self,- img_gen_job: ImgGenJob,- *,- nb_images: int,- ) -> list[GeneratedImageRawDetails]:- if self.inference_model.rules is None:- msg = f"Model '{self.inference_model.name}' does not have rules configured"- raise ImgGenParameterError(msg, error_category=InferenceErrorCategory.CONFIGURATION)- args_dict = await ImgGenArgsFactory.make_args_for_model(- model_rules=self.inference_model.rules,- img_gen_job=img_gen_job,- nb_images=nb_images,- model_id=self.inference_model.model_id,- model_name=self.inference_model.name,- )-- endpoint_path = self.inference_model.endpoint_path- if not endpoint_path:- msg = f"Model '{self.inference_model.name}' does not have an endpoint_path configured but it's required for this model/sdk."- raise ImgGenParameterError(msg, error_category=InferenceErrorCategory.CONFIGURATION)- config_id = GatewayDeck.get_config_id(headers=self.inference_model.extra_headers or {})- image_files: list[ImageFileTuple] | None = args_dict.pop("image", None)- # Given that different backends and different models can be used with this worker, we must interpret the response,- # so we build a plain dict from it in both branches and detect its shape below.- response_dict: dict[str, Any]- try:- # TODO: add portkey tracing headers when enabled- if image_files is not None:- # OpenAI/Azure's Images API splits generation and editing across two REST routes, and- # only /images/edits accepts the 'image' parameter (/images/generations rejects it with- # a 400 "Unknown parameter"). The args factory maps input images to httpx-style file- # tuples under "image"; they must travel as a multipart body.- edits_endpoint_path = endpoint_path.replace("/images/generations", "/images/edits", 1)- if edits_endpoint_path == endpoint_path:- msg = f"Could not derive an /images/edits route from endpoint path '{endpoint_path}'"- raise ImgGenParameterError(msg, error_category=InferenceErrorCategory.CONFIGURATION)- # OpenAI's multipart convention for /images/edits (matching the openai SDK's- # extract_files serialization): a single input image is the bare 'image' field,- # but multiple images must each go under 'image[]' — repeated bare 'image' parts- # are collapsed to one by the server, silently dropping the others.- image_field_name = "image[]" if len(image_files) > 1 else "image"- multipart_files: list[tuple[str, Any]] = [(image_field_name, image_file) for image_file in image_files]- # TODO: PR the one-line fix upstream to portkey-python-sdk — AsyncAPIClient._build_request()- # omits files=options.files (the sync APIClient passes it), so AsyncPortkey.post(files=...)- # silently sends an empty body (verified on portkey-ai 2.3.0 through 2.3.2 and current main).- # Once the fix ships, restore the plain Portkey call- # `self.portkey_client.with_options(config=config_id).post(url=edits_endpoint_path, files=...)`;- # commit 2d4ae4ecb71116e942c0adf2e6516de4b42f0614 holds the state of things and analysis.- # Until then, route the edit through the vendored AsyncOpenAI client that AsyncPortkey already- # carries: same base_url, Portkey auth headers baked in as default_headers, shared connection- # pool — and its multipart serializer renders every scalar arg passed as `body` into a form- # field (bools lowercased, arrays bracketed) once Content-Type is multipart/form-data.- http_response = await self.portkey_client.openai_client.post(- edits_endpoint_path,- cast_to=httpx.Response,- body=args_dict,- files=multipart_files,- options={- "headers": {- PortkeyHeaderKey.CONFIG: config_id,- "Content-Type": "multipart/form-data",- },- },- )- # A 2xx with a non-JSON body (e.g. an intermediary's HTML error page) must surface as a- # categorized ImgGenGenerationError, not a raw JSONDecodeError — the latter escapes the- # Temporal PipelexError bridge and gets retried, duplicating a billable generation.- try:- response_dict = http_response.json()- except json.JSONDecodeError as exc:- msg = f"Gateway returned a non-JSON body for model '{self.inference_model.name}'"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CONTACT_SUPPORT,- detail="The Gateway returned a malformed response — retry, and report this if it persists",- ),- provider_metadata=None,- ) from exc- else:- response = await self.portkey_client.with_options(config=config_id).post( # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType]- url=endpoint_path,- **args_dict,- )- if response is None:- msg = f"Could not get a response for model '{self.inference_model.name}' via Portkey"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CONTACT_SUPPORT,- detail="The Gateway returned no response — retry, and report this if it persists",- ),- provider_metadata=None,- )- if not isinstance(response, GenericResponse):- msg = "Response is not of type GenericResponse"- raise TypeError(msg)- response_dict = response.model_dump(serialize_as_any=True)- except (portkey_exceptions.APIError, portkey_vendored_openai.APIError) as exc:- metadata = extract_gateway_metadata(exc)- classification = classify_inference_error(metadata)- raise render_inference_error(- metadata=metadata,- classification=classification,- family=InferenceErrorFamily.IMG_GEN,- model_desc=self.inference_model.desc,- model_handle=self.inference_model.name,- ) from exc-- # Extract usage tokens if available- if (usage_dict := response_dict.get("usage")) and (img_gen_tokens_usage := img_gen_job.job_report.img_gen_tokens_usage):- nb_tokens: NbTokensByCategoryDict = {}- if input_tokens := usage_dict.get("prompt_tokens") or usage_dict.get("input_tokens"):- nb_tokens[TokenCategory.INPUT] = input_tokens- if output_tokens := usage_dict.get("completion_tokens") or usage_dict.get("output_tokens"):- nb_tokens[TokenCategory.OUTPUT] = output_tokens- img_gen_tokens_usage.nb_tokens_by_category = nb_tokens-- generated_images: list[GeneratedImageRawDetails] = []- if images := response_dict.get("data"):- # Azure-shaped responses, model is either OpenAI's GPT Image or Black Forest Labs' Flux 2 Pro- azure_gpt_image: GatewayImgGenAzureGptImage | None = None- flux_2_pro_image: GatewayImgGenAzureFlux2Pro | None = None- parsing_errors: str = ""- try:- response_azure_gpt_image = GatewayImgGenAzureGptImage.model_validate(response_dict)- azure_gpt_image = response_azure_gpt_image- except ValidationError as azure_gpt_image_error:- validation_error_summary = format_pydantic_validation_error(azure_gpt_image_error)- parsing_errors += f"Azure GPT Image: {validation_error_summary}\n"- try:- response_flux_2_pro_image = GatewayImgGenAzureFlux2Pro.model_validate(response_dict)- flux_2_pro_image = response_flux_2_pro_image- except ValidationError as flux_2_pro_image_error:- validation_error_summary = format_pydantic_validation_error(flux_2_pro_image_error)- parsing_errors += f"\n\nFlux 2 Pro: {validation_error_summary}\n"-- width: int- height: int- image_format: str | None- if azure_gpt_image:- image_format = response_dict.get("output_format")- if not image_format:- msg = "No output format received from Gateway"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned an image without an output format — try a different model",- ),- provider_metadata=None,- )- size = response_dict.get("size")- if not isinstance(size, str):- msg = f"Size from img gen response is not a string: '{size}'"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned a malformed image size — try a different model",- ),- provider_metadata=None,- )- size_split = size.split("x")- if len(size_split) != 2:- msg = f"Size from img gen response is not a valid size: '{size}'"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned a malformed image size — try a different model",- ),- provider_metadata=None,- )- width_str, height_str = size_split- try:- width = int(width_str)- height = int(height_str)- except ValueError as exc:- msg = f"Size from img gen response has non-numeric dimensions: '{size}'"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned a malformed image size — try a different model",- ),- provider_metadata=None,- ) from exc- elif flux_2_pro_image:- # Detect size and format from the first image's data- first_image = images[0] if images else None- if not first_image:- msg = "No images in Flux 2 Pro response"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.CONTENT,- user_action=UserAction(- kind=UserActionKind.CHANGE_INPUT,- detail="The Gateway returned no image — try rephrasing the prompt or using a different model",- ),- provider_metadata=None,- )- first_base64 = first_image.get("b64_json")- if not isinstance(first_base64, str):- msg = f"No base64 image data in first image from model '{self.inference_model.name}'"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.CONTENT,- user_action=UserAction(- kind=UserActionKind.CHANGE_INPUT,- detail="The Gateway returned no image data — try rephrasing the prompt or using a different model",- ),- provider_metadata=None,- )-- # Decode base64 once and detect file type and dimensions. A malformed- # success body (invalid base64, an unrecognized/truncated image) must- # surface as a categorized ImgGenGenerationError, not a raw- # binascii/PIL exception — the latter escapes the Temporal PipelexError- # bridge and gets retried, duplicating a billable generation.- try:- image_bytes = base64.b64decode(first_base64)- image_format = ImageFormat.from_mime_type(- mime_type=detect_file_type_from_bytes(image_bytes).mime,- ).value- with Image.open(io.BytesIO(image_bytes)) as pil_img:- width, height = pil_img.size- except (ValueError, OSError, FileTypeError) as exc:- msg = f"Could not decode the image returned by the Gateway for model '{self.inference_model.name}'"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned a malformed image — try a different model",- ),- provider_metadata=None,- ) from exc- else:- msg = f"Could not parse image generation from Gateway response:\n{parsing_errors}"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned an unexpected response shape — try a different model",- ),- provider_metadata=None,- )-- for image in images:- base64_str = image.get("b64_json")- if not isinstance(base64_str, str):- msg = f"No base64 image data received from model '{self.inference_model.name}'"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.CONTENT,- user_action=UserAction(- kind=UserActionKind.CHANGE_INPUT,- detail="The Gateway returned no image data — try rephrasing the prompt or using a different model",- ),- provider_metadata=None,- )- generated_images.append(- GeneratedImageRawDetails(- base64_str=base64_str,- size=ImageSize(width=width, height=height),- image_format=image_format,- ),- )-- elif response_dict.get("status") in {"IN_QUEUE", "IN_PROGRESS"}:- # Handle FAL queue responses that require polling- fal_poller = FalPoller()- response_dict = await fal_poller.poll_queue_until_complete(response_dict=response_dict)-- for image in response_dict.get("images", []):- url = image.get("url")- if not isinstance(url, str):- msg = "Missing url field in image response"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned an image without a url — try a different model",- ),- provider_metadata=None,- )- fal_width = image.get("width")- if not isinstance(fal_width, int):- msg = "Missing width field in image response"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned an image without a width — try a different model",- ),- provider_metadata=None,- )- fal_height = image.get("height")- if not isinstance(fal_height, int):- msg = "Missing height field in image response"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned an image without a height — try a different model",- ),- provider_metadata=None,- )- content_type = image.get("content_type")- if not isinstance(content_type, str):- msg = "Missing content_type field in image response"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned an image without a content type — try a different model",- ),- provider_metadata=None,- )- generated_image = GeneratedImageRawDetails(- actual_url_or_prefixed_base64=url,- size=ImageSize(width=fal_width, height=fal_height),- mime_type=content_type,- )- generated_images.append(generated_image)- else:- msg = f"Unexpected response from model '{self.inference_model.name}' has no 'data' or 'images' key"- raise ImgGenGenerationError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned an unexpected response shape — try a different model",- ),- provider_metadata=None,- )-- return generated_imagesdiff --git a/pipelex/providers/gateway/gateway_plugin.py b/pipelex/providers/gateway/gateway_plugin.pydeleted file mode 100644index 20d7e52a5..000000000--- a/pipelex/providers/gateway/gateway_plugin.py+++ /dev/null@@ -1,162 +0,0 @@-from pipelex.cogt.inference.inference_worker_abstract import InferenceWorkerAbstract-from pipelex.cogt.model_backends.backend import InferenceBackend-from pipelex.cogt.model_backends.model_spec import InferenceModelSpec-from pipelex.plugins.contract import PLUGIN_API_VERSION-from pipelex.plugins.inference_backend_registry import InferenceFamily-from pipelex.plugins.model_handle import ModelHandle-from pipelex.plugins.registrar import PluginRegistrar-from pipelex.plugins.sdk_client_registry import SdkClientRegistry-from pipelex.reporting.reporting_protocol import ReportingProtocol---def _make_gateway_completions_worker(- *,- inference_model: InferenceModelSpec,- backend: InferenceBackend,- sdk_clients: SdkClientRegistry,- reporting_delegate: ReportingProtocol | None,-) -> InferenceWorkerAbstract:- from pipelex.providers.gateway.gateway_completions_factory import GatewayCompletionsFactory # ruff: ignore[import-outside-top-level]- from pipelex.providers.openai.openai_completions_llm_worker import OpenAICompletionsLLMWorker # ruff: ignore[import-outside-top-level]-- model_handle = ModelHandle.make_for_inference_model(inference_model=inference_model)- sdk_instance = sdk_clients.get_or_create(- handle=model_handle,- build=lambda: GatewayCompletionsFactory.make_portkey_openai_client_for_completions(model_handle=model_handle, backend=backend),- )- return OpenAICompletionsLLMWorker(- openai_completions_factory=GatewayCompletionsFactory(is_http_url_enabled=False),- sdk_instance=sdk_instance,- inference_model=inference_model,- reporting_delegate=reporting_delegate,- )---def _make_gateway_responses_worker(- *,- inference_model: InferenceModelSpec,- backend: InferenceBackend,- sdk_clients: SdkClientRegistry,- reporting_delegate: ReportingProtocol | None,-) -> InferenceWorkerAbstract:- from pipelex.providers.gateway.gateway_responses_factory import GatewayResponsesFactory # ruff: ignore[import-outside-top-level]- from pipelex.providers.openai.openai_responses_llm_worker import OpenAIResponsesLLMWorker # ruff: ignore[import-outside-top-level]-- model_handle = ModelHandle.make_for_inference_model(inference_model=inference_model)- sdk_instance = sdk_clients.get_or_create(- handle=model_handle,- build=lambda: GatewayResponsesFactory.make_portkey_openai_client_for_responses(model_handle=model_handle, backend=backend),- )- return OpenAIResponsesLLMWorker(- openai_responses_factory=GatewayResponsesFactory(is_http_url_enabled=False),- sdk_instance=sdk_instance,- inference_model=inference_model,- reporting_delegate=reporting_delegate,- )---def _make_gateway_img_gen_worker(- *,- inference_model: InferenceModelSpec,- backend: InferenceBackend,- sdk_clients: SdkClientRegistry,- reporting_delegate: ReportingProtocol | None,-) -> InferenceWorkerAbstract:- from pipelex.providers.gateway.gateway_factory import GatewayFactory # ruff: ignore[import-outside-top-level]- from pipelex.providers.gateway.gateway_img_gen_worker import GatewayImgGenWorker # ruff: ignore[import-outside-top-level]-- model_handle = ModelHandle.make_for_inference_model(inference_model=inference_model)- sdk_instance = sdk_clients.get_or_create(- handle=model_handle,- build=lambda: GatewayFactory.make_portkey_client(backend=backend),- )- return GatewayImgGenWorker(- sdk_instance=sdk_instance,- inference_model=inference_model,- reporting_delegate=reporting_delegate,- )---def _make_gateway_completions_img_gen_worker(- *,- inference_model: InferenceModelSpec,- backend: InferenceBackend,- sdk_clients: SdkClientRegistry,- reporting_delegate: ReportingProtocol | None,-) -> InferenceWorkerAbstract:- from pipelex.providers.gateway.gateway_completions_factory import GatewayCompletionsFactory # ruff: ignore[import-outside-top-level]- from pipelex.providers.openai.openai_completions_img_gen_worker import OpenAICompletionsImgGenWorker # ruff: ignore[import-outside-top-level]-- model_handle = ModelHandle.make_for_inference_model(inference_model=inference_model)- sdk_instance = sdk_clients.get_or_create(- handle=model_handle,- build=lambda: GatewayCompletionsFactory.make_portkey_openai_client_for_completions(model_handle=model_handle, backend=backend),- )- return OpenAICompletionsImgGenWorker(- openai_completions_factory=GatewayCompletionsFactory(is_http_url_enabled=False),- sdk_instance=sdk_instance,- inference_model=inference_model,- reporting_delegate=reporting_delegate,- )---def _make_gateway_extract_worker(- *,- inference_model: InferenceModelSpec,- backend: InferenceBackend,- sdk_clients: SdkClientRegistry,- reporting_delegate: ReportingProtocol | None,-) -> InferenceWorkerAbstract:- from pipelex.providers.gateway.gateway_extract_worker import GatewayExtractWorker # ruff: ignore[import-outside-top-level]- from pipelex.providers.gateway.gateway_factory import GatewayFactory # ruff: ignore[import-outside-top-level]-- model_handle = ModelHandle.make_for_inference_model(inference_model=inference_model)- sdk_instance = sdk_clients.get_or_create(- handle=model_handle,- build=lambda: GatewayFactory.make_portkey_client(backend=backend),- )- return GatewayExtractWorker(- sdk_instance=sdk_instance,- extra_config=backend.extra_config,- inference_model=inference_model,- reporting_delegate=reporting_delegate,- )---def _make_gateway_search_worker(- *,- inference_model: InferenceModelSpec,- backend: InferenceBackend,- sdk_clients: SdkClientRegistry,- reporting_delegate: ReportingProtocol | None,-) -> InferenceWorkerAbstract:- from pipelex.providers.gateway.gateway_factory import GatewayFactory # ruff: ignore[import-outside-top-level]- from pipelex.providers.gateway.gateway_search_worker import GatewaySearchWorker # ruff: ignore[import-outside-top-level]-- model_handle = ModelHandle.make_for_inference_model(inference_model=inference_model)- sdk_instance = sdk_clients.get_or_create(- handle=model_handle,- build=lambda: GatewayFactory.make_portkey_client(backend=backend),- )- return GatewaySearchWorker(- sdk_instance=sdk_instance,- inference_model=inference_model,- reporting_delegate=reporting_delegate,- )---class GatewayPlugin:- """Built-in driver for the Pipelex Gateway (OpenAI-compatible substrate), serving all inference families."""-- name = "gateway"- targets_api = PLUGIN_API_VERSION-- def register(self, registrar: PluginRegistrar) -> None:- registrar.add_inference_backend(family=InferenceFamily.LLM, sdk="gateway_completions", make_worker=_make_gateway_completions_worker)- registrar.add_inference_backend(family=InferenceFamily.LLM, sdk="gateway_responses", make_worker=_make_gateway_responses_worker)- registrar.add_inference_backend(family=InferenceFamily.IMG_GEN, sdk="gateway_img_gen", make_worker=_make_gateway_img_gen_worker)- registrar.add_inference_backend(- family=InferenceFamily.IMG_GEN, sdk="gateway_completions", make_worker=_make_gateway_completions_img_gen_worker- )- registrar.add_inference_backend(family=InferenceFamily.EXTRACT, sdk="gateway_extract", make_worker=_make_gateway_extract_worker)- registrar.add_inference_backend(family=InferenceFamily.SEARCH, sdk="gateway_search", make_worker=_make_gateway_search_worker)diff --git a/pipelex/providers/gateway/gateway_protocols.py b/pipelex/providers/gateway/gateway_protocols.pydeleted file mode 100644index c4aa9ff5c..000000000--- a/pipelex/providers/gateway/gateway_protocols.py+++ /dev/null@@ -1,25 +0,0 @@-from __future__ import annotations--from enum import StrEnum---class GatewayExtractProtocol(StrEnum):- MISTRAL_DOC_AI = "mistral-doc-ai"- AZURE_DOC_INTEL = "azure-doc-intel"- DEEPSEEK_OCR = "deepseek-ocr"- LINKUP_FETCH = "linkup-fetch"-- @classmethod- def make_from_model_handle(cls, model_handle: str) -> GatewayExtractProtocol:- match model_handle:- case "mistral-document-ai-2505":- return cls.MISTRAL_DOC_AI- case "azure-document-intelligence":- return cls.AZURE_DOC_INTEL- case "deepseek-ocr":- return cls.DEEPSEEK_OCR- case "linkup-fetch":- return cls.LINKUP_FETCH- case _:- msg = f"Invalid model ID: {model_handle}"- raise ValueError(msg)diff --git a/pipelex/providers/gateway/gateway_responses_factory.py b/pipelex/providers/gateway/gateway_responses_factory.pydeleted file mode 100644index 89d3e59a0..000000000--- a/pipelex/providers/gateway/gateway_responses_factory.py+++ /dev/null@@ -1,58 +0,0 @@-from __future__ import annotations--from typing import TYPE_CHECKING, Any--import openai-from portkey_ai import (- createHeaders, # type: ignore[reportUnknownVariableType]-)-from typing_extensions import override--from pipelex.config import get_config-from pipelex.providers.gateway.gateway_constants import GatewayOpenAISdkVariant-from pipelex.providers.gateway.gateway_exceptions import GatewayFactoryError-from pipelex.providers.gateway.gateway_factory import GatewayFactory-from pipelex.providers.openai.openai_responses_factory import OpenAIResponsesFactory--if TYPE_CHECKING:- from pipelex.cogt.inference.inference_job_abstract import InferenceJobAbstract- from pipelex.cogt.model_backends.backend import InferenceBackend- from pipelex.cogt.model_backends.model_spec import InferenceModelSpec- from pipelex.plugins.model_handle import ModelHandle---class GatewayResponsesFactory(OpenAIResponsesFactory):- @classmethod- def make_portkey_openai_client_for_responses(- cls,- model_handle: ModelHandle,- *,- backend: InferenceBackend,- ) -> openai.AsyncOpenAI:- is_debug_enabled = GatewayFactory.is_debug_enabled(backend=backend)- endpoint = GatewayFactory.get_endpoint(backend=backend)- api_key = GatewayFactory.get_api_key(backend=backend)- if not GatewayOpenAISdkVariant.is_responses(model_handle.sdk):- msg = f"ModelHandle '{model_handle}' is not supported by '{cls.__name__}'"- raise GatewayFactoryError(msg)-- return openai.AsyncOpenAI(- base_url=endpoint,- # Auth is handled via Portkey headers (x-portkey-api-key, x-portkey-config),- # not the OpenAI Authorization header. The SDK rejects an empty api_key since- # 2.34.0, so we pass a non-empty placeholder; the gateway ignores it.- api_key="unused-auth-via-portkey-headers",- # Tier 1 transport retry: set explicitly from config rather than inheriting the SDK default,- # so a transport_max_retries override applies to the gateway LLM path too (matches PortkeyResponsesFactory).- max_retries=get_config().inference.transport_max_retries,- default_headers=createHeaders(- api_key=api_key,- debug=is_debug_enabled,- ), # type: ignore[call-overload]- )-- @override- def make_extras(- self, inference_model: InferenceModelSpec, *, inference_job: InferenceJobAbstract, output_desc: str- ) -> tuple[dict[str, str], dict[str, Any]]:- return GatewayFactory.make_extras(inference_model=inference_model, inference_job=inference_job, output_desc=output_desc)diff --git a/pipelex/providers/gateway/gateway_schemas.py b/pipelex/providers/gateway/gateway_schemas.pydeleted file mode 100644index 0c553f70a..000000000--- a/pipelex/providers/gateway/gateway_schemas.py+++ /dev/null@@ -1,87 +0,0 @@-from typing import Any--from pydantic import BaseModel, ConfigDict, Field--from pipelex.cogt.extract.bounding_box import BoundingBox---class GatewayExtractRequestParams(BaseModel):- should_include_images: bool---class GatewayExtractImageAzure(BaseModel):- """An extracted image with its base64 content and bounding box."""-- base64_str: str = Field(description="Base64-encoded image content")- mime_type: str = Field(description="MIME type of the image")- bounding_box: BoundingBox | None = Field(description="Bounding box coordinates of the image in the page", default=None)- caption: str | None = Field(description="Caption text associated with the image", default=None)---class GatewayExtractPageAzure(BaseModel):- """Result for a single page extracted by Azure Doc Intel."""-- index: int = Field(description="The index of the page")- markdown: str = Field(description="The markdown content of the page")- images: list[GatewayExtractImageAzure] = Field(description="The images on the page")---class ImageDimensions(BaseModel):- """Image dimensions and file size."""-- width: int = Field(description="Image width in pixels")- height: int = Field(description="Image height in pixels")- bytes: int = Field(description="Image file size in bytes")---class ImageInfo(BaseModel):- """Information about the processed image."""-- original: ImageDimensions = Field(description="Original image dimensions before processing")- processed: ImageDimensions = Field(description="Processed image dimensions (after scaling if applied)")- scaled_down: bool = Field(description="Whether the image was scaled down to fit limits")---class GatewayExtractPageDeepseek(BaseModel):- """Result for a single page extracted by DeepSeek-OCR."""-- index: int = Field(description="The index of the page (0-based)")- markdown: str = Field(description="The markdown content of the page")- source_image_info: ImageInfo | None = Field(default=None, description="Information about the source image for this page")---class GatewayExtractImageMistral(BaseModel):- """An extracted image with its base64 content and bounding box."""-- id: str | None = Field(description="The ID of the image", default=None)- top_left_x: int | None = Field(description="The X coordinate of the top left corner of the image", default=None)- top_left_y: int | None = Field(description="The Y coordinate of the top left corner of the image", default=None)- bottom_right_x: int | None = Field(description="The X coordinate of the bottom right corner of the image", default=None)- bottom_right_y: int | None = Field(description="The Y coordinate of the bottom right corner of the image", default=None)- image_base64: str | None = Field(description="Base64-encoded image content", default=None)- image_annotation: str | None = Field(description="Annotation text associated with the image", default=None)---class GatewayExtractPageMistral(BaseModel):- """Result for a single page extracted by Mistral Doc AI."""-- index: int = Field(description="The index of the page")- markdown: str = Field(description="The markdown content of the page")- images: list[GatewayExtractImageMistral] = Field(description="The images on the page")---class GatewayImgGenAzureGptImage(BaseModel):- """Result for a single image generated by Azure GPT Image."""-- model_config = ConfigDict(extra="ignore")-- size: str = Field(description="Size of the image")- output_format: str = Field(description="Output format of the image")---class GatewayImgGenAzureFlux2Pro(BaseModel):- """Result for a single image generated by Azure Flux 2 Pro."""-- model_config = ConfigDict(extra="ignore")-- request_meta: dict[str, Any] = Field(description="Request metadata", default_factory=dict)diff --git a/pipelex/providers/gateway/gateway_search_schemas.py b/pipelex/providers/gateway/gateway_search_schemas.pydeleted file mode 100644index 395f348a4..000000000--- a/pipelex/providers/gateway/gateway_search_schemas.py+++ /dev/null@@ -1,43 +0,0 @@-from pydantic import BaseModel, Field--from pipelex.cogt.search.search_depth import SearchDepth---class GatewaySearchRequestParams(BaseModel):- """Parameters for a web search request sent to the relay."""-- query: str = Field(description="The search query text")- depth: SearchDepth = Field(default=SearchDepth.STANDARD, strict=False, description="Search depth: 'standard' or 'deep'")- include_images: bool = Field(default=False, description="Whether to include images in results")- include_inline_citations: bool = Field(default=True, description="Whether to include inline citations")- max_results: int | None = Field(default=None, description="Maximum number of results to return")- include_domains: list[str] | None = Field(default=None, description="Restrict search to these domains")- exclude_domains: list[str] | None = Field(default=None, description="Exclude these domains from search")- from_date: str | None = Field(default=None, description="Start date filter (YYYY-MM-DD)")- to_date: str | None = Field(default=None, description="End date filter (YYYY-MM-DD)")- output_schema: dict[str, object] | None = Field(default=None, description="JSON Schema for structured search output")---class GatewayFetchRequestParams(BaseModel):- """Parameters for a web page fetch request sent to the relay."""-- url: str = Field(description="The URL to fetch")- include_raw_html: bool | None = Field(default=None, description="Whether to include raw HTML in response")- render_js: bool | None = Field(default=None, description="Whether to render JavaScript before fetching")- extract_images: bool | None = Field(default=None, description="Whether to extract images from the page")- timeout: float | None = Field(default=None, description="Request timeout in seconds")---class GatewayFetchImageResponse(BaseModel):- """An image extracted from a fetched page."""-- url: str = Field(description="URL of the image")- alt: str | None = Field(default=None, description="Alt text of the image")---class GatewayFetchResultResponse(BaseModel):- """Response from a web page fetch."""-- markdown: str | None = Field(default=None, description="Page content as markdown")- images: list[GatewayFetchImageResponse] | None = Field(default=None, description="Extracted images")- raw_html: str | None = Field(default=None, description="Raw HTML of the page")diff --git a/pipelex/providers/gateway/gateway_search_worker.py b/pipelex/providers/gateway/gateway_search_worker.pydeleted file mode 100644index f89ca53ce..000000000--- a/pipelex/providers/gateway/gateway_search_worker.py+++ /dev/null@@ -1,274 +0,0 @@-import json-from typing import Any, cast--from portkey_ai import AsyncPortkey-from portkey_ai.api_resources import exceptions as portkey_exceptions-from portkey_ai.api_resources.utils import GenericResponse-from typing_extensions import override--from pipelex import log-from pipelex.cogt.exceptions import InferenceErrorCategory, SdkTypeError-from pipelex.cogt.inference.error_classification import UserAction, UserActionKind, extract_gateway_metadata-from pipelex.cogt.inference.error_classify import classify_inference_error-from pipelex.cogt.inference.error_render import InferenceErrorFamily, render_inference_error-from pipelex.cogt.model_backends.model_spec import InferenceModelSpec-from pipelex.cogt.search.search_depth import SearchDepth-from pipelex.cogt.search.search_job import SearchJob-from pipelex.cogt.search.search_worker_abstract import SearchWorkerAbstract-from pipelex.cogt.search.structured_search_payload import extract_structured_search_payload-from pipelex.cogt.usage.token_category import NbTokensByCategoryDict, TokenCategory-from pipelex.core.stuffs.document_content import DocumentContent-from pipelex.core.stuffs.search_result_content import SearchResultContent-from pipelex.providers.gateway.gateway_deck import GatewayDeck-from pipelex.providers.gateway.gateway_exceptions import GatewaySearchEmptyResultError, GatewaySearchResponseError-from pipelex.providers.gateway.gateway_search_schemas import GatewaySearchRequestParams-from pipelex.reporting.reporting_protocol import ReportingProtocol-from pipelex.tools.typing.pydantic_utils import BaseModelTypeVar---class GatewaySearchWorker(SearchWorkerAbstract):- """Search worker that routes through Portkey to the relay's LinkUp endpoints."""-- def __init__(- self,- sdk_instance: Any,- inference_model: InferenceModelSpec,- reporting_delegate: ReportingProtocol | None = None,- ):- super().__init__(inference_model=inference_model, reporting_delegate=reporting_delegate)-- if not isinstance(sdk_instance, AsyncPortkey):- msg = f"Provided sdk_instance for {self.__class__.__name__} is not of type AsyncPortkey: it's a '{type(sdk_instance)}'"- raise SdkTypeError(msg)-- self.portkey_client: AsyncPortkey = sdk_instance-- @override- async def _search_sourced_answer(- self,- search_job: SearchJob,- ) -> SearchResultContent:- job_params = search_job.job_params- search_setting = job_params.search_setting-- params = GatewaySearchRequestParams(- query=search_job.query,- depth=SearchDepth(self.inference_model.model_id.rsplit("/", 1)[-1]),- include_images=search_setting.include_images,- include_inline_citations=search_setting.include_inline_citations,- max_results=search_setting.max_results,- include_domains=job_params.include_domains,- exclude_domains=job_params.exclude_domains,- from_date=job_params.from_date,- to_date=job_params.to_date,- )-- response = await self._call_relay(- model=self.inference_model.model_id,- content=params.model_dump_json(),- )-- self._extract_usage(response=response, search_job=search_job)-- content_str = self._extract_content(response)- relay_result = self._decode_relay_json(content_str=content_str)- if not isinstance(relay_result, dict):- msg = f"Gateway sourced-answer search returned a non-object payload of type '{type(relay_result).__name__}'"- raise GatewaySearchResponseError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned a malformed search response — try a different model",- ),- provider_metadata=None,- )- result_dict = cast("dict[str, Any]", relay_result)-- sources = [- DocumentContent(- title=source["name"],- url=source["url"],- public_url=source["url"],- snippet=source["snippet"],- mime_type="text/html",- )- for source in result_dict.get("sources", [])- ]-- return SearchResultContent(- answer=result_dict["answer"],- sources=sources,- )-- @override- async def _search_structured(- self,- search_job: SearchJob,- *,- schema: type[BaseModelTypeVar],- ) -> dict[str, Any]:- job_params = search_job.job_params- search_setting = job_params.search_setting-- # Convert Pydantic model class to JSON Schema dict for the relay- schema_dict: dict[str, Any] = schema.model_json_schema()-- params = GatewaySearchRequestParams(- query=search_job.query,- depth=SearchDepth(self.inference_model.model_id.rsplit("/", 1)[-1]),- include_images=search_setting.include_images,- include_inline_citations=search_setting.include_inline_citations,- max_results=search_setting.max_results,- include_domains=job_params.include_domains,- exclude_domains=job_params.exclude_domains,- from_date=job_params.from_date,- to_date=job_params.to_date,- output_schema=schema_dict,- )-- response = await self._call_relay(- model=self.inference_model.model_id,- content=params.model_dump_json(),- )-- self._extract_usage(response=response, search_job=search_job)-- content_str = self._extract_content(response)- relay_result = self._decode_relay_json(content_str=content_str)- # The relay asks Linkup for sources alongside the structured payload, so its wire shape is a- # {data, sources} envelope — but the contract of a structured search is the payload alone: it is- # validated against the caller's output structure class, which has nowhere to put sources.- # The envelope is recognised *structurally* rather than demanded: the day the relay stops asking- # for sources, this worker keeps working on the bare payload it then returns, so the two repos do- # not have to deploy in lockstep. Demanding it would make that a coordinated two-sided change.- payload = extract_structured_search_payload(response=relay_result, schema=schema)- if payload is not None:- return payload- if isinstance(relay_result, dict):- # The response was an object but carried no structured payload: the search ran and found- # nothing to fill the output structure with. That is the query's fault, not the model's.- msg = "Gateway structured search returned an empty structured result"- raise GatewaySearchEmptyResultError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_INPUT,- detail="The search found nothing to fill your output structure — try a broader query or a wider date range",- ),- provider_metadata=None,- )- msg = f"Gateway structured search returned a non-object payload of type '{type(relay_result).__name__}'"- raise GatewaySearchResponseError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned a malformed structured search response — try a different model",- ),- provider_metadata=None,- )-- def _decode_relay_json(self, *, content_str: str) -> Any:- """Parse the relay's JSON content, classifying a malformed body instead of letting it escape raw.-- A relay answering with something that is not JSON is the likeliest way its contract breaks, and a- bare ``JSONDecodeError`` is neither a ``CogtError`` nor annotated with the model — so it would slip- past exactly the classification the rest of this path exists to provide.- """- try:- return json.loads(content_str)- except json.JSONDecodeError as exc:- msg = "Gateway search response body is not valid JSON"- raise GatewaySearchResponseError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned a malformed search response — try a different model",- ),- provider_metadata=None,- ) from exc-- def _extract_usage(self, response: GenericResponse, *, search_job: SearchJob) -> None:- """Extract token usage from the GenericResponse and populate the search job report."""- response_dict: dict[str, Any] = response.model_dump(serialize_as_any=True)- search_tokens_usage = search_job.job_report.search_tokens_usage- if (usage_dict := response_dict.get("usage")) and search_tokens_usage:- nb_tokens: NbTokensByCategoryDict = {}- if input_tokens := usage_dict.get("prompt_tokens") or usage_dict.get("input_tokens"):- nb_tokens[TokenCategory.INPUT] = input_tokens- if output_tokens := usage_dict.get("completion_tokens") or usage_dict.get("output_tokens"):- nb_tokens[TokenCategory.OUTPUT] = output_tokens- search_tokens_usage.nb_tokens_by_category = nb_tokens-- async def _call_relay(self, *, model: str, content: str) -> GenericResponse:- """Send a request through Portkey to the relay.-- Args:- model: The relay model identifier (e.g., "linkup-sourced-answer")- content: JSON-encoded request parameters-- Returns:- The Portkey GenericResponse- """- config_id = GatewayDeck.get_config_id(headers=self.inference_model.extra_headers or {})- log.dev(f"Search via gateway config '{config_id}' with model '{model}'")-- messages: list[dict[str, str]] = [{"role": "user", "content": content}]-- try:- response = await self.portkey_client.with_options(config=config_id).post( # pyright: ignore[reportUnknownMemberType, reportUnknownVariableType]- "/chat/completions",- model=model,- messages=messages,- )- except portkey_exceptions.APIError as sdk_exc:- metadata = extract_gateway_metadata(sdk_exc)- classification = classify_inference_error(metadata)- raise render_inference_error(- metadata=metadata,- classification=classification,- family=InferenceErrorFamily.SEARCH,- model_desc=self.inference_model.desc,- model_handle=self.inference_model.name,- ) from sdk_exc-- if not isinstance(response, GenericResponse):- msg = "Response is not of type GenericResponse"- raise TypeError(msg)-- return response-- def _extract_content(self, response: GenericResponse) -> str:- """Extract the content string from a GenericResponse.-- GenericResponse uses Pydantic's extra="allow", so `choices` is a raw- list[dict] rather than a list of typed objects — use dict access.- """- try:- choice: dict[str, Any] = response.choices[0] # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue, reportUnknownMemberType]- content = cast("object", choice["message"]["content"])- if not isinstance(content, str):- msg = f"Expected string content in response, got {type(content)}"- raise GatewaySearchResponseError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned a malformed search response — try a different model",- ),- provider_metadata=None,- )- return content- except (KeyError, IndexError, TypeError) as exc:- msg = "Could not extract content from gateway search response"- raise GatewaySearchResponseError(- msg,- error_category=InferenceErrorCategory.UNKNOWN,- user_action=UserAction(- kind=UserActionKind.CHANGE_MODEL,- detail="The Gateway returned a malformed search response — try a different model",- ),- provider_metadata=None,- ) from excdiff --git a/pipelex/providers/manifold/manifold_constants.py b/pipelex/providers/manifold/manifold_constants.pyindex 34d062bf2..a64b67061 100644--- a/pipelex/providers/manifold/manifold_constants.py+++ b/pipelex/providers/manifold/manifold_constants.py@@ -1,7 +1,7 @@"""The manifold dialect's names: its sdk set, its two wire headers, and its route paths.Everything the manifold plugin needs to name is named here rather than imported from-``providers/portkey/`` or ``providers/gateway/``. The duplication is deliberate — it is the+``providers/portkey/``. The duplication is deliberate — it is theno-intertwining rule from the two-gateways design, and it is what keeps the eventual retirement ofthe Portkey path a module deletion rather than an untangling."""diff --git a/pipelex/providers/manifold/manifold_factory.py b/pipelex/providers/manifold/manifold_factory.pyindex dd47bf905..6814a7d7e 100644--- a/pipelex/providers/manifold/manifold_factory.py+++ b/pipelex/providers/manifold/manifold_factory.py@@ -100,7 +100,7 @@ class ManifoldFactory:"""Read from the backend's own configuration and from nothing else.The Portkey-path sibling routes this through the telemetry manager's- `pipelex_gateway.portkey` knobs. Reusing those here would put one configuration block in+ Portkey-path telemetry knobs. Reusing those here would put one configuration block incharge of two services, which is the seam the two-gateways design exists to avoid."""return bool(backend.extra_config.get("debug", False))diff --git a/pipelex/providers/openai/openai_completions_img_gen_worker.py b/pipelex/providers/openai/openai_completions_img_gen_worker.pyindex 6a476fa15..333fdd382 100644--- a/pipelex/providers/openai/openai_completions_img_gen_worker.py+++ b/pipelex/providers/openai/openai_completions_img_gen_worker.py@@ -55,7 +55,7 @@ class OpenAICompletionsImgGenWorker(ImgGenWorkerAbstract):) -> GeneratedImageRawDetails:log.debug(f"Generating image with model: {self.inference_model.tag}")image_format: ImageFormat | None = None- # Both Pipelex-managed gateways, not just the Portkey-cloud one: the manifold service relays+ # Every Pipelex-managed gateway: the manifold service relays# the same models through the same gateway codebase, so it normalises a completions image# response the same way — a URL to a PNG, with no format to read off the bytes.if self.inference_model.backend_name in MANAGED_GATEWAY_BACKEND_NAMES:@@ -123,7 +123,7 @@ class OpenAICompletionsImgGenWorker(ImgGenWorkerAbstract):)base64_str, base64_extracted_mime_type = extractedelif (content := openai_message.content) and content.startswith("http"):- # OpenAI response message is a URL, this happens with blackboxai and pipelex_gateway which have a fixed output format.+ # OpenAI response message is a URL, this happens with blackboxai and the Pipelex-managed gateways which have a fixed output format.# Otherwise we won't know what format the image is in.if image_format is None:msg = (diff --git a/pipelex/runtime_boot.py b/pipelex/runtime_boot.pyindex 3319c2cf9..04d409db2 100644--- a/pipelex/runtime_boot.py+++ b/pipelex/runtime_boot.py@@ -64,7 +64,6 @@ from pipelex.cogt.exceptions import (RoutingProfileLibraryNotFoundError,)from pipelex.cogt.inference.inference_manager import InferenceManager-from pipelex.cogt.model_backends.backend import PipelexBackendfrom pipelex.cogt.model_backends.backend_credentials import (BackendCredentialsErrorMsgFactory,)@@ -97,16 +96,9 @@ from pipelex.system.configuration.config_loader import CONFIG_REFUSED, config_mafrom pipelex.system.configuration.config_root import ConfigRootfrom pipelex.system.configuration.config_surface import INFERENCE_BACKEND_CONFIG_SURFACE_ID, PIPELEX_CONFIG_SURFACE_IDfrom pipelex.system.configuration.configs import PipelexConfig-from pipelex.system.pipelex_service.exceptions import (- GatewayTermsNotAcceptedError,- InferenceSetupRequiredError,- RemoteConfigStaleWarning,-)+from pipelex.system.pipelex_service.exceptions import RemoteConfigStaleWarningfrom pipelex.system.pipelex_service.managed_gateway_configs import build_managed_gateway_configs-from pipelex.system.pipelex_service.pipelex_service_config import (- enabled_managed_gateway_sections,- load_pipelex_service_config_if_exists,-)+from pipelex.system.pipelex_service.pipelex_service_config import enabled_managed_gateway_sectionsfrom pipelex.system.pipelex_service.remote_config_fetcher import RemoteConfigFetcherfrom pipelex.system.registries.class_registry_access import class_registry_scopingfrom pipelex.system.registries.func_registry import FuncRegistry, func_registry@@ -342,56 +334,6 @@ Note that this command resets all config files to their default values.If you need help, drop by our Discord: we're happy to assist: {URLs.discord}."""- @classmethod- def should_enable_pipelex_telemetry(- cls,- *,- integration_mode: IntegrationMode,- is_unit_testing: bool,- is_gateway_enabled: bool,- needs_inference: bool,- is_gateway_config_cached: bool,- ) -> bool:- """Decide whether this boot sends the Pipelex Gateway telemetry stream.-- The stream is disabled when:-- - the legacy gateway backend is not enabled, OR- - inference is not needed (no live runs to track), OR- - the gateway config came from the cache (stale specs imply potentially stale model- identities; phoning home about pipe runs in that state would pollute metrics), OR- - the runtime is booted by a test harness: its runs are not usage, and its fixture user ids must- not become persons in the production analytics project. Two signals say so, and either one is- enough. The integration mode (`CI` or `PYTEST`) is what a harness booting without our pytest- plugin states, such as the pipelex-js conformance scripts. The run mode is what the shared- pytest plugin sets for every session that loads it, which covers the suites that boot in the- default `PYTHON` mode, as the plugin's own recipe does.-- **The first condition asks about `pipelex_gateway` specifically, not about managed backends- in general**, and the distinct id is why: it is derived from `PIPELEX_GATEWAY_API_KEY`, which- a manifold backend neither has nor can stand in for — its own key is, for the private beta,- one token shared by every participant, so keying on it would produce a single indistinguishable- user rather than an identity. Asked the general way, a manifold-only installation would be- required to hold a gateway key it has no other use for and would fail to boot without one.- The common beta case is unaffected: a participant who keeps `pipelex_gateway` enabled has a- real gateway key, and their manifold runs are tracked under it like everything else.-- The per-mode `telemetry_allowed_modes` table does not take part: it governs only the- operator's custom stream, which the telemetry factory gates by itself.-- Args:- integration_mode: The mode the runtime is booted in.- is_unit_testing: Whether the run mode is a test mode, as `RuntimeManager.is_unit_testing` says.- is_gateway_enabled: Whether the `pipelex_gateway` backend is enabled.- needs_inference: Whether this boot runs live inference.- is_gateway_config_cached: Whether the gateway config came from the cache rather than a fresh fetch.-- Returns:- True when the Gateway telemetry stream should be sent.- """- is_test_harness = integration_mode.is_test_harness or is_unit_testing- return is_gateway_enabled and needs_inference and not is_gateway_config_cached and not is_test_harness-def setup(self,*,@@ -433,9 +375,7 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.# --- Pipelex Service and Telemetry --------------------------------------------------# Which Pipelex-managed gateway backends are enabled, and which section of the published- # artifact each takes its model specs from. More than one can be live at once — the Portkey- # cloud service and the manifold one are two services, sharing this one artifact, this one- # fetch and its one cache, and nothing else.+ # artifact each takes its model specs from.try:managed_gateway_sections = enabled_managed_gateway_sections()except BACKEND_LIBRARY_REFUSED as backends_document_exc:@@ -465,32 +405,11 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.# ``pipelex-agent models`` without ``--backend``.log.verbose("Using dummy remote config (inference not needed)")else:- # Terms acceptance is only required for actual inference usage, not for- # read-only operations like fetching model specs for validation.- # Also skip for CI mode — automated pipelines don't require human consent.- #- # **One gate, for any managed gateway backend.** The terms are the Pipelex service's- # terms, not one dialect's: a boot that reaches the service at all passes through- # here, whichever managed backend asked for it.- if needs_inference and integration_mode.requires_terms_acceptance:- pipelex_service_config = load_pipelex_service_config_if_exists(config_dir=config_manager.global_config_dir)- # First-run check: fires if inference has never been configured- # AND terms were never accepted (terms_accepted=true means existing- # user who already completed gateway setup before this flag existed).- if pipelex_service_config is None or (- not pipelex_service_config.onboarding.inference_setup_completed and not pipelex_service_config.agreement.terms_accepted- ):- raise InferenceSetupRequiredError- # Gateway terms check: this block only runs when gateway is- # enabled (is_pipelex_service_enabled guard above). BYOK users- # who disabled gateway via init skip this entire block.- if not pipelex_service_config.agreement.terms_accepted:- raise GatewayTermsNotAcceptedError# Fetch remote configuration (may fall back to on-disk cache when offline).remote_config_result = RemoteConfigFetcher.fetch_remote_config()remote_config = remote_config_result.configgateway_config_source = remote_config_result.source- log.verbose(f"Successfully fetched Pipelex Gateway remote configuration (source={gateway_config_source})")+ log.verbose(f"Successfully fetched the Pipelex remote configuration (source={gateway_config_source})")managed_gateway_configs = build_managed_gateway_configs(remote_config=remote_config,managed_gateway_sections=managed_gateway_sections,@@ -502,7 +421,7 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.if gateway_config_source.is_cached:cached_at_iso = remote_config_result.cached_at.isoformat() if remote_config_result.cached_at else "unknown"warnings.warn(- f"Pipelex Gateway is running off a cached remote config (snapshot: {cached_at_iso}). "+ f"The Pipelex-managed gateway backends are running off a cached remote config (snapshot: {cached_at_iso}). ""Run `pipelex init` while online to refresh.",RemoteConfigStaleWarning,stacklevel=2,@@ -511,11 +430,11 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.# --- Plugin discovery -----------------------------------------------------------------# Build the plugin registrar from the fully-resolved config (pure and import-light:# registering the built-ins imports no backend SDK, constructs no client, touches no hub).- # Built here — after the gateway service/terms precondition gate above (so an unaccepted-terms or- # first-run boot fails fast before any discovery work) and before the secrets provider and the log- # sink below, the first two capabilities resolved out of it: the built-in SecretsPlugin's factory- # (and any external pipelex-secrets-<backend>) is looked up from the registrar-derived- # SecretsProviderRegistry, then the sink from the LogSinkRegistry. The other registries+ # Built here — after the managed-gateway precondition gate above (so a first-run boot fails fast+ # before any discovery work) and before the secrets provider and the log sink below, the first two+ # capabilities resolved out of it: the built-in SecretsPlugin's factory (and any external+ # pipelex-secrets-<backend>) is looked up from the registrar-derived SecretsProviderRegistry, then+ # the sink from the LogSinkRegistry. The other registries# (inference, storage, …) are still built later at their own hub-set points, all referencing this# same already-built registrar; the slot-claim thunks / teardown callbacks it also accumulates are# applied at their ordered apply-points in later phases.@@ -580,27 +499,11 @@ If you need help, drop by our Discord: we're happy to assist: {URLs.discord}.if log_config.pretty_print_mode is PrettyPrintMode.RICH:require_rich_for_rendering()- # Whether the Pipelex Gateway telemetry stream is sent: the conditions, and why each one is- # there, are in `should_enable_pipelex_telemetry`.- #- # The gateway's enablement is read off the mapping computed above rather than by asking the- # document a second time. The two answers are the same one — the gateway resolves to a section- # whenever it is enabled — and a second read would be a second chance for an unparseable file- # to escape the clause that frames it as a backend-library refusal.- gateway_source_is_cached = gateway_config_source is not None and gateway_config_source.is_cached- is_gateway_enabled = PipelexBackend.GATEWAY in managed_gateway_sections- is_pipelex_telemetry_enabled = self.should_enable_pipelex_telemetry(- integration_mode=integration_mode,- is_unit_testing=runtime_manager.is_unit_testing,- is_gateway_enabled=is_gateway_enabled,- needs_inference=needs_inference,- is_gateway_config_cached=gateway_source_is_cached,- )+ # The only telemetry stream is the user's own opt-in one (`telemetry.toml`); nothing in the+ # runtime reports to Pipelex.self.telemetry_manager = TelemetryFactory.make_telemetry_manager(secrets_provider=secrets_provider,integration_mode=integration_mode,- remote_config=remote_config,- is_pipelex_telemetry_enabled=is_pipelex_telemetry_enabled,telemetry_config=telemetry_config,injected_telemetry_manager=telemetry_manager,)diff --git a/pipelex/system/pipelex_service/exceptions.py b/pipelex/system/pipelex_service/exceptions.pyindex 68f763c09..8b4ebb24f 100644--- a/pipelex/system/pipelex_service/exceptions.py+++ b/pipelex/system/pipelex_service/exceptions.py@@ -17,12 +17,11 @@ class PipelexServiceError(PipelexError):class RemoteConfigFetchError(PipelexServiceError):- """Raised when fetching remote configuration from PostHog fails.+ """Raised when fetching the Pipelex remote configuration fails.This error occurs when:- - Network request to PostHog fails- - Feature flag is not found or disabled- - Payload is missing or malformed+ - The network request fails+ - The server answers with an error status"""@@ -31,7 +30,6 @@ class RemoteConfigValidationError(PipelexServiceError):This error occurs when:- JSON payload is not valid- - Required keys are missing- Payload structure doesn't match expected schema"""@@ -39,10 +37,10 @@ class RemoteConfigValidationError(PipelexServiceError):class RemoteConfigUnavailableError(PipelexServiceError):"""Raised when a fresh fetch failed AND no usable cached fallback exists.- This is the user-facing offline-mode error: the gateway is enabled but we have neither- a working network path nor a primed local cache to fall back on. The message names the- cache file path and the remediation (``pipelex init`` while online; or disabling the- gateway in ``backends.toml`` for permanent offline operation).+ This is the user-facing offline-mode error: a Pipelex-managed gateway backend is enabled but we+ have neither a working network path nor a primed local cache to fall back on. The message names+ the cache file path and the remediation (``pipelex init`` while online; or disabling the managed+ backend in ``backends.toml`` for permanent offline operation)."""@@ -55,112 +53,12 @@ class RemoteConfigStaleWarning(UserWarning):"""-class InferenceSetupRequiredError(PipelexServiceError):- """Raised when inference is requested but no inference setup has been completed.-- This is the first-run signal: the user has not yet configured any- inference backend (gateway or BYOK). The agent skill should catch this- error type and guide the user through the onboarding flow.- """-- def __init__(self) -> None:- msg = (- "Inference setup required.\n"- "This looks like your first time running a method with live inference.\n"- "You need to configure an inference backend before running.\n"- "Use /mthds-runner-setup for guided setup,\n"- "or run `pipelex-agent init` with appropriate backend configuration."- )- super().__init__(msg)---class GatewayTermsNotAcceptedError(PipelexServiceError):- """Raised when Pipelex Gateway is enabled but terms are not accepted.-- Users must accept the Pipelex Gateway terms of service before using- the gateway backend. This can be done via `pipelex init config` command.- """-- def __init__(self) -> None:- msg = (- "Pipelex Gateway is enabled but terms have not been accepted.\n"- "To use Pipelex Gateway, you must accept our terms of service.\n"- "Run `pipelex init config` to configure your backends and accept the terms.\n"- "Alternatively, disable pipelex_gateway in .pipelex/inference/backends.toml\n"- "and use your own API keys with direct provider backends.\n"- "For more information: https://docs.pipelex.com/gateway\n"- "Questions? Join our Discord: https://go.pipelex.com/discord"- )- super().__init__(msg)---class GatewayApiKeyMissingError(PipelexServiceError):- """Raised when Pipelex Gateway is enabled but the API key is not set.-- Users must set the PIPELEX_GATEWAY_API_KEY environment variable to use- the gateway backend.- """-- def __init__(self) -> None:- msg = (- "Pipelex Gateway is enabled but PIPELEX_GATEWAY_API_KEY is not set.\n"- "Please set the PIPELEX_GATEWAY_API_KEY environment variable.\n"- "You can get a key at: https://pipelex.com/gateway\n"- "Alternatively, disable pipelex_gateway in .pipelex/inference/backends.toml\n"- "and use your own API keys with direct provider backends.\n"- "For more information: https://docs.pipelex.com/gateway\n"- "Questions? Join our Discord: https://go.pipelex.com/discord"- )- super().__init__(msg)---class GatewayTelemetryManagerInjectedError(PipelexServiceError):- """Raised when a custom TelemetryManager is injected while using Pipelex Gateway.-- Pipelex Gateway requires its own telemetry setup for service monitoring.- Dependency-injecting a TelemetryManager is not allowed when gateway is enabled.- """-- def __init__(self) -> None:- msg = (- "Cannot inject a custom TelemetryManager when Pipelex Gateway is enabled.\n"- "Gateway requires its own telemetry setup for service monitoring.\n\n"- "You can still add your own telemetry via .pipelex/telemetry.toml:\n"- " - PostHog: set host and project_api_key\n"- " - Langfuse: set langfuse_enabled = true (requires env vars)\n"- " - Any OTLP backend: set otlp_endpoint and otlp_headers\n\n"- "These will work alongside Gateway telemetry.\n"- "Remove the telemetry_manager parameter from Pipelex.make() to proceed."- )- super().__init__(msg)---class GatewayDoNotTrackConflictError(PipelexServiceError):- """Raised when DO_NOT_TRACK is set but Pipelex Gateway requires telemetry.-- Pipelex Gateway requires telemetry for service monitoring, but this conflicts- with the user's explicit request to not be tracked.- """-- def __init__(self, dnt_env_var: str) -> None:- msg = (- f"Pipelex Gateway requires telemetry, but '{dnt_env_var}' is set.\n"- "We respect your Do Not Track preference.\n\n"- "To use Pipelex Gateway, unset the DO_NOT_TRACK environment variable.\n"- "Alternatively, disable pipelex_gateway in .pipelex/inference/backends.toml\n"- "and use your own API keys with direct provider backends.\n\n"- "For more information: https://docs.pipelex.com/gateway\n"- "Questions? Join our Discord: https://go.pipelex.com/discord"- )- super().__init__(msg)--class GatewayOverrideWarning(UserWarning):- """Warning issued when local gateway overrides are applied."""+ """Warning issued when local overrides are applied to a managed gateway's served model specs."""class GatewayConfigMergeError(PipelexServiceError):- """Raised when gateway configuration merge encounters invalid data.+ """Raised when merging a managed gateway's served model specs with local overrides meets invalid data.This error occurs when:- Local override for a model is not a dictionarydiff --git a/pipelex/system/pipelex_service/gateway_config_merger.py b/pipelex/system/pipelex_service/gateway_config_merger.pyindex b733305c3..1ed78497c 100644--- a/pipelex/system/pipelex_service/gateway_config_merger.py+++ b/pipelex/system/pipelex_service/gateway_config_merger.py@@ -11,7 +11,7 @@ ALLOWED_OVERRIDE_KEYS = frozenset({"sdk", "structure_method"})class GatewayConfigMerger:- """Merges remote gateway configuration with local overrides.+ """Merges a managed gateway's served model specs with the local overrides of its backend file.Only allows overriding specific keys (sdk, structure_method).Logs warnings when overrides are applied or when disallowed keys are found.@@ -27,8 +27,8 @@ class GatewayConfigMerger:"""Merge remote config with local overrides.Args:- gateway_model_specs: Model specs from Pipelex Gateway.- local_overrides: Local overrides from local pipelex_gateway.toml.+ gateway_model_specs: Model specs served for the managed gateway backend.+ local_overrides: Local overrides from the backend's own file (e.g. `pipelex_manifold.toml`).Returns:Merged configuration with allowed overrides applied.diff --git a/pipelex/system/pipelex_service/managed_gateway_configs.py b/pipelex/system/pipelex_service/managed_gateway_configs.pyindex 23aaa6bd8..c7f055996 100644--- a/pipelex/system/pipelex_service/managed_gateway_configs.py+++ b/pipelex/system/pipelex_service/managed_gateway_configs.py@@ -7,7 +7,6 @@ opinion on which backend reads which section."""from pipelex import log-from pipelex.cogt.model_backends.backend import LEGACY_GATEWAY_MODEL_SPECS_SECTIONfrom pipelex.cogt.model_backends.gateway_config import GatewayConfigfrom pipelex.system.pipelex_service.remote_config import RemoteConfig@@ -20,9 +19,9 @@ def build_managed_gateway_configs("""One gateway configuration per enabled managed backend, sliced out of the one fetched artifact.**One fetch, N configs, kept apart rather than merged.** The artifact is one document with one- version, so there is exactly one network call and one disk cache; but a handle that one service- serves and the other does not is a legitimate configuration and not a conflict to resolve, so the- sections never meet.+ version, so there is exactly one network call and one disk cache; but two managed services are+ two services, and a handle that one serves and another does not is a legitimate configuration+ rather than a conflict to resolve, so the sections never meet.A backend whose declared section is absent from the published artifact is **disabled with a namedwarning** rather than fatal — the same posture as a managed backend missing one of its `${…}`@@ -47,12 +46,5 @@ def build_managed_gateway_configs(f"Set `enabled = false` on it in your backends.toml to silence this warning.")continue- managed_gateway_configs[backend_name] = GatewayConfig(- model_specs=model_specs,- # `aws_region` is a top-level key of the artifact rather than a property of a section, and- # it belongs to the legacy gateway's slice alone: it is threaded into that backend's- # `extra_config`, and nothing on the manifold path reads it back because there the Bedrock- # credentials live gateway-side.- aws_region=remote_config.aws_region if section_name == LEGACY_GATEWAY_MODEL_SPECS_SECTION else None,- )+ managed_gateway_configs[backend_name] = GatewayConfig(model_specs=model_specs)return managed_gateway_configsdiff --git a/pipelex/system/pipelex_service/pipelex_details.py b/pipelex/system/pipelex_service/pipelex_details.pyindex 50f44524f..41e1a97d7 100644--- a/pipelex/system/pipelex_service/pipelex_details.py+++ b/pipelex/system/pipelex_service/pipelex_details.py@@ -1,14 +1,10 @@import os-from pipelex.tools.misc.hash_utils import hash_sha256-_DEFAULT_REMOTE_CONFIG_URL = "https://pipelex-config.s3.eu-west-3.amazonaws.com/pipelex_remote_config_13.json"REMOTE_CONFIG_URL_ENV_VAR = "PIPELEX_REMOTE_CONFIG_URL"class PipelexDetails:- PIPELEX_GATEWAY_API_KEY_VAR = "PIPELEX_GATEWAY_API_KEY"-@classmethoddef remote_config_url(cls) -> str:"""The URL to fetch the Pipelex remote config from.@@ -17,15 +13,3 @@ class PipelexDetails:(useful for testing/staging), otherwise falls back to the production URL."""return os.environ.get(REMOTE_CONFIG_URL_ENV_VAR) or _DEFAULT_REMOTE_CONFIG_URL-- @classmethod- def make_distinct_id(cls, gateway_api_key: str) -> str:- """Make a distinct_id for PostHog from the gateway API key.-- Args:- gateway_api_key: The raw Pipelex Gateway API key.-- Returns:- First 16 characters of SHA256 hex digest.- """- return hash_sha256(data=gateway_api_key, length=16)diff --git a/pipelex/system/pipelex_service/pipelex_service_config.py b/pipelex/system/pipelex_service/pipelex_service_config.pyindex 51b91f8b5..981303fb8 100644--- a/pipelex/system/pipelex_service/pipelex_service_config.py+++ b/pipelex/system/pipelex_service/pipelex_service_config.py@@ -5,7 +5,7 @@ from pydantic import Field, ValidationErrorfrom pipelex import logfrom pipelex.cogt.exceptions import InferenceBackendLibraryValidationError-from pipelex.cogt.model_backends.backend import PipelexBackend, resolve_model_specs_section+from pipelex.cogt.model_backends.backend import resolve_model_specs_sectionfrom pipelex.system.configuration.config_loader import config_managerfrom pipelex.system.configuration.config_model import ConfigModelfrom pipelex.system.configuration.config_surface import (@@ -15,9 +15,8 @@ from pipelex.system.configuration.config_surface import (strip_reserved_meta,)from pipelex.system.pipelex_service.exceptions import PipelexServiceConfigValidationError-from pipelex.system.pipelex_service.pipelex_service_agreement import (+from pipelex.system.pipelex_service.pipelex_service_onboarding import (PIPELEX_SERVICE_CONFIG_FILE_NAME,- PipelexServiceAgreement,PipelexServiceOnboarding,)from pipelex.tools.misc.exceptions import TomlError@@ -29,7 +28,6 @@ class PipelexServiceConfig(ConfigModel):# A default_factory, not a required field: this is the surface's defaults layer. Every# in-scope configuration surface must have one, because it is what makes an additive schema# change absorbable and therefore never a migration — see docs/migration-ledger.md.- agreement: PipelexServiceAgreement = Field(default_factory=PipelexServiceAgreement)onboarding: PipelexServiceOnboarding = Field(default_factory=PipelexServiceOnboarding)@@ -62,9 +60,9 @@ def _service_config_the_ledger_can_explain(*, config_path: Path) -> PipelexServi"""The same service configuration with the ledger replayed over the user's file, or `None`.Boot tolerance for the one surface with no tiers: a single file, so the "merge" the shared- helper performs is a merge of one. The ledger for this surface is empty today, which makes- this the branch that costs nothing until the first entry lands — exactly the point of wiring- every surface at once rather than only the one that currently needs it.+ helper performs is a merge of one. This is what lets a file written by an earlier release —+ one still carrying a table the schema has since dropped — boot with a warning rather than a+ refusal, once the ledger carries the entry that drops it."""replayed = replay_surface_files_in_memory(surface_id=PIPELEX_SERVICE_CONFIG_SURFACE_ID, paths=[config_path])if replayed is None:@@ -82,8 +80,8 @@ def _backends_document(*, config_dir: Path | None) -> dict[str, Any] | None:The same document the library loader reads: the base first, then every``backends_override.toml`` that exists, deep-merged in order — from- ``config_manager.backends_file_paths``. Both readers below go through here so neither can end- up branching on a narrower view of the configuration than the loader they feed.+ ``config_manager.backends_file_paths``. The reader below goes through here so it cannot end+ up branching on a narrower view of the configuration than the loader it feeds.Raises:InferenceBackendLibraryValidationError: a file in the document does not parse. The same@@ -105,21 +103,30 @@ def enabled_managed_gateway_sections(*, config_dir: Path | None = None) -> dict[A *managed gateway backend* is one whose model specs arrive from the Pipelex service's publishedartifact rather than from a local per-backend TOML, and naming a section is what declares it one- — see `resolve_model_specs_section`, which also explains why `pipelex_gateway` resolves to a- section it never declared. There can now be more than one, which is why the boot asks this- question rather than the single-name one below.+ — see `resolve_model_specs_section`.- Read here, off the raw document, for the same reason `is_pipelex_gateway_enabled` is: the boot- needs the answer *before* it can load the backend library, because what it fetches is the input- to that load. It applies the same truthiness reading of `enabled`, for the same reason.+ Read here, off the raw document, because the boot needs the answer *before* it can load the+ backend library: what it fetches is the input to that load.++ **It must read `enabled` exactly as the library loader does** — the raw value's truthiness, and+ enabled when the key is absent, over the same merged document — because the boot acts on the+ answer here: it fetches the managed backends' model specs only when this says one is enabled,+ then hands them to a loader that decides for itself which backends are enabled. Reading the+ literal `true` here while the loader read truthiness would leave `enabled = 1` in a state neither+ could name: no specs fetched, backend loaded — refused as *"model specs were not provided"* on a+ strict boot, silently dropped from the deck on a lenient one. An override the loader saw and this+ did not would be the same split.Args:config_dir: Read the document at that directory — its ``backends.toml`` and its own- ``backends_override.toml`` — exactly as below. ``None`` (default) reads the layered- document.+ ``backends_override.toml`` — as ``pipelex init`` targeting one ``.pipelex/`` and the+ doctor's ``--global`` do, so they never branch on a sibling configuration. ``None``+ (default) reads the layered document: the resolved base, then the global override, then+ the project override.Returns:- ``{backend_name: section_name}``, empty when no managed gateway backend is enabled.+ ``{backend_name: section_name}``, empty when no managed gateway backend is enabled — including+ when there is no base file.Raises:InferenceBackendLibraryValidationError: a file in the document does not parse — see@@ -144,55 +151,3 @@ def enabled_managed_gateway_sections(*, config_dir: Path | None = None) -> dict[if section is not None:sections[backend_name] = sectionreturn sections---def is_pipelex_gateway_enabled(*, config_dir: Path | None = None) -> bool:- """Check if pipelex_gateway is enabled in the backends configuration.-- Narrower than `enabled_managed_gateway_sections` on purpose, and still the right question for- the callers that ask it: the boot's telemetry decision and the test-session plugin are about- the Portkey-cloud service specifically, not about managed backends in general.-- Two callers that read like they belong here do not. Terms acceptance asks the broad question- because the terms are the Pipelex service's rather than one dialect's — see `_init_agreement`- and `customize_backends_config`. And `pipelex init`'s cache priming asks it because what it- caches is the single published configuration carrying every managed backend's section, so a- manifold-only installation has exactly as much to prime as a gateway one.-- This reads the backends document directly without loading the full backend library — the- same document the loader reads: the base ``backends.toml`` with every ``backends_override.toml``- merged over it, from ``config_manager.backends_file_paths``.-- **It must read `enabled` exactly as the library loader does** — the raw value's truthiness, and- enabled when the key is absent, over the same merged document — because the boot acts on the- answer here: it fetches the gateway's model specs only when this says enabled, then hands them- to a loader that decides for itself which backends are enabled. Reading the literal `true` here- while the loader read truthiness left `enabled = 1` in a state neither could name: no specs- fetched, backend loaded — refused as *"model specs were not provided"* on a strict boot, silently- dropped from the deck on a lenient one. An override the loader saw and this did not would be the- same split.-- Args:- config_dir: Read the document at that directory — its ``backends.toml`` and its own- ``backends_override.toml`` — as ``pipelex init`` targeting one ``.pipelex/`` and the- doctor's ``--global`` do, so they never branch on a sibling configuration. ``None``- (default) reads the layered document: the resolved base, then the global override, then- the project override.-- Returns:- True if pipelex_gateway is enabled, False otherwise — including when there is no base file.-- Raises:- InferenceBackendLibraryValidationError: a file in the document does not parse — see- `_backends_document`.- """- backends_toml = _backends_document(config_dir=config_dir)- if backends_toml is None:- return False-- gateway_config = backends_toml.get(PipelexBackend.GATEWAY)- if gateway_config is None or not isinstance(gateway_config, dict):- return False-- gateway_config_dict = cast("dict[str, Any]", gateway_config)- return bool(gateway_config_dict.get("enabled", True))diff --git a/pipelex/system/pipelex_service/pipelex_service_agreement.py b/pipelex/system/pipelex_service/pipelex_service_onboarding.pysimilarity index 59%rename from pipelex/system/pipelex_service/pipelex_service_agreement.pyrename to pipelex/system/pipelex_service/pipelex_service_onboarding.pyindex c6ed0429f..7584d7be6 100644--- a/pipelex/system/pipelex_service/pipelex_service_agreement.py+++ b/pipelex/system/pipelex_service/pipelex_service_onboarding.py@@ -12,44 +12,13 @@ from pipelex.tools.misc.toml_utils import load_toml_with_tomlkit, save_toml_to_pPIPELEX_SERVICE_CONFIG_FILE_NAME = "pipelex_service.toml"-class PipelexServiceAgreement(ConfigModel):- terms_accepted: bool = Field(- default=False,- description="Whether the user has accepted Pipelex terms of service",- )--class PipelexServiceOnboarding(ConfigModel):inference_setup_completed: bool = Field(default=False,- description="Whether the user has completed inference setup (gateway or BYOK)",+ description="Whether the user has completed inference setup",)-def update_service_terms_acceptance(*, accepted: bool, config_dir: Path | None = None) -> None:- """Update the service terms acceptance in pipelex_service.toml.-- Args:- accepted: Whether the user accepted the terms.- config_dir: Explicit config directory path. If None, uses config_manager.global_config_dir.- """- resolved_config_dir = config_dir or config_manager.global_config_dir- service_config_path = resolved_config_dir / PIPELEX_SERVICE_CONFIG_FILE_NAME-- if path_exists(service_config_path):- toml_doc = load_toml_with_tomlkit(service_config_path)- else:- # Load from the kit template- template_path = str(get_kit_configs_dir() / PIPELEX_SERVICE_CONFIG_FILE_NAME)- toml_doc = load_toml_with_tomlkit(template_path)-- # Update terms_accepted- toml_doc["agreement"]["terms_accepted"] = accepted # type: ignore[index]-- resolved_config_dir.mkdir(parents=True, exist_ok=True)- save_toml_to_path(toml_doc, path=service_config_path)--def update_inference_setup_completed(*, completed: bool, config_dir: Path | None = None) -> None:"""Update the inference setup completed flag in pipelex_service.toml.diff --git a/pipelex/system/pipelex_service/remote_config.py b/pipelex/system/pipelex_service/remote_config.pyindex c266a3f1c..f995867bf 100644--- a/pipelex/system/pipelex_service/remote_config.py+++ b/pipelex/system/pipelex_service/remote_config.py@@ -1,34 +1,22 @@from typing import cast-from pydantic import BaseModel, ConfigDict, Field+from pydantic import BaseModel, ConfigDictfrom pipelex.cogt.model_backends.model_spec_factory import BackendModelSpecs-class PipelexPosthogConfig(BaseModel):- model_config = ConfigDict(extra="allow")-- project_api_key: str = Field(description="Posthog project API key")- endpoint: str = Field(description="Posthog endpoint URL")- is_geoip_enabled: bool = Field(description="Enable GeoIP lookup")- is_debug_enabled: bool = Field(description="Enable PostHog debug mode")--class RemoteConfig(BaseModel):"""The single artifact the Pipelex service publishes, carrying one model-specs section per managed gateway.- `backend_model_specs` is the legacy gateway's section and stays a declared field. Every other- section — `manifold_model_specs` today — arrives through `extra="allow"`, which is what makes- adding one a non-breaking change for a client that predates it: an older runtime parses the- artifact and simply never asks for the new section.+ Every section — `manifold_model_specs` today — arrives through `extra="allow"`, which is what+ makes adding one a non-breaking change for a client that predates it: an older runtime parses the+ artifact and simply never asks for the new section. The same tolerance covers the keys the+ artifact still carries for other consumers (the hosted plane reads it too): the runtime declares+ no field of its own and reads only the sections its enabled managed backends name."""model_config = ConfigDict(extra="allow")- posthog: PipelexPosthogConfig = Field(description="Posthog configuration")- backend_model_specs: BackendModelSpecs = Field(description="Model specifications for Pipelex Gateway (model_name -> spec dict)")- aws_region: str = Field(description="AWS region")-def get_model_specs_section(self, section_name: str) -> BackendModelSpecs | None:"""The named model-specs section, or ``None`` when the artifact does not carry one.@@ -37,19 +25,15 @@ class RemoteConfig(BaseModel):real answer and not an error here: a backend declaring a section the published artifact doesnot carry is disabled with a named warning, the same posture as a missing variable.- **The lookup is confined to the artifact's own content** — its declared fields and the extra- sections it was published with — rather than being a bare ``getattr`` on the model. The name- arrives from `model_specs_section` in the user's own `backends.toml`, and a bare ``getattr``- would answer for pydantic's machinery too: ``model_config`` and ``model_fields`` are both- plain dicts on a v2 model, so either would pass the shape check below and be carried- onwards as if the service had published it. Confined this way, an unmeant name is simply a- section the artifact does not carry, and earns the named disabling warning it should.+ **The lookup is confined to the artifact's own content** — the sections it was published+ with — rather than being a bare ``getattr`` on the model. The name arrives from+ `model_specs_section` in the user's own `backends.toml`, and a bare ``getattr`` would answer+ for pydantic's machinery too: ``model_config`` and ``model_fields`` are both plain dicts on a+ v2 model, so either would pass the shape check below and be carried onwards as if the+ service had published it. Confined this way, an unmeant name is simply a section the+ artifact does not carry, and earns the named disabling warning it should."""- raw: object | None- if section_name in type(self).model_fields:- raw = getattr(self, section_name)- else:- raw = (self.__pydantic_extra__ or {}).get(section_name)+ raw: object | None = (self.__pydantic_extra__ or {}).get(section_name)if not isinstance(raw, dict):return Nonereturn cast("BackendModelSpecs", raw)diff --git a/pipelex/system/pipelex_service/remote_config_cache.py b/pipelex/system/pipelex_service/remote_config_cache.pyindex 0888a3173..93add9f73 100644--- a/pipelex/system/pipelex_service/remote_config_cache.py+++ b/pipelex/system/pipelex_service/remote_config_cache.py@@ -1,4 +1,4 @@-"""On-disk fallback cache for the Pipelex Gateway remote config.+"""On-disk fallback cache for the Pipelex remote config.The cache is a **last-resort** safety net for offline operation. It is never read for freshnessoptimisation. Layout::@@ -34,7 +34,7 @@ CACHE_FILE_NAME = "remote_config.json"class CachedRemoteConfig(BaseModel):- """A snapshot of the remote gateway config plus the metadata needed to validate it."""+ """A snapshot of the remote config plus the metadata needed to validate it."""model_config = ConfigDict(extra="forbid")diff --git a/pipelex/system/pipelex_service/remote_config_fetcher.py b/pipelex/system/pipelex_service/remote_config_fetcher.pyindex e7e3b487e..c06fef693 100644--- a/pipelex/system/pipelex_service/remote_config_fetcher.py+++ b/pipelex/system/pipelex_service/remote_config_fetcher.py@@ -1,4 +1,4 @@-"""Fetch the Pipelex Gateway remote config with retry, cache, and provenance tracking.+"""Fetch the Pipelex remote config with retry, cache, and provenance tracking.The fetcher is the single entry point used by ``Pipelex.setup`` and the dev/doctor CLIs.Its public method returns a :class:`RemoteConfigResult` carrying the parsed config plus the@@ -44,7 +44,7 @@ from pipelex.system.pipelex_service.exceptions import (RemoteConfigValidationError,)from pipelex.system.pipelex_service.pipelex_details import PipelexDetails-from pipelex.system.pipelex_service.remote_config import PipelexPosthogConfig, RemoteConfig+from pipelex.system.pipelex_service.remote_config import RemoteConfigfrom pipelex.system.pipelex_service.remote_config_cache import RemoteConfigCachefrom pipelex.system.pipelex_service.types import RemoteConfigSourcefrom pipelex.system.runtime import runtime_manager@@ -116,25 +116,15 @@ class RemoteConfigFetcher:def make_dummy_remote_config(cls) -> RemoteConfig:"""Create a default RemoteConfig for testing in offline environments.- **Every managed gateway's section is present and empty, not just the legacy one.** An absent- section means "this backend's specs were not published" and earns a disabling warning; on- this path that would be a warning about a backend nobody asked for, since the boots that- take this branch (``pipelex-agent models``, validation, dry runs) need no specs at all.+ **Every managed gateway's section is present and empty.** An absent section means "this+ backend's specs were not published" and earns a disabling warning; on this path that would+ be a warning about a backend nobody asked for, since the boots that take this branch+ (``pipelex-agent models``, validation, dry runs) need no specs at all.Returns:- A minimal RemoteConfig with analytics disabled and empty model specs.+ A minimal RemoteConfig with empty model specs."""- return RemoteConfig(- posthog=PipelexPosthogConfig(- project_api_key="",- endpoint="https://dummy-endpoint.pipelex.com",- is_geoip_enabled=False,- is_debug_enabled=False,- ),- backend_model_specs={},- aws_region="us-east-1",- **{MANIFOLD_MODEL_SPECS_SECTION: {}},- )+ return RemoteConfig(**{MANIFOLD_MODEL_SPECS_SECTION: {}})@classmethoddef _fetch_fresh(cls, url: str) -> tuple[dict[str, Any], RemoteConfig]:@@ -194,12 +184,12 @@ class RemoteConfigFetcher:else:location = f"and no usable local cache is available at {cache_path}"msg = (- f"Pipelex Gateway is enabled but the remote configuration is unreachable "+ f"A Pipelex-managed gateway backend is enabled but the remote configuration is unreachable "f"{location}.\n"f"Underlying error: {fetch_error}\n""Remediation:\n"" - Run `pipelex init` while online to prime the cache.\n"- " - Or disable pipelex_gateway in .pipelex/inference/backends.toml to operate "+ " - Or disable the Pipelex-managed gateway backends in .pipelex/inference/backends.toml to operate ""permanently offline with your own API keys (BYOK).")return RemoteConfigUnavailableError(msg)@@ -237,16 +227,10 @@ class RemoteConfigFetcher:cached = RemoteConfigCache.load()if cached is None:raise cls._build_unavailable_error(fetch_error) from fetch_error- # A valid cache wrapper can still hold a stale or malformed ``raw_config`` —- # ``RemoteConfigCache.load()`` only validates the wrapper, not the inner payload.- # Treat such a cache as unusable and surface the normal offline-mode remediation- # instead of letting a raw Pydantic ``ValidationError`` escape.- try:- cached_config = cached.to_remote_config()- except ValidationError as validation_error:- raise cls._build_unavailable_error(fetch_error) from validation_error+ # The wrapper `load()` validated already holds the payload as a JSON object, and+ # `RemoteConfig` declares no field of its own, so re-validating it cannot fail.return RemoteConfigResult(- config=cached_config,+ config=cached.to_remote_config(),source=RemoteConfigSource.CACHED,cached_at=cached.cached_at,)diff --git a/pipelex/system/runtime.py b/pipelex/system/runtime.pyindex bb7a8f63a..d673bd9cb 100644--- a/pipelex/system/runtime.py+++ b/pipelex/system/runtime.py@@ -19,46 +19,6 @@ class IntegrationMode(StrEnum):PYTEST = "pytest"PYTHON = "python"- @property- def requires_terms_acceptance(self) -> bool:- match self:- case IntegrationMode.CI:- return False- case IntegrationMode.CLI:- return True- case IntegrationMode.DOCKER:- return True- case IntegrationMode.FASTAPI:- return True- case IntegrationMode.MCP:- return True- case IntegrationMode.N8N:- return True- case IntegrationMode.PYTEST:- return True- case IntegrationMode.PYTHON:- return True-- @property- def is_test_harness(self) -> bool:- """Whether this is a mode only test suites and conformance scripts boot in.-- The boot keeps the Pipelex Gateway telemetry stream off in these modes, so a test run never- reports to the production analytics project.- """- match self:- case IntegrationMode.CI | IntegrationMode.PYTEST:- return True- case (- IntegrationMode.CLI- | IntegrationMode.DOCKER- | IntegrationMode.FASTAPI- | IntegrationMode.MCP- | IntegrationMode.N8N- | IntegrationMode.PYTHON- ):- return False-class RunMode(StrEnum):NORMAL = "normal"diff --git a/pipelex/system/telemetry/exception_capture.py b/pipelex/system/telemetry/exception_capture.pyindex b1c80ab8b..40066cb62 100644--- a/pipelex/system/telemetry/exception_capture.py+++ b/pipelex/system/telemetry/exception_capture.py@@ -14,11 +14,12 @@ if TYPE_CHECKING:from posthog.args import ExceptionArg-class DualClientExceptionCapture:- """Captures unhandled exceptions and sends them to multiple PostHog clients.+class ExceptionCapture:+ """Captures unhandled exceptions and sends them to the operator's PostHog client.- Unlike PostHog's built-in exception_autocapture which only uses default_client,- this implementation sends to both custom and Pipelex PostHog clients.+ Installed in place of PostHog's built-in exception_autocapture, which only+ uses `default_client`, so the capture goes through the client the telemetry+ manager built with its sanitized `capture_exception`.**An `$exception` is attributed like every other capture.** It is resolvedthrough `TelemetryIdentity` rather than from a raw id, and per capture rather@@ -40,13 +41,9 @@ class DualClientExceptionCapture:self,custom_posthog_client: "Posthog | None",custom_identity_rule: StreamIdentityRule,- pipelex_posthog_client: "Posthog | None",- pipelex_identity_rule: StreamIdentityRule,):self._custom_client = custom_posthog_clientself._custom_identity_rule = custom_identity_rule- self._pipelex_client = pipelex_posthog_client- self._pipelex_identity_rule = pipelex_identity_rule# Save original hooksself._original_excepthook = sys.excepthook@@ -105,23 +102,11 @@ class DualClientExceptionCapture:exc_traceback,)- # Send to custom PostHog clientif self._custom_client:self._capture_to_client(client=self._custom_client,identity=self._custom_identity_rule.resolve(caller_identity=caller_identity),posthog_exc_info=posthog_exc_info,- stream_name="custom",- )-- # Send to Pipelex PostHog client- if self._pipelex_client:- self._forget_posthog_capture_marks(exc_value=exc_value)- self._capture_to_client(- client=self._pipelex_client,- identity=self._pipelex_identity_rule.resolve(caller_identity=caller_identity),- posthog_exc_info=posthog_exc_info,- stream_name="Pipelex",)@classmethod@@ -141,9 +126,8 @@ class DualClientExceptionCapture:client: "Posthog",identity: TelemetryIdentity,posthog_exc_info: tuple[type[BaseException], BaseException, TracebackType | None],- stream_name: str,) -> None:- """Send one `$exception` to one stream, under the identity that stream resolved.+ """Send the `$exception` under the identity the stream resolved.The identified and anonymous shapes are PostHog's own: an identifiedcapture passes `distinct_id` and the groups it belongs to, an anonymous@@ -157,28 +141,7 @@ class DualClientExceptionCapture:client.capture_exception(posthog_exc_info, properties={PostHogAttr.PROCESS_PERSON_PROFILE: False})except Exception as capture_exc: # ruff: ignore[blind-except]# Telemetry must never break the app: a failed exception capture is logged at debug and swallowed.- log.debug(f"Failed to capture exception to {stream_name} PostHog: {capture_exc}")-- @classmethod- def _forget_posthog_capture_marks(cls, *, exc_value: BaseException) -> None:- """Let this stream judge the error for itself, whatever the other one did with it.-- Both streams are handed the same exception object, and PostHog drops a- capture of an error it has already sent — a guard meant for one stream- seeing one error twice. Two clients are two destinations rather than a- repeat, so without this whichever stream goes second receives nothing at- all, and the Gateway stream, which is always second, would never record- a crash on a machine that also reports to an operator's own project.-- It runs only between the two streams, never before the first: a mark- already present when the hook ran is the host's own capture, and- `_capture_exception` has skipped that error. The marks left by the last- stream to capture stay in place, so the guard still holds for anything- downstream of this class.- """- for mark in cls.POSTHOG_CAPTURE_MARKS:- if hasattr(exc_value, mark):- delattr(exc_value, mark)+ log.debug(f"Failed to capture exception to PostHog: {capture_exc}")@classmethoddef is_marked_as_captured(cls, *, exception: "ExceptionArg") -> bool:diff --git a/pipelex/system/telemetry/otel_factory.py b/pipelex/system/telemetry/otel_factory.pyindex 2e40e745b..496db914c 100644--- a/pipelex/system/telemetry/otel_factory.py+++ b/pipelex/system/telemetry/otel_factory.py@@ -219,9 +219,6 @@ class OtelFactory:custom_run_identity_policy: RunIdentityPolicy,custom_posthog_client: "Posthog | None",custom_redaction_config: TelemetryRedactionConfig,- pipelex_posthog_client: "Posthog | None",- pipelex_gateway_redaction_config: TelemetryRedactionConfig,- pipelex_distinct_id: str | None,otlp_exporters: list[OtlpExporterConfig] | None,langfuse_config: LangfuseConfig | None,) -> "tuple[OTelTracer, OTelTracerProvider]":@@ -232,9 +229,8 @@ class OtelFactory:It can configure multiple types of exporters:1. Custom PostHog Exporter: User's PostHog for their own analytics- 2. Pipelex PostHog Exporter: Pipelex internal telemetry (mandatory for gateway)- 3. OTLP Exporters: Sends standard OTLP traces to collectors (supports multiple)- 4. Langfuse Exporter: Sends OTLP traces to Langfuse for LLM observability+ 2. OTLP Exporters: Sends standard OTLP traces to collectors (supports multiple)+ 3. Langfuse Exporter: Sends OTLP traces to Langfuse for LLM observabilityArgs:custom_fallback_distinct_id: The operator's configured ``user_id``, used@@ -246,9 +242,6 @@ class OtelFactory:``DIRECT`` under ``identified``, ``NONE`` otherwisecustom_posthog_client: Optional user's PostHog client for sending eventscustom_redaction_config: Redaction config for custom PostHog exporter- pipelex_posthog_client: Optional Pipelex internal PostHog client (for gateway)- pipelex_gateway_redaction_config: Redaction config for Pipelex Gateway PostHog exporter- pipelex_distinct_id: Distinct ID for Pipelex telemetryotlp_exporters: List of OTLP exporter configurationslangfuse_config: Optional Langfuse configuration (enables Langfuse if provided and enabled)@@ -291,19 +284,6 @@ class OtelFactory:provider.add_span_processor(OTelBatchSpanProcessor(custom_posthog_exporter))log.verbose("Custom PostHog exporter enabled for custom telemetry")- # Add Pipelex PostHog Exporter if client is provided (mandatory for gateway)- if pipelex_posthog_client:- # A span's own user is its `distinct_id` and the run's groups ride- # the capture, as on the operator's stream.- pipelex_posthog_exporter = PostHogSpanExporter(- posthog_client=pipelex_posthog_client,- fallback_distinct_id=pipelex_distinct_id,- run_identity_policy=RunIdentityPolicy.DIRECT,- redaction_config=pipelex_gateway_redaction_config,- )- provider.add_span_processor(OTelBatchSpanProcessor(pipelex_posthog_exporter))- log.verbose("Pipelex PostHog exporter enabled for gateway telemetry (with full redaction)")-# Add OTLP Exporters (supports multiple)if otlp_exporters:for exporter_config in otlp_exporters:diff --git a/pipelex/system/telemetry/telemetry_config.py b/pipelex/system/telemetry/telemetry_config.pyindex 7070951a6..068a785d9 100644--- a/pipelex/system/telemetry/telemetry_config.py+++ b/pipelex/system/telemetry/telemetry_config.py@@ -124,37 +124,6 @@ class OtlpExporterConfig(BaseModel):headers: dict[str, str] = Field(default_factory=dict, description="Headers for OTLP export")-class PipelexGatewayTelemetryConfig(BaseModel):- """Pipelex Gateway telemetry configuration for internal maintainer use.-- NOTE TO CONTRIBUTORS: This config class exists to support personal overrides used by- maintainers for improved observability while debugging and demoing Pipelex. It is NOT- included in the base `.pipelex/telemetry.toml` installed via `pipelex init telemetry`.-- Maintainers can enable this by adding a `[pipelex_gateway]` section to their personal- `telemetry_override.toml` file, which is loaded after and merged with the base config.-- IMPORTANT DISTINCTIONS:-- - **This config** (`pipelex_gateway`): Internal maintainer tooling, applied via personal overrides- - **Custom telemetry** (`custom_posthog`, `langfuse`, `otlp`): User-controlled destinations- - **Gateway telemetry** (automatic): When using Pipelex Gateway as inference backend,- identified telemetry is automatically enabled (tied to Gateway API key, hashed for security)-- Using Pipelex Gateway is entirely optional—you can BYOK (Bring Your Own Keys) with direct- provider backends (OpenAI, Anthropic, Azure, Bedrock, etc.) instead.-- See Also:- - docs/setup/telemetry.md: Overview of telemetry streams- - docs/configuration/config-practical/telemetry-config.md: Custom telemetry configuration- """-- model_config = ConfigDict(extra="forbid")-- posthog: PostHogConfig = Field(description="Pipelex Gateway PostHog configuration")- portkey: PortkeyConfig = Field(description="Pipelex Gateway Portkey SDK configuration")--class TelemetryConfig(ConfigModel):"""Main telemetry configuration with nested sections."""@@ -177,7 +146,6 @@ class TelemetryConfig(ConfigModel):"Defaults live here so a project-level telemetry.toml that omits the section ""doesn't silently disable custom telemetry for everyone.",)- pipelex_gateway: PipelexGatewayTelemetryConfig | None = Field(default=None, description="Pipelex Gateway telemetry configuration")def is_custom_telemetry_allowed_for_mode(self, mode: str) -> bool:"""Check if custom telemetry is allowed for the given integration mode.diff --git a/pipelex/system/telemetry/telemetry_factory.py b/pipelex/system/telemetry/telemetry_factory.pyindex 7a7fa2b0e..9d1064c61 100644--- a/pipelex/system/telemetry/telemetry_factory.py+++ b/pipelex/system/telemetry/telemetry_factory.py@@ -1,12 +1,5 @@from pipelex import logfrom pipelex.system.environment import is_env_var_truthy-from pipelex.system.pipelex_service.exceptions import (- GatewayApiKeyMissingError,- GatewayDoNotTrackConflictError,- GatewayTelemetryManagerInjectedError,-)-from pipelex.system.pipelex_service.pipelex_details import PipelexDetails-from pipelex.system.pipelex_service.remote_config import RemoteConfigfrom pipelex.system.runtime import IntegrationModefrom pipelex.system.telemetry.otel_constants import OTelConstantsfrom pipelex.system.telemetry.telemetry_config import PostHogMode, TelemetryConfig@@ -15,7 +8,6 @@ from pipelex.system.telemetry.telemetry_manager_abstract import (TelemetryManagerAbstract,TelemetryManagerNoOp,)-from pipelex.tools.secrets.exceptions import SecretNotFoundErrorfrom pipelex.tools.secrets.secrets_provider_abstract import SecretsProviderAbstract@@ -26,66 +18,36 @@ class TelemetryFactory:*,secrets_provider: SecretsProviderAbstract,integration_mode: IntegrationMode,- remote_config: RemoteConfig | None,- is_pipelex_telemetry_enabled: bool = False,telemetry_config: TelemetryConfig | None = None,injected_telemetry_manager: TelemetryManagerAbstract | None = None,) -> TelemetryManagerAbstract:- gateway_api_key: str | None = None- if is_pipelex_telemetry_enabled:- # Cannot inject custom TelemetryManager when gateway is enabled- if injected_telemetry_manager is not None:- raise GatewayTelemetryManagerInjectedError-- # Get gateway API key for telemetry distinct_id- try:- gateway_api_key = secrets_provider.get_required_secret(PipelexDetails.PIPELEX_GATEWAY_API_KEY_VAR)- except SecretNotFoundError as exc:- raise GatewayApiKeyMissingError from exc+ """The telemetry manager for this boot: the user's own opt-in telemetry, or a no-op.+ There is exactly one telemetry stream, and it is the user's: what ``telemetry.toml`` configures+ under ``[custom_posthog]``, ``[langfuse]`` and ``[[otlp]]``. Nothing here phones home to+ Pipelex.+ """# Always load telemetry config first to determine allowed modesif not telemetry_config:telemetry_config = load_telemetry_config(secrets_provider=secrets_provider)- allows_custom_telemetry = telemetry_config.is_custom_telemetry_allowed_for_mode(integration_mode)+ if not telemetry_config.is_custom_telemetry_allowed_for_mode(integration_mode):+ log.verbose(f"Telemetry is disabled because the integration mode '{integration_mode}' does not allow it")+ return TelemetryManagerNoOp()++ # Always respect DO_NOT_TRACK env var+ if is_env_var_truthy(OTelConstants.DO_NOT_TRACK_ENV_VAR_KEY):+ log.debug(f"Telemetry is disabled by env var '{OTelConstants.DO_NOT_TRACK_ENV_VAR_KEY}'")+ return TelemetryManagerNoOp()# Deferred import: avoid pulling heavy SDK at module-load timefrom pipelex.system.telemetry.telemetry_manager import TelemetryManager # ruff: ignore[import-outside-top-level]chosen_telemetry_manager: TelemetryManagerAbstract- if allows_custom_telemetry or is_pipelex_telemetry_enabled:- # Always respect DO_NOT_TRACK env var- if is_env_var_truthy(OTelConstants.DO_NOT_TRACK_ENV_VAR_KEY):- if is_pipelex_telemetry_enabled:- # Gateway requires telemetry but DNT is set - we respect DNT- raise GatewayDoNotTrackConflictError(dnt_env_var=OTelConstants.DO_NOT_TRACK_ENV_VAR_KEY)+ match telemetry_config.custom_posthog.mode:+ case PostHogMode.OFF:chosen_telemetry_manager = TelemetryManagerNoOp()- log.debug(f"Telemetry is disabled by env var '{OTelConstants.DO_NOT_TRACK_ENV_VAR_KEY}'")- return chosen_telemetry_manager-- match telemetry_config.custom_posthog.mode:- case PostHogMode.OFF:- if is_pipelex_telemetry_enabled:- # Gateway requires telemetry - create manager with only Pipelex telemetry- chosen_telemetry_manager = TelemetryManager(- telemetry_config=telemetry_config,- remote_config=remote_config,- pipelex_telemetry_enabled=True,- gateway_api_key=gateway_api_key,- )- log.verbose("Custom telemetry is off, but Pipelex Gateway telemetry is enabled")- else:- chosen_telemetry_manager = TelemetryManagerNoOp()- log.debug("Telemetry is disabled because posthog.mode is set to 'off'")- case PostHogMode.ANONYMOUS | PostHogMode.IDENTIFIED:- chosen_telemetry_manager = injected_telemetry_manager or TelemetryManager(- telemetry_config=telemetry_config,- remote_config=remote_config,- pipelex_telemetry_enabled=is_pipelex_telemetry_enabled,- gateway_api_key=gateway_api_key,- )- else:- chosen_telemetry_manager = TelemetryManagerNoOp()- log.verbose(f"Telemetry is disabled because the integration mode '{integration_mode}' does not allow it")-+ log.debug("Telemetry is disabled because posthog.mode is set to 'off'")+ case PostHogMode.ANONYMOUS | PostHogMode.IDENTIFIED:+ chosen_telemetry_manager = injected_telemetry_manager or TelemetryManager(telemetry_config=telemetry_config)return chosen_telemetry_managerdiff --git a/pipelex/system/telemetry/telemetry_manager.py b/pipelex/system/telemetry/telemetry_manager.pyindex da96e6580..471f0abde 100644--- a/pipelex/system/telemetry/telemetry_manager.py+++ b/pipelex/system/telemetry/telemetry_manager.py@@ -13,11 +13,9 @@ from pipelex.base_exceptions import PipelexUnexpectedErrorfrom pipelex.system.caller_identity import CallerIdentity, get_current_caller_identityfrom pipelex.system.environment import is_env_var_truthyfrom pipelex.system.exceptions import PipelexError-from pipelex.system.pipelex_service.pipelex_details import PipelexDetails-from pipelex.system.pipelex_service.remote_config import RemoteConfigfrom pipelex.system.runtime import IntegrationModefrom pipelex.system.telemetry.events import EventName, EventProperty-from pipelex.system.telemetry.exception_capture import DualClientExceptionCapture+from pipelex.system.telemetry.exception_capture import ExceptionCapturefrom pipelex.system.telemetry.otel_constants import OTelConstants, PostHogAttr, PostHogEventfrom pipelex.system.telemetry.otel_factory import OtelFactoryfrom pipelex.system.telemetry.telemetry_config import PostHogMode, TelemetryConfig, TelemetryRedactionConfig@@ -33,27 +31,16 @@ if TYPE_CHECKING:class TelemetryManager(TelemetryManagerAbstract):PRIVACY_NOTICE = "[Privacy: exception message redacted]"- def __init__(- self,- telemetry_config: TelemetryConfig,- remote_config: RemoteConfig | None,- pipelex_telemetry_enabled: bool = False,- gateway_api_key: str | None = None,- ):- """Initialize the TelemetryManager with custom and optional Pipelex telemetry.+ def __init__(self, telemetry_config: TelemetryConfig):+ """Initialize the TelemetryManager with the user's own telemetry destinations.Args:telemetry_config: User's telemetry configuration.- remote_config: Remote configuration for Pipelex Service (including telemetry).- pipelex_telemetry_enabled: Whether Pipelex internal telemetry is enabled (for gateway).- gateway_api_key: The user's Pipelex Gateway API key (required if pipelex_telemetry_enabled)."""self.telemetry_config = telemetry_config- self._pipelex_telemetry_enabled = pipelex_telemetry_enabled- self._pipelex_distinct_id: str | None = None- self._exception_capture: DualClientExceptionCapture | None = None+ self._exception_capture: ExceptionCapture | None = None- # Create custom PostHog client only if user's telemetry is enabled+ # Create the PostHog client only if the user's event tracking is enabledself.custom_posthog_client: Posthog | None = Noneif telemetry_config.custom_posthog.mode.is_enabled:if not telemetry_config.custom_posthog.api_key:@@ -67,45 +54,17 @@ class TelemetryManager(TelemetryManagerAbstract):on_error=self._handle_transmission_error,)- # Create Pipelex PostHog client if gateway telemetry is enabled- self.pipelex_posthog_client: Posthog | None = None- if pipelex_telemetry_enabled:- if gateway_api_key:- self._pipelex_distinct_id = PipelexDetails.make_distinct_id(gateway_api_key)- if not remote_config:- msg = "Pipelex Gateway telemetry is enabled but remote config is not set"- raise PipelexUnexpectedError(msg)- pipelex_posthog_config = remote_config.posthog- self.pipelex_posthog_client = Posthog(- project_api_key=pipelex_posthog_config.project_api_key,- host=pipelex_posthog_config.endpoint,- disable_geoip=not pipelex_posthog_config.is_geoip_enabled,- debug=pipelex_posthog_config.is_debug_enabled,- on_error=self._handle_pipelex_transmission_error,- )- log.verbose("Pipelex Gateway telemetry enabled")-# Create OTel tracer for AI tracing if enabledself._otel_tracer: OTelTracer | Noneself._tracer_provider: OTelTracerProvider | None- if telemetry_config.custom_posthog.tracing.enabled or pipelex_telemetry_enabled:- # AI tracing is enabled if either custom or pipelex telemetry wants it- # Create redaction config from user settings for custom telemetry+ if telemetry_config.custom_posthog.tracing.enabled:+ # Create redaction config from user settingscustom_redaction_config = TelemetryRedactionConfig.make_from_posthog_config(posthog_config=telemetry_config.custom_posthog)- if telemetry_config.pipelex_gateway:- pipelex_gateway_redaction_config = TelemetryRedactionConfig.make_from_posthog_config(- posthog_config=telemetry_config.pipelex_gateway.posthog- )- else:- pipelex_gateway_redaction_config = TelemetryRedactionConfig.make_from_posthog_config(posthog_config=None)self._otel_tracer, self._tracer_provider = OtelFactory.make_ai_tracer(custom_fallback_distinct_id=telemetry_config.custom_posthog.user_id,custom_run_identity_policy=RunIdentityPolicy.make_for_operator_stream(posthog_mode=telemetry_config.custom_posthog.mode),- custom_posthog_client=self.custom_posthog_client if telemetry_config.custom_posthog.tracing.enabled else None,+ custom_posthog_client=self.custom_posthog_client,custom_redaction_config=custom_redaction_config,- pipelex_posthog_client=self.pipelex_posthog_client,- pipelex_gateway_redaction_config=pipelex_gateway_redaction_config,- pipelex_distinct_id=self._pipelex_distinct_id,otlp_exporters=telemetry_config.otlp,langfuse_config=telemetry_config.langfuse,)@@ -115,45 +74,38 @@ class TelemetryManager(TelemetryManagerAbstract):self._tracer_provider = Nonelog.verbose("AI tracing disabled: No OpenTelemetry tracer created")- # Wrap capture_exception to sanitize before sending (for whichever clients are enabled)+ # Wrap capture_exception to sanitize before sendingif self.custom_posthog_client:self._wrap_capture_exception(self.custom_posthog_client)- if self.pipelex_posthog_client:- self._wrap_capture_exception(self.pipelex_posthog_client)- # Set global PostHog settings (prefer custom client, fall back to pipelex client)+ # Set global PostHog settingsposthog.privacy_mode = True- posthog.default_client = self.custom_posthog_client or self.pipelex_posthog_client+ posthog.default_client = self.custom_posthog_client- # Set up dual-client exception autocapture if any client is enabled- if self.custom_posthog_client or self.pipelex_posthog_client:+ # Set up exception autocapture if the client is enabled+ if self.custom_posthog_client:self._exception_capture = self._make_exception_capture()- def _make_exception_capture(self) -> DualClientExceptionCapture:- """Build the exception autocapture, with each stream's identity rule.+ def _make_exception_capture(self) -> ExceptionCapture:+ """Build the exception autocapture, with the stream's identity rule.An unhandled exception is attributed when it arrives, not here: thecapture reads back the caller of the pipe run the error escaped from, andfalls back to the stream's own id only for an error that belongs to no- caller. What is fixed here is each stream's rule, taken from the same- settings as every other capture on that stream — which is what carries+ caller. What is fixed here is the stream's rule, taken from the same+ settings as every other capture on it — which is what carries`anonymous` mode onto this path: a stream that identifies nobody must notidentify somebody when the process crashes.Stated as its own method so the wiring can be exercised without the- constructor, which builds live clients and registers a singleton.+ constructor, which builds a live client and registers a singleton."""- return DualClientExceptionCapture(+ return ExceptionCapture(custom_posthog_client=self.custom_posthog_client,custom_identity_rule=StreamIdentityRule(fallback_distinct_id=self.telemetry_config.custom_posthog.user_id,run_identity_policy=RunIdentityPolicy.make_for_operator_stream(posthog_mode=self.telemetry_config.custom_posthog.mode),),- pipelex_posthog_client=self.pipelex_posthog_client,- pipelex_identity_rule=StreamIdentityRule(- fallback_distinct_id=self._pipelex_distinct_id,- run_identity_policy=RunIdentityPolicy.DIRECT,- ),)def _handle_transmission_error( # kw-only: ignore — PostHog on_error callback, invoked positionally as (error, items)@@ -168,18 +120,6 @@ class TelemetryManager(TelemetryManagerAbstract):if error:log.error(f"Telemetry transmission error: {error}")- def _handle_pipelex_transmission_error( # kw-only: ignore — PostHog on_error callback, invoked positionally as (error, items)- self, error: Exception | None, _items: list[dict[str, Any]]- ) -> None:- """Handle errors that occur during Pipelex telemetry transmission.-- Args:- error: The transmission error that occurred- _items: List of telemetry items that failed to send- """- if error:- log.debug(f"Pipelex telemetry transmission error: {error}")-def _wrap_capture_exception(self, client: Posthog) -> None:"""Wrap a PostHog client's capture_exception method to sanitize exception messages.@@ -210,14 +150,14 @@ class TelemetryManager(TelemetryManagerAbstract):"""try:resolved = self._resolved_exception_arg(exception=exception)- if resolved is None or DualClientExceptionCapture.is_marked_as_captured(exception=resolved):+ if resolved is None or ExceptionCapture.is_marked_as_captured(exception=resolved):return Nonesanitized = self._sanitized_exception_arg(exception=resolved)except Exception as sanitize_exc: # ruff: ignore[blind-except]log.debug(f"Dropped an exception capture the privacy redaction could not complete: {sanitize_exc!r}")return Noneresult = original_capture_exception(sanitized, **kwargs)- DualClientExceptionCapture.carry_capture_marks(source=sanitized, target=resolved)+ ExceptionCapture.carry_capture_marks(source=sanitized, target=resolved)return resultclient.capture_exception = sanitized_capture_exception # type: ignore[method-assign]@@ -367,9 +307,7 @@ class TelemetryManager(TelemetryManagerAbstract):try:copied = exception_type.__new__(exception_type, *exception.args)copied.args = exception.args- copied.__dict__.update(- {name: value for name, value in exception.__dict__.items() if name not in DualClientExceptionCapture.POSTHOG_CAPTURE_MARKS}- )+ copied.__dict__.update({name: value for name, value in exception.__dict__.items() if name not in ExceptionCapture.POSTHOG_CAPTURE_MARKS})except Exception: # ruff: ignore[blind-except]# A class whose construction cannot be reproduced keeps its name and message, and nothing else.return Exception(f"{exception_type.__name__}: {exception}")@@ -400,7 +338,7 @@ class TelemetryManager(TelemetryManagerAbstract):# Suppress any shutdown errors to avoid cascading failureslog.debug(f"Error during TracerProvider shutdown: {exc}")- # Then shutdown custom PostHog client+ # Then shutdown the PostHog clientif self.custom_posthog_client:try:self.custom_posthog_client.shutdown()@@ -408,14 +346,6 @@ class TelemetryManager(TelemetryManagerAbstract):# Suppress any shutdown errors to avoid cascading failureslog.debug(f"Error during custom PostHog shutdown: {exc}")- # Then shutdown Pipelex PostHog client- if self.pipelex_posthog_client:- try:- self.pipelex_posthog_client.shutdown()- except Exception as exc: # ruff: ignore[blind-except]- # Suppress any shutdown errors to avoid cascading failures- log.debug(f"Error during Pipelex PostHog shutdown: {exc}")-# Clear singleton instanceTelemetryManagerAbstract.clear_instance()@@ -438,7 +368,7 @@ class TelemetryManager(TelemetryManagerAbstract):caller_identity = self.resolve_event_caller_identity(run_metadata=run_metadata)- # Track to custom PostHog based on user's posthog.mode+ # Track to PostHog based on the user's posthog.modematch self.telemetry_config.custom_posthog.mode:case PostHogMode.ANONYMOUS:# The operator chose not to identify people, and that choice covers@@ -461,10 +391,6 @@ class TelemetryManager(TelemetryManagerAbstract):case PostHogMode.OFF:log.verbose(f"Custom telemetry is off, skipping event '{event_name}' for custom client")- # Always track to Pipelex PostHog if enabled (independent of posthog.mode)- if self._pipelex_telemetry_enabled:- self._track_to_pipelex(event_name, properties=tracked_properties, caller_identity=caller_identity)-@classmethoddef resolve_event_caller_identity(cls, *, run_metadata: "RunMetadata | None") -> CallerIdentity | None:"""The caller an event is attributed to: its run's, else the one in scope, else nobody.@@ -483,11 +409,9 @@ class TelemetryManager(TelemetryManagerAbstract):def _capture_custom_event(self, event_name: str, *, properties: dict[str, Any], identity: TelemetryIdentity):"""Capture one event on the operator's stream, under the identity resolved for it.- Captures a COPY of the properties, because the same dict is offered to- both streams and the anonymous branch below stamps- `$process_person_profile` on the one it sends. Without the copy that mark- travelled on to the Pipelex capture, labelling an event sent WITH a- distinct_id as having no person profile.+ Captures a COPY of the properties, because the anonymous branch below+ stamps `$process_person_profile` onto the one it sends, and the caller's+ dict must not carry that mark away with it."""if not self.custom_posthog_client:log.error("Could not track event to custom telemetry because custom_posthog_client is not set")@@ -506,29 +430,6 @@ class TelemetryManager(TelemetryManagerAbstract):self.custom_posthog_client.capture(event_name, properties=capture_properties)log.verbose(f"Tracked anonymous event '{event_name}' with properties: {capture_properties}")- def _track_to_pipelex(self, event_name: str, *, properties: dict[str, Any], caller_identity: CallerIdentity | None = None):- """Track event to Pipelex's PostHog (always identified, always direct).-- The stream has no mode to turn identification off. A run's own- `user_id` is the `distinct_id` and its groups ride the capture; an event- that names nobody reports under the stream's fallback.- """- if not self.pipelex_posthog_client or not self._pipelex_distinct_id:- log.error("Could not track event to Pipelex telemetry because pipelex_posthog_client or _pipelex_distinct_id is not set")- return- identity = TelemetryIdentity.make_from_caller_identity(- caller_identity=caller_identity,- fallback_distinct_id=self._pipelex_distinct_id,- run_identity_policy=RunIdentityPolicy.DIRECT,- )- self.pipelex_posthog_client.capture(- event_name,- distinct_id=identity.distinct_id,- properties=dict(properties),- groups=identity.groups or None,- )- log.verbose(f"Tracked event '{event_name}' to Pipelex telemetry")-@override@contextmanagerdef telemetry_context(self) -> Generator[None, None, None]:@@ -558,50 +459,6 @@ class TelemetryManager(TelemetryManagerAbstract):else:return False- @override- def is_pipelex_gateway_portkey_logging_enabled(self, *, is_debug_configured: bool) -> bool:- # The Gateway's Portkey logging follows the Gateway stream: where the stream is off, a test run- # above all, neither the backend's `debug` nor the force flag may turn it on.- if not self._pipelex_telemetry_enabled:- return False- is_debug: bool = is_debug_configured- if (- not is_debug- and self.telemetry_config.pipelex_gateway- and self.telemetry_config.pipelex_gateway.portkey- and self.telemetry_config.pipelex_gateway.portkey.force_debug_enabled- ):- log.verbose(- "Force-enabling Portkey logging (debug mode) because pipelex_gateway.portkey.force_debug_enabled is set in telemetry configuration"- )- is_debug = True- if is_debug and is_env_var_truthy(OTelConstants.DO_NOT_TRACK_ENV_VAR_KEY):- log.warning(- f"Disabling Pipelex Gateway Portkey logging (debug mode) "- f"because '{OTelConstants.DO_NOT_TRACK_ENV_VAR_KEY}' is set and that setting takes precedence"- )- is_debug = False- return is_debug-- @override- def is_pipelex_gateway_portkey_tracing_enabled(self) -> bool:- # Trace correlation follows the Gateway stream for the same reason as the logging above.- if not self._pipelex_telemetry_enabled:- return False- if (- self.telemetry_config.pipelex_gateway- and self.telemetry_config.pipelex_gateway.portkey- and self.telemetry_config.pipelex_gateway.portkey.force_tracing_enabled- and not is_env_var_truthy(OTelConstants.DO_NOT_TRACK_ENV_VAR_KEY)- ):- log.verbose(- "Force-enabling Pipelex Gateway Portkey tracing "- "because pipelex_gateway.portkey.force_tracing_enabled is set in telemetry configuration"- )- return True- else:- return False-@overridedef get_otel_tracer(self) -> OTelTracer | None:return self._otel_tracer@@ -631,11 +488,6 @@ class TelemetryManager(TelemetryManagerAbstract):def is_langfuse_enabled(self) -> bool:return self.telemetry_config.langfuse.enabled- @property- @override- def is_pipelex_telemetry_enabled(self) -> bool:- return self._pipelex_telemetry_enabled-@overridedef handle_trace_start(self, *, trace_name: str, trace_name_redacted: str, trace_id: int, run_metadata: "RunMetadata | None" = None) -> None:"""Hook to do something when a trace starts.@@ -646,8 +498,8 @@ class TelemetryManager(TelemetryManagerAbstract):before any batched pipe spans, establishing the correct trace name.Args:- trace_name: Full trace name with pipe code (for custom telemetry).- trace_name_redacted: Redacted trace name without pipe code (for Pipelex telemetry).+ trace_name: Full trace name with pipe code.+ trace_name_redacted: Redacted trace name without pipe code, used when pipe codes are not captured.trace_id: The trace ID.run_metadata: The run this trace belongs to. Carries the identity theevent is attributed to, resolved exactly as every pipe span under@@ -663,7 +515,7 @@ class TelemetryManager(TelemetryManagerAbstract):f" trace_id={trace_id:032x}")- # Send to custom PostHog if configured (uses full trace name based on user's capture settings)+ # Send to PostHog if configured (uses full trace name based on user's capture settings)if self.custom_posthog_client and self.telemetry_config.custom_posthog.tracing.enabled:# Use full or redacted trace name based on user's capture_pipe_codes settingcustom_trace_name = trace_name if self.telemetry_config.custom_posthog.tracing.capture.pipe_codes else trace_name_redacted@@ -692,31 +544,3 @@ class TelemetryManager(TelemetryManagerAbstract):event=PostHogEvent.SPAN,properties=custom_properties,)-- # Send to Pipelex PostHog if gateway telemetry is enabled (always uses redacted trace name)- if self.pipelex_posthog_client:- pipelex_properties: dict[str, Any] = {- PostHogAttr.TRACE_ID: f"{trace_id:032x}",- PostHogAttr.SPAN_NAME: trace_name_redacted,- PostHogAttr.TRACE_NAME: trace_name_redacted,- }- if run_metadata is not None:- pipelex_properties[EventProperty.PIPELINE_RUN_ID] = run_metadata.pipeline_run_id- pipelex_identity = TelemetryIdentity.make_from_caller_identity(- caller_identity=caller_identity,- fallback_distinct_id=self._pipelex_distinct_id,- run_identity_policy=RunIdentityPolicy.DIRECT,- )- if pipelex_identity.distinct_id:- self.pipelex_posthog_client.capture(- distinct_id=pipelex_identity.distinct_id,- event=PostHogEvent.SPAN,- properties=pipelex_properties,- groups=pipelex_identity.groups or None,- )- else:- pipelex_properties[PostHogAttr.PROCESS_PERSON_PROFILE] = False- self.pipelex_posthog_client.capture(- event=PostHogEvent.SPAN,- properties=pipelex_properties,- )diff --git a/pipelex/system/telemetry/telemetry_manager_abstract.py b/pipelex/system/telemetry/telemetry_manager_abstract.pyindex 2b18aae8f..4883e485e 100644--- a/pipelex/system/telemetry/telemetry_manager_abstract.py+++ b/pipelex/system/telemetry/telemetry_manager_abstract.py@@ -128,14 +128,6 @@ class TelemetryManagerAbstract(metaclass=ABCSingletonMeta):def is_custom_portkey_tracing_enabled(self) -> bool:pass- @abstractmethod- def is_pipelex_gateway_portkey_logging_enabled(self, *, is_debug_configured: bool) -> bool:- pass-- @abstractmethod- def is_pipelex_gateway_portkey_tracing_enabled(self) -> bool:- pass-@abstractmethoddef get_otel_tracer(self) -> "OTelTracer | None":"""Get the OpenTelemetry tracer for GenAI spans, if configured."""@@ -165,11 +157,6 @@ class TelemetryManagerAbstract(metaclass=ABCSingletonMeta):def is_langfuse_enabled(self) -> bool:"""Whether Langfuse OTLP exporter is enabled."""- @property- @abstractmethod- def is_pipelex_telemetry_enabled(self) -> bool:- """Whether Pipelex internal telemetry is enabled (for gateway usage)."""-@abstractmethoddef handle_trace_start(self, *, trace_name: str, trace_name_redacted: str, trace_id: int, run_metadata: "RunMetadata | None" = None) -> None:"""Hook to do something when a trace starts.@@ -217,14 +204,6 @@ class TelemetryManagerNoOp(TelemetryManagerAbstract):def is_custom_portkey_tracing_enabled(self) -> bool:return False- @override- def is_pipelex_gateway_portkey_logging_enabled(self, *, is_debug_configured: bool) -> bool:- return False-- @override- def is_pipelex_gateway_portkey_tracing_enabled(self) -> bool:- return False-@overridedef get_otel_tracer(self) -> "OTelTracer | None":return None@@ -254,11 +233,6 @@ class TelemetryManagerNoOp(TelemetryManagerAbstract):def is_langfuse_enabled(self) -> bool:return False- @property- @override- def is_pipelex_telemetry_enabled(self) -> bool:- return False-@overridedef handle_trace_start(self, *, trace_name: str, trace_name_redacted: str, trace_id: int, run_metadata: "RunMetadata | None" = None) -> None:passdiff --git a/pipelex/test_extras/shared_pytest_plugins.py b/pipelex/test_extras/shared_pytest_plugins.pyindex f0feaa22b..058f5b53c 100644--- a/pipelex/test_extras/shared_pytest_plugins.py+++ b/pipelex/test_extras/shared_pytest_plugins.py@@ -8,8 +8,6 @@ from pipelex.system.environment import is_env_var_set, is_env_var_truthy, set_enfrom pipelex.system.pipe_run_mode import PipeRunModefrom pipelex.system.runtime import CODEX_CLOUD_ENV_VAR_KEY, RunMode, runtime_managerfrom pipelex.tools.misc.placeholder import make_placeholder_value, value_is_placeholder-from pipelex.tools.misc.pretty import plain_markup_text-from pipelex.tools.misc.rich_extra import is_rich_installedfrom pipelex.tools.misc.terminal_utils import print_to_stderr@@ -24,7 +22,6 @@ ENV_VAR_KEYS_WHICH_MAY_NEED_PLACEHOLDERS_IN_CI = ["PIPELEX_API_KEY","PIPELEX_API_BASE_URL","PIPELEX_INFERENCE_API_KEY",- "PIPELEX_GATEWAY_API_KEY","OPENAI_API_KEY","AWS_ACCESS_KEY_ID","AWS_SECRET_ACCESS_KEY",@@ -66,6 +63,17 @@ def _set_test_run_mode() -> None:runtime_manager.set_run_mode(run_mode=RunMode.UNIT_TEST)[email protected](tryfirst=True)+def pytest_configure() -> None:+ """Set the test run mode before collection starts.++ First among the configure hooks, rather than in a fixture, because a boot at+ test-module import, during collection or in a later pytest hook happens+ before any fixture runs and would otherwise see the normal run mode.+ """+ _set_test_run_mode()++def pytest_addoption(parser: Parser):parser.addoption("--pipe-run-mode",@@ -78,8 +86,7 @@ def pytest_addoption(parser: Parser):"--disable-inference",action="store_true",default=False,- help="Disable inference for this test session. Uses mock content generator, "- "skips gateway terms check, and auto-skips tests marked with @pytest.mark.inference.",+ help="Disable inference for this test session. Uses mock content generator and auto-skips tests marked with @pytest.mark.inference.",)parser.addoption("--class-registry",@@ -90,83 +97,6 @@ def pytest_addoption(parser: Parser):)-#: What a session stopped for the terms agreement says. Written as Rich markup once: the Rich panel renders it,-#: and the Rich-free path prints the text it renders to, so the message arrives either way.-_TERMS_REQUIRED_MARKUP = (- "[bold yellow]Pipelex Service Terms Agreement Required[/bold yellow]\n\n"- "Tests cannot run because Pipelex Gateway is enabled but terms haven't been accepted.\n\n"- "[bold]To fix this, choose one option:[/bold]\n\n"- " [cyan]1.[/cyan] Run [green]pipelex init agreement[/green] to accept terms (quick, no config reset)\n\n"- " [cyan]2.[/cyan] Run [green]pipelex init config[/green] to fully reset and configure backends\n\n"- " [cyan]3.[/cyan] Disable gateway in [blue].pipelex/inference/backends.toml[/blue]:\n"- " [dim]Set pipelex_gateway.enabled = false[/dim]\n"-)--_TERMS_REQUIRED_TITLE = "⚠️ Setup Required"---def _print_terms_required() -> None:- """Say why the session is stopping, framed by Rich where the extra is installed and plainly where it is not.-- Rich is the ``cli`` extra and this plugin loads in every session of every project that registers it, so the- message a stopped session depends on is never allowed to depend on it.- """- if not is_rich_installed():- print_to_stderr("")- print_to_stderr(_TERMS_REQUIRED_TITLE)- print_to_stderr(plain_markup_text(markup=_TERMS_REQUIRED_MARKUP) or _TERMS_REQUIRED_MARKUP)- return- from rich.console import Console- from rich.panel import Panel-- console = Console()- console.print()- console.print(Panel(_TERMS_REQUIRED_MARKUP, title=_TERMS_REQUIRED_TITLE, border_style="yellow"))--[email protected](tryfirst=True)-def pytest_configure(config: Config) -> None:- """Set the test run mode, then check prerequisites before test collection starts.-- The run mode is set here, first among the configure hooks, rather than in a fixture, because- it is what keeps the Pipelex Gateway telemetry stream off in a test run: a boot at test-module- import, during collection or in a later pytest hook happens before any fixture runs, and would- otherwise see the normal run mode and send the stream.-- Then validates that Pipelex Gateway terms are accepted when gateway is enabled.- This runs early to provide clear feedback before wasting time on test collection.- """- _set_test_run_mode()-- # Skip check when inference is disabled via CLI option- if config.getoption("--disable-inference", default=False):- return-- # Skip check in CI environments (IntegrationMode.CI doesn't require terms)- if is_env_var_set(key="GITHUB_ACTIONS") or is_env_var_set(key="CI"):- return-- # Skip check in Codex Cloud (terms acceptance handled differently)- if is_env_var_truthy(key=CODEX_CLOUD_ENV_VAR_KEY):- return-- # Import here to avoid circular imports during pytest startup- from pipelex.system.configuration.config_loader import config_manager # ruff: ignore[import-outside-top-level]- from pipelex.system.pipelex_service.pipelex_service_config import ( # ruff: ignore[import-outside-top-level]- is_pipelex_gateway_enabled,- load_pipelex_service_config_if_exists,- )-- if not is_pipelex_gateway_enabled():- return-- pipelex_service_config = load_pipelex_service_config_if_exists(config_dir=config_manager.global_config_dir)-- if pipelex_service_config is None or not pipelex_service_config.agreement.terms_accepted:- _print_terms_required()- pytest.exit("Service terms not accepted - run 'pipelex init agreement' first", returncode=1)--@pytest.fixture(scope="session")def pipe_run_mode(request: FixtureRequest) -> PipeRunMode:# Force dry mode when inference is disableddiff --git a/pipelex/urls.py b/pipelex/urls.pyindex b91371def..78f5d129a 100644--- a/pipelex/urls.py+++ b/pipelex/urls.py@@ -9,9 +9,6 @@ class URLs:discord = "https://go.pipelex.com/discord"privacy_policy = "https://go.pipelex.com/privacy-policy"telemetry_docs = "https://docs.pipelex.com/latest/setup/telemetry/"- gateway_docs = (- "https://docs.pipelex.com/latest/setup/configure-ai-providers/#option-1-pipelex-gateway-easiest-and-most-powerful-for-getting-started"- )pipe_func_docs = "https://docs.pipelex.com/latest/building-methods/pipes/pipe-operators/PipeFunc/"backend_provider_docs = "https://docs.pipelex.com/latest/setup/configure-ai-providers/"native_concepts_docs = "https://docs.pipelex.com/latest/building-methods/concepts/native-concepts/"diff --git a/subject_grants.toml b/subject_grants.tomlindex ace8873e2..8fc3b620f 100644--- a/subject_grants.toml+++ b/subject_grants.toml@@ -244,10 +244,6 @@ rationale = "Verb-object: fixes the bundle at bundle_path; options stay keyword.param = "input_file"rationale = "Renders the input file to a graph; single operand."-["pipelex/cli/commands/init/backends.py::disable_managed_gateway_backends"]-param = "backends_toml_path"-rationale = "Edits the backends TOML at the path to disable the managed gateway backends; single operand."-["pipelex/cli/commands/init/backends.py::get_selected_backend_keys"]param = "backends_toml_path"rationale = "Derives from the backends_toml_path; single operand."@@ -304,14 +300,6 @@ rationale = "Derives from the remaining_backends; single operand."param = "backend_keys"rationale = "Derives from the backend_keys; single operand."-["pipelex/cli/commands/login/command.py::save_api_key"]-param = "api_key"-rationale = "File op keyed by the api_key path; single operand."--["pipelex/cli/commands/login/command.py::serve_until_callback"]-param = "server"-rationale = "Serves the HTTP server until the callback fires; single operand."-["pipelex/cli/commands/run/_inputs_file_loader.py::_convert_temporal_inputs"]param = "inputs_dict"rationale = "Single-operand conversion of the inputs dict."@@ -480,38 +468,6 @@ rationale = "File op keyed by the repo_root path; single operand."param = "ack"rationale = "File op keyed by the ack path; single operand."-["pipelex/cli/dev_cli/commands/gateway_models_generator.py::extract_reference_data"]-param = "model_specs"-rationale = "Extracts from the model_specs; single operand."--["pipelex/cli/dev_cli/commands/gateway_models_generator.py::generate_markdown_table"]-param = "models"-rationale = "Renders the models as a markdown table; single operand."--["pipelex/cli/dev_cli/commands/gateway_models_generator.py::generate_markdown_table.sort_by_preferred"]-param = "items"-rationale = "Sorts the items by the preferred order; single operand."--["pipelex/cli/dev_cli/commands/gateway_models_generator.py::generate_pure_markdown_list"]-param = "models"-rationale = "Renders the models as a plain markdown list; single operand."--["pipelex/cli/dev_cli/commands/gateway_models_generator.py::generate_pure_markdown_list.sort_by_preferred"]-param = "items"-rationale = "Sorts the items by the preferred order; single operand."--["pipelex/cli/dev_cli/commands/gateway_models_generator.py::generate_reference_markdown"]-param = "model_specs"-rationale = "Renders the model_specs; single operand."--["pipelex/cli/dev_cli/commands/gateway_models_generator.py::generate_reference_pure_markdown"]-param = "model_specs"-rationale = "Renders the model_specs; single operand."--["pipelex/cli/dev_cli/commands/gateway_models_generator.py::normalize_for_comparison"]-param = "content"-rationale = "Normalizes the content for comparison; single operand."-["pipelex/cli/dev_cli/commands/keyword_only_guard.py::_Collector._visit_function"]param = "node"rationale = "Guard/CLI helper: operates on the node; single operand."@@ -692,34 +648,14 @@ rationale = "Renders the result; single operand."param = "value"rationale = "Renders the value; single operand."-["pipelex/cli/dev_cli/commands/update_gateway_models_cmd.py::_all_references_up_to_date"]-param = "reference_files"-rationale = "Predicate: whether the reference files are current; single operand."-["pipelex/cli/error_handlers.py::_validation_category_header"]param = "category"rationale = "Noun-named derivation: the header text for the category; single operand."-["pipelex/cli/error_handlers.py::handle_gateway_api_key_missing_error"]-param = "exc"-rationale = "Error handler: the exc is the single operand handled."--["pipelex/cli/error_handlers.py::handle_gateway_do_not_track_conflict_error"]-param = "exc"-rationale = "Error handler: the exc is the single operand handled."--["pipelex/cli/error_handlers.py::handle_gateway_terms_not_accepted_error"]-param = "exc"-rationale = "Error handler: the exc is the single operand handled."-["pipelex/cli/error_handlers.py::handle_gateway_unknown_model_error"]param = "exc"rationale = "Error handler: the exc is the single operand handled."-["pipelex/cli/error_handlers.py::handle_inference_setup_required_error"]-param = "exc"-rationale = "Error handler: the exc is the single operand handled."-["pipelex/cli/error_handlers.py::handle_model_availability_error"]param = "exc"rationale = "Error handler: the exc is the single operand handled."@@ -2136,10 +2072,6 @@ rationale = "Deck/file op on the manifest; single operand."param = "model_handle"rationale = "Keyed accessor by the model_handle; single operand."-["pipelex/cogt/models/model_deck.py::ModelDeck._is_model_available_in_backend"]-param = "model_handle"-rationale = "Predicate on the model_handle; single operand."-["pipelex/cogt/models/model_deck.py::ModelDeck._raise_handle_not_found_error"]param = "ref"rationale = "Operates on the ref; single operand (qualifiers keyword-only)."@@ -4976,102 +4908,6 @@ rationale = "Predicate on the exc; single operand."param = "response_dict"rationale = "Parses/consumes the response_dict; single operand."-["pipelex/providers/gateway/gateway_completions_factory.py::GatewayCompletionsFactory._extract_content_string_from_response"]-param = "response"-rationale = "Extracts from the response; single operand (qualifiers keyword-only)."--["pipelex/providers/gateway/gateway_completions_factory.py::GatewayCompletionsFactory._extract_pages_from_choices_content"]-param = "response"-rationale = "Extracts from the response; single operand (qualifiers keyword-only)."--["pipelex/providers/gateway/gateway_completions_factory.py::GatewayCompletionsFactory._make_extract_output_from_response_azure"]-param = "response"-rationale = "Factory from source: builds the result from the response; single operand."--["pipelex/providers/gateway/gateway_completions_factory.py::GatewayCompletionsFactory._make_extract_output_from_response_deepseek"]-param = "response"-rationale = "Factory from source: builds the result from the response; single operand."--["pipelex/providers/gateway/gateway_completions_factory.py::GatewayCompletionsFactory._make_extract_output_from_response_linkup_fetch"]-param = "response"-rationale = "Factory from source: builds the result from the response; single operand."--["pipelex/providers/gateway/gateway_completions_factory.py::GatewayCompletionsFactory._make_extract_output_from_response_mistral"]-param = "response"-rationale = "Factory from source: builds the result from the response; single operand."--["pipelex/providers/gateway/gateway_completions_factory.py::GatewayCompletionsFactory.make_portkey_openai_client_for_completions"]-param = "model_handle"-rationale = "Factory from source: builds the result from the model_handle; single operand."--["pipelex/providers/gateway/gateway_constants.py::GatewayOpenAISdkVariant.is_completions"]-param = "sdk"-rationale = "Predicate on the sdk; single operand."--["pipelex/providers/gateway/gateway_constants.py::GatewayOpenAISdkVariant.is_responses"]-param = "sdk"-rationale = "Predicate on the sdk; single operand."--["pipelex/providers/gateway/gateway_deck.py::GatewayDeck.get_config_id"]-param = "headers"-rationale = "Derives the gateway config id from the request headers; single operand."--["pipelex/providers/gateway/gateway_extract_worker.py::GatewayExtractWorker._extract_base64_url"]-param = "extract_job"-rationale = "Extracts from the extract_job; single operand (qualifiers keyword-only)."--["pipelex/providers/gateway/gateway_extract_worker.py::GatewayExtractWorker._extract_document"]-param = "extract_job"-rationale = "Extracts from the extract_job; single operand (qualifiers keyword-only)."--["pipelex/providers/gateway/gateway_extract_worker.py::GatewayExtractWorker._extract_web_fetch"]-param = "extract_job"-rationale = "Extracts from the extract_job; single operand (qualifiers keyword-only)."--["pipelex/providers/gateway/gateway_factory.py::GatewayFactory._make_gemini_image_config"]-param = "inference_model"-rationale = "Factory from source: builds the result from the inference_model; single operand."--["pipelex/providers/gateway/gateway_factory.py::GatewayFactory.get_api_key"]-param = "backend"-rationale = "Derives the value from the backend config; single operand."--["pipelex/providers/gateway/gateway_factory.py::GatewayFactory.get_endpoint"]-param = "backend"-rationale = "Derives the value from the backend config; single operand."--["pipelex/providers/gateway/gateway_factory.py::GatewayFactory.is_debug_enabled"]-param = "backend"-rationale = "Predicate: reports whether debug logging is enabled for the backend; single operand."--["pipelex/providers/gateway/gateway_factory.py::GatewayFactory.make_extras"]-param = "inference_model"-rationale = "Factory from source: builds the result from the inference_model; single operand."--["pipelex/providers/gateway/gateway_factory.py::GatewayFactory.make_portkey_client"]-param = "backend"-rationale = "Factory from source: builds the result from the backend; single operand."--["pipelex/providers/gateway/gateway_plugin.py::GatewayPlugin.register"]-param = "registrar"-rationale = "Plugin protocol register: the registrar is the sole sink the plugin populates."--["pipelex/providers/gateway/gateway_protocols.py::GatewayExtractProtocol.make_from_model_handle"]-param = "model_handle"-rationale = "Factory from source: builds the result from the model_handle; single operand."--["pipelex/providers/gateway/gateway_responses_factory.py::GatewayResponsesFactory.make_portkey_openai_client_for_responses"]-param = "model_handle"-rationale = "Factory from source: builds the result from the model_handle; single operand."--["pipelex/providers/gateway/gateway_search_worker.py::GatewaySearchWorker._extract_content"]-param = "response"-rationale = "Extracts from the response; single operand (qualifiers keyword-only)."--["pipelex/providers/gateway/gateway_search_worker.py::GatewaySearchWorker._extract_usage"]-param = "response"-rationale = "Extracts from the response; single operand (qualifiers keyword-only)."-["pipelex/providers/google/google_config.py::GoogleConfig.get_reasoning_level"]param = "effort"rationale = "Maps the reasoning effort to a provider reasoning level; single operand."@@ -5688,10 +5524,6 @@ rationale = "Predicate on the var named by the key; single operand."param = "gateway_model_specs"rationale = "Verb-object: merges the gateway model specs; merge context stays keyword."-["pipelex/system/pipelex_service/pipelex_details.py::PipelexDetails.make_distinct_id"]-param = "gateway_api_key"-rationale = "Derivation: hashes the gateway API key into a distinct id; single operand."-["pipelex/system/pipelex_service/pipelex_service_config.py::load_pipelex_service_config_if_exists"]param = "config_dir"rationale = "Verb-object: loads from the config dir; single operand."@@ -5852,11 +5684,11 @@ rationale = "Setter: installs the run mode; single self-labelling operand."param = "worker_mode"rationale = "Setter: installs the worker mode; single self-labelling operand."-["pipelex/system/telemetry/exception_capture.py::DualClientExceptionCapture._capture_exception"]+["pipelex/system/telemetry/exception_capture.py::ExceptionCapture._capture_exception"]param = "exc_info"rationale = "Verb-object: captures the exc info; single operand."-["pipelex/system/telemetry/exception_capture.py::DualClientExceptionCapture._thread_exception_handler"]+["pipelex/system/telemetry/exception_capture.py::ExceptionCapture._thread_exception_handler"]param = "args"rationale = "Positional Callable protocol: threading.excepthook handler, invoked hook(args)."@@ -5952,10 +5784,6 @@ rationale = "Factory from source: builds from the posthog config; single operandparam = "event_name"rationale = "Verb-object: captures the event named; properties and identity stay keyword."-["pipelex/system/telemetry/telemetry_manager.py::TelemetryManager._track_to_pipelex"]-param = "event_name"-rationale = "Verb-object: tracks the event named; properties stay keyword."-["pipelex/system/telemetry/telemetry_manager.py::TelemetryManager._wrap_capture_exception"]param = "client"rationale = "Verb-object: wraps the client's capture; single operand."@@ -5992,10 +5820,6 @@ rationale = "Predicate inspecting the pytest request; single operand."param = "parser"rationale = "Framework-owned pytest hook signature; pluggy binds by parameter name."-["pipelex/test_extras/shared_pytest_plugins.py::pytest_configure"]-param = "config"-rationale = "Framework-owned pytest hook signature; pluggy binds by parameter name."-["pipelex/tools/jinja2/image_registry.py::ImageRegistry.get_image_placeholder"]param = "image"rationale = "Extracts/derives from the image; single operand."diff --git a/tests/conftest.py b/tests/conftest.pyindex e544cd786..9f4307607 100644--- a/tests/conftest.py+++ b/tests/conftest.py@@ -10,12 +10,6 @@ from pipelex import logfrom pipelex.interpreter_hub import clear_current_library, get_current_library_id_or_none, get_library_manager, set_current_libraryfrom pipelex.pipelex import Pipelexfrom pipelex.system.job_metadata import JobMetadata, RunMetadata-from pipelex.system.pipelex_service.pipelex_service_config import (- PipelexServiceConfig,-)-from pipelex.system.pipelex_service.pipelex_service_config import (- load_pipelex_service_config_if_exists as _original_load_pipelex_service_config,-)from pipelex.system.pipelex_service.remote_config import RemoteConfigfrom pipelex.system.pipelex_service.remote_config_fetcher import RemoteConfigFetcher, RemoteConfigResultfrom pipelex.system.pipelex_service.types import RemoteConfigSource@@ -48,21 +42,6 @@ def _cached_fetch_remote_config(require_fresh: bool = False) -> "RemoteConfigResreturn RemoteConfigResult(config=_remote_config_cache["config"], source=RemoteConfigSource.FRESH, cached_at=None)-# Session-level cache for pipelex service config to avoid flaky tests from concurrent file reads-_pipelex_service_config_cache: dict[Path, PipelexServiceConfig | None] = {}---def _cached_load_pipelex_service_config(config_dir: Path) -> PipelexServiceConfig | None:- """Wrapper that caches the pipelex service config for the entire test session.-- This prevents flaky tests caused by concurrent file reads during parallel pytest-xdist execution.- The cache key includes the config_dir to handle different config directories.- """- if config_dir not in _pipelex_service_config_cache:- _pipelex_service_config_cache[config_dir] = _original_load_pipelex_service_config(config_dir)- return _pipelex_service_config_cache[config_dir]--def _fast_telemetry_teardown(self: "TelemetryManager") -> None:"""Skip expensive OTel/PostHog shutdown during tests (~0.49s per call).@@ -92,11 +71,6 @@ def cache_configs_for_session(session_mocker: MockerFixture):"""Cache configurations and optimize teardown for the entire test session."""# Cache remote config to avoid repeated network fetchessession_mocker.patch.object(RemoteConfigFetcher, "fetch_remote_config", _cached_fetch_remote_config)- # Cache pipelex service config to avoid flaky tests from concurrent file reads- session_mocker.patch(- "pipelex.runtime_boot.load_pipelex_service_config_if_exists",- _cached_load_pipelex_service_config,- )# Skip expensive telemetry shutdown (OTel + PostHog flush) during testsfrom pipelex.system.telemetry.telemetry_manager import TelemetryManager # ruff: ignore[import-outside-top-level]@@ -106,8 +80,7 @@ def cache_configs_for_session(session_mocker: MockerFixture):def _get_test_integration_mode() -> IntegrationMode:"""Return the appropriate integration mode for tests.- Uses CI mode in CI environments (no terms acceptance required),- PYTEST mode for local development (terms acceptance required).+ Uses CI mode in CI environments, PYTEST mode for local development."""if runtime_manager.is_ci_testing:return IntegrationMode.CIdiff --git a/tests/data/errors/error_identity.txt b/tests/data/errors/error_identity.txtindex 86c3af55c..367d9077d 100644--- a/tests/data/errors/error_identity.txt+++ b/tests/data/errors/error_identity.txt@@ -101,18 +101,7 @@ FileTypeError | File type | https://docs.pipelex.com/latest/errors/file-type-errFixTransactionError | Fix transaction | https://docs.pipelex.com/latest/errors/fix-transaction-error/FixWriteConflictError | Fix write conflict | https://docs.pipelex.com/latest/errors/fix-write-conflict-error/FuncRegistryError | Func registry | https://docs.pipelex.com/latest/errors/func-registry-error/-GatewayApiKeyMissingError | Gateway api key missing | https://docs.pipelex.com/latest/errors/gateway-api-key-missing-error/GatewayConfigMergeError | Gateway config merge | https://docs.pipelex.com/latest/errors/gateway-config-merge-error/-GatewayCredentialsError | Gateway credentials | https://docs.pipelex.com/latest/errors/gateway-credentials-error/-GatewayDeckError | Gateway deck | https://docs.pipelex.com/latest/errors/gateway-deck-error/-GatewayDoNotTrackConflictError | Gateway do not track conflict | https://docs.pipelex.com/latest/errors/gateway-do-not-track-conflict-error/-GatewayError | Gateway | https://docs.pipelex.com/latest/errors/gateway-error/-GatewayExtractResponseError | Gateway extract response | https://docs.pipelex.com/latest/errors/gateway-extract-response-error/-GatewayFactoryError | Gateway factory | https://docs.pipelex.com/latest/errors/gateway-factory-error/-GatewaySearchEmptyResultError | Gateway search empty result | https://docs.pipelex.com/latest/errors/gateway-search-empty-result-error/-GatewaySearchResponseError | Gateway search response | https://docs.pipelex.com/latest/errors/gateway-search-response-error/-GatewayTelemetryManagerInjectedError | Gateway telemetry manager injected | https://docs.pipelex.com/latest/errors/gateway-telemetry-manager-injected-error/-GatewayTermsNotAcceptedError | Gateway terms not accepted | https://docs.pipelex.com/latest/errors/gateway-terms-not-accepted-error/GatewayUnknownModelError | Gateway unknown model | https://docs.pipelex.com/latest/errors/gateway-unknown-model-error/GcpLogSinkCredentialsError | Log sink credentials missing or refused | https://docs.pipelex.com/latest/errors/gcp-log-sink-credentials-error/GeneratedImageError | Generated image | https://docs.pipelex.com/latest/errors/generated-image-error/@@ -135,7 +124,6 @@ InferenceBackendLibraryNotFoundError | Inference backend library not found | httInferenceBackendLibraryValidationError | Inference backend library validation | https://docs.pipelex.com/latest/errors/inference-backend-library-validation-error/InferenceBackendNotFoundError | Inference backend not found | https://docs.pipelex.com/latest/errors/inference-backend-not-found-error/InferenceModelSpecError | Inference model spec | https://docs.pipelex.com/latest/errors/inference-model-spec-error/-InferenceSetupRequiredError | Inference setup required | https://docs.pipelex.com/latest/errors/inference-setup-required-error/InputShapingError | Input shaping | https://docs.pipelex.com/latest/errors/input-shaping-error/InputStuffSpecNotFoundError | Input stuff spec not found | https://docs.pipelex.com/latest/errors/input-stuff-spec-not-found-error/InputStuffSpecsError | Input stuff specs | https://docs.pipelex.com/latest/errors/input-stuff-specs-error/diff --git a/tests/e2e/agent_cli/conftest.py b/tests/e2e/agent_cli/conftest.pyindex 500d13554..1e84791e6 100644--- a/tests/e2e/agent_cli/conftest.py+++ b/tests/e2e/agent_cli/conftest.py@@ -7,8 +7,8 @@ the ``.pipelex/`` config directory AND the ``~/.pipelex/cache/`` directory the ofallback reads.The kit configs are copied wholesale so the subprocess sees a realistic Pipelex install,-not a hand-rolled minimal one. Per-test tweaks (gateway enabled/disabled, terms accepted,-primed cache content) layer on top.+not a hand-rolled minimal one. Per-test tweaks (manifold enabled/disabled, primed cache+content) layer on top."""from __future__ import annotations@@ -47,18 +47,18 @@ OFFLINE_BUNDLES_DIR = REPO_ROOT / "tests" / "e2e" / "data" / "offline_mode"# Reserved/unroutable address — httpx will raise ConnectError immediately without hanging.UNREACHABLE_REMOTE_CONFIG_URL = "http://127.0.0.1:1/pipelex_remote_config.json"-# Minimal-but-valid gateway spec bodies per model type (valid against InferenceModelSpecBlueprint).-# Each ``sdk`` names the dedicated gateway worker for its type — gateway_completions (LLM),-# gateway_img_gen (image), gateway_extract, gateway_search — i.e. a value the matching worker factory's-# gateway branch accepts (an unrecognized sdk like "gateway_image" hits ``case _: raise NotImplementedError``).+# Minimal-but-valid manifold spec bodies per model type (valid against InferenceModelSpecBlueprint).+# Each ``sdk`` names the dedicated manifold worker for its type — manifold_completions (LLM),+# manifold_img_gen (image), manifold_extract, manifold_search — i.e. a value the manifold plugin+# registers for that family (an unrecognized sdk would be refused at worker creation).# The sdk is consumed only at worker creation, which the offline dry-run tests never reach# (the cogt leaf mocks generation under DRY), so the membership check is indifferent to it — but it must still# be real so the fake cache stays faithful and any non-dry consumer of this helper can build a worker.-_GATEWAY_SPEC_TEMPLATE_BY_TYPE: dict[ModelType, dict[str, Any]] = {- ModelType.LLM: {"sdk": "gateway_completions", "model_type": "llm", "inputs": ["text"], "outputs": ["text", "structured"]},- ModelType.IMG_GEN: {"sdk": "gateway_img_gen", "model_type": "img_gen"},- ModelType.TEXT_EXTRACTOR: {"sdk": "gateway_extract", "model_type": "text_extractor"},- ModelType.SEARCH: {"sdk": "gateway_search", "model_type": "search"},+_MANIFOLD_SPEC_TEMPLATE_BY_TYPE: dict[ModelType, dict[str, Any]] = {+ ModelType.LLM: {"sdk": "manifold_completions", "model_type": "llm", "inputs": ["text"], "outputs": ["text", "structured"]},+ ModelType.IMG_GEN: {"sdk": "manifold_img_gen", "model_type": "img_gen"},+ ModelType.TEXT_EXTRACTOR: {"sdk": "manifold_extract", "model_type": "text_extractor"},+ ModelType.SEARCH: {"sdk": "manifold_search", "model_type": "search"},}@@ -87,39 +87,39 @@ def load_kit_model_deck_blueprint() -> ModelDeckBlueprint:def software_only_internal_handles() -> set[str]:- """Handles served by the local ``internal`` backend — the ones the Pipelex Gateway never provides.+ """Handles served by the local ``internal`` backend — the ones Pipelex Manifold never provides.``PipelexBackend.INTERNAL`` is the software-only backend ("runs internally, without AI" — e.g. the- pypdfium2 / docling text extractors). Those handles have no gateway equivalent, so they must be- excluded from the derived gateway specs: otherwise the primed cache would claim the gateway serves a+ pypdfium2 / docling text extractors). Those handles have no manifold equivalent, so they must be+ excluded from the derived manifold specs: otherwise the primed cache would claim the manifold serves asoftware-only extractor, and a deck alias like ``@default-no-inference`` / ``@default-text-from-pdf``- could resolve through the fake ``gateway_extract`` worker instead of the real internal backend.+ could resolve through the fake ``manifold_extract`` worker instead of the real internal backend.Read straight from the shipped backend spec file (no booted Pipelex needed) and keyed off the enumvalue, so adding a new software-only extractor to the internal backend auto-excludes it here too.Provider-backed models (claude, gpt, linkup, nano-banana, ...) are intentionally NOT excluded: the- gateway genuinely proxies those, so they belong in the faithful gateway cache.+ manifold genuinely proxies those, so they belong in the faithful manifold cache."""internal_spec_path = Path(str(get_kit_configs_dir())) / "inference" / "backends" / f"{PipelexBackend.INTERNAL}.toml"raw_specs = load_toml_from_path(path=str(internal_spec_path))return {name for name, spec in raw_specs.items() if name != "defaults" and isinstance(spec, dict)}-def gateway_backend_model_specs_for_kit_deck() -> dict[str, Any]:- """Build a gateway ``backend_model_specs`` payload covering every concrete model handle the kit deck names.+def manifold_model_specs_for_kit_deck() -> dict[str, Any]:+ """Build a manifold ``manifold_model_specs`` payload covering every concrete model handle the kit deck names.Derived from the shipped kit deck rather than a hand-maintained list, so the primedoffline cache auto-tracks deck changes — e.g. promoting a premium alias to a new modelno longer silently breaks these tests. Every bare handle named in the deck's aliases,waterfalls, and presets (across all model types) gets a minimal spec declaring the- gateway sdk for its type — all ``ModelManager._enforce_gateway_model_membership`` needs- is name membership. Deck/gateway consistency itself is covered by ``TestModelDeckReferences``.+ manifold sdk for its type — all ``ModelManager._enforce_gateway_model_membership`` needs+ is name membership. Deck/manifold consistency itself is covered by ``TestModelDeckReferences``.Handles served by the software-only ``internal`` backend (see ``software_only_internal_handles``)- are excluded: the gateway never provides them, so claiming it does would make the fake cache- unfaithful and let a software-only extractor alias resolve through the gateway worker. Those+ are excluded: the manifold never provides them, so claiming it does would make the fake cache+ unfaithful and let a software-only extractor alias resolve through the manifold worker. Thosehandles are still reachable in the offline subprocess via the local internal backend, so the- membership check passes for them without a gateway spec.+ membership check passes for them without a manifold spec."""blueprint = load_kit_model_deck_blueprint()excluded_handles = software_only_internal_handles()@@ -144,9 +144,9 @@ def gateway_backend_model_specs_for_kit_deck() -> dict[str, Any]:case ModelReferenceKind.ALIAS | ModelReferenceKind.WATERFALL | ModelReferenceKind.PRESET:continue- specs: dict[str, Any] = {"defaults": {"sdk": "gateway_completions"}}+ specs: dict[str, Any] = {"defaults": {"sdk": "manifold_completions"}}for handle, model_type in handle_model_types.items():- specs[handle] = dict(_GATEWAY_SPEC_TEMPLATE_BY_TYPE[model_type])+ specs[handle] = dict(_MANIFOLD_SPEC_TEMPLATE_BY_TYPE[model_type])return specs@@ -176,46 +176,34 @@ def _copy_kit_configs_into(pipelex_dir: Path) -> None:shutil.copy2(source_file, dst / source_file.name)-def set_gateway_enabled(backends_path: Path, *, enabled: bool) -> None:- """Toggle ``[pipelex_gateway].enabled`` in a backends.toml file in place.+def set_manifold_enabled(backends_path: Path, *, enabled: bool) -> None:+ """Toggle ``[pipelex_manifold].enabled`` in a backends.toml file in place.Avoids loading the file through ``tomlkit`` (which the kit configs are encoded with)- by doing a targeted text rewrite — the kit file's ``enabled = true`` line directly- follows the ``[pipelex_gateway]`` section header.+ by doing a targeted text rewrite of the ``enabled`` line inside the ``[pipelex_manifold]``+ section."""original_text = backends_path.read_text(encoding="utf-8")lines = original_text.splitlines(keepends=True)target_value = "true" if enabled else "false"- in_gateway_section = False+ in_manifold_section = Falserewrote = Falsefor index, line in enumerate(lines):stripped = line.strip()if stripped.startswith("[") and stripped.endswith("]"):- in_gateway_section = stripped == "[pipelex_gateway]"+ in_manifold_section = stripped == "[pipelex_manifold]"continue- if in_gateway_section and stripped.startswith("enabled"):+ if in_manifold_section and stripped.startswith("enabled"):indent = line[: len(line) - len(line.lstrip())]lines[index] = f"{indent}enabled = {target_value} # set by offline-mode E2E fixture\n"rewrote = Truebreakif not rewrote:- msg = f"Could not find [pipelex_gateway].enabled in {backends_path}"+ msg = f"Could not find [pipelex_manifold].enabled in {backends_path}"raise AssertionError(msg)backends_path.write_text("".join(lines), encoding="utf-8")-def write_pipelex_service_config(pipelex_dir: Path, *, terms_accepted: bool, inference_setup_completed: bool) -> None:- """Overwrite ``pipelex_service.toml`` so the subprocess skips the first-run gate."""- content = (- "[agreement]\n"- f"terms_accepted = {str(terms_accepted).lower()}\n"- "\n"- "[onboarding]\n"- f"inference_setup_completed = {str(inference_setup_completed).lower()}\n"- )- (pipelex_dir / "pipelex_service.toml").write_text(content, encoding="utf-8")--def write_active_routing_profile(routing_profiles_path: Path, active_profile: str) -> None:"""Rewrite the ``active = "..."`` line in routing_profiles.toml in place."""original_text = routing_profiles_path.read_text(encoding="utf-8")@@ -250,12 +238,11 @@ def write_remote_config_cache(pipelex_dir: Path, raw_config: dict[str, Any]) ->def hermetic_home(tmp_path: Path) -> Path:"""Return a tmp ``HOME`` that already has a populated ``.pipelex/`` config tree.- Tests further tweak the resulting directory (toggle gateway, prime cache, ...) before+ Tests further tweak the resulting directory (toggle the manifold, prime cache, ...) beforeinvoking the subprocess."""pipelex_dir = tmp_path / ".pipelex"_copy_kit_configs_into(pipelex_dir)- write_pipelex_service_config(pipelex_dir, terms_accepted=True, inference_setup_completed=True)return tmp_path@@ -275,14 +262,14 @@ def offline_subprocess_env(hermetic_home: Path) -> dict[str, str]:"HOME": str(hermetic_home),"PATH": "/usr/bin:/bin:/usr/local/bin","PIPELEX_REMOTE_CONFIG_URL": UNREACHABLE_REMOTE_CONFIG_URL,- # Force CI test mode so vertexai is skipped and terms-acceptance gate doesn't fire- # for code paths that still consult the integration mode.+ # Force CI test mode so vertexai is skipped."RUN_MODE": "ci_test",# Dummy credentials — the test never makes a real provider call (dry-run only) and# ``lenient=True`` (set by ``--dry-run``) skips backends whose env vars are missing# rather than raising. We populate every key so backend loading is deterministic# regardless of the developer's shell environment.- "PIPELEX_GATEWAY_API_KEY": "dummy-gateway-key",+ "PIPELEX_MANIFOLD_ENDPOINT": "https://manifold.example.invalid",+ "PIPELEX_MANIFOLD_API_KEY": "dummy-manifold-key","ANTHROPIC_API_KEY": "dummy-anthropic-key","AWS_REGION": "us-east-1","AZURE_API_BASE": "https://example.invalid",@@ -315,9 +302,9 @@ __all__ = ["OFFLINE_BUNDLES_DIR","PIPELEX_AGENT_BIN","UNREACHABLE_REMOTE_CONFIG_URL",- "gateway_backend_model_specs_for_kit_deck",+ "manifold_model_specs_for_kit_deck","load_kit_model_deck_blueprint",- "set_gateway_enabled",+ "set_manifold_enabled","software_only_internal_handles","write_active_routing_profile","write_remote_config_cache",diff --git a/tests/e2e/agent_cli/test_fix_bundle.py b/tests/e2e/agent_cli/test_fix_bundle.pyindex 3c2ee8565..6ccd38a59 100644--- a/tests/e2e/agent_cli/test_fix_bundle.py+++ b/tests/e2e/agent_cli/test_fix_bundle.py@@ -8,7 +8,7 @@ from typing import TYPE_CHECKINGimport pytest-from tests.e2e.agent_cli.conftest import PIPELEX_AGENT_BIN, set_gateway_enabled+from tests.e2e.agent_cli.conftest import PIPELEX_AGENT_BIN, set_manifold_enabledif TYPE_CHECKING:from pathlib import Path@@ -71,7 +71,7 @@ def _run_fix_bundle(bundle_path: Path, *, env: dict[str, str], cwd: Path) -> subclass TestFixBundleE2E:def test_fixable_bundle_outputs_clean_json_and_writes_file(self, hermetic_home: Path, offline_subprocess_env: dict[str, str]) -> None:pipelex_dir = hermetic_home / ".pipelex"- set_gateway_enabled(pipelex_dir / "inference" / "backends.toml", enabled=False)+ set_manifold_enabled(pipelex_dir / "inference" / "backends.toml", enabled=False)bundle_path = hermetic_home / "bundle.mthds"bundle_path.write_text(_FIXABLE_SEQUENCE_MTHDS, encoding="utf-8")@@ -87,7 +87,7 @@ class TestFixBundleE2E:def test_unfixable_bundle_outputs_json_error_and_exit_one(self, hermetic_home: Path, offline_subprocess_env: dict[str, str]) -> None:pipelex_dir = hermetic_home / ".pipelex"- set_gateway_enabled(pipelex_dir / "inference" / "backends.toml", enabled=False)+ set_manifold_enabled(pipelex_dir / "inference" / "backends.toml", enabled=False)bundle_path = hermetic_home / "bundle.mthds"bundle_path.write_text(_UNFIXABLE_MTHDS, encoding="utf-8")diff --git a/tests/e2e/agent_cli/test_offline_run_dry.py b/tests/e2e/agent_cli/test_offline_run_dry.pyindex 78288d594..d20d903d8 100644--- a/tests/e2e/agent_cli/test_offline_run_dry.py+++ b/tests/e2e/agent_cli/test_offline_run_dry.py@@ -16,12 +16,13 @@ from typing import TYPE_CHECKING, castimport pytest+from pipelex.cogt.models.model_reference import ModelReferencefrom tests.e2e.agent_cli.conftest import (OFFLINE_BUNDLES_DIR,PIPELEX_AGENT_BIN,- gateway_backend_model_specs_for_kit_deck,load_kit_model_deck_blueprint,- set_gateway_enabled,+ manifold_model_specs_for_kit_deck,+ set_manifold_enabled,write_active_routing_profile,write_remote_config_cache,)@@ -109,19 +110,13 @@ def _parse_agent_json(output: str) -> dict[str, object]:def _cached_remote_config_payload() -> dict[str, object]:"""A structurally complete cached remote-config payload for the primed-cache scenarios.- ``backend_model_specs`` is derived from the shipped kit deck (see- ``gateway_backend_model_specs_for_kit_deck``) so the gateway-membership check in+ The manifold section is derived from the shipped kit deck (see+ ``manifold_model_specs_for_kit_deck``) so the gateway-membership check in``Pipelex.setup`` accepts the cache without a hand-maintained handle list that goesstale whenever the deck promotes an alias to a new model."""return {- "posthog": {- "project_api_key": "test-key",- "endpoint": "https://example.invalid",- "is_geoip_enabled": False,- "is_debug_enabled": False,- },- "backend_model_specs": gateway_backend_model_specs_for_kit_deck(),+ "manifold_model_specs": manifold_model_specs_for_kit_deck(),"aws_region": "us-east-1",}@@ -159,9 +154,9 @@ class TestOfflineDryRun:assert "warnings" in parsed, f"the outer envelope (with 'warnings') must be returned: {parsed!r}"def test_byok_offline_succeeds(self, hermetic_home: Path, offline_subprocess_env: dict[str, str]) -> None:- """Gateway disabled + no network + no cache → dry-run exits 0 with structured success JSON."""+ """No managed gateway + no network + no cache → dry-run exits 0 with structured success JSON."""pipelex_dir = hermetic_home / ".pipelex"- set_gateway_enabled(pipelex_dir / "inference" / "backends.toml", enabled=False)+ set_manifold_enabled(pipelex_dir / "inference" / "backends.toml", enabled=False)write_active_routing_profile(pipelex_dir / "inference" / "routing_profiles.toml", "all_anthropic")staged_bundle = _stage_bundle(OFFLINE_BUNDLES_DIR / "byok_simple", hermetic_home)@@ -174,68 +169,71 @@ class TestOfflineDryRun:assert "error" not in payload, payloadassert "text" in payload, payload- def test_gateway_no_cache_no_network_fails_with_unavailable(self, hermetic_home: Path, offline_subprocess_env: dict[str, str]) -> None:- """Gateway enabled + no network + no cache → ``RemoteConfigUnavailableError`` with remediation hint."""+ def test_manifold_no_cache_no_network_fails_with_unavailable(self, hermetic_home: Path, offline_subprocess_env: dict[str, str]) -> None:+ """Manifold enabled + no network + no cache → ``RemoteConfigUnavailableError`` with remediation hint."""pipelex_dir = hermetic_home / ".pipelex"- set_gateway_enabled(pipelex_dir / "inference" / "backends.toml", enabled=True)+ set_manifold_enabled(pipelex_dir / "inference" / "backends.toml", enabled=True)+ write_active_routing_profile(pipelex_dir / "inference" / "routing_profiles.toml", "all_pipelex_manifold")- staged_bundle = _stage_bundle(OFFLINE_BUNDLES_DIR / "gateway_known_model", hermetic_home)+ staged_bundle = _stage_bundle(OFFLINE_BUNDLES_DIR / "manifold_known_model", hermetic_home)result = _run_agent_bundle(staged_bundle, offline_subprocess_env, cwd=hermetic_home)- assert result.returncode != 0, f"Gateway offline with no cache must fail.\nstdout={result.stdout!r}\nstderr={result.stderr!r}"+ assert result.returncode != 0, f"Manifold offline with no cache must fail.\nstdout={result.stdout!r}\nstderr={result.stderr!r}"payload = _parse_agent_json(result.stderr or result.stdout)assert payload.get("error_type") == "RemoteConfigUnavailableError", payloadmessage = str(payload.get("message", ""))assert "pipelex init" in message.lower(), f"Error must mention `pipelex init` remediation; got: {message!r}"def test_primed_cache_specs_track_kit_deck_premium_alias(self) -> None:- """Regression: the primed gateway cache is derived from the kit deck, so it tracks alias promotions.+ """Regression: the primed manifold cache is derived from the kit deck, so it tracks alias promotions.Reads the deck's own ``default-premium`` target — whatever model it currently points- to — and asserts the derived gateway specs cover it, without hardcoding the model name.+ to — and asserts the derived manifold specs cover it, without hardcoding the model name.If a future deck promotes the premium alias to a new handle this keeps passing; if thederivation ever stops covering a referenced handle it fails fast here (a unit-speedcheck) instead of deep inside a subprocess setup with an opaque GatewayUnknownModelError."""blueprint = load_kit_model_deck_blueprint()premium_target = blueprint.llm.aliases["default-premium"]- specs = gateway_backend_model_specs_for_kit_deck()+ specs = manifold_model_specs_for_kit_deck()assert premium_target in specs, (- f"Derived gateway specs must cover the kit deck's default-premium target '{premium_target}'; got handles: {sorted(specs)}"+ f"Derived manifold specs must cover the kit deck's default-premium target '{premium_target}'; got handles: {sorted(specs)}")def test_primed_cache_excludes_software_only_internal_handles(self) -> None:- """Regression: the gateway cache must not claim software-only internal extractors as gateway models.+ """Regression: the manifold cache must not claim software-only internal extractors as manifold models.``@default-no-inference`` / ``@default-text-from-pdf`` resolve to an extractor served by thelocal ``internal`` backend (``PipelexBackend.INTERNAL`` — "runs internally, without AI"), which- the Pipelex Gateway never provides. If the derived gateway specs claimed it, an offline dry-run- could resolve the alias to the fake ``gateway_extract`` worker instead of exercising the real- internal backend. The companion assertion guards the other direction: a genuinely gateway-served- extract model (the ``default-extract-document`` target) must stay covered, so the exclusion does- not over-reach onto provider-backed models the gateway does proxy.+ Pipelex Manifold never provides. If the derived manifold specs claimed it, an offline dry-run+ could resolve the alias to the fake ``manifold_extract`` worker instead of exercising the real+ internal backend. The companion assertion guards the other direction: a genuinely manifold-served+ extract model (the first choice of the ``default-extract-document`` waterfall) must stay covered, so the exclusion does+ not over-reach onto provider-backed models the manifold does proxy."""blueprint = load_kit_model_deck_blueprint()software_only_target = blueprint.extract.aliases["default-no-inference"]- gateway_extract_target = blueprint.extract.aliases["default-extract-document"]- specs = gateway_backend_model_specs_for_kit_deck()+ document_waterfall = ModelReference.parse(blueprint.extract.aliases["default-extract-document"])+ manifold_extract_target = blueprint.extract.waterfalls[document_waterfall.name][0]+ specs = manifold_model_specs_for_kit_deck()assert software_only_target not in specs, (- f"Derived gateway specs must exclude software-only internal handle '{software_only_target}'; got handles: {sorted(specs)}"+ f"Derived manifold specs must exclude software-only internal handle '{software_only_target}'; got handles: {sorted(specs)}")- assert gateway_extract_target in specs, (- f"Gateway-served extract target '{gateway_extract_target}' must remain covered; got handles: {sorted(specs)}"+ assert manifold_extract_target in specs, (+ f"Manifold-served extract target '{manifold_extract_target}' must remain covered; got handles: {sorted(specs)}")- def test_gateway_known_with_cache_succeeds_offline(self, hermetic_home: Path, offline_subprocess_env: dict[str, str]) -> None:- """Gateway enabled + no network + primed cache → dry-run exits 0 with stale-cache warning."""+ def test_manifold_known_with_cache_succeeds_offline(self, hermetic_home: Path, offline_subprocess_env: dict[str, str]) -> None:+ """Manifold enabled + no network + primed cache → dry-run exits 0 with stale-cache warning."""pipelex_dir = hermetic_home / ".pipelex"- set_gateway_enabled(pipelex_dir / "inference" / "backends.toml", enabled=True)+ set_manifold_enabled(pipelex_dir / "inference" / "backends.toml", enabled=True)+ write_active_routing_profile(pipelex_dir / "inference" / "routing_profiles.toml", "all_pipelex_manifold")write_remote_config_cache(pipelex_dir, _cached_remote_config_payload())- staged_bundle = _stage_bundle(OFFLINE_BUNDLES_DIR / "gateway_known_model", hermetic_home)+ staged_bundle = _stage_bundle(OFFLINE_BUNDLES_DIR / "manifold_known_model", hermetic_home)result = _run_agent_bundle(staged_bundle, offline_subprocess_env, cwd=hermetic_home)- assert result.returncode == 0, f"Gateway dry-run with primed cache must succeed offline.\nstdout={result.stdout!r}\nstderr={result.stderr!r}"+ assert result.returncode == 0, f"Manifold dry-run with primed cache must succeed offline.\nstdout={result.stdout!r}\nstderr={result.stderr!r}"payload = _parse_agent_json(result.stdout)assert "error" not in payload, payloadrendered = json.dumps(payload)@@ -243,11 +241,11 @@ class TestOfflineDryRun:f"Cached-source setup must surface a RemoteConfigStale warning on the envelope; got: {payload!r}")- def test_gateway_img_gen_with_cache_succeeds_offline(self, hermetic_home: Path, offline_subprocess_env: dict[str, str]) -> None:- """Gateway enabled + no network + primed cache → an image-gen pipe dry-runs offline.+ def test_manifold_img_gen_with_cache_succeeds_offline(self, hermetic_home: Path, offline_subprocess_env: dict[str, str]) -> None:+ """Manifold enabled + no network + primed cache → an image-gen pipe dry-runs offline.- Companion to ``test_gateway_known_with_cache_succeeds_offline``, but the bundle's pipe is a- ``PipeImgGen`` referencing a gateway image handle (``gpt-image-2``). It proves the derived+ Companion to ``test_manifold_known_with_cache_succeeds_offline``, but the bundle's pipe is a+ ``PipeImgGen`` referencing a manifold image handle (``gpt-image-2``). It proves the derivedcache covers img_gen handles too — not just LLMs — so the gateway-membership check passes foran image model and the offline dry-run completes.@@ -257,32 +255,34 @@ class TestOfflineDryRun:runtime (non-dry) concern."""pipelex_dir = hermetic_home / ".pipelex"- set_gateway_enabled(pipelex_dir / "inference" / "backends.toml", enabled=True)+ set_manifold_enabled(pipelex_dir / "inference" / "backends.toml", enabled=True)+ write_active_routing_profile(pipelex_dir / "inference" / "routing_profiles.toml", "all_pipelex_manifold")write_remote_config_cache(pipelex_dir, _cached_remote_config_payload())- staged_bundle = _stage_bundle(OFFLINE_BUNDLES_DIR / "gateway_img_gen_model", hermetic_home)+ staged_bundle = _stage_bundle(OFFLINE_BUNDLES_DIR / "manifold_img_gen_model", hermetic_home)result = _run_agent_bundle(staged_bundle, offline_subprocess_env, cwd=hermetic_home)assert result.returncode == 0, (- f"Gateway img-gen dry-run with primed cache must succeed offline.\nstdout={result.stdout!r}\nstderr={result.stderr!r}"+ f"Manifold img-gen dry-run with primed cache must succeed offline.\nstdout={result.stdout!r}\nstderr={result.stderr!r}")payload = _parse_agent_json(result.stdout)assert "error" not in payload, payload- def test_gateway_unknown_with_cache_fails_with_clear_error(self, hermetic_home: Path, offline_subprocess_env: dict[str, str]) -> None:- """Bundle pipe references a model absent from the cached gateway specs → clear error.+ def test_manifold_unknown_with_cache_fails_with_clear_error(self, hermetic_home: Path, offline_subprocess_env: dict[str, str]) -> None:+ """Bundle pipe references a model absent from the cached manifold specs → clear error.- The default kit deck only references "known" gateway handles, so this scenario fires+ The default kit deck only references "known" manifold handles, so this scenario firesat the pipe-operator layer (the membership check at ``ModelManager.setup`` looks atdeck presets/choice defaults, not raw per-pipe model strings). Either way the agentCLI must surface a structured error with the unknown handle visible — that is theuser-facing contract."""pipelex_dir = hermetic_home / ".pipelex"- set_gateway_enabled(pipelex_dir / "inference" / "backends.toml", enabled=True)+ set_manifold_enabled(pipelex_dir / "inference" / "backends.toml", enabled=True)+ write_active_routing_profile(pipelex_dir / "inference" / "routing_profiles.toml", "all_pipelex_manifold")write_remote_config_cache(pipelex_dir, _cached_remote_config_payload())- staged_bundle = _stage_bundle(OFFLINE_BUNDLES_DIR / "gateway_unknown_model", hermetic_home)+ staged_bundle = _stage_bundle(OFFLINE_BUNDLES_DIR / "manifold_unknown_model", hermetic_home)result = _run_agent_bundle(staged_bundle, offline_subprocess_env, cwd=hermetic_home)assert result.returncode != 0, f"Unknown-model bundle must fail.\nstdout={result.stdout!r}\nstderr={result.stderr!r}"diff --git a/tests/e2e/data/offline_mode/byok_simple/byok_simple.mthds b/tests/e2e/data/offline_mode/byok_simple/byok_simple.mthdsindex 01e437a3c..3e938d9c0 100644--- a/tests/e2e/data/offline_mode/byok_simple/byok_simple.mthds+++ b/tests/e2e/data/offline_mode/byok_simple/byok_simple.mthds@@ -5,7 +5,7 @@ main_pipe = "byok_simple_pipe"[pipe][pipe.byok_simple_pipe]type = "PipeLLM"-description = "Single LLM step using a non-gateway backend model handle"+description = "Single LLM step using a BYOK backend model handle"inputs = { topic = "Text" }output = "Text"model = "claude-4.5-haiku"diff --git a/tests/e2e/data/offline_mode/gateway_img_gen_model/gateway_img_gen_model.mthds b/tests/e2e/data/offline_mode/gateway_img_gen_model/gateway_img_gen_model.mthdsdeleted file mode 100644index 6ebb1dc6f..000000000--- a/tests/e2e/data/offline_mode/gateway_img_gen_model/gateway_img_gen_model.mthds+++ /dev/null@@ -1,11 +0,0 @@-domain = "offline_gateway_img_gen"-description = "Pipeline referencing a gateway image-generation model that exists in the cached gateway specs"-main_pipe = "gateway_img_gen_pipe"--[pipe]-[pipe.gateway_img_gen_pipe]-type = "PipeImgGen"-description = "Single image-generation step using a gateway-listed image model handle"-output = "Image"-model = "gpt-image-2"-prompt = "A single red circle on a white background."diff --git a/tests/e2e/data/offline_mode/gateway_known_model/gateway_known_model.mthds b/tests/e2e/data/offline_mode/gateway_known_model/gateway_known_model.mthdsdeleted file mode 100644index 06373a7f4..000000000--- a/tests/e2e/data/offline_mode/gateway_known_model/gateway_known_model.mthds+++ /dev/null@@ -1,12 +0,0 @@-domain = "offline_gateway_known"-description = "Pipeline referencing a gateway model that exists in the cached gateway specs"-main_pipe = "gateway_known_pipe"--[pipe]-[pipe.gateway_known_pipe]-type = "PipeLLM"-description = "Single LLM step using a gateway-listed model handle"-inputs = { topic = "Text" }-output = "Text"-model = "gpt-5.6-luna"-prompt = "Write a single sentence about $topic.text."diff --git a/tests/e2e/data/offline_mode/gateway_unknown_model/gateway_unknown_model.mthds b/tests/e2e/data/offline_mode/gateway_unknown_model/gateway_unknown_model.mthdsdeleted file mode 100644index 05b52e7fa..000000000--- a/tests/e2e/data/offline_mode/gateway_unknown_model/gateway_unknown_model.mthds+++ /dev/null@@ -1,12 +0,0 @@-domain = "offline_gateway_unknown"-description = "Pipeline referencing a gateway model that does NOT exist in the cached gateway specs"-main_pipe = "gateway_unknown_pipe"--[pipe]-[pipe.gateway_unknown_pipe]-type = "PipeLLM"-description = "Single LLM step using a gateway model handle that is intentionally absent from the test fixture"-inputs = { topic = "Text" }-output = "Text"-model = "gpt-future-fake-99"-prompt = "Write a single sentence about $topic.text."diff --git a/tests/e2e/data/offline_mode/manifold_img_gen_model/manifold_img_gen_model.mthds b/tests/e2e/data/offline_mode/manifold_img_gen_model/manifold_img_gen_model.mthdsnew file mode 100644index 000000000..5aca77c1a--- /dev/null+++ b/tests/e2e/data/offline_mode/manifold_img_gen_model/manifold_img_gen_model.mthds@@ -0,0 +1,11 @@+domain = "offline_manifold_img_gen"+description = "Pipeline referencing a manifold image-generation model that exists in the cached manifold specs"+main_pipe = "manifold_img_gen_pipe"++[pipe]+[pipe.manifold_img_gen_pipe]+type = "PipeImgGen"+description = "Single image-generation step using a manifold-listed image model handle"+output = "Image"+model = "gpt-image-2"+prompt = "A single red circle on a white background."diff --git a/tests/e2e/data/offline_mode/manifold_known_model/manifold_known_model.mthds b/tests/e2e/data/offline_mode/manifold_known_model/manifold_known_model.mthdsnew file mode 100644index 000000000..e7bbbdaea--- /dev/null+++ b/tests/e2e/data/offline_mode/manifold_known_model/manifold_known_model.mthds@@ -0,0 +1,12 @@+domain = "offline_manifold_known"+description = "Pipeline referencing a manifold model that exists in the cached manifold specs"+main_pipe = "manifold_known_pipe"++[pipe]+[pipe.manifold_known_pipe]+type = "PipeLLM"+description = "Single LLM step using a manifold-listed model handle"+inputs = { topic = "Text" }+output = "Text"+model = "gpt-5.6-luna"+prompt = "Write a single sentence about $topic.text."diff --git a/tests/e2e/data/offline_mode/manifold_unknown_model/manifold_unknown_model.mthds b/tests/e2e/data/offline_mode/manifold_unknown_model/manifold_unknown_model.mthdsnew file mode 100644index 000000000..60efe9ae0--- /dev/null+++ b/tests/e2e/data/offline_mode/manifold_unknown_model/manifold_unknown_model.mthds@@ -0,0 +1,12 @@+domain = "offline_manifold_unknown"+description = "Pipeline referencing a manifold model that does NOT exist in the cached manifold specs"+main_pipe = "manifold_unknown_pipe"++[pipe]+[pipe.manifold_unknown_pipe]+type = "PipeLLM"+description = "Single LLM step using a manifold model handle that is intentionally absent from the test fixture"+inputs = { topic = "Text" }+output = "Text"+model = "gpt-future-fake-99"+prompt = "Write a single sentence about $topic.text."diff --git a/tests/e2e/pipelex/cli/test_fix_bundle_cmd.py b/tests/e2e/pipelex/cli/test_fix_bundle_cmd.pyindex e604109ad..3b206658c 100644--- a/tests/e2e/pipelex/cli/test_fix_bundle_cmd.py+++ b/tests/e2e/pipelex/cli/test_fix_bundle_cmd.py@@ -12,7 +12,7 @@ from typing import TYPE_CHECKINGimport pytest-from tests.e2e.agent_cli.conftest import REPO_ROOT, set_gateway_enabled+from tests.e2e.agent_cli.conftest import REPO_ROOT, set_manifold_enabledif TYPE_CHECKING:from pathlib import Path@@ -80,7 +80,7 @@ class TestFixBundleHumanE2E:offline_subprocess_env: dict[str, str],) -> None:pipelex_dir = hermetic_home / ".pipelex"- set_gateway_enabled(pipelex_dir / "inference" / "backends.toml", enabled=False)+ set_manifold_enabled(pipelex_dir / "inference" / "backends.toml", enabled=False)bundle_path = hermetic_home / "bundle.mthds"bundle_path.write_text(_FIXABLE_SEQUENCE_MTHDS, encoding="utf-8")@@ -97,7 +97,7 @@ class TestFixBundleHumanE2E:offline_subprocess_env: dict[str, str],) -> None:pipelex_dir = hermetic_home / ".pipelex"- set_gateway_enabled(pipelex_dir / "inference" / "backends.toml", enabled=False)+ set_manifold_enabled(pipelex_dir / "inference" / "backends.toml", enabled=False)bundle_path = hermetic_home / "bundle.mthds"bundle_path.write_text(_UNFIXABLE_MTHDS, encoding="utf-8")diff --git a/tests/e2e/pipelex/cli/test_init_cmd_edge_cases.py b/tests/e2e/pipelex/cli/test_init_cmd_edge_cases.pyindex 7108767de..f9b6fb630 100644--- a/tests/e2e/pipelex/cli/test_init_cmd_edge_cases.py+++ b/tests/e2e/pipelex/cli/test_init_cmd_edge_cases.py@@ -5,8 +5,6 @@ from typing import TYPE_CHECKINGfrom pipelex.cli.commands.init.command import init_cmdfrom pipelex.cli.commands.init.ui.types import InitFocus-from pipelex.cogt.model_backends.backend import PipelexBackend-from pipelex.cogt.model_routing.routing_profile import PipelexRoutingProfilefrom pipelex.kit.paths import get_kit_configs_dirfrom pipelex.tools.misc.toml_utils import load_toml_with_tomlkit, save_toml_to_pathfrom tests.helpers.init_cmd_helpers import MockedInitEnvironment, get_backend_indices_helper@@ -16,30 +14,6 @@ if TYPE_CHECKING:class TestEdgeCases:- def test_pipelex_gateway_sets_all_pipelex_gateway(self, tmp_path: Path, mocker: MockerFixture) -> None:- """Test Case 9.1: pipelex_gateway always sets all_pipelex_gateway."""- # Setup environment- env = MockedInitEnvironment(tmp_path, mocker)- env.setup_empty_dir()-- # Get indices for pipelex_gateway and openai- kit_backends = Path(str(get_kit_configs_dir())) / "inference" / "backends.toml"- indices = get_backend_indices_helper(str(kit_backends), [PipelexBackend.GATEWAY, "openai"])- indices_str = ",".join(str(i) for i in indices)-- # User inputs - no primary/fallback prompts expected- env.add_confirm_input(True) # Confirm initialization- env.add_confirm_input(True) # Accept gateway terms of service- env.add_prompt_input(indices_str) # Select pipelex_gateway and openai-- env.setup_mocks()-- # Execute- init_cmd(focus=InitFocus.ALL)-- # Verify all_pipelex_gateway is set automatically- env.verify_routing(PipelexRoutingProfile.ALL_PIPELEX_GATEWAY)-def test_single_non_pipelex_backend(self, tmp_path: Path, mocker: MockerFixture) -> None:"""Test Case 9.2: Single non-pipelex backend."""# Setup environment@@ -96,7 +70,7 @@ class TestEdgeCases:# Set initial statebackends_path = env.inference_dir / "backends.toml"toml_doc = load_toml_with_tomlkit(str(backends_path))- toml_doc[PipelexBackend.GATEWAY]["enabled"] = True # type: ignore[index]+ toml_doc["openrouter"]["enabled"] = True # type: ignore[index]save_toml_to_path(toml_doc, path=str(backends_path))telemetry_path = env.pipelex_dir / "telemetry.toml"@@ -151,7 +125,7 @@ class TestEdgeCases:assert toml_doc["mistral"]["enabled"] is True # type: ignore[index]# Non-selected backends should be disabled- assert toml_doc[PipelexBackend.GATEWAY]["enabled"] is False # type: ignore[index]+ assert toml_doc["openrouter"]["enabled"] is False # type: ignore[index]assert toml_doc["anthropic"]["enabled"] is False # type: ignore[index]# Internal backend should be enableddiff --git a/tests/e2e/pipelex/cli/test_init_cmd_first_time.py b/tests/e2e/pipelex/cli/test_init_cmd_first_time.pyindex 88d866d99..65c9e738d 100644--- a/tests/e2e/pipelex/cli/test_init_cmd_first_time.py+++ b/tests/e2e/pipelex/cli/test_init_cmd_first_time.py@@ -7,9 +7,8 @@ import pytestimport typerfrom pipelex.cli.commands.init.command import init_cmd+from pipelex.cli.commands.init.ui.backends_ui import RECOMMENDED_INIT_BACKENDfrom pipelex.cli.commands.init.ui.types import InitFocus-from pipelex.cogt.model_backends.backend import PipelexBackend-from pipelex.cogt.model_routing.routing_profile import PipelexRoutingProfilefrom pipelex.kit.paths import get_kit_configs_dirfrom pipelex.tools.misc.toml_utils import load_toml_with_tomlkitfrom tests.helpers.init_cmd_helpers import MockedInitEnvironment, get_backend_indices_helper@@ -25,10 +24,9 @@ class TestFirstTimeInitialization:env = MockedInitEnvironment(tmp_path, mocker)env.setup_empty_dir()- # User inputs: confirm init, default backend (1), accept gateway terms+ # User inputs: confirm init, recommended default backendenv.add_confirm_input(True) # Confirm initialization- env.add_confirm_input(True) # Accept gateway terms of service- env.add_prompt_input("1") # Default: pipelex_gateway+ env.add_prompt_input("") # Empty = the recommended defaultenv.setup_mocks()@@ -40,8 +38,8 @@ class TestFirstTimeInitialization:env.verify_file_exists("inference/backends.toml")env.verify_file_exists("inference/routing_profiles.toml")env.verify_file_exists("telemetry.toml")- env.verify_backends_enabled([PipelexBackend.GATEWAY])- env.verify_routing(PipelexRoutingProfile.ALL_PIPELEX_GATEWAY)+ env.verify_backends_enabled([RECOMMENDED_INIT_BACKEND])+ env.verify_routing(f"all_{RECOMMENDED_INIT_BACKEND}")env.verify_telemetry("off")def test_init_with_multiple_backends_and_routing(self, tmp_path: Path, mocker: MockerFixture) -> None:@@ -83,8 +81,9 @@ class TestFirstTimeInitialization:# User inputsenv.add_confirm_input(True) # Confirm initialization- env.add_confirm_input(True) # Accept gateway terms of service (since all includes gateway)env.add_prompt_input("all") # Select all backends+ env.add_prompt_input("1") # Primary backend: the first listed+ env.add_prompt_input("") # Accept the default fallback orderenv.setup_mocks()@@ -97,8 +96,9 @@ class TestFirstTimeInitialization:if backend_key != "internal":assert toml_doc[backend_key]["enabled"] is True # type: ignore[index]- # Verify routing (all_pipelex_gateway since pipelex_gateway is included)- env.verify_routing(PipelexRoutingProfile.ALL_PIPELEX_GATEWAY)+ # Verify routing: several backends selected, so a custom profile led by the first one+ first_backend = next(key for key in toml_doc if key != "internal")+ env.verify_routing("custom_routing", expected_default=first_backend)def test_cancel_at_backend_selection(self, tmp_path: Path, mocker: MockerFixture) -> None:"""Test Case 1.4: Cancel at backend selection."""@@ -122,9 +122,9 @@ class TestFirstTimeInitialization:# Verify config files were created but backends remain in template stateenv.verify_file_exists("inference/backends.toml")- # Verify pipelex_gateway is still enabled (default template state)+ # Verify the template state is untouched (every shipped BYOK backend enabled)toml_doc = load_toml_with_tomlkit(str(env.inference_dir / "backends.toml"))- assert toml_doc[PipelexBackend.GATEWAY]["enabled"] is True # type: ignore[index]+ assert toml_doc["openai"]["enabled"] is True # type: ignore[index]def test_cancel_at_initialization_confirmation(self, tmp_path: Path, mocker: MockerFixture) -> None:"""Test Case 1.5: Cancel at initialization confirmation."""diff --git a/tests/e2e/pipelex/cli/test_init_cmd_focused.py b/tests/e2e/pipelex/cli/test_init_cmd_focused.pyindex ae719e915..25a0e2cf2 100644--- a/tests/e2e/pipelex/cli/test_init_cmd_focused.py+++ b/tests/e2e/pipelex/cli/test_init_cmd_focused.py@@ -6,7 +6,6 @@ from typing import TYPE_CHECKINGfrom pipelex.cli.commands.init.command import init_cmdfrom pipelex.cli.commands.init.ui.types import InitFocusfrom pipelex.cogt.model_backends.backend import PipelexBackend-from pipelex.cogt.model_routing.routing_profile import PipelexRoutingProfilefrom pipelex.kit.paths import get_kit_configs_dirfrom pipelex.tools.misc.toml_utils import load_toml_with_tomlkit, save_toml_to_pathfrom tests.helpers.init_cmd_helpers import MockedInitEnvironment, get_backend_indices_helper@@ -24,8 +23,7 @@ class TestFocusedInitialization:# User inputsenv.add_confirm_input(True) # Confirm initialization- env.add_confirm_input(True) # Accept gateway terms of service- env.add_prompt_input("1") # Backend selection (pipelex_gateway)+ env.add_prompt_input("") # Backend selection: the recommended defaultenv.setup_mocks()@@ -72,10 +70,10 @@ class TestFocusedInitialization:env = MockedInitEnvironment(tmp_path, mocker)env.setup_with_configs(include_backends=True, include_routing=True, include_telemetry=True)- # Set pipelex_gateway as initially enabled+ # Set openrouter as initially enabledbackends_path = env.inference_dir / "backends.toml"toml_doc = load_toml_with_tomlkit(str(backends_path))- toml_doc[PipelexBackend.GATEWAY]["enabled"] = True # type: ignore[index]+ toml_doc["openrouter"]["enabled"] = True # type: ignore[index]save_toml_to_path(toml_doc, path=str(backends_path))# Get index for mistral@@ -198,19 +196,19 @@ class TestFocusedInitialization:# After reconfigure, telemetry should be reset to default (off)env.verify_telemetry("off")- def test_reset_routing_with_pipelex_gateway(self, tmp_path: Path, mocker: MockerFixture) -> None:- """Test Case: Reset routing when only pipelex_gateway is enabled (bug fix test)."""- # Setup environment with existing config and pipelex_gateway enabled+ def test_reset_routing_with_pipelex_manifold(self, tmp_path: Path, mocker: MockerFixture) -> None:+ """Test Case: Reset routing when only pipelex_manifold is enabled (bug fix test)."""+ # Setup environment with existing config and pipelex_manifold enabledenv = MockedInitEnvironment(tmp_path, mocker)env.setup_with_configs(include_backends=True, include_routing=True, include_telemetry=True)- # Enable only pipelex_gateway (disable everything else)+ # Enable only pipelex_manifold (disable everything else)backends_path = env.inference_dir / "backends.toml"toml_doc = load_toml_with_tomlkit(str(backends_path))for backend_key in toml_doc:if backend_key == "internal":continue- toml_doc[backend_key]["enabled"] = backend_key == PipelexBackend.GATEWAY # type: ignore[index]+ toml_doc[backend_key]["enabled"] = backend_key == PipelexBackend.MANIFOLD # type: ignore[index]save_toml_to_path(toml_doc, path=str(backends_path))# Modify routing to have wrong config (simulating the bug scenario)@@ -227,8 +225,8 @@ class TestFocusedInitialization:# Execute with ROUTING focus and reset flaginit_cmd(focus=InitFocus.ROUTING)- # Verify routing was reset to all_pipelex_gateway (correct for pipelex_gateway)- env.verify_routing(PipelexRoutingProfile.ALL_PIPELEX_GATEWAY)+ # Verify routing was reset to all_pipelex_manifold (correct for a single enabled backend)+ env.verify_routing(f"all_{PipelexBackend.MANIFOLD}")def test_everything_already_configured(self, tmp_path: Path, mocker: MockerFixture) -> None:"""Test Case 7.1: Everything configured - decline reconfigure."""diff --git a/tests/e2e/pipelex/cli/test_init_cmd_validation.py b/tests/e2e/pipelex/cli/test_init_cmd_validation.pyindex ea7f514d3..b9514cc4b 100644--- a/tests/e2e/pipelex/cli/test_init_cmd_validation.py+++ b/tests/e2e/pipelex/cli/test_init_cmd_validation.py@@ -4,8 +4,8 @@ from pathlib import Pathfrom typing import TYPE_CHECKINGfrom pipelex.cli.commands.init.command import init_cmd+from pipelex.cli.commands.init.ui.backends_ui import RECOMMENDED_INIT_BACKENDfrom pipelex.cli.commands.init.ui.types import InitFocus-from pipelex.cogt.model_backends.backend import PipelexBackendfrom pipelex.kit.paths import get_kit_configs_dirfrom tests.helpers.init_cmd_helpers import MockedInitEnvironment, get_backend_indices_helper@@ -22,9 +22,8 @@ class TestInputValidation:# User inputs: invalid index, then validenv.add_confirm_input(True) # Confirm initialization- env.add_confirm_input(True) # Accept gateway terms of serviceenv.add_prompt_input("99") # Invalid index- env.add_prompt_input("1") # Valid: pipelex_gateway+ env.add_prompt_input("") # Valid: the recommended defaultenv.setup_mocks()@@ -32,7 +31,7 @@ class TestInputValidation:init_cmd(focus=InitFocus.ALL)# Verify successful completion with valid selection- env.verify_backends_enabled([PipelexBackend.GATEWAY])+ env.verify_backends_enabled([RECOMMENDED_INIT_BACKEND])def test_invalid_non_numeric_input_then_valid(self, tmp_path: Path, mocker: MockerFixture) -> None:"""Test Case 8.2: Non-numeric input, then valid."""@@ -42,9 +41,8 @@ class TestInputValidation:# User inputsenv.add_confirm_input(True) # Confirm initialization- env.add_confirm_input(True) # Accept gateway terms of serviceenv.add_prompt_input("abc") # Invalid non-numeric- env.add_prompt_input("1") # Valid: pipelex_gateway+ env.add_prompt_input("") # Valid: the recommended defaultenv.setup_mocks()@@ -52,7 +50,7 @@ class TestInputValidation:init_cmd(focus=InitFocus.ALL)# Verify successful completion- env.verify_backends_enabled([PipelexBackend.GATEWAY])+ env.verify_backends_enabled([RECOMMENDED_INIT_BACKEND])def test_space_separated_backend_indices(self, tmp_path: Path, mocker: MockerFixture) -> None:"""Test Case 8.3: Space-separated backend indices."""@@ -87,8 +85,7 @@ class TestInputValidation:# User inputs: empty string for defaultenv.add_confirm_input(True) # Confirm initialization- env.add_confirm_input(True) # Accept gateway terms of service- env.add_prompt_input("") # Empty = default (pipelex_gateway)+ env.add_prompt_input("") # Empty = the recommended defaultenv.setup_mocks()@@ -96,7 +93,7 @@ class TestInputValidation:init_cmd(focus=InitFocus.ALL)# Verify default backend is selected- env.verify_backends_enabled([PipelexBackend.GATEWAY])+ env.verify_backends_enabled([RECOMMENDED_INIT_BACKEND])def test_invalid_fallback_order_wrong_count(self, tmp_path: Path, mocker: MockerFixture) -> None:"""Test Case 8.7: Invalid fallback order - wrong count."""diff --git a/tests/e2e/pipelex/cli/test_migrate_commands.py b/tests/e2e/pipelex/cli/test_migrate_commands.pyindex 4e2a760eb..5fc4016ff 100644--- a/tests/e2e/pipelex/cli/test_migrate_commands.py+++ b/tests/e2e/pipelex/cli/test_migrate_commands.py@@ -1151,7 +1151,7 @@ class TestAStaleBackendDirectory:Everything else in this module is planted on a file that sits *directly* in a configurationdirectory. These files do not: they are the reason the walk learned to enter a subdirectory atall, and the reason a file is claimed by `(directory, name)` rather than by name — the kit ships- a `pipelex_gateway.toml` in there, which the main configuration's `pipelex_*.toml` glob would+ a `pipelex_manifold.toml` in there, which the main configuration's `pipelex_*.toml` glob wouldotherwise have claimed. It is present here for that reason, untouched, and the assertions say so.What a boot *says* is not asserted here and cannot be: the probe is `pipelex-agent`, which cuts@@ -1163,7 +1163,7 @@ class TestAStaleBackendDirectory:"""Everything in and beside the directory that no migration may rewrite.Excluded by name rather than by extension, and the difference is the whole point of this- class: the kit ships `pipelex_gateway.toml` in this directory, which the main configuration's+ class: the kit ships `pipelex_manifold.toml` in this directory, which the main configuration's`pipelex_*.toml` glob would claim by name alone, so it is the one file a walk that forgotabout directories would rewrite. An extension filter dropped it — and every other `.toml` inhere — out of the snapshot, leaving the class's own claim unasserted. Only the files thediff --git a/tests/helpers/init_cmd_helpers.py b/tests/helpers/init_cmd_helpers.pyindex dee8e3022..dcbdfdcaa 100644--- a/tests/helpers/init_cmd_helpers.py+++ b/tests/helpers/init_cmd_helpers.py@@ -253,6 +253,10 @@ class MockedInitEnvironment:# Mock prompt_credentials to avoid env-dependent Prompt.ask calls for missing API keysself.mocker.patch("pipelex.cli.commands.init.command.prompt_credentials")+ # The IDE extension suggestion asks to install into the editor it finds on this machine, so it would+ # consume a queued answer and install into the real editor wherever the extension is missing+ self.mocker.patch("pipelex.cli.commands.init.backends.suggest_extension_install_if_needed")+def get_backend_indices(self, backend_names: list[str]) -> list[int]:"""Get 1-based indices for backend names.diff --git a/tests/integration/pipelex/cli/commands/init/test_cache_priming.py b/tests/integration/pipelex/cli/commands/init/test_cache_priming.pyindex 868aceab0..4ee5a2c50 100644--- a/tests/integration/pipelex/cli/commands/init/test_cache_priming.py+++ b/tests/integration/pipelex/cli/commands/init/test_cache_priming.py@@ -2,8 +2,8 @@These tests pin the helper's behaviour:-- When the gateway is enabled and terms are accepted, a successful online fetch persists- the raw payload to ``~/.pipelex/cache/remote_config.json`` (priming).+- When a managed gateway backend is enabled, a successful online fetch persists the raw payload+ to ``~/.pipelex/cache/remote_config.json`` (priming).- When offline at init time, priming logs a yellow warning and continues — the cache staysempty, the user has been told, init does not crash.- When no managed gateway backend is enabled in ``backends.toml``, priming is a no-op (BYOK setups@@ -14,7 +14,6 @@ These tests pin the helper's behaviour:from __future__ import annotationsimport json-from datetime import UTC, datetimefrom pathlib import Path # ruff: ignore[typing-only-standard-library-import] — referenced by pytest fixture type hints at runtimefrom typing import TYPE_CHECKING@@ -23,16 +22,9 @@ import pytestfrom rich.console import Consolefrom pipelex.cli.commands.init.command import prime_remote_config_cache-from pipelex.cogt.model_backends.backend import LEGACY_GATEWAY_MODEL_SPECS_SECTION, MANIFOLD_MODEL_SPECS_SECTION, PipelexBackend+from pipelex.cogt.model_backends.backend import MANIFOLD_MODEL_SPECS_SECTION, PipelexBackendfrom pipelex.system.configuration.config_loader import ConfigLoader-from pipelex.system.pipelex_service.pipelex_service_agreement import (- PipelexServiceAgreement,- PipelexServiceOnboarding,-)-from pipelex.system.pipelex_service.pipelex_service_config import PipelexServiceConfigfrom pipelex.system.pipelex_service.remote_config_cache import (- CACHE_SCHEMA_VERSION,- CachedRemoteConfig,RemoteConfigCache,)from pipelex.system.pipelex_service.remote_config_fetcher import RemoteConfigFetcher@@ -43,7 +35,7 @@ if TYPE_CHECKING:from pytest_mock import MockerFixtureINIT_COMMAND_MODULE = "pipelex.cli.commands.init.command"-GATEWAY_ONLY_SECTIONS = {PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION}+MANIFOLD_ONLY_SECTIONS = {PipelexBackend.MANIFOLD: MANIFOLD_MODEL_SPECS_SECTION}# Capture the unpatched classmethod at module import — the session conftest replaces# ``fetch_remote_config`` with a cache shim that bypasses ``httpx``. We need the real@@ -51,43 +43,23 @@ GATEWAY_ONLY_SECTIONS = {PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECT_ORIGINAL_FETCH_REMOTE_CONFIG = RemoteConfigFetcher.fetch_remote_config-def _accepted_service_config() -> PipelexServiceConfig:- return PipelexServiceConfig(- agreement=PipelexServiceAgreement(terms_accepted=True),- onboarding=PipelexServiceOnboarding(inference_setup_completed=True),- )--def _fake_remote_payload() -> dict[str, object]:"""Minimal valid payload for ``RemoteConfig.model_validate``."""return {- "posthog": {- "project_api_key": "test-key",- "endpoint": "https://example.invalid",- "is_geoip_enabled": False,- "is_debug_enabled": False,- },- "backend_model_specs": {},+ MANIFOLD_MODEL_SPECS_SECTION: {},"aws_region": "us-east-1",}-def _store_malformed_cache(remote_config_payload: dict[str, object]) -> None:- """Drop-in for ``RemoteConfigCache.store`` that writes a structurally valid cache *wrapper*- whose inner ``raw_config`` does NOT validate as a ``RemoteConfig``.+def _store_unreadable_cache(remote_config_payload: dict[str, object]) -> None:+ """Drop-in for ``RemoteConfigCache.store`` that writes a cache file ``RemoteConfigCache.load()`` cannot read back.- Reproduces the case where ``RemoteConfigCache.load()`` succeeds (the wrapper is fine) but the- cached payload is unusable for offline runs.+ Reproduces a write that lands on disk without raising yet leaves nothing an offline run can use."""- del remote_config_payload # intentionally discarded — we write a deliberately broken payload- cached = CachedRemoteConfig(- schema_version=CACHE_SCHEMA_VERSION,- cached_at=datetime.now(tz=UTC),- raw_config={},- )+ del remote_config_payload # intentionally discarded — we write a deliberately broken filecache_path = RemoteConfigCache.cache_path()cache_path.parent.mkdir(parents=True, exist_ok=True)- cache_path.write_text(cached.model_dump_json(), encoding="utf-8")+ cache_path.write_text("{not json", encoding="utf-8")def _make_httpx_response(payload: dict[str, object]) -> httpx.Response:@@ -130,12 +102,8 @@ def _layered_or_pinned(layered_backends: Path) -> Callable[..., list[Path]]:class TestCachePriming:@pytest.mark.usefixtures("isolated_cache_dir")def test_init_primes_cache_when_online(self, mocker: MockerFixture) -> None:- """Gateway enabled + terms accepted + online → cache file written under the global dir."""- mocker.patch(f"{INIT_COMMAND_MODULE}.enabled_managed_gateway_sections", return_value=GATEWAY_ONLY_SECTIONS)- mocker.patch(- f"{INIT_COMMAND_MODULE}.load_pipelex_service_config_if_exists",- return_value=_accepted_service_config(),- )+ """Managed gateway enabled + online → cache file written under the global dir."""+ mocker.patch(f"{INIT_COMMAND_MODULE}.enabled_managed_gateway_sections", return_value=MANIFOLD_ONLY_SECTIONS)mocker.patch("pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",new_callable=mocker.PropertyMock,@@ -154,12 +122,8 @@ class TestCachePriming:@pytest.mark.usefixtures("isolated_cache_dir")def test_init_warns_when_offline(self, mocker: MockerFixture) -> None:- """Gateway enabled + terms accepted + offline + no cache → warn, do not crash, no cache file."""- mocker.patch(f"{INIT_COMMAND_MODULE}.enabled_managed_gateway_sections", return_value=GATEWAY_ONLY_SECTIONS)- mocker.patch(- f"{INIT_COMMAND_MODULE}.load_pipelex_service_config_if_exists",- return_value=_accepted_service_config(),- )+ """Managed gateway enabled + offline + no cache → warn, do not crash, no cache file."""+ mocker.patch(f"{INIT_COMMAND_MODULE}.enabled_managed_gateway_sections", return_value=MANIFOLD_ONLY_SECTIONS)mocker.patch("pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",new_callable=mocker.PropertyMock,@@ -179,7 +143,7 @@ class TestCachePriming:assert "yellow" in printed.lower(), f"priming offline must print a yellow warning; got: {printed!r}"@pytest.mark.usefixtures("isolated_cache_dir")- def test_init_skips_priming_when_gateway_disabled(self, mocker: MockerFixture) -> None:+ def test_init_skips_priming_when_no_managed_gateway_is_enabled(self, mocker: MockerFixture) -> None:"""No managed gateway backend enabled → priming is a no-op (no fetch, no cache write)."""mocker.patch(f"{INIT_COMMAND_MODULE}.enabled_managed_gateway_sections", return_value={})fetch_spy = mocker.spy(RemoteConfigFetcher, "fetch_remote_config")@@ -188,9 +152,9 @@ class TestCachePriming:console = mocker.create_autospec(Console, instance=True)prime_remote_config_cache(console=console)- assert fetch_spy.call_count == 0, "priming must not invoke the fetcher when gateway is disabled"- assert httpx_get_mock.call_count == 0, "priming must not hit the network when gateway is disabled"- assert not RemoteConfigCache.cache_path().exists(), "no cache should be written when gateway is disabled"+ assert fetch_spy.call_count == 0, "priming must not invoke the fetcher when no managed gateway is enabled"+ assert httpx_get_mock.call_count == 0, "priming must not hit the network when no managed gateway is enabled"+ assert not RemoteConfigCache.cache_path().exists(), "no cache should be written when no managed gateway is enabled"@pytest.mark.usefixtures("isolated_cache_dir")def test_init_warns_when_offline_with_stale_cache_present(self, mocker: MockerFixture) -> None:@@ -206,11 +170,7 @@ class TestCachePriming:cache_path = RemoteConfigCache.cache_path()stale_on_disk_before = json.loads(cache_path.read_text(encoding="utf-8"))- mocker.patch(f"{INIT_COMMAND_MODULE}.enabled_managed_gateway_sections", return_value=GATEWAY_ONLY_SECTIONS)- mocker.patch(- f"{INIT_COMMAND_MODULE}.load_pipelex_service_config_if_exists",- return_value=_accepted_service_config(),- )+ mocker.patch(f"{INIT_COMMAND_MODULE}.enabled_managed_gateway_sections", return_value=MANIFOLD_ONLY_SECTIONS)mocker.patch("pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",new_callable=mocker.PropertyMock,@@ -235,31 +195,32 @@ class TestCachePriming:resolves to first.Setup:- - layered ``backends.toml`` (default ``config_manager.backends_file_paths()``) has gateway DISABLED.- - target_config_dir's ``backends.toml`` has gateway ENABLED.+ - layered ``backends.toml`` (default ``config_manager.backends_file_paths()``) has the manifold DISABLED.+ - target_config_dir's ``backends.toml`` has the manifold ENABLED.- Expected: priming runs (gateway enabled at the target). Without the fix, the helper+ Expected: priming runs (managed gateway enabled at the target). Without the fix, the helperwould consult the layered file and skip priming entirely."""- # Layered config says gateway is disabled — without the fix, this is what gets read.+ # Layered config says the manifold is disabled — without the fix, this is what gets read.layered_dir = tmp_path / "layered_dir"layered_backends = layered_dir / "inference" / "backends.toml"layered_backends.parent.mkdir(parents=True, exist_ok=True)- layered_backends.write_text("[pipelex_gateway]\nenabled = false\n", encoding="utf-8")+ layered_backends.write_text(+ f"[pipelex_manifold]\nenabled = false\nmodel_specs_section = {MANIFOLD_MODEL_SPECS_SECTION!r}\n",+ encoding="utf-8",+ )mocker.patch.object(ConfigLoader, "backends_file_paths", side_effect=_layered_or_pinned(layered_backends))- # Target init dir says gateway IS enabled. The priming helper must read THIS file.+ # Target init dir says the manifold IS enabled. The priming helper must read THIS file.target_dir = tmp_path / "target_dir"target_backends = target_dir / "inference" / "backends.toml"target_backends.parent.mkdir(parents=True, exist_ok=True)- target_backends.write_text("[pipelex_gateway]\nenabled = true\n", encoding="utf-8")-- # Terms-accepted check still consults the global pipelex_service.toml — keep that mocked- # as before. Make the fetcher succeed so we can assert the cache is actually written.- mocker.patch(- f"{INIT_COMMAND_MODULE}.load_pipelex_service_config_if_exists",- return_value=_accepted_service_config(),+ target_backends.write_text(+ f"[pipelex_manifold]\nenabled = true\nmodel_specs_section = {MANIFOLD_MODEL_SPECS_SECTION!r}\n",+ encoding="utf-8",)++ # Make the fetcher succeed so we can assert the cache is actually written.mocker.patch("pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",new_callable=mocker.PropertyMock,@@ -272,29 +233,35 @@ class TestCachePriming:prime_remote_config_cache(console=console, target_config_dir=target_dir)assert RemoteConfigCache.cache_path().exists(), (- "priming must run (and write the cache) when the TARGET backends.toml has gateway "+ "priming must run (and write the cache) when the TARGET backends.toml has the manifold ""enabled, even if the layered backends.toml says otherwise")@pytest.mark.usefixtures("isolated_cache_dir")- def test_priming_skips_when_target_dir_says_gateway_disabled(self, mocker: MockerFixture, tmp_path: Path) -> None:- """Inverse of the above: target says gateway disabled, layered says enabled → skip.+ def test_priming_skips_when_target_dir_says_manifold_disabled(self, mocker: MockerFixture, tmp_path: Path) -> None:+ """Inverse of the above: target says the manifold is disabled, layered says enabled → skip.Without the fix, the helper would see the layered "enabled" file, try to fetch, andwrite a cache the user did not opt in to. We assert no fetch attempt and no cache file."""- # Layered says gateway enabled — without the fix, this is what gets read.+ # Layered says the manifold is enabled — without the fix, this is what gets read.layered_dir = tmp_path / "layered_dir"layered_backends = layered_dir / "inference" / "backends.toml"layered_backends.parent.mkdir(parents=True, exist_ok=True)- layered_backends.write_text("[pipelex_gateway]\nenabled = true\n", encoding="utf-8")+ layered_backends.write_text(+ f"[pipelex_manifold]\nenabled = true\nmodel_specs_section = {MANIFOLD_MODEL_SPECS_SECTION!r}\n",+ encoding="utf-8",+ )mocker.patch.object(ConfigLoader, "backends_file_paths", side_effect=_layered_or_pinned(layered_backends))- # Target says gateway disabled — priming should respect that and become a no-op.+ # Target says the manifold is disabled — priming should respect that and become a no-op.target_dir = tmp_path / "target_dir"target_backends = target_dir / "inference" / "backends.toml"target_backends.parent.mkdir(parents=True, exist_ok=True)- target_backends.write_text("[pipelex_gateway]\nenabled = false\n", encoding="utf-8")+ target_backends.write_text(+ f"[pipelex_manifold]\nenabled = false\nmodel_specs_section = {MANIFOLD_MODEL_SPECS_SECTION!r}\n",+ encoding="utf-8",+ )fetch_spy = mocker.spy(RemoteConfigFetcher, "fetch_remote_config")httpx_get_mock = mocker.patch("httpx.get", side_effect=httpx.ConnectError("should not be called"))@@ -302,30 +269,25 @@ class TestCachePriming:console = mocker.create_autospec(Console, instance=True)prime_remote_config_cache(console=console, target_config_dir=target_dir)- assert fetch_spy.call_count == 0, "target dir disables the gateway — priming must NOT consult the layered backends.toml"+ assert fetch_spy.call_count == 0, "target dir disables the manifold — priming must NOT consult the layered backends.toml"assert httpx_get_mock.call_count == 0assert not RemoteConfigCache.cache_path().exists()@pytest.mark.usefixtures("isolated_cache_dir")def test_priming_runs_for_a_manifold_only_installation(self, mocker: MockerFixture, tmp_path: Path) -> None:- """Priming asks the boot's question — is *any* managed gateway backend enabled — not the- Portkey-cloud one's. The published configuration is one artifact carrying every managed- backend's section, so a manifold-only installation has exactly as much to cache as a- gateway one, and skipping it left the first offline dry-run after init with no fallback.+ """Priming asks the boot's question — is *any* managed gateway backend enabled. The published+ configuration is one artifact carrying every managed backend's section, so a manifold-only+ installation has exactly as much to cache as any other, and skipping it would leave the first+ offline dry-run after init with no fallback."""target_dir = tmp_path / "target_dir"target_backends = target_dir / "inference" / "backends.toml"target_backends.parent.mkdir(parents=True, exist_ok=True)target_backends.write_text(- f"[{PipelexBackend.GATEWAY}]\nenabled = false\n\n"f"[{PipelexBackend.MANIFOLD}]\nenabled = true\nmodel_specs_section = {MANIFOLD_MODEL_SPECS_SECTION!r}\n",encoding="utf-8",)- mocker.patch(- f"{INIT_COMMAND_MODULE}.load_pipelex_service_config_if_exists",- return_value=_accepted_service_config(),- )mocker.patch("pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",new_callable=mocker.PropertyMock,@@ -348,11 +310,7 @@ class TestCachePriming:while no usable cache exists, so ``pipelex-agent init`` would emit ``cache_primed: true``and a later offline run would hit ``RemoteConfigUnavailableError``."""- mocker.patch(f"{INIT_COMMAND_MODULE}.enabled_managed_gateway_sections", return_value=GATEWAY_ONLY_SECTIONS)- mocker.patch(- f"{INIT_COMMAND_MODULE}.load_pipelex_service_config_if_exists",- return_value=_accepted_service_config(),- )+ mocker.patch(f"{INIT_COMMAND_MODULE}.enabled_managed_gateway_sections", return_value=MANIFOLD_ONLY_SECTIONS)mocker.patch("pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",new_callable=mocker.PropertyMock,@@ -371,20 +329,14 @@ class TestCachePriming:assert "yellow" in printed.lower(), f"a failed cache write must surface a yellow warning; got: {printed!r}"@pytest.mark.usefixtures("isolated_cache_dir")- def test_init_warns_when_cached_payload_is_malformed(self, mocker: MockerFixture) -> None:- """Online fetch succeeds and a cache file is written, but its inner ``raw_config`` is not- a valid ``RemoteConfig`` → priming reports failure, not success.-- ``RemoteConfigCache.load()`` validates only the cache *wrapper*, so a malformed inner- payload would still pass an ``is None`` check. Priming must re-validate the payload as a- ``RemoteConfig``, otherwise ``pipelex-agent init`` would emit ``cache_primed: true`` while- a later offline run hits ``RemoteConfigUnavailableError``.+ def test_init_warns_when_the_written_cache_does_not_read_back(self, mocker: MockerFixture) -> None:+ """Online fetch succeeds and a cache file is written, but it does not read back → priming+ reports failure, not success.++ Priming reads the cache back rather than trusting the write, otherwise ``pipelex-agent init``+ would emit ``cache_primed: true`` while a later offline run hits ``RemoteConfigUnavailableError``."""- mocker.patch(f"{INIT_COMMAND_MODULE}.enabled_managed_gateway_sections", return_value=GATEWAY_ONLY_SECTIONS)- mocker.patch(- f"{INIT_COMMAND_MODULE}.load_pipelex_service_config_if_exists",- return_value=_accepted_service_config(),- )+ mocker.patch(f"{INIT_COMMAND_MODULE}.enabled_managed_gateway_sections", return_value=MANIFOLD_ONLY_SECTIONS)mocker.patch("pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",new_callable=mocker.PropertyMock,@@ -392,13 +344,13 @@ class TestCachePriming:)mocker.patch.object(RemoteConfigFetcher, "fetch_remote_config", _ORIGINAL_FETCH_REMOTE_CONFIG)mocker.patch("httpx.get", return_value=_make_httpx_response(_fake_remote_payload()))- mocker.patch.object(RemoteConfigCache, "store", side_effect=_store_malformed_cache)+ mocker.patch.object(RemoteConfigCache, "store", side_effect=_store_unreadable_cache)console = mocker.create_autospec(Console, instance=True)prime_remote_config_cache(console=console) # must NOT raiseprinted = " ".join(str(call_args) for call_args in console.print.call_args_list)- assert "yellow" in printed.lower(), f"a malformed cached payload must surface a yellow warning; got: {printed!r}"+ assert "yellow" in printed.lower(), f"a cache that does not read back must surface a yellow warning; got: {printed!r}"@pytest.mark.usefixtures("isolated_cache_dir")def test_init_does_not_double_prime(self, mocker: MockerFixture) -> None:@@ -411,11 +363,7 @@ class TestCachePriming:stale_on_disk = json.loads(cache_path.read_text(encoding="utf-8"))assert stale_on_disk["raw_config"]["aws_region"] == "eu-west-1"- mocker.patch(f"{INIT_COMMAND_MODULE}.enabled_managed_gateway_sections", return_value=GATEWAY_ONLY_SECTIONS)- mocker.patch(- f"{INIT_COMMAND_MODULE}.load_pipelex_service_config_if_exists",- return_value=_accepted_service_config(),- )+ mocker.patch(f"{INIT_COMMAND_MODULE}.enabled_managed_gateway_sections", return_value=MANIFOLD_ONLY_SECTIONS)mocker.patch("pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",new_callable=mocker.PropertyMock,diff --git a/tests/integration/pipelex/cli/test_init_cmd_backend_customization.py b/tests/integration/pipelex/cli/test_init_cmd_backend_customization.pyindex cb5c7adb9..97d4e77cd 100644--- a/tests/integration/pipelex/cli/test_init_cmd_backend_customization.py+++ b/tests/integration/pipelex/cli/test_init_cmd_backend_customization.py@@ -4,20 +4,28 @@ import shutilfrom pathlib import Pathfrom typing import TYPE_CHECKING, Any+import pytest+if TYPE_CHECKING:from pytest_mock import MockerFixturefrom pipelex.cli.commands.init.backends import customize_backends_configfrom pipelex.cli.commands.init.config_files import init_config-from pipelex.cogt.model_backends.backend import PipelexBackend+from pipelex.cli.commands.init.ui.backends_ui import RECOMMENDED_INIT_BACKENDfrom pipelex.kit.paths import get_kit_configs_dirfrom pipelex.tools.misc.toml_utils import load_toml_with_tomlkitfrom tests.helpers.init_cmd_helpers import get_backend_indices_helper[email protected](autouse=True)+def no_extension_suggestion(mocker: MockerFixture) -> None:+ """Keep the IDE extension suggestion from consuming a queued answer and installing into the real editor."""+ mocker.patch("pipelex.cli.commands.init.backends.suggest_extension_install_if_needed")++class TestBackendCustomization:def test_customize_backends_config_with_default_selection(self, tmp_path: Path, mocker: MockerFixture) -> None:- """Test backend customization with default selection (pipelex_gateway)."""+ """Test backend customization with the recommended default selection."""# Setup directories with actual backends.tomlinference_dir = tmp_path / ".pipelex" / "inference"inference_dir.mkdir(parents=True)@@ -37,8 +45,8 @@ class TestBackendCustomization:mocker.patch("pipelex.cli.commands.init.backends.get_console", return_value=mocker.MagicMock())# Setup input queues - global patching like MockedInitEnvironment- prompt_inputs = ["1"] # Select pipelex_gateway- confirm_inputs = [True] # Accept gateway terms+ prompt_inputs = [""] # Empty = the recommended default+ confirm_inputs: list[bool] = []def prompt_side_effect(*args: Any, **_kwargs: Any) -> str:if not prompt_inputs:@@ -63,12 +71,12 @@ class TestBackendCustomization:# Verify backends.toml was customizedtoml_doc = load_toml_with_tomlkit(str(test_backends))- # pipelex_gateway should be enabled- assert "enabled" in toml_doc[PipelexBackend.GATEWAY] # type: ignore[operator]- assert toml_doc[PipelexBackend.GATEWAY]["enabled"] is True # type: ignore[index]+ # the recommended backend should be enabled+ assert "enabled" in toml_doc[RECOMMENDED_INIT_BACKEND] # type: ignore[operator]+ assert toml_doc[RECOMMENDED_INIT_BACKEND]["enabled"] is True # type: ignore[index]# Other backends should be disabled- for backend in ["openai", "anthropic", "mistral", "fal"]:+ for backend in ["openrouter", "anthropic", "mistral", "fal"]:if backend in toml_doc and "enabled" in toml_doc[backend]: # type: ignore[operator]assert toml_doc[backend]["enabled"] is False # type: ignore[index]@@ -98,7 +106,7 @@ class TestBackendCustomization:# Mock console providermocker.patch("pipelex.cli.commands.init.backends.get_console", return_value=mocker.MagicMock())- # Setup input queues - no gateway selected, so no confirm needed+ # Setup input queues - no confirm neededprompt_inputs = [indices_str]def prompt_side_effect(*args: Any, **_kwargs: Any) -> str:@@ -121,8 +129,8 @@ class TestBackendCustomization:assert toml_doc["anthropic"]["enabled"] is True # type: ignore[index]assert toml_doc["mistral"]["enabled"] is True # type: ignore[index]- # pipelex_gateway should be disabled- assert toml_doc[PipelexBackend.GATEWAY]["enabled"] is False # type: ignore[index]+ # An unselected backend should be disabled+ assert toml_doc["openrouter"]["enabled"] is False # type: ignore[index]# fal should be disabledassert toml_doc["fal"]["enabled"] is False # type: ignore[index]@@ -140,7 +148,7 @@ class TestBackendCustomization:shutil.copy2(actual_backends, test_backends)# Dynamically get indices for the backends we want to test- backend_names = [PipelexBackend.GATEWAY, "openai", "fal"]+ backend_names = ["openrouter", "openai", "fal"]indices = get_backend_indices_helper(str(actual_backends), backend_names)indices_str = " ".join(str(idx) for idx in indices)@@ -153,9 +161,9 @@ class TestBackendCustomization:# Mock console providermocker.patch("pipelex.cli.commands.init.backends.get_console", return_value=mocker.MagicMock())- # Setup input queues - gateway selected, so confirm needed+ # Setup input queues - no confirm neededprompt_inputs = [indices_str]- confirm_inputs = [True] # Accept gateway terms+ confirm_inputs: list[bool] = []def prompt_side_effect(*args: Any, **_kwargs: Any) -> str:if not prompt_inputs:@@ -181,7 +189,7 @@ class TestBackendCustomization:toml_doc = load_toml_with_tomlkit(str(test_backends))# Selected backends should be enabled- assert toml_doc[PipelexBackend.GATEWAY]["enabled"] is True # type: ignore[index]+ assert toml_doc["openrouter"]["enabled"] is True # type: ignore[index]assert toml_doc["openai"]["enabled"] is True # type: ignore[index]assert toml_doc["fal"]["enabled"] is True # type: ignore[index]@@ -241,123 +249,3 @@ class TestBackendCustomization:# Verify warning was printedmock_console.print.assert_called()-- def test_customize_backends_disables_gateway_when_terms_save_raises_type_error(self, tmp_path: Path, mocker: MockerFixture) -> None:- """A TypeError from terms persistence (malformed [agreement] TOML) still triggers the gateway-disable safety fallback."""- inference_dir = tmp_path / ".pipelex" / "inference"- inference_dir.mkdir(parents=True)-- actual_backends = Path(str(get_kit_configs_dir())) / "inference" / "backends.toml"- test_backends = inference_dir / "backends.toml"- shutil.copy2(actual_backends, test_backends)-- mock_config_manager = mocker.MagicMock()- mock_config_manager.pipelex_config_dir = tmp_path / ".pipelex"- mock_config_manager.global_config_dir = tmp_path / ".pipelex"- mocker.patch("pipelex.cli.commands.init.backends.config_manager", mock_config_manager)- mocker.patch("pipelex.cli.commands.init.backends.get_console", return_value=mocker.MagicMock())-- # Terms persistence fails with a TypeError, as a malformed [agreement] section would produce.- mocker.patch(- "pipelex.cli.commands.init.backends.update_service_terms_acceptance",- side_effect=TypeError("'str' object does not support item assignment"),- )-- prompt_inputs = ["1"] # Select pipelex_gateway- confirm_inputs = [True] # Accept gateway terms-- def prompt_side_effect(*args: Any, **_kwargs: Any) -> str:- if not prompt_inputs:- question = str(args[0]) if args else "<unknown prompt>"- msg = f"Unexpected prompt without predefined input: {question}"- raise AssertionError(msg)- return prompt_inputs.pop(0)-- def confirm_side_effect(*args: Any, **_kwargs: Any) -> bool:- if not confirm_inputs:- question = str(args[0]) if args else "<unknown confirmation>"- msg = f"Unexpected confirm without predefined input: {question}"- raise AssertionError(msg)- return confirm_inputs.pop(0)-- mocker.patch("rich.prompt.Prompt.ask", side_effect=prompt_side_effect)- mocker.patch("rich.prompt.Confirm.ask", side_effect=confirm_side_effect)-- # Execute - the TypeError must be caught so the safety fallback runs.- customize_backends_config()-- # The gateway must be disabled since its terms could not be recorded.- toml_doc = load_toml_with_tomlkit(str(test_backends))- assert toml_doc[PipelexBackend.GATEWAY]["enabled"] is False # type: ignore[index]---class TestTermsAreAskedForAnyManagedGateway:- """The terms are the Pipelex service's terms, not one dialect's.-- The boot gate asks the broad question — any enabled managed gateway backend puts the install- behind service-terms acceptance (`runtime_boot`). These prompts have to ask the same question,- or selecting the manifold service alone produces a configuration that init calls complete and- the next inference boot refuses, with no init step that records acceptance.- """-- @staticmethod- def _prepare(tmp_path: Path, mocker: MockerFixture) -> Path:- inference_dir = tmp_path / ".pipelex" / "inference"- inference_dir.mkdir(parents=True)- test_backends = inference_dir / "backends.toml"- shutil.copy2(Path(str(get_kit_configs_dir())) / "inference" / "backends.toml", test_backends)-- mock_config_manager = mocker.MagicMock()- mock_config_manager.pipelex_config_dir = tmp_path / ".pipelex"- mock_config_manager.global_config_dir = tmp_path / ".pipelex"- mocker.patch("pipelex.cli.commands.init.backends.config_manager", mock_config_manager)- mocker.patch("pipelex.cli.commands.init.backends.get_console", return_value=mocker.MagicMock())- return test_backends-- @staticmethod- def _answer(mocker: MockerFixture, *, selection: str, accepts_terms: bool) -> None:- prompt_inputs = [selection]- confirm_inputs = [accepts_terms]-- def prompt_side_effect(*args: Any, **_kwargs: Any) -> str:- if not prompt_inputs:- question = str(args[0]) if args else "<unknown prompt>"- msg = f"Unexpected prompt without predefined input: {question}"- raise AssertionError(msg)- return prompt_inputs.pop(0)-- def confirm_side_effect(*args: Any, **_kwargs: Any) -> bool:- if not confirm_inputs:- question = str(args[0]) if args else "<unknown confirmation>"- msg = f"Unexpected confirm without predefined input: {question}"- raise AssertionError(msg)- return confirm_inputs.pop(0)-- mocker.patch("rich.prompt.Prompt.ask", side_effect=prompt_side_effect)- mocker.patch("rich.prompt.Confirm.ask", side_effect=confirm_side_effect)-- def test_selecting_only_the_manifold_service_records_terms_acceptance(self, tmp_path: Path, mocker: MockerFixture) -> None:- """Accepting must persist, exactly as it does for the Portkey-cloud service."""- test_backends = self._prepare(tmp_path, mocker)- recorded = mocker.patch("pipelex.cli.commands.init.backends.update_service_terms_acceptance")- manifold_index = get_backend_indices_helper(str(test_backends), [PipelexBackend.MANIFOLD])[0]- self._answer(mocker, selection=str(manifold_index), accepts_terms=True)-- customize_backends_config()-- recorded.assert_called_once()- assert recorded.call_args.kwargs["accepted"] is True- toml_doc = load_toml_with_tomlkit(str(test_backends))- assert toml_doc[PipelexBackend.MANIFOLD]["enabled"] is True # type: ignore[index]-- def test_declining_removes_the_manifold_service_from_the_selection(self, tmp_path: Path, mocker: MockerFixture) -> None:- """The same guarantee the gateway decline path gives: refused terms leave nothing enabled."""- test_backends = self._prepare(tmp_path, mocker)- mocker.patch("pipelex.cli.commands.init.backends.update_service_terms_acceptance")- manifold_index = get_backend_indices_helper(str(test_backends), [PipelexBackend.MANIFOLD])[0]- self._answer(mocker, selection=str(manifold_index), accepts_terms=False)-- customize_backends_config()-- toml_doc = load_toml_with_tomlkit(str(test_backends))- assert toml_doc[PipelexBackend.MANIFOLD]["enabled"] is False # type: ignore[index]diff --git a/tests/integration/pipelex/cli/test_init_cmd_integration.py b/tests/integration/pipelex/cli/test_init_cmd_integration.pyindex ea105914b..ffc15b8c7 100644--- a/tests/integration/pipelex/cli/test_init_cmd_integration.py+++ b/tests/integration/pipelex/cli/test_init_cmd_integration.py@@ -4,9 +4,8 @@ from pathlib import Pathfrom typing import TYPE_CHECKINGfrom pipelex.cli.commands.init.command import init_cmd+from pipelex.cli.commands.init.ui.backends_ui import RECOMMENDED_INIT_BACKENDfrom pipelex.cli.commands.init.ui.types import InitFocus-from pipelex.cogt.model_backends.backend import PipelexBackend-from pipelex.cogt.model_routing.routing_profile import PipelexRoutingProfilefrom pipelex.kit.paths import get_kit_configs_dirfrom pipelex.tools.misc.toml_utils import load_toml_with_tomlkit, save_toml_to_pathfrom tests.helpers.init_cmd_helpers import MockedInitEnvironment, get_backend_indices_helper@@ -24,8 +23,9 @@ class TestInitCommandIntegration:# User inputs: confirm init, select all backendsenv.add_confirm_input(True) # Confirm initialization- env.add_confirm_input(True) # Accept gateway terms of service (since "all" includes gateway)env.add_prompt_input("all") # Select all backends+ env.add_prompt_input("1") # Primary backend: the first listed+ env.add_prompt_input("") # Accept the default fallback orderenv.setup_mocks()@@ -38,8 +38,9 @@ class TestInitCommandIntegration:if backend_key != "internal":assert toml_doc[backend_key]["enabled"] is True # type: ignore[index]- # Verify routing was set to all_pipelex_gateway (since pipelex_gateway is in "all")- env.verify_routing(PipelexRoutingProfile.ALL_PIPELEX_GATEWAY)+ # Verify routing: several backends selected, so a custom profile led by the first one+ first_backend = next(key for key in toml_doc if key != "internal")+ env.verify_routing("custom_routing", expected_default=first_backend)# Verify telemetry (always "off" - default from template)env.verify_telemetry("off")@@ -112,8 +113,7 @@ class TestInitCommandIntegration:# User inputs - CONFIG focus still runs full init on first timeenv.add_confirm_input(True) # Confirm initialization- env.add_confirm_input(True) # Accept gateway terms of service- env.add_prompt_input("1") # Backend selection (pipelex_gateway)+ env.add_prompt_input("") # Backend selection: the recommended defaultenv.setup_mocks()@@ -125,8 +125,8 @@ class TestInitCommandIntegration:env.verify_file_exists("inference/backends.toml")# CONFIG focus on first init triggers full flow- env.verify_backends_enabled([PipelexBackend.GATEWAY])- env.verify_routing(PipelexRoutingProfile.ALL_PIPELEX_GATEWAY)+ env.verify_backends_enabled([RECOMMENDED_INIT_BACKEND])+ env.verify_routing(f"all_{RECOMMENDED_INIT_BACKEND}")# Telemetry should be createdif (env.pipelex_dir / "telemetry.toml").exists():env.verify_telemetry("off")@@ -243,10 +243,10 @@ class TestInitCommandIntegration:env = MockedInitEnvironment(tmp_path, mocker)env.setup_with_configs(include_backends=True, include_routing=True, include_telemetry=True)- # Set pipelex_gateway as enabled initially+ # Set openrouter as enabled initiallybackends_path = env.inference_dir / "backends.toml"toml_doc = load_toml_with_tomlkit(str(backends_path))- toml_doc[PipelexBackend.GATEWAY]["enabled"] = True # type: ignore[index]+ toml_doc["openrouter"]["enabled"] = True # type: ignore[index]save_toml_to_path(toml_doc, path=str(backends_path))# Get index for openai@@ -295,30 +295,3 @@ class TestInitCommandIntegration:# Verify custom routing with automatic fallback orderenv.verify_routing("custom_routing", expected_default="anthropic", expected_fallback_order=["anthropic", "openai"])-- def test_init_pipelex_gateway_sets_all_pipelex_gateway(self, tmp_path: Path, mocker: MockerFixture) -> None:- """Test that selecting pipelex_gateway automatically sets all_pipelex_gateway routing."""- # Setup environment- env = MockedInitEnvironment(tmp_path, mocker)- env.setup_empty_dir()-- # Get indices for pipelex_gateway and openai- kit_backends = Path(str(get_kit_configs_dir())) / "inference" / "backends.toml"- indices = get_backend_indices_helper(str(kit_backends), [PipelexBackend.GATEWAY, "openai"])- indices_str = ",".join(str(i) for i in indices)-- # User inputs - no primary/fallback prompts because pipelex_gateway is included- env.add_confirm_input(True) # Confirm initialization- env.add_confirm_input(True) # Accept gateway terms of service- env.add_prompt_input(indices_str) # Select pipelex_gateway and openai-- env.setup_mocks()-- # Execute- init_cmd(focus=InitFocus.ALL)-- # Verify backends- env.verify_backends_enabled([PipelexBackend.GATEWAY, "openai"])-- # Verify routing is automatically set to all_pipelex_gateway- env.verify_routing(PipelexRoutingProfile.ALL_PIPELEX_GATEWAY)diff --git a/tests/integration/pipelex/cli/test_validate_load_refusals_cli.py b/tests/integration/pipelex/cli/test_validate_load_refusals_cli.pyindex 2c9a00a4f..a5dda246a 100644--- a/tests/integration/pipelex/cli/test_validate_load_refusals_cli.py+++ b/tests/integration/pipelex/cli/test_validate_load_refusals_cli.py@@ -48,7 +48,7 @@ type = "PipeLLM"description = "Write the tide note for the harbour board"inputs = { tide_times = "Text" }output = "Text"-model = "gpt-5.1"+model = "gpt-5.6-lunna"prompt = "Write a short note for the harbour board from these tide times: $tide_times""""@@ -96,7 +96,7 @@ class TestValidateLoadRefusalsCli:assert "Bundle validation failed" in outputassert "Pipe Validation Errors:" in outputassert "Unknown Model" in output- assert "Model handle 'gpt-5.1' was not found in the model deck" in output+ assert "Model handle 'gpt-5.6-lunna' was not found in the model deck" in outputassert "Path: pipe.write_tide_note.model" in outputassert "Traceback" not in output@@ -130,7 +130,7 @@ class TestValidateLoadRefusalsCli:assert item["domain_code"] == "tide_tables"assert item["source"] == str(unknown_model_bundle)assert item["field_path"] == "pipe.write_tide_note.model"- assert item["model_reference"] == "gpt-5.1"+ assert item["model_reference"] == "gpt-5.6-lunna"assert item["model_type"] == "llm"assert item["suggestions"]diff --git a/tests/integration/pipelex/cogt/model_backends/test_gateway_unknown_model.py b/tests/integration/pipelex/cogt/model_backends/test_managed_gateway_unknown_model.pysimilarity index 58%rename from tests/integration/pipelex/cogt/model_backends/test_gateway_unknown_model.pyrename to tests/integration/pipelex/cogt/model_backends/test_managed_gateway_unknown_model.pyindex 190b1af2c..e9b0404bc 100644--- a/tests/integration/pipelex/cogt/model_backends/test_gateway_unknown_model.py+++ b/tests/integration/pipelex/cogt/model_backends/test_managed_gateway_unknown_model.py@@ -1,6 +1,6 @@"""GatewayUnknownModelError contract.-When a model deck references a handle that the gateway should provide but the gateway's+When a model deck references a handle that a managed gateway should provide but that gateway'smodel specs (fresh or cached) don't contain it, setup must raise ``GatewayUnknownModelError``with provenance so the message can hint stale-cache remediation. This complements theexisting ``LLMHandleNotFoundError`` path: the gateway-specific check fires even when@@ -10,46 +10,40 @@ distinct, user-actionable failure mode that deserves its own error class.from __future__ import annotations+from pathlib import Pathfrom typing import TYPE_CHECKINGimport pytestfrom pipelex import logfrom pipelex.cogt.exceptions import GatewayUnknownModelError-from pipelex.cogt.model_backends.backend import LEGACY_GATEWAY_MODEL_SPECS_SECTION, PipelexBackend+from pipelex.cogt.model_backends.backend import MANIFOLD_MODEL_SPECS_SECTION, PipelexBackendfrom pipelex.pipelex import Pipelex-from pipelex.system.pipelex_service.remote_config import PipelexPosthogConfig, RemoteConfig+from pipelex.system.configuration.config_loader import ConfigLoader, config_manager+from pipelex.system.pipelex_service.remote_config import RemoteConfigfrom pipelex.system.pipelex_service.remote_config_fetcher import (RemoteConfigFetcher,RemoteConfigResult,)from pipelex.system.pipelex_service.types import RemoteConfigSourcefrom pipelex.system.runtime import IntegrationMode+from pipelex.tools.misc.toml_utils import load_toml_with_tomlkit, save_toml_to_pathif TYPE_CHECKING:from collections.abc import Generatorfrom pytest_mock import MockerFixture-RUNTIME_BOOT_MODULE = "pipelex.runtime_boot"+MANIFOLD_ROUTING_PROFILE = "all_pipelex_manifold"-def _empty_gateway_remote_config_result(source: RemoteConfigSource) -> RemoteConfigResult:- """Build a ``RemoteConfigResult`` whose gateway has no model specs.+def _empty_manifold_remote_config_result(source: RemoteConfigSource) -> RemoteConfigResult:+ """Build a ``RemoteConfigResult`` whose manifold section has no model specs.- Forces every deck-referenced handle that should come from the gateway to be missing,- so the new membership check trips on the first one.+ Forces every deck-referenced handle that should come from the manifold to be missing,+ so the membership check trips on the first one."""- config = RemoteConfig(- posthog=PipelexPosthogConfig(- project_api_key="",- endpoint="https://dummy.example.com",- is_geoip_enabled=False,- is_debug_enabled=False,- ),- backend_model_specs={},- aws_region="us-east-1",- )+ config = RemoteConfig(**{MANIFOLD_MODEL_SPECS_SECTION: {}})return RemoteConfigResult(config=config, source=source, cached_at=None)@@ -60,10 +54,41 @@ def reset_pipelex_config_fixture() -> Generator[None, None, None]:Pipelex.teardown_if_needed()+def manifold_routed_boot(tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:+ """Boot on the repository's inference documents with the manifold enabled and every model routed to it.++ The membership check only judges the handles the active profile routes to a managed backend, so+ enabling the manifold is not enough: the default profile tries it last, after every BYOK backend+ that serves the same model. Both sequences are pinned whole, so a personal override on this machine+ cannot route the boot elsewhere. The manifold's variables are set, or the loader would disable it+ before ever reading its specs.+ """+ routing_profiles_doc = load_toml_with_tomlkit(str(config_manager.routing_profiles_file_path))+ routing_profiles_doc["active"] = MANIFOLD_ROUTING_PROFILE+ routing_profiles_path = tmp_path / "routing_profiles.toml"+ save_toml_to_path(routing_profiles_doc, path=str(routing_profiles_path))++ backends_base_path = Path(config_manager.backends_file_path)+ backends_override_path = tmp_path / "backends_override.toml"+ backends_override_path.write_text(f"[{PipelexBackend.MANIFOLD}]\nenabled = true\n", encoding="utf-8")++ def pinned_routing_profiles_file_paths(_self: object, **_kwargs: object) -> list[Path]:+ return [routing_profiles_path]++ def pinned_backends_file_paths(_self: object, **_kwargs: object) -> list[Path]:+ return [backends_base_path, backends_override_path]++ monkeypatch.setattr(ConfigLoader, "routing_profiles_file_paths", pinned_routing_profiles_file_paths)+ monkeypatch.setattr(ConfigLoader, "backends_file_paths", pinned_backends_file_paths)+ monkeypatch.setenv("PIPELEX_MANIFOLD_ENDPOINT", "https://manifold.example.test/v1")+ monkeypatch.setenv("PIPELEX_MANIFOLD_API_KEY", "test-manifold-key")++class TestGatewayUnknownModel:def test_known_model_loads(self) -> None:- """Happy path: the session-cached gateway config contains every model referenced by- the default deck, so the new gateway-membership check should be silent.+ """Happy path: with no managed gateway enabled by default, the membership check has+ nothing to validate and setup is silent."""Pipelex.teardown_if_needed()try:@@ -76,15 +101,12 @@ class TestGatewayUnknownModel:Pipelex.teardown_if_needed()log.reset()+ @pytest.mark.usefixtures("manifold_routed_boot")def test_unknown_model_fresh_raises(self, mocker: MockerFixture) -> None:- """Gateway returns no model specs → first deck-referenced gateway handle trips+ """The manifold section carries no model specs → the first deck-referenced handle trips``GatewayUnknownModelError(source=FRESH)`` with the missing model name surfaced."""Pipelex.teardown_if_needed()- mocker.patch(- f"{RUNTIME_BOOT_MODULE}.enabled_managed_gateway_sections",- return_value={PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION},- )mocker.patch("pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",new_callable=mocker.PropertyMock,@@ -93,7 +115,7 @@ class TestGatewayUnknownModel:mocker.patch.object(RemoteConfigFetcher,"fetch_remote_config",- return_value=_empty_gateway_remote_config_result(RemoteConfigSource.FRESH),+ return_value=_empty_manifold_remote_config_result(RemoteConfigSource.FRESH),)try:@@ -106,24 +128,21 @@ class TestGatewayUnknownModel:assert exc_info.value.source == RemoteConfigSource.FRESHassert exc_info.value.model_name, "the error must carry the missing model name"assert exc_info.value.model_name in str(exc_info.value), "the error message must surface the missing model name"- assert exc_info.value.backend_name == PipelexBackend.GATEWAY, "with more than one managed gateway, the error has to say which"+ assert exc_info.value.backend_name == PipelexBackend.MANIFOLD, "with more than one managed gateway, the error has to say which"finally:Pipelex.teardown_if_needed()log.reset()+ @pytest.mark.usefixtures("manifold_routed_boot")def test_dummy_specs_path_skips_membership_check(self, mocker: MockerFixture) -> None:- """When gateway is enabled but ``needs_model_specs=False``, ``Pipelex.setup`` builds a- dummy ``RemoteConfig`` with empty ``backend_model_specs``. The membership check must NOT- run on this path — its provenance is "no live gateway data," so validating the deck's- gateway handles against an empty spec set would always fail. This covers read-only+ """When a managed gateway is enabled but ``needs_model_specs=False``, ``Pipelex.setup`` builds+ a dummy ``RemoteConfig`` with empty sections. The membership check must NOT run on this+ path — its provenance is "no live gateway data," so validating the deck's handles against+ an empty spec set would always fail. This covers read-onlyflows like ``pipelex-agent models`` (no ``--backend``) where the user did not opt in tofetching specs."""Pipelex.teardown_if_needed()- mocker.patch(- f"{RUNTIME_BOOT_MODULE}.enabled_managed_gateway_sections",- return_value={PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION},- )mocker.patch("pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",new_callable=mocker.PropertyMock,@@ -144,15 +163,12 @@ class TestGatewayUnknownModel:Pipelex.teardown_if_needed()log.reset()+ @pytest.mark.usefixtures("manifold_routed_boot")def test_unknown_model_cached_raises_with_stale_hint(self, mocker: MockerFixture) -> None:- """Same scenario as fresh, but the gateway config came from the cache → the error+ """Same scenario as fresh, but the remote config came from the cache → the errormessage must point at ``pipelex init`` (while online) to refresh the cache."""Pipelex.teardown_if_needed()- mocker.patch(- f"{RUNTIME_BOOT_MODULE}.enabled_managed_gateway_sections",- return_value={PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION},- )mocker.patch("pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",new_callable=mocker.PropertyMock,@@ -161,7 +177,7 @@ class TestGatewayUnknownModel:mocker.patch.object(RemoteConfigFetcher,"fetch_remote_config",- return_value=_empty_gateway_remote_config_result(RemoteConfigSource.CACHED),+ return_value=_empty_manifold_remote_config_result(RemoteConfigSource.CACHED),)try:diff --git a/tests/integration/pipelex/pipeline/test_validate_bundle_load_refusals.py b/tests/integration/pipelex/pipeline/test_validate_bundle_load_refusals.pyindex 841d90576..e170b1e65 100644--- a/tests/integration/pipelex/pipeline/test_validate_bundle_load_refusals.py+++ b/tests/integration/pipelex/pipeline/test_validate_bundle_load_refusals.py@@ -111,12 +111,12 @@ class _UnknownModelCase(NamedTuple):_UNKNOWN_MODEL_CASES: list[_UnknownModelCase] = [_UnknownModelCase(case_id="llm_handle",- bundle=_llm_bundle(model_line='model = "gpt-5.1"'),+ bundle=_llm_bundle(model_line='model = "gpt-5.6-lunna"'),pipe_code="write_tide_note",field_name="model",- model_reference="gpt-5.1",+ model_reference="gpt-5.6-lunna",model_type="llm",- model_sentence="Model handle 'gpt-5.1' was not found in the model deck",+ model_sentence="Model handle 'gpt-5.6-lunna' was not found in the model deck",),_UnknownModelCase(case_id="llm_alias",@@ -352,7 +352,7 @@ class TestValidateBundleLoadRefusals:read_scope=None,user_id="test-user",execution_config=execution_config,- mthds_contents=[_llm_bundle(model_line='model = "gpt-5.1"')],+ mthds_contents=[_llm_bundle(model_line='model = "gpt-5.6-lunna"')],pipe_code="write_tide_note",pipe_run_mode=PipeRunMode.DRY,)@@ -368,6 +368,6 @@ class TestValidateBundleLoadRefusals:assert strict_payload["error_type"] == "ValidateBundleError"assert strict_payload["error_domain"] == "input"assert "Pipe 'write_tide_note'" in strict_payload["message"]- assert "Model handle 'gpt-5.1' was not found in the model deck" in strict_payload["message"]+ assert "Model handle 'gpt-5.6-lunna' was not found in the model deck" in strict_payload["message"](strict_item,) = strict_payload["validation_errors"]assert strict_item["error_type"] == "unknown_model"diff --git a/tests/integration/pipelex/system/pipelex_service/conftest.py b/tests/integration/pipelex/system/pipelex_service/conftest.pydeleted file mode 100644index 349e31e4d..000000000--- a/tests/integration/pipelex/system/pipelex_service/conftest.py+++ /dev/null@@ -1,23 +0,0 @@-import os--import pytest-from pytest_mock import MockerFixture--from pipelex.system.pipelex_service.pipelex_details import PipelexDetails-from pipelex.system.telemetry.otel_constants import OTelConstants---def gateway_telemetry_reachable(mocker: MockerFixture) -> None:- """Clear what would stop a boot from building the Gateway telemetry stream, and send nothing.-- A placeholder gateway key and no `DO_NOT_TRACK`, so a boot that turns the stream on builds the real- manager instead of refusing, which makes a test's assertion on the stream the thing that fails. PostHog- is a mock, so that manager reaches no network, and the PostHog module globals it sets are restored- after the test.- """- mocker.patch.dict(os.environ, {PipelexDetails.PIPELEX_GATEWAY_API_KEY_VAR: "placeholder-gateway-key"})- os.environ.pop(OTelConstants.DO_NOT_TRACK_ENV_VAR_KEY, None)- mocker.patch("pipelex.system.telemetry.telemetry_manager.Posthog")- mocker.patch("posthog.default_client", None)- mocker.patch("posthog.privacy_mode", False)diff --git a/tests/integration/pipelex/system/pipelex_service/test_offline_baseline.py b/tests/integration/pipelex/system/pipelex_service/test_offline_baseline.pyindex 35551443e..8fbebb221 100644--- a/tests/integration/pipelex/system/pipelex_service/test_offline_baseline.py+++ b/tests/integration/pipelex/system/pipelex_service/test_offline_baseline.py@@ -2,9 +2,10 @@These tests describe the behaviour that must NOT regress:-- BYOK setups (gateway disabled) must complete offline without any remote-config fetch.-- Gateway-enabled setups with no network AND no cache must raise+- BYOK setups (no managed gateway enabled) must complete offline without any remote-config fetch.+- Managed-gateway setups with no network AND no cache must raise``RemoteConfigUnavailableError`` (the user-facing offline-mode error introduced in Phase 2).+- A live boot on a managed gateway needs no ``pipelex_service.toml``, in any integration mode."""from __future__ import annotations@@ -16,15 +17,10 @@ import httpximport pytestfrom pipelex import log-from pipelex.cogt.model_backends.backend import LEGACY_GATEWAY_MODEL_SPECS_SECTION, PipelexBackend+from pipelex.cogt.model_backends.backend import MANIFOLD_MODEL_SPECS_SECTION, PipelexBackendfrom pipelex.pipelex import Pipelexfrom pipelex.system.configuration.config_loader import ConfigLoaderfrom pipelex.system.pipelex_service.exceptions import RemoteConfigUnavailableError-from pipelex.system.pipelex_service.pipelex_service_agreement import (- PipelexServiceAgreement,- PipelexServiceOnboarding,-)-from pipelex.system.pipelex_service.pipelex_service_config import PipelexServiceConfigfrom pipelex.system.pipelex_service.remote_config_fetcher import RemoteConfigFetcherfrom pipelex.system.runtime import IntegrationMode@@ -54,9 +50,9 @@ class TestOfflineBaseline:self,mocker: MockerFixture,) -> None:- """Gateway disabled: setup must succeed with no network and never hit remote config.+ """No managed gateway enabled: setup must succeed with no network and never hit remote config.- Even with ``needs_model_specs=True``, when the gateway is disabled the fetch is+ Even with ``needs_model_specs=True``, when no managed gateway is enabled the fetch isunreachable and the BYOK setup should complete normally."""Pipelex.teardown_if_needed()@@ -80,15 +76,15 @@ class TestOfflineBaseline:finally:Pipelex.teardown_if_needed()- assert fetch_spy.call_count == 0, "fetch_remote_config must not be invoked when gateway is disabled"- assert httpx_get_mock.call_count == 0, "httpx.get must not be invoked when gateway is disabled"+ assert fetch_spy.call_count == 0, "fetch_remote_config must not be invoked when no managed gateway is enabled"+ assert httpx_get_mock.call_count == 0, "httpx.get must not be invoked when no managed gateway is enabled"- def test_gateway_offline_without_cache_raises_remote_config_unavailable_error(+ def test_managed_gateway_offline_without_cache_raises_remote_config_unavailable_error(self,mocker: MockerFixture,tmp_path: Path,) -> None:- """Gateway enabled + offline + no primed cache → ``RemoteConfigUnavailableError``.+ """Managed gateway enabled + offline + no primed cache → ``RemoteConfigUnavailableError``.Phase 2 introduced a cache fallback so the fetcher only raises when both the networkand the local cache are unusable. We redirect ``~/.pipelex`` to a tmp path so any@@ -105,17 +101,9 @@ class TestOfflineBaseline:return_value=tmp_path / ".pipelex",)- service_config = PipelexServiceConfig(- agreement=PipelexServiceAgreement(terms_accepted=True),- onboarding=PipelexServiceOnboarding(inference_setup_completed=True),- )mocker.patch(f"{RUNTIME_BOOT_MODULE}.enabled_managed_gateway_sections",- return_value={PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION},- )- mocker.patch(- f"{RUNTIME_BOOT_MODULE}.load_pipelex_service_config_if_exists",- return_value=service_config,+ return_value={PipelexBackend.MANIFOLD: MANIFOLD_MODEL_SPECS_SECTION},)mocker.patch("pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",@@ -143,3 +131,46 @@ class TestOfflineBaseline:# "LogConfig is already set". Reset it manually here so other test modules can# still spin up a fresh Pipelex instance.log.reset()++ @pytest.mark.parametrize("integration_mode", [IntegrationMode.FASTAPI, IntegrationMode.CLI, IntegrationMode.PYTEST])+ def test_live_boot_on_a_managed_gateway_needs_no_service_file(+ self,+ mocker: MockerFixture,+ tmp_path: Path,+ integration_mode: IntegrationMode,+ ) -> None:+ """A live boot with a managed gateway enabled and no ``pipelex_service.toml`` goes straight to the fetch.++ No first-run check stands in front of the remote config: a server, a worker booting through the+ CLI helper or a test suite boots from its config files alone. The fetch is the first thing the+ boot does for the managed gateway, so reaching its offline refusal proves nothing stopped earlier.+ """+ Pipelex.teardown_if_needed()++ # An empty global directory holds no pipelex_service.toml and no primed cache.+ mocker.patch.object(+ ConfigLoader,+ "global_config_dir",+ new_callable=mocker.PropertyMock,+ return_value=tmp_path / ".pipelex",+ )+ mocker.patch(+ f"{RUNTIME_BOOT_MODULE}.enabled_managed_gateway_sections",+ return_value={PipelexBackend.MANIFOLD: MANIFOLD_MODEL_SPECS_SECTION},+ )+ mocker.patch(+ "pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",+ new_callable=mocker.PropertyMock,+ return_value=False,+ )+ mocker.patch.object(RemoteConfigFetcher, "fetch_remote_config", _ORIGINAL_FETCH_REMOTE_CONFIG)+ mocker.patch.object(RemoteConfigFetcher, "FETCH_MAX_RETRIES", 1)+ mocker.patch("httpx.get", side_effect=httpx.ConnectError("no network"))++ try:+ with pytest.raises(RemoteConfigUnavailableError):+ Pipelex.make(integration_mode=integration_mode, needs_inference=True)+ finally:+ Pipelex.teardown_if_needed()+ log.reset()+ assert not (tmp_path / ".pipelex" / "pipelex_service.toml").exists()diff --git a/tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.py b/tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.pyindex f8b8c4793..098a6fbb3 100644--- a/tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.py+++ b/tests/integration/pipelex/system/pipelex_service/test_remote_config_fetcher.py@@ -19,8 +19,8 @@ from typing import TYPE_CHECKING, Anyimport httpximport pytest-from pydantic import ValidationError+from pipelex.cogt.model_backends.backend import MANIFOLD_MODEL_SPECS_SECTIONfrom pipelex.system.configuration.config_loader import ConfigLoaderfrom pipelex.system.pipelex_service.exceptions import (RemoteConfigFetchError,@@ -44,13 +44,7 @@ _ORIGINAL_FETCH_REMOTE_CONFIG = RemoteConfigFetcher.fetch_remote_configdef _valid_remote_config_payload() -> dict[str, Any]:return {- "posthog": {- "project_api_key": "test-key",- "endpoint": "https://posthog.example.com",- "is_geoip_enabled": False,- "is_debug_enabled": False,- },- "backend_model_specs": {"defaults": {"sdk": "gateway_completions"}},+ MANIFOLD_MODEL_SPECS_SECTION: {"defaults": {"sdk": "manifold_completions"}},"aws_region": "eu-west-3",}@@ -111,7 +105,7 @@ class TestRemoteConfigFetcher:assert isinstance(result, RemoteConfigResult)assert result.source == RemoteConfigSource.FRESHassert result.cached_at is None- assert result.config.aws_region == "eu-west-3"+ assert result.config.get_model_specs_section(MANIFOLD_MODEL_SPECS_SECTION) == {"defaults": {"sdk": "manifold_completions"}}cached = RemoteConfigCache.load()assert cached is not None, "successful fetch must persist the raw payload to the cache"@@ -137,7 +131,7 @@ class TestRemoteConfigFetcher:assert result.source == RemoteConfigSource.CACHEDassert result.cached_at == stored_snapshot.cached_at, "result must forward the cache's snapshot timestamp, not a freshly-computed one"- assert result.config.aws_region == "eu-west-3"+ assert result.config.get_model_specs_section(MANIFOLD_MODEL_SPECS_SECTION) == {"defaults": {"sdk": "manifold_completions"}}@pytest.mark.usefixtures("isolated_cache_dir")def test_network_failure_without_cache_raises_unavailable(self, mocker: MockerFixture) -> None:@@ -152,30 +146,6 @@ class TestRemoteConfigFetcher:assert expected_cache_path in str(exc_info.value), "error message must name the cache path so users can prime it"assert "pipelex init" in str(exc_info.value), "error message must point at the remediation command"- @pytest.mark.usefixtures("isolated_cache_dir")- def test_network_failure_with_invalid_cache_raises_unavailable(self, mocker: MockerFixture) -> None:- """A cache with a valid wrapper but a stale/malformed ``raw_config`` must be treated- as unusable. ``RemoteConfigCache.load()`` only validates the wrapper, so the offline- path must catch the inner ``RemoteConfig`` validation failure and raise- ``RemoteConfigUnavailableError`` with the normal remediation message — never let a- raw Pydantic ``ValidationError`` escape.- """- # store() does not validate raw_config against RemoteConfig, so this writes a- # cache whose wrapper is valid but whose payload cannot parse as RemoteConfig.- RemoteConfigCache.store({"bogus": "payload"})-- mocker.patch("httpx.get", side_effect=httpx.ConnectError("no network"))- mocker.patch.object(RemoteConfigFetcher, "FETCH_MAX_RETRIES", 1)-- with pytest.raises(RemoteConfigUnavailableError) as exc_info:- RemoteConfigFetcher.fetch_remote_config()-- assert "pipelex init" in str(exc_info.value), "invalid cache must surface the normal offline remediation, not a raw ValidationError"- assert isinstance(exc_info.value.__cause__, ValidationError), (- "the unavailable error must chain from the inner RemoteConfig ValidationError, "- "proving the malformed-cache branch (not the missing-cache branch) was exercised"- )-@pytest.mark.usefixtures("isolated_cache_dir")def test_http_error_with_cache_returns_cached(self, mocker: MockerFixture) -> None:"""5xx response with a primed cache falls back to cache, same as a connect error.@@ -199,7 +169,7 @@ class TestRemoteConfigFetcher:assert result.source == RemoteConfigSource.CACHEDassert result.cached_at == stored_snapshot.cached_at- assert result.config.aws_region == "eu-west-3"+ assert result.config.get_model_specs_section(MANIFOLD_MODEL_SPECS_SECTION) == {"defaults": {"sdk": "manifold_completions"}}@pytest.mark.usefixtures("isolated_cache_dir")def test_http_error_without_cache_raises_unavailable(self, mocker: MockerFixture) -> None:@@ -217,7 +187,7 @@ class TestRemoteConfigFetcher:@pytest.mark.usefixtures("isolated_cache_dir")def test_validation_error_does_not_fall_back(self, mocker: MockerFixture) -> None:"""Server-side schema break must surface — we control the server, so a stale cache- would be the wrong answer here.+ would be the wrong answer here. The artifact must be a JSON object; any object parses."""# Cache is populated and otherwise usable; we want to assert it's NOT consulted.RemoteConfigCache.store(_valid_remote_config_payload())@@ -225,7 +195,7 @@ class TestRemoteConfigFetcher:bad_response = httpx.Response(status_code=200,request=httpx.Request("GET", "https://example.com/remote_config.json"),- content=b'{"posthog": "not-an-object"}',+ content=b'["not-an-object"]',)mocker.patch("httpx.get", return_value=bad_response)@@ -328,7 +298,7 @@ class TestRemoteConfigFetcher:result = RemoteConfigFetcher.fetch_remote_config()assert result.source == RemoteConfigSource.FRESH- assert result.config.aws_region == "eu-west-3"+ assert result.config.get_model_specs_section(MANIFOLD_MODEL_SPECS_SECTION) == {"defaults": {"sdk": "manifold_completions"}}captured = capsys.readouterr()assert "failed to persist remote config cache" in captured.err, (f"cache-write failure must surface as a warning on stderr; got stderr={captured.err!r}"diff --git a/tests/integration/pipelex/system/pipelex_service/test_setup_gateway_telemetry.py b/tests/integration/pipelex/system/pipelex_service/test_setup_gateway_telemetry.pydeleted file mode 100644index 207e6ca28..000000000--- a/tests/integration/pipelex/system/pipelex_service/test_setup_gateway_telemetry.py+++ /dev/null@@ -1,85 +0,0 @@-from __future__ import annotations--from typing import TYPE_CHECKING--import pytest--from pipelex import log-from pipelex.cogt.model_backends.backend import LEGACY_GATEWAY_MODEL_SPECS_SECTION, PipelexBackend-from pipelex.pipelex import Pipelex-from pipelex.system.pipelex_service.pipelex_service_agreement import (- PipelexServiceAgreement,- PipelexServiceOnboarding,-)-from pipelex.system.pipelex_service.pipelex_service_config import PipelexServiceConfig-from pipelex.system.runtime import IntegrationMode, runtime_manager--if TYPE_CHECKING:- from collections.abc import Generator-- from pytest_mock import MockerFixture--RUNTIME_BOOT_MODULE = "pipelex.runtime_boot"--[email protected](scope="module", autouse=True)-def reset_pipelex_config_fixture() -> Generator[None, None, None]:- """Override the global module fixture: each test boots with its own ``Pipelex.make``."""- yield- Pipelex.teardown_if_needed()---def gateway_enabled_boot(mocker: MockerFixture) -> None:- """A boot with `pipelex_gateway` enabled, the terms accepted, and the session's fresh remote config."""- mocker.patch(- f"{RUNTIME_BOOT_MODULE}.enabled_managed_gateway_sections",- return_value={PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION},- )- mocker.patch(- f"{RUNTIME_BOOT_MODULE}.load_pipelex_service_config_if_exists",- return_value=PipelexServiceConfig(- agreement=PipelexServiceAgreement(terms_accepted=True),- onboarding=PipelexServiceOnboarding(inference_setup_completed=True),- ),- )- mocker.patch(- "pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",- new_callable=mocker.PropertyMock,- return_value=False,- )---def _boot_and_read_the_stream(*, integration_mode: IntegrationMode) -> bool:- Pipelex.teardown_if_needed()- try:- telemetry_manager = Pipelex.make(integration_mode=integration_mode, needs_inference=True).telemetry_manager- assert telemetry_manager is not None- return telemetry_manager.is_pipelex_telemetry_enabled- finally:- Pipelex.teardown_if_needed()- log.reset()--[email protected]("gateway_enabled_boot", "gateway_telemetry_reachable")-class TestSetupGatewayTelemetry:- def test_a_deployment_boot_sends_the_stream(self, mocker: MockerFixture) -> None:- """The production path, end to end: the one boot that must build the real manager with the Gateway stream on.-- The run mode the shared pytest plugin set is neutralised here, as a deployment has none. Nothing- else in the suite builds this manager, so a crash in the factory's key lookup or in the- manager's Gateway branch would otherwise reach every production boot with the Gateway enabled.- """- mocker.patch(f"{RUNTIME_BOOT_MODULE}.runtime_manager", is_unit_testing=False)- assert _boot_and_read_the_stream(integration_mode=IntegrationMode.PYTHON)-- @pytest.mark.parametrize("integration_mode", [IntegrationMode.CI, IntegrationMode.PYTEST])- def test_a_test_harness_mode_boot_keeps_the_stream_off(self, mocker: MockerFixture, integration_mode: IntegrationMode) -> None:- """The integration mode alone turns the stream off, as for a harness that boots without the shared pytest plugin."""- mocker.patch(f"{RUNTIME_BOOT_MODULE}.runtime_manager", is_unit_testing=False)- assert not _boot_and_read_the_stream(integration_mode=integration_mode)-- def test_a_unit_testing_run_mode_boot_keeps_the_stream_off(self) -> None:- """The run mode alone turns the stream off: a suite booting in the default `PYTHON` mode, as the shared plugin's recipe does."""- assert runtime_manager.is_unit_testing, "the shared pytest plugin sets a test run mode for every session that loads it"- assert not _boot_and_read_the_stream(integration_mode=IntegrationMode.PYTHON)diff --git a/tests/integration/pipelex/system/pipelex_service/test_setup_with_cache.py b/tests/integration/pipelex/system/pipelex_service/test_setup_with_cache.pyindex b91122014..7e5bd6277 100644--- a/tests/integration/pipelex/system/pipelex_service/test_setup_with_cache.py+++ b/tests/integration/pipelex/system/pipelex_service/test_setup_with_cache.py@@ -1,14 +1,11 @@-"""Phase 3 contract: gateway-cache fallback flows through ``Pipelex.make``.+"""Phase 3 contract: the remote-config cache fallback flows through ``Pipelex.make``.These tests pin the post-refactor behaviour at the Pipelex-setup boundary (the fetcher-levelcontract is locked in by ``test_remote_config_fetcher.py``):- Dry-run setup ``(needs_inference=False, needs_model_specs=True)`` succeeds with a primedcache and emits ``RemoteConfigStaleWarning``; cold cache raises ``RemoteConfigUnavailableError``.-- Pipelex telemetry must be disabled whenever the gateway config is cached, even when- ``needs_inference=True``. Stale config implies stale model identities, so phoning home about- pipe runs against possibly-stale specs would pollute metrics.-- BYOK with the gateway disabled never reaches ``fetch_remote_config``, regardless of+- BYOK with no managed gateway enabled never reaches ``fetch_remote_config``, regardless of``needs_model_specs``. Explicit regression guard so future refactors can't reintroduce thephantom network call described in the original offline-mode bug."""@@ -16,7 +13,6 @@ contract is locked in by ``test_remote_config_fetcher.py``):from __future__ import annotationsimport warnings-from datetime import UTC, datetimefrom pathlib import Path # ruff: ignore[typing-only-standard-library-import] — referenced by pytest fixture type hints at runtimefrom typing import TYPE_CHECKING@@ -24,24 +20,15 @@ import httpximport pytestfrom pipelex import log-from pipelex.cogt.model_backends.backend import LEGACY_GATEWAY_MODEL_SPECS_SECTION, PipelexBackend+from pipelex.cogt.model_backends.backend import MANIFOLD_MODEL_SPECS_SECTION, PipelexBackendfrom pipelex.pipelex import Pipelexfrom pipelex.system.configuration.config_loader import ConfigLoaderfrom pipelex.system.pipelex_service.exceptions import (RemoteConfigStaleWarning,RemoteConfigUnavailableError,)-from pipelex.system.pipelex_service.pipelex_service_agreement import (- PipelexServiceAgreement,- PipelexServiceOnboarding,-)-from pipelex.system.pipelex_service.pipelex_service_config import PipelexServiceConfigfrom pipelex.system.pipelex_service.remote_config_cache import RemoteConfigCache-from pipelex.system.pipelex_service.remote_config_fetcher import (- RemoteConfigFetcher,- RemoteConfigResult,-)-from pipelex.system.pipelex_service.types import RemoteConfigSource+from pipelex.system.pipelex_service.remote_config_fetcher import RemoteConfigFetcherfrom pipelex.system.runtime import IntegrationModeif TYPE_CHECKING:@@ -57,13 +44,6 @@ RUNTIME_BOOT_MODULE = "pipelex.runtime_boot"_ORIGINAL_FETCH_REMOTE_CONFIG = RemoteConfigFetcher.fetch_remote_config-def _accepted_service_config() -> PipelexServiceConfig:- return PipelexServiceConfig(- agreement=PipelexServiceAgreement(terms_accepted=True),- onboarding=PipelexServiceOnboarding(inference_setup_completed=True),- )--@pytest.fixture(scope="module", autouse=True)def reset_pipelex_config_fixture() -> Generator[None, None, None]:"""Override the global module fixture: each test handles its own ``Pipelex.make``."""@@ -92,7 +72,7 @@ class TestSetupWithCache:self,mocker: MockerFixture,) -> None:- """Gateway enabled, network down, cache primed → setup completes and emits+ """Managed gateway enabled, network down, cache primed → setup completes and emits``RemoteConfigStaleWarning``. Validates the end-to-end stale-cache UX (dry-run)."""Pipelex.teardown_if_needed()@@ -106,11 +86,7 @@ class TestSetupWithCache:mocker.patch(f"{RUNTIME_BOOT_MODULE}.enabled_managed_gateway_sections",- return_value={PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION},- )- mocker.patch(- f"{RUNTIME_BOOT_MODULE}.load_pipelex_service_config_if_exists",- return_value=_accepted_service_config(),+ return_value={PipelexBackend.MANIFOLD: MANIFOLD_MODEL_SPECS_SECTION},)mocker.patch("pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",@@ -143,18 +119,14 @@ class TestSetupWithCache:self,mocker: MockerFixture,) -> None:- """Gateway enabled, network down, no cache → ``RemoteConfigUnavailableError`` surfaces+ """Managed gateway enabled, network down, no cache → ``RemoteConfigUnavailableError`` surfacesfrom ``Pipelex.make`` (not silently swallowed)."""Pipelex.teardown_if_needed()mocker.patch(f"{RUNTIME_BOOT_MODULE}.enabled_managed_gateway_sections",- return_value={PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION},- )- mocker.patch(- f"{RUNTIME_BOOT_MODULE}.load_pipelex_service_config_if_exists",- return_value=_accepted_service_config(),+ return_value={PipelexBackend.MANIFOLD: MANIFOLD_MODEL_SPECS_SECTION},)mocker.patch("pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",@@ -176,59 +148,8 @@ class TestSetupWithCache:Pipelex.teardown_if_needed()log.reset()- @pytest.mark.usefixtures("gateway_telemetry_reachable")- def test_telemetry_disabled_when_source_cached(self, mocker: MockerFixture) -> None:- """``Pipelex.make(needs_inference=True)`` with a cached gateway config → the Gateway- telemetry stream is off. Stale specs imply stale model identities; phoning home- about pipe runs in that state would pollute metrics, so the guard is stricter than- the plain ``needs_inference and gateway_enabled`` check.-- The boot is a deployment's: ``PYTHON`` mode with the test run mode neutralised, because- either test-harness signal would turn the stream off by itself and leave the cache- condition unguarded.- """- Pipelex.teardown_if_needed()-- # Reuse the session-cached gateway config so deck validation passes, but re-wrap with- # ``source=CACHED`` to exercise the stricter telemetry guard.- session_result = RemoteConfigFetcher.fetch_remote_config()- cached_result = RemoteConfigResult(- config=session_result.config,- source=RemoteConfigSource.CACHED,- cached_at=datetime.now(tz=UTC),- )-- mocker.patch(- f"{RUNTIME_BOOT_MODULE}.enabled_managed_gateway_sections",- return_value={PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION},- )- mocker.patch(- f"{RUNTIME_BOOT_MODULE}.load_pipelex_service_config_if_exists",- return_value=_accepted_service_config(),- )- mocker.patch(- "pipelex.system.runtime.RuntimeManager.is_in_codex_cloud",- new_callable=mocker.PropertyMock,- return_value=False,- )- mocker.patch.object(RemoteConfigFetcher, "fetch_remote_config", return_value=cached_result)- mocker.patch(f"{RUNTIME_BOOT_MODULE}.runtime_manager", is_unit_testing=False)-- try:- telemetry_manager = Pipelex.make(- integration_mode=IntegrationMode.PYTHON,- needs_inference=True,- ).telemetry_manager- assert telemetry_manager is not None- assert not telemetry_manager.is_pipelex_telemetry_enabled, (- "cached gateway config must turn the Gateway telemetry stream off, even when needs_inference=True"- )- finally:- Pipelex.teardown_if_needed()- log.reset()-def test_byok_offline_regression_guard(self, mocker: MockerFixture) -> None:- """Gateway disabled in ``backends.toml`` → ``fetch_remote_config`` is never invoked,+ """No managed gateway enabled in ``backends.toml`` → ``fetch_remote_config`` is never invoked,even with ``needs_model_specs=True``. Without this guard a future refactor couldreintroduce the phantom network call that originally motivated the offline-mode work."""@@ -253,5 +174,5 @@ class TestSetupWithCache:Pipelex.teardown_if_needed()log.reset()- assert fetch_spy.call_count == 0, "fetch_remote_config must never be invoked when the gateway is disabled"- assert httpx_get_mock.call_count == 0, "httpx.get must never be invoked when the gateway is disabled"+ assert fetch_spy.call_count == 0, "fetch_remote_config must never be invoked when no managed gateway is enabled"+ assert httpx_get_mock.call_count == 0, "httpx.get must never be invoked when no managed gateway is enabled"diff --git a/tests/unit/pipelex/cli/agent_cli/commands/test_agent_init_routing.py b/tests/unit/pipelex/cli/agent_cli/commands/test_agent_init_routing.pynew file mode 100644index 000000000..e588d1128--- /dev/null+++ b/tests/unit/pipelex/cli/agent_cli/commands/test_agent_init_routing.py@@ -0,0 +1,50 @@+"""`pipelex-agent init` routing: which profile a config with no backend list leaves active.++The template enables many backends and routes among them with its own profile, so naming no backends+must keep that profile rather than demand a primary backend nobody was asked for.+"""++import shutil+from pathlib import Path++import pytest+import typer++from pipelex.cli.agent_cli.commands.init_cmd import _configure_routing # pyright: ignore[reportPrivateUsage]+from pipelex.kit.paths import get_kit_configs_dir+from pipelex.tools.misc.toml_utils import load_toml_from_path++TEMPLATE_BACKENDS = ["openai", "anthropic", "mistral"]+++def target_dir(tmp_path: Path) -> Path:+ inference_dir = tmp_path / "inference"+ inference_dir.mkdir()+ shutil.copy2(Path(str(get_kit_configs_dir())) / "inference" / "routing_profiles.toml", inference_dir / "routing_profiles.toml")+ return tmp_path+++def _active_profile(target_dir: Path) -> str:+ return str(load_toml_from_path(target_dir / "inference" / "routing_profiles.toml")["active"])+++class TestAgentInitRouting:+ def test_no_backends_named_keeps_the_template_profile(self, target_dir: Path) -> None:+ template_active = _active_profile(target_dir)++ profile = _configure_routing(TEMPLATE_BACKENDS, config={}, target_dir=target_dir)++ assert profile == template_active+ assert _active_profile(target_dir) == template_active++ def test_primary_named_alone_routes_the_template_backends_to_it_first(self, target_dir: Path) -> None:+ profile = _configure_routing(TEMPLATE_BACKENDS, config={"primary_backend": "mistral"}, target_dir=target_dir)++ assert profile == "custom_routing"+ custom_routing = load_toml_from_path(target_dir / "inference" / "routing_profiles.toml")["profiles"]["custom_routing"]+ assert custom_routing["fallback_order"] == ["mistral", "openai", "anthropic"]++ def test_several_backends_named_without_a_primary_is_refused(self, target_dir: Path) -> None:+ with pytest.raises(typer.Exit):+ _configure_routing(TEMPLATE_BACKENDS, config={"backends": TEMPLATE_BACKENDS}, target_dir=target_dir)diff --git a/tests/unit/pipelex/cli/agent_cli/test_agent_init_managed_gateway_terms.py b/tests/unit/pipelex/cli/agent_cli/test_agent_init_managed_gateway_terms.pydeleted file mode 100644index ca7c21a7a..000000000--- a/tests/unit/pipelex/cli/agent_cli/test_agent_init_managed_gateway_terms.py+++ /dev/null@@ -1,52 +0,0 @@-"""`pipelex-agent init` records service-terms acceptance for any managed gateway backend.--The agent flow takes `accept_gateway_terms` as an explicit instruction. Asked the gateway-only way,-that instruction was silently dropped for a request naming only the manifold service — and since-the same flow marks inference setup complete unconditionally, the next inference boot refused with-`GatewayTermsNotAcceptedError` on a configuration the agent had been told was finished.-"""--from __future__ import annotations--import shutil-from pathlib import Path-from typing import TYPE_CHECKING, Any--from pipelex.cli.agent_cli.commands.init_cmd import _configure_backends # pyright: ignore[reportPrivateUsage]-from pipelex.cogt.model_backends.backend import PipelexBackend-from pipelex.kit.paths import get_kit_configs_dir--if TYPE_CHECKING:- from pytest_mock import MockerFixture---def _backends_files(tmp_path: Path) -> tuple[Path, Path]:- """The user's backends.toml (a copy of the kit template) and the template itself."""- template = Path(str(get_kit_configs_dir())) / "inference" / "backends.toml"- user_file = tmp_path / "backends.toml"- shutil.copy2(template, user_file)- return user_file, template---class TestAgentInitTermsForAnyManagedGateway:- def test_a_manifold_only_request_persists_the_acceptance_it_was_given(self, tmp_path: Path, mocker: MockerFixture) -> None:- user_file, template = _backends_files(tmp_path)- mocker.patch("pipelex.cli.agent_cli.commands.init_cmd.config_manager", mocker.MagicMock(global_config_dir=tmp_path))- recorded = mocker.patch("pipelex.cli.agent_cli.commands.init_cmd.update_service_terms_acceptance")-- config: dict[str, Any] = {"backends": [PipelexBackend.MANIFOLD], "accept_gateway_terms": True}- _configure_backends(config=config, backends_toml_path=user_file, template_backends_path=template)-- recorded.assert_called_once()- assert recorded.call_args.kwargs["accepted"] is True-- def test_a_byok_only_request_records_nothing(self, tmp_path: Path, mocker: MockerFixture) -> None:- """The guard: no managed backend means no terms question, whatever the config carries."""- user_file, template = _backends_files(tmp_path)- mocker.patch("pipelex.cli.agent_cli.commands.init_cmd.config_manager", mocker.MagicMock(global_config_dir=tmp_path))- recorded = mocker.patch("pipelex.cli.agent_cli.commands.init_cmd.update_service_terms_acceptance")-- config: dict[str, Any] = {"backends": ["anthropic"], "accept_gateway_terms": True}- _configure_backends(config=config, backends_toml_path=user_file, template_backends_path=template)-- recorded.assert_not_called()diff --git a/tests/unit/pipelex/cli/commands/init/test_recommended_init_backend.py b/tests/unit/pipelex/cli/commands/init/test_recommended_init_backend.pynew file mode 100644index 000000000..b71730c59--- /dev/null+++ b/tests/unit/pipelex/cli/commands/init/test_recommended_init_backend.py@@ -0,0 +1,46 @@+"""The backend `pipelex init` recommends serves every default language-model and image-generation tier of the shipped deck.++Accepting the recommendation enables that backend alone and routes every model to it, so a default+alias it does not serve fails the first method that uses it, with a valid key in hand.+"""++from pathlib import Path++import pytest++from pipelex.cli.commands.init.ui.backends_ui import RECOMMENDED_INIT_BACKEND+from pipelex.kit.paths import get_kit_configs_dir+from pipelex.tools.misc.toml_utils import load_toml_from_path++# The deck families a single provider key serves; search, extraction, judgment and document+# generation default to dedicated backends whichever key the user holds.+DECK_FILE_BY_FAMILY = {+ "llm": "1_llm_deck.toml",+ "img_gen": "2_img_gen_deck.toml",+}+++def _inference_dir() -> Path:+ return Path(str(get_kit_configs_dir())) / "inference"+++def _recommended_backend_handles() -> set[str]:+ backend_doc = load_toml_from_path(_inference_dir() / "backends" / f"{RECOMMENDED_INIT_BACKEND}.toml")+ return {handle for handle in backend_doc if handle != "defaults"}+++class TestRecommendedInitBackend:+ @pytest.mark.parametrize(("family", "deck_file"), DECK_FILE_BY_FAMILY.items())+ def test_serves_every_default_alias_of_the_deck(self, family: str, deck_file: str) -> None:+ deck_doc = load_toml_from_path(_inference_dir() / "deck" / deck_file)+ aliases: dict[str, str] = deck_doc[family]["aliases"]+ default_targets = {alias: target for alias, target in aliases.items() if alias.startswith("default-")}+ assert default_targets, f"the {family} deck declares no default alias"++ served = _recommended_backend_handles()+ unserved = {alias: target for alias, target in default_targets.items() if target not in served}+ assert not unserved, f"'{RECOMMENDED_INIT_BACKEND}' serves none of these {family} defaults: {unserved}"++ def test_is_a_backend_the_template_lists(self) -> None:+ template_doc = load_toml_from_path(_inference_dir() / "backends.toml")+ assert RECOMMENDED_INIT_BACKEND in template_docdiff --git a/tests/unit/pipelex/cli/commands/login/test_login_command.py b/tests/unit/pipelex/cli/commands/login/test_login_command.pydeleted file mode 100644index dd3c345b7..000000000--- a/tests/unit/pipelex/cli/commands/login/test_login_command.py+++ /dev/null@@ -1,152 +0,0 @@-"""Tests for the pipelex login command."""--from __future__ import annotations--import http.client-import threading-from functools import partial-from http.server import HTTPServer-from io import StringIO-from typing import TYPE_CHECKING--from rich.console import Console--from pipelex.cli.commands.init.credentials import read_env_file, write_env_file-from pipelex.cli.commands.login.command import (- PIPELEX_GATEWAY_API_KEY_VAR,- CallbackHandler,- login_cmd,- save_api_key,-)--if TYPE_CHECKING:- from pathlib import Path-- from pytest_mock import MockerFixture---class TestLoginCommand:- def test_callback_handler_extracts_api_key(self) -> None:- """The callback handler extracts the api_key param and stores it in result."""- result: dict[str, str | None] = {"api_key": None}- handler_cls = partial(CallbackHandler, result)- server = HTTPServer(("127.0.0.1", 0), handler_cls) # type: ignore[arg-type]- port = server.server_address[1]-- server_thread = threading.Thread(target=server.handle_request, daemon=True)- server_thread.start()-- conn = http.client.HTTPConnection("127.0.0.1", port)- conn.request("GET", "/callback?api_key=test-key-12345")- response = conn.getresponse()- conn.close()- server_thread.join(timeout=5)- server.server_close()-- assert response.status == 200- assert result["api_key"] == "test-key-12345"-- def test_callback_handler_returns_400_without_key(self) -> None:- """The callback handler returns 400 when api_key param is missing."""- result: dict[str, str | None] = {"api_key": None}- handler_cls = partial(CallbackHandler, result)- server = HTTPServer(("127.0.0.1", 0), handler_cls) # type: ignore[arg-type]- port = server.server_address[1]-- server_thread = threading.Thread(target=server.handle_request, daemon=True)- server_thread.start()-- conn = http.client.HTTPConnection("127.0.0.1", port)- conn.request("GET", "/callback")- response = conn.getresponse()- conn.close()- server_thread.join(timeout=5)- server.server_close()-- assert response.status == 400- assert result["api_key"] is None-- def test_callback_handler_returns_400_for_wrong_path(self) -> None:- """The callback handler returns 400 for paths other than /callback."""- result: dict[str, str | None] = {"api_key": None}- handler_cls = partial(CallbackHandler, result)- server = HTTPServer(("127.0.0.1", 0), handler_cls) # type: ignore[arg-type]- port = server.server_address[1]-- server_thread = threading.Thread(target=server.handle_request, daemon=True)- server_thread.start()-- conn = http.client.HTTPConnection("127.0.0.1", port)- conn.request("GET", "/other?api_key=test-key")- response = conn.getresponse()- conn.close()- server_thread.join(timeout=5)- server.server_close()-- assert response.status == 400- assert result["api_key"] is None-- def test_save_api_key_creates_env_file(self, tmp_path: Path, mocker: MockerFixture) -> None:- """save_api_key writes the key to ~/.pipelex/.env."""- env_path = tmp_path / ".env"- mocker.patch(- "pipelex.cli.commands.login.command.get_global_env_path",- return_value=env_path,- )- save_api_key("pk_live_test123")-- entries = read_env_file(env_path)- assert entries[PIPELEX_GATEWAY_API_KEY_VAR] == "pk_live_test123"-- def test_save_api_key_preserves_existing_entries(self, tmp_path: Path, mocker: MockerFixture) -> None:- """save_api_key preserves existing .env entries when adding the API key."""- env_path = tmp_path / ".env"- write_env_file(env_path, entries={"EXISTING_KEY": "existing_value"})-- mocker.patch(- "pipelex.cli.commands.login.command.get_global_env_path",- return_value=env_path,- )- save_api_key("pk_live_test456")-- entries = read_env_file(env_path)- assert entries["EXISTING_KEY"] == "existing_value"- assert entries[PIPELEX_GATEWAY_API_KEY_VAR] == "pk_live_test456"-- def test_save_api_key_updates_existing_key(self, tmp_path: Path, mocker: MockerFixture) -> None:- """save_api_key overwrites an existing PIPELEX_GATEWAY_API_KEY."""- env_path = tmp_path / ".env"- write_env_file(env_path, entries={PIPELEX_GATEWAY_API_KEY_VAR: "old_key"})-- mocker.patch(- "pipelex.cli.commands.login.command.get_global_env_path",- return_value=env_path,- )- save_api_key("new_key")-- entries = read_env_file(env_path)- assert entries[PIPELEX_GATEWAY_API_KEY_VAR] == "new_key"-- def test_login_cmd_stdout_never_contains_api_key(self, tmp_path: Path, mocker: MockerFixture) -> None:- """login_cmd never prints the API key to stdout."""- env_path = tmp_path / ".env"- mocker.patch(- "pipelex.cli.commands.login.command.get_global_env_path",- return_value=env_path,- )-- output = StringIO()- mock_console = Console(file=output)- mocker.patch("pipelex.cli.commands.login.command.get_console", return_value=mock_console)- mocker.patch("pipelex.cli.commands.login.command.webbrowser.open")-- # Mock serve_until_callback to immediately set the api_key in login_cmd's own result dict- def fake_serve(_server: object, result: dict[str, str | None]) -> None:- result["api_key"] = "secret_key_12345"-- mocker.patch("pipelex.cli.commands.login.command.serve_until_callback", side_effect=fake_serve)-- login_cmd()-- printed = output.getvalue()- assert "secret_key_12345" not in printeddiff --git a/tests/unit/pipelex/cli/commands/test_init_agreement_any_managed_gateway.py b/tests/unit/pipelex/cli/commands/test_init_agreement_any_managed_gateway.pydeleted file mode 100644index a1f183e58..000000000--- a/tests/unit/pipelex/cli/commands/test_init_agreement_any_managed_gateway.py+++ /dev/null@@ -1,45 +0,0 @@-"""`pipelex init agreement` is the recovery path, and it has to cover every managed gateway.--The boot puts an installation behind service-terms acceptance as soon as *any* managed gateway-backend is enabled. This command is the human CLI's only way to record that acceptance after the-fact, so a question narrower than the boot's leaves a manifold-only installation with no supported-step that unblocks it — the command reports there is nothing to accept while the boot refuses to-start for want of exactly that.-"""--from __future__ import annotations--from typing import TYPE_CHECKING--from pipelex.cli.commands.init.command import _init_agreement # pyright: ignore[reportPrivateUsage]-from pipelex.cogt.model_backends.backend import PipelexBackend--if TYPE_CHECKING:- from pytest_mock import MockerFixture--MANIFOLD_ONLY_SECTIONS = {PipelexBackend.MANIFOLD: "manifold_model_specs"}---class TestInitAgreementCoversEveryManagedGateway:- def test_a_manifold_only_installation_is_prompted_rather_than_told_nothing_is_needed(self, mocker: MockerFixture) -> None:- """The dead end this closes: the terms panel must appear, and acceptance must persist."""- mocker.patch("pipelex.cli.commands.init.command.enabled_managed_gateway_sections", return_value=MANIFOLD_ONLY_SECTIONS)- mocker.patch("pipelex.cli.commands.init.command.load_pipelex_service_config_if_exists", return_value=None)- mocker.patch("rich.prompt.Confirm.ask", return_value=True)- recorded = mocker.patch("pipelex.cli.commands.init.command.update_service_terms_acceptance")-- _init_agreement(console=mocker.MagicMock())-- recorded.assert_called_once()- assert recorded.call_args.kwargs["accepted"] is True-- def test_no_managed_gateway_at_all_still_reports_nothing_to_accept(self, mocker: MockerFixture) -> None:- """The guard: a BYOK-only installation must keep its early exit, and prompt for nothing."""- mocker.patch("pipelex.cli.commands.init.command.enabled_managed_gateway_sections", return_value={})- recorded = mocker.patch("pipelex.cli.commands.init.command.update_service_terms_acceptance")- asked = mocker.patch("rich.prompt.Confirm.ask")-- _init_agreement(console=mocker.MagicMock())-- recorded.assert_not_called()- asked.assert_not_called()diff --git a/tests/unit/pipelex/cli/dev/test_preprocess_test_models_cmd.py b/tests/unit/pipelex/cli/dev/test_preprocess_test_models_cmd.pyindex d2f9fcefd..e76e217b4 100644--- a/tests/unit/pipelex/cli/dev/test_preprocess_test_models_cmd.py+++ b/tests/unit/pipelex/cli/dev/test_preprocess_test_models_cmd.py@@ -27,7 +27,7 @@ class TestPreprocessTestModelsCmd:mocker.patch.object(preprocess_test_models_cmd,"enabled_managed_gateway_sections",- return_value={"pipelex_gateway": "backend_model_specs"},+ return_value={"pipelex_manifold": "manifold_model_specs"},)mocker.patch.object(RemoteConfigFetcher, "fetch_remote_config", side_effect=gateway_error)@@ -54,13 +54,13 @@ class TestPreprocessTestModelsCmd:preprocess_test_models_cmd,"enabled_managed_gateway_sections",return_value={- "pipelex_gateway": "backend_model_specs",+ "pipelex_other": "other_model_specs","pipelex_manifold": "manifold_model_specs","absent_gateway": "no_such_section",},)sections = {- "backend_model_specs": {"defaults": {"model_type": "llm"}, "on-the-cloud": {}},+ "other_model_specs": {"defaults": {"model_type": "llm"}, "on-the-cloud": {}},"manifold_model_specs": {"defaults": {"model_type": "llm"}, "in-our-vpc": {"model_type": "search"}},}config = mocker.Mock()@@ -69,7 +69,7 @@ class TestPreprocessTestModelsCmd:result = _fetch_managed_gateway_models()- assert set(result) == {"pipelex_gateway", "pipelex_manifold"}- assert result["pipelex_gateway"]["llm"] == ["on-the-cloud"]+ assert set(result) == {"pipelex_other", "pipelex_manifold"}+ assert result["pipelex_other"]["llm"] == ["on-the-cloud"]assert result["pipelex_manifold"]["llm"] == []assert result["pipelex_manifold"]["search"] == ["in-our-vpc"]diff --git a/tests/unit/pipelex/cli/test_agent_cli_factory.py b/tests/unit/pipelex/cli/test_agent_cli_factory.pyindex eb15662aa..b2f1ef7fb 100644--- a/tests/unit/pipelex/cli/test_agent_cli_factory.py+++ b/tests/unit/pipelex/cli/test_agent_cli_factory.py@@ -16,9 +16,6 @@ from pipelex.cli.agent_cli.commands.agent_cli_factory import make_pipelex_for_agfrom pipelex.cogt.exceptions import ModelDeckPresetValidatonErrorfrom pipelex.cogt.model_backends.model_type import ModelTypefrom pipelex.system.pipelex_service.exceptions import (- GatewayApiKeyMissingError,- GatewayDoNotTrackConflictError,- GatewayTermsNotAcceptedError,RemoteConfigValidationError,)from pipelex.system.telemetry.exceptions import TelemetryConfigValidationError@@ -55,9 +52,6 @@ class TestMakePipelexForAgentCli:("exc_class", "exc_args", "expected_error_type"),[(TelemetryConfigValidationError, ("telemetry config bad",), "TelemetryConfigValidationError"),- (GatewayTermsNotAcceptedError, (), "GatewayTermsNotAcceptedError"),- (GatewayApiKeyMissingError, (), "GatewayApiKeyMissingError"),- (GatewayDoNotTrackConflictError, ("DO_NOT_TRACK",), "GatewayDoNotTrackConflictError"),(RemoteConfigValidationError, ("bad remote config",), "RemoteConfigValidationError"),],)diff --git a/tests/unit/pipelex/cli/test_cli_factory.py b/tests/unit/pipelex/cli/test_cli_factory.pydeleted file mode 100644index 323dceab0..000000000--- a/tests/unit/pipelex/cli/test_cli_factory.py+++ /dev/null@@ -1,42 +0,0 @@-"""Regression test: standard CLI factory must handle InferenceSetupRequiredError.--The agent CLI factory catches InferenceSetupRequiredError and prints a friendly-markdown message. The standard CLI factory must also catch it so that first-run-users of ``pipelex run`` get a user-friendly message instead of an unhandled traceback.-"""--from __future__ import annotations--from typing import TYPE_CHECKING--import pytest-import typer--from pipelex.cli.cli_factory import make_pipelex_for_cli-from pipelex.cli.error_handlers import ErrorContext-from pipelex.system.pipelex_service.exceptions import InferenceSetupRequiredError--if TYPE_CHECKING:- from pytest_mock import MockerFixture--CLI_FACTORY_MODULE = "pipelex.cli.cli_factory"---class TestCliFactory:- """Verify that make_pipelex_for_cli() handles setup errors gracefully."""-- def test_first_run_catches_inference_setup_required(- self,- mocker: MockerFixture,- ) -> None:- """On first run, InferenceSetupRequiredError must be caught and exit cleanly."""- mocker.patch(- f"{CLI_FACTORY_MODULE}.Pipelex.make",- side_effect=InferenceSetupRequiredError(),- )-- with pytest.raises(typer.Exit):- make_pipelex_for_cli(- context=ErrorContext.VALIDATION_BEFORE_PIPE_RUN,- needs_inference=True,- )diff --git a/tests/unit/pipelex/cli/test_doctor_backend_checks.py b/tests/unit/pipelex/cli/test_doctor_backend_checks.pyindex 757e1a2b3..d78c9d540 100644--- a/tests/unit/pipelex/cli/test_doctor_backend_checks.py+++ b/tests/unit/pipelex/cli/test_doctor_backend_checks.py@@ -234,21 +234,38 @@ class TestDoctorBackendChecks:assert reports["vertexai"].is_valid is Truedef test_backend_files_stock_kit_is_healthy(self, tmp_path: Path) -> None:- """The shipped defaults enable the gateway and ship its override file; the probe hands the- loader no gateway config, and that must not be reported as a malformed file.- """+ """Every backend file the shipped defaults enable loads cleanly."""self._copy_kit_inference(tmp_path)healthy, reports, message = check_backend_files(secrets_provider=SECRETS_PROVIDER, config_dir=tmp_path)assert healthy is Trueassert message == "All backend files are valid"- assert reports["pipelex_gateway"].is_valid is True+ assert reportsassert all(report.is_valid for report in reports.values())- def test_backend_files_malformed_file_still_caught_under_leniency(self, tmp_path: Path) -> None:- """Leniency skips the gateway, not a malformed file — and the gateway no longer hides one behind it."""+ def test_backend_files_enabled_manifold_is_healthy(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:+ """The probe hands the loader no manifold model specs, and that must not be reported as a malformed file.++ The manifold's variables are set, or the loader would skip it before ever asking for its specs.+ """+ self._copy_kit_inference(tmp_path)+ _write_backends_override(tmp_path, "[pipelex_manifold]\nenabled = true\n")+ monkeypatch.setenv("PIPELEX_MANIFOLD_ENDPOINT", "https://manifold.example.test/v1")+ monkeypatch.setenv("PIPELEX_MANIFOLD_API_KEY", "test-manifold-key")++ healthy, reports, message = check_backend_files(secrets_provider=SECRETS_PROVIDER, config_dir=tmp_path)++ assert healthy is True+ assert message == "All backend files are valid"+ assert reports["pipelex_manifold"].is_valid is True++ def test_backend_files_malformed_file_still_caught_under_leniency(self, tmp_path: Path, monkeypatch: pytest.MonkeyPatch) -> None:+ """Leniency skips the managed gateway, not a malformed file — and the gateway does not hide one behind it."""backends_dir = self._copy_kit_inference(tmp_path)+ _write_backends_override(tmp_path, "[pipelex_manifold]\nenabled = true\n")+ monkeypatch.setenv("PIPELEX_MANIFOLD_ENDPOINT", "https://manifold.example.test/v1")+ monkeypatch.setenv("PIPELEX_MANIFOLD_API_KEY", "test-manifold-key")anthropic_file = backends_dir / "anthropic.toml"anthropic_file.write_text(anthropic_file.read_text(encoding="utf-8") + '\n[bogus_key_table]\nfoo = "bar"\n', encoding="utf-8")@@ -259,7 +276,7 @@ class TestDoctorBackendChecks:assert reports["anthropic"].is_valid is Falseassert reports["anthropic"].error_message is not Noneassert "anthropic" in reports["anthropic"].error_message- assert reports["pipelex_gateway"].is_valid is True+ assert reports["pipelex_manifold"].is_valid is Truedef test_kit_template_exists_for_shipped_backend(self) -> None:"""The kit ships an openai backend template."""diff --git a/tests/unit/pipelex/cli/test_doctor_check_models.py b/tests/unit/pipelex/cli/test_doctor_check_models.pyindex f5d3a176b..86b1c5845 100644--- a/tests/unit/pipelex/cli/test_doctor_check_models.py+++ b/tests/unit/pipelex/cli/test_doctor_check_models.py@@ -1,6 +1,6 @@-"""Unit tests for doctor's check_models — gateway gating and model deck validation paths.+"""Unit tests for doctor's check_models — managed-gateway gating and model deck validation paths.-All inference-adjacent collaborators (backend files probe, gateway config fetch,+All inference-adjacent collaborators (backend files probe, remote config fetch,ModelManager) are mocked at the doctor module namespace: these tests cover thedecision tree, not the model loading itself."""@@ -21,9 +21,9 @@ from pipelex.cogt.exceptions import (ModelDeckValidationError,RoutingProfileLibraryError,)-from pipelex.cogt.model_backends.backend import LEGACY_GATEWAY_MODEL_SPECS_SECTION, PipelexBackend+from pipelex.cogt.model_backends.backend import MANIFOLD_MODEL_SPECS_SECTION, PipelexBackendfrom pipelex.system.pipelex_service.exceptions import RemoteConfigUnavailableError-from pipelex.system.pipelex_service.remote_config import PipelexPosthogConfig, RemoteConfig+from pipelex.system.pipelex_service.remote_config import RemoteConfigfrom pipelex.system.pipelex_service.types import RemoteConfigSourcefrom pipelex.tools.secrets.env_secrets_provider import EnvSecretsProvider@@ -78,8 +78,8 @@ class TestCheckModels:manager_class_mock.assert_not_called()@pytest.mark.usefixtures("healthy_backend_files", "gateway_disabled")- def test_gateway_disabled_happy_path(self, models_manager: Any) -> None:- """With the gateway disabled and a valid deck, models are healthy."""+ def test_managed_gateway_disabled_happy_path(self, models_manager: Any) -> None:+ """With no managed gateway enabled and a valid deck, models are healthy."""healthy, message, reports = check_models(secrets_provider=SECRETS_PROVIDER)assert healthy is True@@ -90,43 +90,12 @@ class TestCheckModels:models_manager.validate_model_deck.assert_called_once()@pytest.mark.usefixtures("healthy_backend_files")- def test_gateway_enabled_missing_service_config(self, mocker: MockerFixture) -> None:- """Gateway enabled without a service config is unhealthy."""- mocker.patch(- "pipelex.cli.commands.doctor_cmd.enabled_managed_gateway_sections",- return_value={PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION},- )- mocker.patch("pipelex.cli.commands.doctor_cmd.load_pipelex_service_config_if_exists", return_value=None)-- healthy, message, _ = check_models(secrets_provider=SECRETS_PROVIDER)-- assert healthy is False- assert message == "Pipelex Gateway is enabled but service configuration is missing"-- @pytest.mark.usefixtures("healthy_backend_files")- def test_gateway_enabled_terms_not_accepted(self, mocker: MockerFixture) -> None:- """Gateway enabled with unaccepted terms is unhealthy."""- mocker.patch(- "pipelex.cli.commands.doctor_cmd.enabled_managed_gateway_sections",- return_value={PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION},- )- service_config = SimpleNamespace(agreement=SimpleNamespace(terms_accepted=False))- mocker.patch("pipelex.cli.commands.doctor_cmd.load_pipelex_service_config_if_exists", return_value=service_config)-- healthy, message, _ = check_models(secrets_provider=SECRETS_PROVIDER)-- assert healthy is False- assert message == "Pipelex Gateway is enabled but terms have not been accepted"-- @pytest.mark.usefixtures("healthy_backend_files")- def test_gateway_enabled_remote_fetch_failure(self, mocker: MockerFixture) -> None:+ def test_managed_gateway_enabled_remote_fetch_failure(self, mocker: MockerFixture) -> None:"""A failed remote-config fetch is unhealthy with the fetch error in the message."""mocker.patch("pipelex.cli.commands.doctor_cmd.enabled_managed_gateway_sections",- return_value={PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION},+ return_value={PipelexBackend.MANIFOLD: MANIFOLD_MODEL_SPECS_SECTION},)- service_config = SimpleNamespace(agreement=SimpleNamespace(terms_accepted=True))- mocker.patch("pipelex.cli.commands.doctor_cmd.load_pipelex_service_config_if_exists", return_value=service_config)mocker.patch("pipelex.cli.commands.doctor_cmd.RemoteConfigFetcher.fetch_remote_config",side_effect=RemoteConfigUnavailableError("offline, cold cache"),@@ -135,23 +104,17 @@ class TestCheckModels:healthy, message, _ = check_models(secrets_provider=SECRETS_PROVIDER)assert healthy is False- assert message == "Failed to fetch Pipelex Gateway remote configuration: offline, cold cache"+ assert message == "Failed to fetch the Pipelex remote configuration: offline, cold cache"@pytest.mark.usefixtures("healthy_backend_files")- def test_gateway_enabled_passes_gateway_config_to_setup(self, mocker: MockerFixture, models_manager: Any) -> None:+ def test_managed_gateway_enabled_passes_gateway_config_to_setup(self, mocker: MockerFixture, models_manager: Any) -> None:"""A successful fetch builds one GatewayConfig per managed backend and threads them into the model setup."""mocker.patch("pipelex.cli.commands.doctor_cmd.enabled_managed_gateway_sections",- return_value={PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION},+ return_value={PipelexBackend.MANIFOLD: MANIFOLD_MODEL_SPECS_SECTION},)- service_config = SimpleNamespace(agreement=SimpleNamespace(terms_accepted=True))- mocker.patch("pipelex.cli.commands.doctor_cmd.load_pipelex_service_config_if_exists", return_value=service_config)fetch_result = SimpleNamespace(- config=RemoteConfig(- posthog=PipelexPosthogConfig(project_api_key="", endpoint="", is_geoip_enabled=False, is_debug_enabled=False),- backend_model_specs={},- aws_region="eu-west-3",- ),+ config=RemoteConfig(**{MANIFOLD_MODEL_SPECS_SECTION: {"gpt-5": {"model_id": "gpt-5"}}}),source=RemoteConfigSource.FRESH,)mocker.patch("pipelex.cli.commands.doctor_cmd.RemoteConfigFetcher.fetch_remote_config", return_value=fetch_result)@@ -163,7 +126,7 @@ class TestCheckModels:setup_kwargs = models_manager.setup.call_args.kwargsmanaged_gateway_configs = setup_kwargs["managed_gateway_configs"]assert managed_gateway_configs is not None- assert managed_gateway_configs[PipelexBackend.GATEWAY].aws_region == "eu-west-3"+ assert set(managed_gateway_configs[PipelexBackend.MANIFOLD].model_specs) == {"gpt-5"}assert setup_kwargs["gateway_config_source"] == RemoteConfigSource.FRESH@pytest.mark.usefixtures("healthy_backend_files", "gateway_disabled")diff --git a/tests/unit/pipelex/cli/test_error_handlers.py b/tests/unit/pipelex/cli/test_error_handlers.pyindex b054aeb45..22d651ca4 100644--- a/tests/unit/pipelex/cli/test_error_handlers.py+++ b/tests/unit/pipelex/cli/test_error_handlers.py@@ -9,7 +9,6 @@ import typerfrom pipelex.cli.error_handlers import (ErrorContext,- handle_inference_setup_required_error,handle_model_availability_error,handle_model_choice_error,handle_model_deck_preset_error,@@ -21,7 +20,6 @@ from pipelex.core.pipes.exceptions import PipeOperatorModelChoiceErrorfrom pipelex.pipe_operators.exceptions import PipeOperatorModelAvailabilityErrorfrom pipelex.pipeline.exceptions import ValidateBundleErrorfrom pipelex.system.pipe_run_mode import PipeRunMode-from pipelex.system.pipelex_service.exceptions import InferenceSetupRequiredErrorif TYPE_CHECKING:from pytest_mock import MockerFixture@@ -99,13 +97,3 @@ class TestErrorHandlers:assert exc_info.value.exit_code == 1spy.assert_called_once()-- def test_handle_inference_setup_required_error_exits(self, mocker: MockerFixture) -> None:- """handle_inference_setup_required_error should exit with code 1."""- mocker.patch("pipelex.cli.error_handlers.get_console")- exc = InferenceSetupRequiredError()-- with pytest.raises(typer.Exit) as exc_info:- handle_inference_setup_required_error(exc)-- assert exc_info.value.exit_code == 1diff --git a/tests/unit/pipelex/cli/test_error_handlers_more.py b/tests/unit/pipelex/cli/test_error_handlers_more.pyindex 700ceae3e..83a6d56c0 100644--- a/tests/unit/pipelex/cli/test_error_handlers_more.py+++ b/tests/unit/pipelex/cli/test_error_handlers_more.py@@ -1,6 +1,6 @@"""Unit tests for the CLI error handlers not covered by test_error_handlers.py.-Covers the shared panel renderer, the gateway/telemetry/signature handlers, and the+Covers the shared panel renderer, the remote-config/telemetry/signature handlers, and thedetailed sections of bundle-validation error display. Assertions are on the recordedplain-text console output plus the exit code."""@@ -18,9 +18,6 @@ from pipelex.base_exceptions import MigrationErrorBlockfrom pipelex.cli.error_handlers import (ErrorContext,display_error_panel,- handle_gateway_api_key_missing_error,- handle_gateway_do_not_track_conflict_error,- handle_gateway_terms_not_accepted_error,handle_gateway_unknown_model_error,handle_model_deck_preset_error,handle_remote_config_unavailable_error,@@ -35,9 +32,6 @@ from pipelex.core.exceptions import DryRunFailureErrorData, PipelexBundleBlueprifrom pipelex.core.validation import MIGRATE_COMMANDfrom pipelex.pipeline.exceptions import ValidateBundleErrorfrom pipelex.system.pipelex_service.exceptions import (- GatewayApiKeyMissingError,- GatewayDoNotTrackConflictError,- GatewayTermsNotAcceptedError,RemoteConfigUnavailableError,RemoteConfigValidationError,)@@ -278,46 +272,14 @@ class TestErrorHandlersExtended:assert f"{MIGRATE_COMMAND} --dry-run" in outputassert "init telemetry" not in output, "a file the migration cannot repair is still never answered with a reset"- def test_handle_gateway_terms_not_accepted_error(self, console: Console) -> None:- """The terms handler points at init config and the BYOK alternative."""- with pytest.raises(typer.Exit) as exc_info:- handle_gateway_terms_not_accepted_error(GatewayTermsNotAcceptedError())-- assert exc_info.value.exit_code == 1- output = console.export_text()- assert "Pipelex Gateway terms not accepted" in output- assert "pipelex init config" in output- assert "Disable pipelex_gateway" in output-- def test_handle_gateway_api_key_missing_error(self, console: Console) -> None:- """The API-key handler names the env var to set."""- with pytest.raises(typer.Exit) as exc_info:- handle_gateway_api_key_missing_error(GatewayApiKeyMissingError())-- assert exc_info.value.exit_code == 1- output = console.export_text()- assert "Pipelex Gateway API key not set" in output- assert "PIPELEX_GATEWAY_API_KEY" in output-- def test_handle_gateway_do_not_track_conflict_error(self, console: Console) -> None:- """The DNT handler offers both resolution options."""- with pytest.raises(typer.Exit) as exc_info:- handle_gateway_do_not_track_conflict_error(GatewayDoNotTrackConflictError(dnt_env_var="DO_NOT_TRACK"))-- assert exc_info.value.exit_code == 1- output = console.export_text()- assert "Pipelex Gateway requires telemetry" in output- assert "Unset" in output- assert "disable pipelex_gateway" in output-def test_handle_remote_config_validation_error(self, console: Console) -> None:- """A malformed gateway config is flagged as a server-side bug to report."""+ """A malformed remote config is flagged as a server-side bug to report."""with pytest.raises(typer.Exit) as exc_info:handle_remote_config_validation_error(RemoteConfigValidationError("missing key 'models'"))assert exc_info.value.exit_code == 1output = console.export_text()- assert "Pipelex Gateway configuration is invalid" in output+ assert "remote configuration is invalid" in outputassert "missing key 'models'" in outputassert "Please report this!" in outputdiff --git a/tests/unit/pipelex/cli/test_init_gateway_terms_overrides.py b/tests/unit/pipelex/cli/test_init_gateway_terms_overrides.pydeleted file mode 100644index 6057bf287..000000000--- a/tests/unit/pipelex/cli/test_init_gateway_terms_overrides.py+++ /dev/null@@ -1,101 +0,0 @@-"""`pipelex init` decides "managed gateway enabled" on the merged backends document, and says so when a write to the base cannot take.--The init writers edit the base `backends.toml` while the runtime reads it with `backends_override.toml`-merged over it. Two consequences are pinned here: the terms prompt fires for a managed gateway backend-enabled only by an override, and declining the terms — which disables every managed backend in the base —-warns when an override still pins one on, naming the files, instead of leaving the next boot to refuse for-terms the user just declined.--The question asked is the broad one, over every Pipelex-managed gateway backend rather than-`pipelex_gateway` by name, because the terms are the Pipelex service's: a manifold pinned back on by an-override puts the installation behind them exactly as the legacy gateway does.-"""--from __future__ import annotations--import io-from pathlib import Path-from typing import TYPE_CHECKING--from rich.console import Console--from pipelex.cli.commands.init.backends import warn_if_managed_gateway_pinned_by_override-from pipelex.cli.commands.init.command import _check_gateway_terms_if_needed # pyright: ignore[reportPrivateUsage]-from pipelex.cogt.model_backends.backend import MANIFOLD_MODEL_SPECS_SECTION--if TYPE_CHECKING:- from pytest_mock import MockerFixture--BASE_GATEWAY_OFF = "[pipelex_gateway]\nenabled = false\n"-OVERRIDE_GATEWAY_ON = "[pipelex_gateway]\nenabled = true\n"-BASE_MANIFOLD_OFF = f'[pipelex_manifold]\nenabled = false\nmodel_specs_section = "{MANIFOLD_MODEL_SPECS_SECTION}"\n'-OVERRIDE_MANIFOLD_ON = "[pipelex_manifold]\nenabled = true\n"---def _write_backends(config_dir: Path, *, base: str, override: str | None) -> Path:- inference_dir = config_dir / "inference"- inference_dir.mkdir(parents=True)- backends_toml_path = inference_dir / "backends.toml"- backends_toml_path.write_text(base)- if override is not None:- (inference_dir / "backends_override.toml").write_text(override)- return backends_toml_path---def _capturing_console() -> tuple[Console, io.StringIO]:- buffer = io.StringIO()- return Console(file=buffer, force_terminal=False, width=200), buffer---class TestWarnIfManagedGatewayPinnedByOverride:- def test_says_nothing_when_the_base_is_the_whole_story(self, tmp_path: Path) -> None:- backends_toml_path = _write_backends(tmp_path, base=BASE_GATEWAY_OFF, override=None)- console, buffer = _capturing_console()-- assert warn_if_managed_gateway_pinned_by_override(console=console, backends_toml_path=backends_toml_path) is False- assert buffer.getvalue() == ""-- def test_names_the_override_that_still_enables_the_gateway(self, tmp_path: Path) -> None:- backends_toml_path = _write_backends(tmp_path, base=BASE_GATEWAY_OFF, override=OVERRIDE_GATEWAY_ON)- console, buffer = _capturing_console()-- assert warn_if_managed_gateway_pinned_by_override(console=console, backends_toml_path=backends_toml_path) is True- assert "backends_override.toml" in buffer.getvalue()- assert "still enabled" in buffer.getvalue()- assert "pipelex_gateway" in buffer.getvalue()-- def test_it_asks_the_broad_question_so_a_manifold_pinned_on_is_named_too(self, tmp_path: Path) -> None:- """The terms are the service's, not one dialect's — a manifold override puts the install behind them."""- backends_toml_path = _write_backends(tmp_path, base=BASE_MANIFOLD_OFF, override=OVERRIDE_MANIFOLD_ON)- console, buffer = _capturing_console()-- assert warn_if_managed_gateway_pinned_by_override(console=console, backends_toml_path=backends_toml_path) is True- assert "pipelex_manifold" in buffer.getvalue()---class TestCheckGatewayTermsIfNeeded:- def test_a_gateway_enabled_only_by_an_override_is_prompted_for_terms_and_warned_on_decline(self, tmp_path: Path, mocker: MockerFixture) -> None:- backends_toml_path = _write_backends(tmp_path, base=BASE_GATEWAY_OFF, override=OVERRIDE_GATEWAY_ON)- console, buffer = _capturing_console()- mocker.patch("pipelex.cli.commands.init.command.load_pipelex_service_config_if_exists", return_value=None)- prompt = mocker.patch("pipelex.cli.commands.init.command.prompt_gateway_acceptance", return_value=False)- mocker.patch("pipelex.cli.commands.init.command.display_gateway_declined_message")- record_terms = mocker.patch("pipelex.cli.commands.init.command.update_service_terms_acceptance")- mocker.patch.object(Path, "home", return_value=tmp_path / "home")-- _check_gateway_terms_if_needed(console=console, backends_toml_path=backends_toml_path)-- prompt.assert_called_once()- record_terms.assert_called_once()- assert record_terms.call_args.kwargs["accepted"] is False- assert "backends_override.toml" in buffer.getvalue()-- def test_a_gateway_disabled_in_the_merged_document_is_not_prompted(self, tmp_path: Path, mocker: MockerFixture) -> None:- """The reverse: enabled in the base, switched off by the override — no terms needed."""- backends_toml_path = _write_backends(tmp_path, base=OVERRIDE_GATEWAY_ON, override=BASE_GATEWAY_OFF)- console, _ = _capturing_console()- prompt = mocker.patch("pipelex.cli.commands.init.command.prompt_gateway_acceptance")-- _check_gateway_terms_if_needed(console=console, backends_toml_path=backends_toml_path)-- prompt.assert_not_called()diff --git a/tests/unit/pipelex/cli/test_traceback_flag_error_handlers.py b/tests/unit/pipelex/cli/test_traceback_flag_error_handlers.pyindex e38a563f3..cbb3e4c75 100644--- a/tests/unit/pipelex/cli/test_traceback_flag_error_handlers.py+++ b/tests/unit/pipelex/cli/test_traceback_flag_error_handlers.py@@ -1,6 +1,6 @@"""Integration tests for error handlers respecting the --traceback flag.-Verifies that handle_inference_setup_required_error prints or omits a Rich+Verifies that a handler (here handle_model_deck_preset_error) prints or omits a Richtraceback depending on the --traceback flag state."""@@ -13,47 +13,58 @@ import pytestimport typerfrom rich.traceback import Traceback-from pipelex.cli.error_handlers import handle_inference_setup_required_error-from pipelex.system.pipelex_service.exceptions import InferenceSetupRequiredError+from pipelex.cli.error_handlers import ErrorContext, handle_model_deck_preset_error+from pipelex.cogt.exceptions import ModelDeckPresetValidatonError+from pipelex.cogt.model_backends.model_type import ModelTypeif TYPE_CHECKING:from pytest_mock import MockerFixture+def _deck_preset_error() -> ModelDeckPresetValidatonError:+ return ModelDeckPresetValidatonError(+ message="preset references unavailable model",+ model_type=ModelType.LLM,+ preset_id="default",+ model_handle="gpt-5",+ enabled_backends={"openai"},+ )++class TestTracebackFlagInErrorHandlers:"""Integration: error handlers respect the --traceback flag."""def test_handler_prints_traceback_when_flag_active(self, mocker: MockerFixture) -> None:- """handle_inference_setup_required_error prints traceback when --traceback is set."""+ """handle_model_deck_preset_error prints traceback when --traceback is set."""mock_console = mocker.MagicMock()mocker.patch("pipelex.cli.error_handlers.get_console", return_value=mock_console)- exc = InferenceSetupRequiredError()+ exc = _deck_preset_error()ctx = click.Context(click.Command("test"), obj={"traceback": True})with ctx:try:raise exc- except InferenceSetupRequiredError:+ except ModelDeckPresetValidatonError:with pytest.raises(typer.Exit):- handle_inference_setup_required_error(exc)+ handle_model_deck_preset_error(exc, context=ErrorContext.VALIDATION)# The first call to console.print should be the Tracebackfirst_call_arg = mock_console.print.call_args_list[0][0][0]assert isinstance(first_call_arg, Traceback)def test_handler_does_not_print_traceback_when_flag_absent(self, mocker: MockerFixture) -> None:- """handle_inference_setup_required_error does NOT print traceback without --traceback."""+ """handle_model_deck_preset_error does NOT print traceback without --traceback."""mock_console = mocker.MagicMock()mocker.patch("pipelex.cli.error_handlers.get_console", return_value=mock_console)- exc = InferenceSetupRequiredError()+ exc = _deck_preset_error()ctx = click.Context(click.Command("test"), obj={"traceback": False})with ctx:try:raise exc- except InferenceSetupRequiredError:+ except ModelDeckPresetValidatonError:with pytest.raises(typer.Exit):- handle_inference_setup_required_error(exc)+ handle_model_deck_preset_error(exc, context=ErrorContext.VALIDATION)# No call should have a Traceback argumentfor call in mock_console.print.call_args_list:diff --git a/tests/unit/pipelex/cli/test_update_cmd.py b/tests/unit/pipelex/cli/test_update_cmd.pyindex 2deacc730..dd660b12f 100644--- a/tests/unit/pipelex/cli/test_update_cmd.py+++ b/tests/unit/pipelex/cli/test_update_cmd.py@@ -84,7 +84,7 @@ class TestUpdateCmd:self._seed_kit_backends(mocker,kit_backends_dir,- {"internal.toml": "internal-with-reportlab", "openai.toml": "openai-kit", "pipelex_gateway_models.md": "models-kit"},+ {"internal.toml": "internal-with-reportlab", "openai.toml": "openai-kit", "models_reference.md": "models-kit"},)self._seed_installed(backends_dir, {"internal.toml": "internal-before-reportlab", "openai.toml": "openai-user", "my_backend.toml": "mine"})self._patch_resolve_backends_dir(mocker, backends_dir)@@ -257,7 +257,7 @@ class TestUpdateCmd:assert (backends_dir / "openai.toml").read_text(encoding="utf-8") == "openai-user"assert (backends_dir / "my_backend.toml").read_text(encoding="utf-8") == "mine"- assert not (backends_dir / "pipelex_gateway_models.md").exists()+ assert not (backends_dir / "models_reference.md").exists()assert sorted(path.name for path in backends_dir.glob("*.bak.*")) == [next(backends_dir.glob("internal.toml.bak.*")).name]def test_a_refreshed_internal_toml_is_up_to_date_afterwards(self, kit_and_backends: tuple[Path, Path]) -> None:diff --git a/tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_config_faults.py b/tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_config_faults.pyindex 082c1a467..354e814ed 100644--- a/tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_config_faults.py+++ b/tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_config_faults.py@@ -1,7 +1,7 @@"""An image worker refuses a model spec it cannot use as a configuration fault, not as the caller's input.-A spec with no `rules`, a rule value this release does not know, or one missing the `model_choice` or-`endpoint_path` its worker needs, is the backend configuration's fault: the job fails before any provider call with an `ImgGenParameterError`+A spec with no `rules`, a rule value this release does not know, or one missing the `model_choice` its+worker needs, is the backend configuration's fault: the job fails before any provider call with an `ImgGenParameterError`in the `CONFIGURATION` category, which the error model renders as a 500 rather than the 422 thattells a caller to change what they sent."""@@ -24,7 +24,6 @@ from pipelex.cogt.model_backends.model_type import ModelTypefrom pipelex.plugins.model_handle import ModelHandlefrom pipelex.providers.azure_rest.azure_img_gen_worker import AzureImgGenWorkerfrom pipelex.providers.fal.fal_img_gen_worker import FalImgGenWorker-from pipelex.providers.gateway.gateway_img_gen_worker import GatewayImgGenWorkerfrom pipelex.providers.huggingface.huggingface_img_gen_worker import HuggingFaceImgGenWorkerfrom pipelex.providers.manifold.manifold_img_gen_worker import ManifoldImgGenWorkerfrom pipelex.providers.openai.openai_img_gen_worker import OpenAIImgGenWorker@@ -68,11 +67,6 @@ def _make_worker(mocker: MockerFixture, *, worker_kind: str, rules: ImgGenModelRreturn OpenAIImgGenWorker(sdk_instance=mocker.MagicMock(spec=AsyncOpenAI), inference_model=_model(backend_name="openai", sdk="openai_img_gen", rules=rules))- case "gateway":- return GatewayImgGenWorker(- sdk_instance=mocker.MagicMock(spec=AsyncPortkey),- inference_model=_model(backend_name="pipelex_gateway", sdk="gateway_img_gen", rules=rules),- )case "manifold":return ManifoldImgGenWorker(sdk_instance=mocker.MagicMock(spec=AsyncPortkey),@@ -107,14 +101,12 @@ class TestImgGenWorkerConfigFaults:("worker_kind", "rules", "error_match"),[("openai", None, "does not have rules configured"),- ("gateway", None, "does not have rules configured"),("manifold", None, "does not have rules configured"),("fal", None, "does not have rules configured"),("huggingface", None, "does not have rules configured"),("azure", None, "does not have rules configured"),("fal", PROMPT_ONLY_RULES, "must include a 'model_choice' entry"),("huggingface", PROMPT_ONLY_RULES, "must include a 'model_choice' entry"),- ("gateway", PROMPT_ONLY_RULES, "does not have an endpoint_path configured"),("openai", UNKNOWN_ASPECT_RATIO_RULES, "unknown aspect_ratio taxonomy 'gemini_9_turbo'"),("manifold", UNKNOWN_ASPECT_RATIO_RULES, "unknown aspect_ratio taxonomy 'gemini_9_turbo'"),("azure", UNKNOWN_ASPECT_RATIO_RULES, "unknown aspect_ratio taxonomy 'gemini_9_turbo'"),diff --git a/tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_factory.py b/tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_factory.pyindex 4329bd18d..738adb53c 100644--- a/tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_factory.py+++ b/tests/unit/pipelex/cogt/img_gen/test_img_gen_worker_factory.py@@ -24,7 +24,6 @@ from pipelex.plugins.model_handle import ModelHandlefrom pipelex.plugins.registrar import PluginRegistrarfrom pipelex.plugins.sdk_client_registry import SdkClientRegistryfrom pipelex.providers.blackboxai.blackboxai_completions_factory import BlackboxaiCompletionsFactory-from pipelex.providers.gateway.gateway_completions_factory import GatewayCompletionsFactoryfrom pipelex.providers.openai.openai_completions_factory import OpenAICompletionsFactoryfrom pipelex.providers.openrouter.openrouter_completions_factory import OpenRouterCompletionsFactory@@ -52,15 +51,12 @@ def build_builtin_inference_backend_registry() -> InferenceBackendRegistry:FACTORY_MODULE = "pipelex.cogt.img_gen.img_gen_worker_factory"-GATEWAY_CLIENT = "pipelex.providers.gateway.gateway_factory.GatewayFactory.make_portkey_client"-GATEWAY_COMPLETIONS_CLIENT = (- "pipelex.providers.gateway.gateway_completions_factory.GatewayCompletionsFactory.make_portkey_openai_client_for_completions"-)+MANIFOLD_CLIENT = "pipelex.providers.manifold.manifold_factory.ManifoldFactory.make_portkey_client"OPENAI_CLIENT = "pipelex.providers.openai.openai_client_factory.OpenAIClientFactory.make_openai_client"GOOGLE_CLIENT = "pipelex.providers.google.google_factory.GoogleFactory.make_google_client"HUGGINGFACE_PROVIDER = "pipelex.providers.huggingface.huggingface_factory.HuggingFaceFactory.make_huggingface_inference_provider"-GATEWAY_WORKER = "pipelex.providers.gateway.gateway_img_gen_worker.GatewayImgGenWorker"+MANIFOLD_WORKER = "pipelex.providers.manifold.manifold_img_gen_worker.ManifoldImgGenWorker"FAL_WORKER = "pipelex.providers.fal.fal_img_gen_worker.FalImgGenWorker"HUGGINGFACE_WORKER = "pipelex.providers.huggingface.huggingface_img_gen_worker.HuggingFaceImgGenWorker"OPENAI_WORKER = "pipelex.providers.openai.openai_img_gen_worker.OpenAIImgGenWorker"@@ -114,19 +110,10 @@ class TestImgGenWorkerFactory:@pytest.mark.parametrize(("sdk", "client_target", "worker_target", "factory_cls", "http_flag", "passes_model_handle"),[- pytest.param("gateway_img_gen", GATEWAY_CLIENT, GATEWAY_WORKER, None, None, False, id="gateway_img_gen"),+ pytest.param("manifold_img_gen", MANIFOLD_CLIENT, MANIFOLD_WORKER, None, None, False, id="manifold_img_gen"),pytest.param("openai_img_gen", OPENAI_CLIENT, OPENAI_WORKER, None, None, True, id="openai_img_gen"),pytest.param("blackboxai_img_gen", OPENAI_CLIENT, COMPLETIONS_WORKER, BlackboxaiCompletionsFactory, True, True, id="blackboxai_img_gen"),pytest.param("openrouter_img_gen", OPENAI_CLIENT, COMPLETIONS_WORKER, OpenRouterCompletionsFactory, True, True, id="openrouter_img_gen"),- pytest.param(- "gateway_completions",- GATEWAY_COMPLETIONS_CLIENT,- COMPLETIONS_WORKER,- GatewayCompletionsFactory,- False,- True,- id="gateway_completions",- ),pytest.param("google", GOOGLE_CLIENT, GOOGLE_WORKER, None, None, False, id="google"),],)@@ -242,12 +229,12 @@ class TestImgGenWorkerFactory:"""A pre-seeded registry entry is reused: the client factory must not be called."""backend = make_backend()registry = patch_hub_getters(mocker, backend=backend)- inference_model = make_img_gen_model_spec(sdk="gateway_img_gen")+ inference_model = make_img_gen_model_spec(sdk="manifold_img_gen")model_handle = ModelHandle.make_for_inference_model(inference_model=inference_model)cached_client = mocker.MagicMock(name="cached_client")registry.set(model_handle=model_handle, sdk_instance=cached_client)- client_factory_mock = mocker.patch(GATEWAY_CLIENT)- worker_cls_mock = mocker.patch(GATEWAY_WORKER)+ client_factory_mock = mocker.patch(MANIFOLD_CLIENT)+ worker_cls_mock = mocker.patch(MANIFOLD_WORKER)ImgGenWorkerFactory.make_img_gen_worker(inference_model=inference_model)diff --git a/tests/unit/pipelex/cogt/llm/test_llm_worker_factory.py b/tests/unit/pipelex/cogt/llm/test_llm_worker_factory.pyindex f48f4ecf6..51b03ea8d 100644--- a/tests/unit/pipelex/cogt/llm/test_llm_worker_factory.py+++ b/tests/unit/pipelex/cogt/llm/test_llm_worker_factory.py@@ -23,8 +23,6 @@ from pipelex.plugins.inference_backend_registry import InferenceBackendRegistryfrom pipelex.plugins.model_handle import ModelHandlefrom pipelex.plugins.registrar import PluginRegistrarfrom pipelex.plugins.sdk_client_registry import SdkClientRegistry-from pipelex.providers.gateway.gateway_completions_factory import GatewayCompletionsFactory-from pipelex.providers.gateway.gateway_responses_factory import GatewayResponsesFactoryfrom pipelex.providers.mistral.mistral_factory import MistralFactoryfrom pipelex.providers.openai.openai_completions_factory import OpenAICompletionsFactoryfrom pipelex.providers.openai.openai_responses_factory import OpenAIResponsesFactory@@ -55,10 +53,6 @@ def build_builtin_inference_backend_registry() -> InferenceBackendRegistry:FACTORY_MODULE = "pipelex.cogt.llm.llm_worker_factory"-GATEWAY_COMPLETIONS_CLIENT = (- "pipelex.providers.gateway.gateway_completions_factory.GatewayCompletionsFactory.make_portkey_openai_client_for_completions"-)-GATEWAY_RESPONSES_CLIENT = "pipelex.providers.gateway.gateway_responses_factory.GatewayResponsesFactory.make_portkey_openai_client_for_responses"PORTKEY_COMPLETIONS_CLIENT = ("pipelex.providers.portkey.portkey_completions_factory.PortkeyCompletionsFactory.make_portkey_openai_client_for_completions")@@ -121,28 +115,6 @@ class TestLLMWorkerFactory:@pytest.mark.parametrize(("sdk", "client_target", "worker_target", "factory_field", "factory_cls", "http_flag", "passes_model_handle", "expects_extra_config"),[- pytest.param(- "gateway_completions",- GATEWAY_COMPLETIONS_CLIENT,- COMPLETIONS_WORKER,- "openai_completions_factory",- GatewayCompletionsFactory,- False,- True,- False,- id="gateway_completions",- ),- pytest.param(- "gateway_responses",- GATEWAY_RESPONSES_CLIENT,- RESPONSES_WORKER,- "openai_responses_factory",- GatewayResponsesFactory,- False,- True,- False,- id="gateway_responses",- ),pytest.param("portkey_completions",PORTKEY_COMPLETIONS_CLIENT,diff --git a/tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py b/tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.pyindex 343044243..d52872135 100644--- a/tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py+++ b/tests/unit/pipelex/cogt/model_backends/test_backend_boot_tolerance.py@@ -31,7 +31,7 @@ from typing import TYPE_CHECKING, Anyimport pytestfrom pipelex.cogt.exceptions import InferenceBackendLibraryError-from pipelex.cogt.model_backends.backend import PipelexBackend+from pipelex.cogt.model_backends.backend import MANIFOLD_MODEL_SPECS_SECTION, PipelexBackendfrom pipelex.cogt.model_backends.backend_library import InferenceBackendLibraryfrom pipelex.cogt.model_backends.gateway_config import GatewayConfigfrom pipelex.kit.paths import get_kit_configs_dir@@ -53,13 +53,15 @@ enabled = trueapi_key = "sk-not-a-real-key-either""""-GATEWAY_BACKENDS_TOML = """-[pipelex_gateway]+MANIFOLD_BACKENDS_TOML = f"""+[pipelex_manifold]enabled = true+model_specs_section = "{MANIFOLD_MODEL_SPECS_SECTION}"+endpoint = "https://manifold.example.com"api_key = "sk-not-a-real-key""""-GATEWAY_SERVED_SPECS: dict[str, Any] = {+MANIFOLD_SERVED_SPECS: dict[str, Any] = {"defaults": {"model_type": "llm", "sdk": "openai_responses", "thinking_mode": "none"},"gpt-4o": {"model_id": "gpt-4o"},}@@ -252,8 +254,8 @@ class TestAStaleBackendDirectory:assert retry.call_count == 0- def test_a_stale_gateway_override_never_reaches_the_loader_at_all(self, machine: Path) -> None:- """The gateway's local file is the one backend file a stale key cannot break, and here is why.+ def test_a_stale_managed_gateway_override_never_reaches_the_loader_at_all(self, machine: Path) -> None:+ """A managed gateway's local file is the one backend file a stale key cannot break, and here is why.`GatewayConfigMerger` ignores a local `[defaults]` outright and keeps only `sdk` and`structure_method` from a per-model override, so the retired key is filtered out before any@@ -262,17 +264,17 @@ class TestAStaleBackendDirectory:path would need one too. `pipelex migrate` still repairs the file on disk: it is a `*.toml`in the directory the surface owns, and the walk claims it like any other."""- gateway_file = self._backends_dir(machine) / f"{PipelexBackend.GATEWAY}.toml"+ gateway_file = self._backends_dir(machine) / f"{PipelexBackend.MANIFOLD}.toml"gateway_file.write_text(f'[defaults]\n{RETIRED_KEY} = "openai"\n\n[gpt-4o]\n{RETIRED_KEY} = "openai"\n', encoding="utf-8")library = self._load(machine,lenient=False,- library_body=GATEWAY_BACKENDS_TOML,- managed_gateway_configs={PipelexBackend.GATEWAY: GatewayConfig(model_specs=GATEWAY_SERVED_SPECS, aws_region="eu-west-1")},+ library_body=MANIFOLD_BACKENDS_TOML,+ managed_gateway_configs={PipelexBackend.MANIFOLD: GatewayConfig(model_specs=MANIFOLD_SERVED_SPECS)},)- backend = library.get_inference_backend(backend_name=PipelexBackend.GATEWAY)+ backend = library.get_inference_backend(backend_name=PipelexBackend.MANIFOLD)assert backend is not Noneassert backend.model_specs["gpt-4o"].model_id == "gpt-4o", "the served spec is what loads, untouched"assert library.take_stale_configuration_warning() is Nonediff --git a/tests/unit/pipelex/cogt/model_backends/test_backend_credentials.py b/tests/unit/pipelex/cogt/model_backends/test_backend_credentials.pyindex f564e24ba..f3997272d 100644--- a/tests/unit/pipelex/cogt/model_backends/test_backend_credentials.py+++ b/tests/unit/pipelex/cogt/model_backends/test_backend_credentials.py@@ -8,15 +8,11 @@ from pipelex.cogt.model_backends.backend_credentials import (from pipelex.tools.secrets.env_secrets_provider import EnvSecretsProviderfrom pipelex.tools.secrets.secrets_provider_abstract import SecretsProviderAbstract-GATEWAY_PITCH = (- "\n💡 Tip: Get a free Pipelex Gateway API key!\n"- " With Pipelex Gateway, you get unified access to multiple AI providers\n"- " (OpenAI, Anthropic, Google, Mistral, etc.) with a single API key.\n"- " Check the project's 'README.md' for details on obtaining your key.\n"- "\n🔑 Or bring your own keys:\n"+BYOK_HINT = (+ "\n🔑 Bring your own keys:\n"" Set your own provider keys (OPENAI_API_KEY, ANTHROPIC_API_KEY, GOOGLE_API_KEY,\n"- " MISTRAL_API_KEY, AZURE_API_KEY, etc.) and enable the corresponding backends\n"- " in '.pipelex/inference/backends.toml'.\n"+ " MISTRAL_API_KEY, AZURE_API_KEY, OPENROUTER_API_KEY, etc.) and enable the corresponding\n"+ " backends in '.pipelex/inference/backends.toml'.\n")@@ -65,7 +61,7 @@ class TestBackendCredentials:" Add the variable to your environment or .env file:\n"" - 'OPENAI_API_KEY'=<your_api_key>\n""\n2. Disable this backend\n"- " Add 'enabled = false' under '\\[openai]' in '.pipelex/inference/backends.toml'\n" + GATEWAY_PITCH+ " Add 'enabled = false' under '\\[openai]' in '.pipelex/inference/backends.toml'\n" + BYOK_HINT)assert error_msg == expected_msg@@ -84,7 +80,7 @@ class TestBackendCredentials:"1. Provide the missing secret\n"" Make sure 'ANTHROPIC_API_KEY' is available from your secrets provider.\n""\n2. Disable this backend\n"- " Add 'enabled = false' under '\\[anthropic]' in '.pipelex/inference/backends.toml'\n" + GATEWAY_PITCH+ " Add 'enabled = false' under '\\[anthropic]' in '.pipelex/inference/backends.toml'\n" + BYOK_HINT)assert error_msg == expected_msgassert ".env file" not in error_msg@@ -106,7 +102,7 @@ class TestBackendCredentials:" - 'OPENAI_API_KEY'=<your_api_key>\n""\n2. Disable unused backends\n"" Disable backends you don't need in '.pipelex/inference/backends.toml':\n"- " - Add 'enabled = false' under '\\[openai]'\n" + GATEWAY_PITCH+ " - Add 'enabled = false' under '\\[openai]'\n" + BYOK_HINT)assert error_msg == expected_msg@@ -181,6 +177,6 @@ class TestBackendCredentials:"\n2. Disable unused backends\n"" Disable backends you don't need in '.pipelex/inference/backends.toml':\n"" - Add 'enabled = false' under '\\[anthropic]'\n"- " - Add 'enabled = false' under '\\[bedrock]'\n" + GATEWAY_PITCH+ " - Add 'enabled = false' under '\\[bedrock]'\n" + BYOK_HINT)assert error_msg == expected_msgdiff --git a/tests/unit/pipelex/cogt/model_backends/test_managed_backend_missing_variable.py b/tests/unit/pipelex/cogt/model_backends/test_managed_backend_missing_variable.pyindex 370c1949c..2ca379213 100644--- a/tests/unit/pipelex/cogt/model_backends/test_managed_backend_missing_variable.py+++ b/tests/unit/pipelex/cogt/model_backends/test_managed_backend_missing_variable.py@@ -8,13 +8,7 @@ warning naming it.**The scoping is the point of these tests, not a detail.** The tolerance sits on a code path everybackend shares, so a global version of it would mean a user who typos `ANTHROPIC_API_KEY` stopsgetting a boot failure and starts getting a silently missing backend that resurfaces much later as a-model-resolution error — a behaviour change on the Portkey-cloud path and on every direct-SDK path,-which the two-gateways work must not make.--**And the predicate is the declaration rather than managed-ness**, because the two come apart on-`pipelex_gateway`: it is handed its section by compatibility default, so keying on managed-ness-would hand it the tolerance too and lose exactly the boot failure the paragraph above protects. The-third test below is what holds those two apart.+model-resolution error — a behaviour change on every direct-SDK path that must not be made."""from __future__ import annotations@@ -26,7 +20,6 @@ import pytestfrom pipelex.cogt.exceptions import InferenceBackendCredentialsErrorfrom pipelex.cogt.model_backends.backend import MANIFOLD_MODEL_SPECS_SECTION, PipelexBackendfrom pipelex.cogt.model_backends.backend_library import InferenceBackendLibrary-from pipelex.cogt.model_backends.gateway_config import GatewayConfigfrom pipelex.tools.secrets.env_secrets_provider import EnvSecretsProviderif TYPE_CHECKING:@@ -34,6 +27,8 @@ if TYPE_CHECKING:from pytest_mock import MockerFixture+ from pipelex.cogt.model_backends.gateway_config import GatewayConfig+# A name no environment has, so the substitution fails for the reason under test rather than by luck.UNSET_VAR = "PIPELEX_TEST_VARIABLE_THAT_IS_NEVER_SET"@@ -51,14 +46,6 @@ enabled = trueapi_key = "${{{UNSET_VAR}}}""""-# The legacy gateway, declaring nothing: `resolve_model_specs_section` hands it a section by-# compatibility default, which is exactly why it must not inherit the tolerance along with it.-LEGACY_GATEWAY_BACKEND_TOML = f"""-[pipelex_gateway]-enabled = true-api_key = "${{{UNSET_VAR}}}"-"""-def _load(tmp_path: Path, *, body: str, managed_gateway_configs: dict[str, GatewayConfig] | None = None) -> InferenceBackendLibrary:backends_dir = tmp_path / "backends"@@ -96,26 +83,6 @@ class TestAManagedBackendMissingItsVariables:assert refused.value.key_name == UNSET_VAR- def test_the_legacy_gateway_missing_its_key_still_stops_the_boot(self, tmp_path: Path) -> None:- """The Portkey-cloud path keeps today's fatal boot, and the distinction is why this test exists.-- `pipelex_gateway` declares no `model_specs_section` — it is handed one by compatibility- default so that a `backends.toml` written before the field keeps working. That default makes- it *managed*, and if the tolerance were scoped to managed-ness it would inherit it: an unset- `PIPELEX_GATEWAY_API_KEY` would stop being a boot failure with a remediation message and- become a silently missing backend that resurfaces much later as a model-resolution error.- The tolerance is therefore scoped to a backend that *declares* its section, which the kit- ships only for a backend it also ships disabled.- """- with pytest.raises(InferenceBackendCredentialsError) as refused:- _load(- tmp_path,- body=LEGACY_GATEWAY_BACKEND_TOML,- managed_gateway_configs={PipelexBackend.GATEWAY: GatewayConfig(model_specs={}, aws_region="eu-west-1")},- )-- assert refused.value.key_name == UNSET_VAR-class TestAManagedBackendWithNoPublishedSection:def test_it_is_disabled_rather_than_refused(self, tmp_path: Path) -> None:diff --git a/tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_per_model_keys.py b/tests/unit/pipelex/cogt/model_backends/test_managed_gateway_unknown_per_model_keys.pysimilarity index 84%rename from tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_per_model_keys.pyrename to tests/unit/pipelex/cogt/model_backends/test_managed_gateway_unknown_per_model_keys.pyindex 8a6baa1e6..e94468566 100644--- a/tests/unit/pipelex/cogt/model_backends/test_gateway_unknown_per_model_keys.py+++ b/tests/unit/pipelex/cogt/model_backends/test_managed_gateway_unknown_per_model_keys.py@@ -1,4 +1,4 @@-"""The remote gateway config may carry per-model keys this client's model-spec blueprint does not know.+"""A managed gateway's served config may carry per-model keys this client's model-spec blueprint does not know.It is served by a component that deploys on its own schedule, so a client can read a config writtenby a different release than itself. The loader's per-model rule tolerates that skew: an unknown@@ -14,34 +14,37 @@ from typing import Any, castfrom pytest_mock import MockerFixturefrom pipelex.cogt.llm.llm_job import LLMJob-from pipelex.cogt.model_backends.backend import PipelexBackend+from pipelex.cogt.model_backends.backend import MANIFOLD_MODEL_SPECS_SECTION, PipelexBackendfrom pipelex.cogt.model_backends.backend_library import InferenceBackendLibraryfrom pipelex.cogt.model_backends.gateway_config import GatewayConfigfrom pipelex.cogt.model_backends.model_spec_factory import BackendModelSpecs-from pipelex.providers.gateway.gateway_factory import GatewayFactory+from pipelex.providers.manifold.manifold_factory import ManifoldFactoryfrom pipelex.tools.secrets.env_secrets_provider import EnvSecretsProvider+from tests.unit.pipelex.providers.manifold.test_data import ManifoldMetadataTestData-GATEWAY_BACKENDS_TOML = """-[pipelex_gateway]+MANIFOLD_BACKENDS_TOML = f"""+[pipelex_manifold]enabled = true+model_specs_section = "{MANIFOLD_MODEL_SPECS_SECTION}"+endpoint = "https://manifold.example.com"api_key = "pk-not-a-real-key""""-class TestGatewayUnknownPerModelKeys:+class TestManagedGatewayUnknownPerModelKeys:"""The loader's per-model rule on a remote payload: header-shaped keys are headers, the rest is pruned."""def _load(self, tmp_path: Path, *, model_specs: BackendModelSpecs) -> InferenceBackendLibrary:backends_dir = tmp_path / "backends"backends_dir.mkdir()backends_library_path = tmp_path / "backends.toml"- backends_library_path.write_text(GATEWAY_BACKENDS_TOML)+ backends_library_path.write_text(MANIFOLD_BACKENDS_TOML)library = InferenceBackendLibrary.make_empty()library.load(secrets_provider=EnvSecretsProvider(),backends_library_paths=[backends_library_path],backends_dir_path=str(backends_dir),- managed_gateway_configs={PipelexBackend.GATEWAY: GatewayConfig(model_specs=model_specs, aws_region="eu-west-3")},+ managed_gateway_configs={PipelexBackend.MANIFOLD: GatewayConfig(model_specs=model_specs)},)return library@@ -49,7 +52,7 @@ class TestGatewayUnknownPerModelKeys:return cast("BackendModelSpecs",{- "defaults": {"model_type": "llm", "sdk": "gateway_completions"},+ "defaults": {"model_type": "llm", "sdk": "manifold_completions"},"gpt-4o-mini": {"model_id": "gpt-4o-mini", **per_model_extras},},)@@ -58,7 +61,7 @@ class TestGatewayUnknownPerModelKeys:"""`x-portkey-config` is on every served model; without it the gateway cannot route."""library = self._load(tmp_path, model_specs=self._remote_specs(per_model_extras={"x-portkey-config": "pc-openai-6e7576"}))- backend = library.get_inference_backend(backend_name="pipelex_gateway")+ backend = library.get_inference_backend(backend_name="pipelex_manifold")assert backend is not Noneassert backend.model_specs["gpt-4o-mini"].extra_headers == {"x-portkey-config": "pc-openai-6e7576"}@@ -69,7 +72,7 @@ class TestGatewayUnknownPerModelKeys:model_specs=self._remote_specs(per_model_extras={"x-portkey-config": "pc-openai-6e7576", "a_field_we_removed": "openai"}),)- backend = library.get_inference_backend(backend_name="pipelex_gateway")+ backend = library.get_inference_backend(backend_name="pipelex_manifold")assert backend is not Nonemodel_spec = backend.model_specs["gpt-4o-mini"]assert model_spec.extra_headers == {"x-portkey-config": "pc-openai-6e7576"}@@ -84,7 +87,7 @@ class TestGatewayUnknownPerModelKeys:model_specs=self._remote_specs(per_model_extras={"x-portkey-config": "pc-openai-6e7576", "x-weird": 3}),)- backend = library.get_inference_backend(backend_name="pipelex_gateway")+ backend = library.get_inference_backend(backend_name="pipelex_manifold")assert backend is not Noneassert backend.model_specs["gpt-4o-mini"].extra_headers == {"x-portkey-config": "pc-openai-6e7576"}@@ -97,7 +100,7 @@ class TestGatewayUnknownPerModelKeys:model_specs=self._remote_specs(per_model_extras={"x-portkey-config": "pc-openai-6e7576", "x-weird key": "value"}),)- backend = library.get_inference_backend(backend_name="pipelex_gateway")+ backend = library.get_inference_backend(backend_name="pipelex_manifold")assert backend is not Noneassert backend.model_specs["gpt-4o-mini"].extra_headers == {"x-portkey-config": "pc-openai-6e7576"}@@ -110,7 +113,7 @@ class TestGatewayUnknownPerModelKeys:model_specs=self._remote_specs(per_model_extras={"x-portkey-config": "pc-openai-6e7576", "x-weird": "two\r\nlines"}),)- backend = library.get_inference_backend(backend_name="pipelex_gateway")+ backend = library.get_inference_backend(backend_name="pipelex_manifold")assert backend is not Noneassert backend.model_specs["gpt-4o-mini"].extra_headers == {"x-portkey-config": "pc-openai-6e7576"}@@ -120,21 +123,21 @@ class TestGatewayUnknownPerModelKeys:"""library = self._load(tmp_path, model_specs=self._remote_specs(per_model_extras={"endpoint_path": "openai/deployments/x/images/generations"}))- backend = library.get_inference_backend(backend_name="pipelex_gateway")+ backend = library.get_inference_backend(backend_name="pipelex_manifold")assert backend is not Nonemodel_spec = backend.model_specs["gpt-4o-mini"]assert model_spec.endpoint_path == "openai/deployments/x/images/generations"assert not model_spec.extra_headersdef test_the_accepted_header_reaches_the_wire(self, tmp_path: Path, mocker: MockerFixture) -> None:- telemetry_manager = mocker.MagicMock()- telemetry_manager.is_pipelex_gateway_portkey_tracing_enabled.return_value = False- mocker.patch("pipelex.providers.gateway.gateway_factory.get_telemetry_manager", return_value=telemetry_manager)library = self._load(tmp_path, model_specs=self._remote_specs(per_model_extras={"x-portkey-config": "pc-openai-6e7576"}))- backend = library.get_inference_backend(backend_name="pipelex_gateway")+ backend = library.get_inference_backend(backend_name="pipelex_manifold")assert backend is not Nonemodel_spec = backend.model_specs["gpt-4o-mini"]- extra_headers, _ = GatewayFactory.make_extras(model_spec, inference_job=mocker.MagicMock(spec=LLMJob), output_desc="text")+ inference_job = mocker.MagicMock(spec=LLMJob)+ inference_job.job_metadata = ManifoldMetadataTestData.JOB_METADATA++ extra_headers, _ = ManifoldFactory.make_extras(model_spec, inference_job=inference_job, output_desc="text")assert extra_headers["x-portkey-config"] == "pc-openai-6e7576"diff --git a/tests/unit/pipelex/cogt/model_backends/test_model_spec_document.py b/tests/unit/pipelex/cogt/model_backends/test_model_spec_document.pyindex fa3e01723..a87fa1f24 100644--- a/tests/unit/pipelex/cogt/model_backends/test_model_spec_document.py+++ b/tests/unit/pipelex/cogt/model_backends/test_model_spec_document.py@@ -84,7 +84,7 @@ class TestABackendFileIsADocumentNotAModel:assert describe_model_spec_document_rejection(document=document) is Nonedef test_a_document_with_no_model_at_all_is_accepted(self) -> None:- """`pipelex_gateway.toml` in the kit is comments only, and the loader loads it without complaint."""+ """`pipelex_manifold.toml` in the kit is comments only, and the loader loads it without complaint."""assert describe_model_spec_document_rejection(document={}) is None@pytest.mark.parametrize(diff --git a/tests/unit/pipelex/cogt/model_routing/test_routing_profile_optional_routes.py b/tests/unit/pipelex/cogt/model_routing/test_routing_profile_optional_routes.pyindex 8bc19869e..e2a2497be 100644--- a/tests/unit/pipelex/cogt/model_routing/test_routing_profile_optional_routes.py+++ b/tests/unit/pipelex/cogt/model_routing/test_routing_profile_optional_routes.py@@ -70,11 +70,11 @@ class TestRoutingProfileOptionalRoutes:"""`jev-*` sends every versioned judgment model to its backend while that backend is enabled."""routing_profile = RoutingProfile(name="test_profile",- default="pipelex_gateway",+ default="pipelex_manifold",optional_routes={"jev-*": "typesafe"},)- result = routing_profile.get_backend_match_for_model(enabled_backends=["pipelex_gateway", "typesafe"], model_name="jev-1.13.0")+ result = routing_profile.get_backend_match_for_model(enabled_backends=["pipelex_manifold", "typesafe"], model_name="jev-1.13.0")assert result is not Noneassert result.backend_name == "typesafe"@@ -90,12 +90,12 @@ class TestRoutingProfileOptionalRoutes:"""routing_profile = RoutingProfile(name="test_profile",- default="pipelex_gateway",+ default="pipelex_manifold",routes={"gpt-*": "openai"},optional_routes={"jev-*": "typesafe"},)- routing_profile.get_backend_match_for_model(enabled_backends=["pipelex_gateway", "openai", "typesafe"], model_name="jev-1.13.0")+ routing_profile.get_backend_match_for_model(enabled_backends=["pipelex_manifold", "openai", "typesafe"], model_name="jev-1.13.0")assert routing_profile.routes == {"gpt-*": "openai"}assert routing_profile.optional_routes == {"jev-*": "typesafe"}diff --git a/tests/unit/pipelex/cogt/models/test_deck_manifest.py b/tests/unit/pipelex/cogt/models/test_deck_manifest.pyindex efc4784d6..ab853ef3b 100644--- a/tests/unit/pipelex/cogt/models/test_deck_manifest.py+++ b/tests/unit/pipelex/cogt/models/test_deck_manifest.py@@ -308,7 +308,7 @@ class TestDeckManifest:"""The kit's other backend files and a user's own are never the update's: only internal.toml is hashed, on either side."""kit_backends_dir = tmp_path / "kit-backends"kit_backends_dir.mkdir()- for filename in ("internal.toml", "openai.toml", "pipelex_gateway_models.md"):+ for filename in ("internal.toml", "openai.toml", "models_reference.md"):(kit_backends_dir / filename).write_text(f"kit {filename}", encoding="utf-8")mocker.patch.object(deck_manifest, "kit_backends_dir", return_value=kit_backends_dir)backends_dir = tmp_path / "backends"diff --git a/tests/unit/pipelex/cogt/models/test_enforce_gateway_model_membership.py b/tests/unit/pipelex/cogt/models/test_enforce_gateway_model_membership.pyindex b328798c4..a70f1c6b8 100644--- a/tests/unit/pipelex/cogt/models/test_enforce_gateway_model_membership.py+++ b/tests/unit/pipelex/cogt/models/test_enforce_gateway_model_membership.py@@ -5,7 +5,7 @@ services live that question only makes sense per service. Two failure shapes arepins down, because the single-gateway implementation had no way to tell them apart:- a **union** across the sections would accept a handle routed to the manifold service purely- because the Portkey-cloud section happens to serve it — a boot that then fails at the first call;+ because another managed section happens to serve it — a boot that then fails at the first call;- the same check run twice, once per section, over the *whole* deck would demand that every deckhandle appear in **both** sections, which no mixed routing profile can satisfy.@@ -42,10 +42,12 @@ if TYPE_CHECKING:from pipelex.cogt.model_backends.model_spec_factory import BackendModelSpecsBYOK_BACKEND = "xai"-ENABLED_BACKENDS = [PipelexBackend.GATEWAY, PipelexBackend.MANIFOLD, BYOK_BACKEND, PipelexBackend.INTERNAL]+# A second managed service beside the manifold, standing in for the next one the kit could ship.+OTHER_BACKEND = "pipelex_other"+ENABLED_BACKENDS = [OTHER_BACKEND, PipelexBackend.MANIFOLD, BYOK_BACKEND, PipelexBackend.INTERNAL]# The handles the fixture deck advertises. Everything not matched by a route lands on the profile's-# default backend, which is the Portkey-cloud service here.+# default backend, which is the other managed service here.GATEWAY_HANDLE = "gpt-5"MANIFOLD_HANDLE = "claude-4-sonnet"BYOK_HANDLE = "grok-3"@@ -56,7 +58,7 @@ SEARCH_HANDLE = "web-search"def _specs(*model_names: str) -> BackendModelSpecs:"""A spec map carrying exactly these model names, plus the `defaults` table the check ignores."""- specs: dict[str, object] = {"defaults": {"model_type": "llm", "sdk": "gateway_completions"}}+ specs: dict[str, object] = {"defaults": {"model_type": "llm", "sdk": "manifold_completions"}}for model_name in model_names:specs[model_name] = {"model_id": model_name}return specs # pyright: ignore[reportReturnType]@@ -71,7 +73,7 @@ def _resolved(name: str, *, backend_name: str) -> InferenceModelSpec:return InferenceModelSpec(backend_name=backend_name,name=name,- sdk="gateway_completions",+ sdk="manifold_completions",model_type=ModelType.LLM,model_id=name,costs={CostCategory.INPUT: 0.001, CostCategory.OUTPUT: 0.002},@@ -140,8 +142,8 @@ def _make_manager()manager._routing_profile = RoutingProfile( # pyright: ignore[reportPrivateUsage] # ruff: ignore[private-member-access]name="mixed",- description="Portkey's cloud by default, Claude through the manifold service, grok direct",- default=PipelexBackend.GATEWAY,+ description="The other managed service by default, Claude through the manifold service, grok direct",+ default=OTHER_BACKEND,routes={"claude-*": PipelexBackend.MANIFOLD, "grok-*": BYOK_BACKEND},)return manager@@ -156,7 +158,7 @@ def _enforce() -> None:manager._enforce_gateway_model_membership( # pyright: ignore[reportPrivateUsage] # ruff: ignore[private-member-access]managed_gateway_configs={- PipelexBackend.GATEWAY: GatewayConfig(model_specs=gateway_specs, aws_region="eu-west-3"),+ OTHER_BACKEND: GatewayConfig(model_specs=gateway_specs),PipelexBackend.MANIFOLD: GatewayConfig(model_specs=manifold_specs),},gateway_config_source=source,@@ -181,7 +183,7 @@ class TestEnforceGatewayModelMembership:def test_a_handle_absent_from_the_service_it_is_routed_to_raises_naming_that_service(self) -> None:"""The case that must still fail loudly — and the one a union across the sections would miss.- `claude-4-sonnet` is served by the Portkey-cloud section here, and the profile routes it to+ `claude-4-sonnet` is served by the other managed section here, and the profile routes it tothe manifold service, which does not carry it. Every call would fail; the boot says so."""manager = _make_manager(llm_presets={"cheap": LLMSetting(model=MANIFOLD_HANDLE, temperature=0.5)})@@ -257,13 +259,13 @@ class TestAWaterfallSpansBackends:"""The primary is absent from the service it routes to, and the fallback resolves elsewhere.`claude-4-sonnet` routes to the manifold service, which carries nothing; `gpt-5` routes to- the Portkey-cloud one and is already resolved in the deck. At runtime the waterfall walks+ the other managed one and is already resolved in the deck. At runtime the waterfall walkspast the first and uses the second, so the boot has nothing to refuse."""manager = _make_manager(llm_presets={"premium": LLMSetting(model="~premium", temperature=0.5)},llm_waterfalls={"premium": [MANIFOLD_HANDLE, GATEWAY_HANDLE]},- inference_models={GATEWAY_HANDLE: _resolved(GATEWAY_HANDLE, backend_name=PipelexBackend.GATEWAY)},+ inference_models={GATEWAY_HANDLE: _resolved(GATEWAY_HANDLE, backend_name=OTHER_BACKEND)},)_enforce(diff --git a/tests/unit/pipelex/cogt/models/test_inference_config_overrides_end_to_end.py b/tests/unit/pipelex/cogt/models/test_inference_config_overrides_end_to_end.pyindex afb34f125..27db0c39e 100644--- a/tests/unit/pipelex/cogt/models/test_inference_config_overrides_end_to_end.py+++ b/tests/unit/pipelex/cogt/models/test_inference_config_overrides_end_to_end.py@@ -1,8 +1,8 @@"""The two personal override files, read where the boot reads them: through the global `config_manager`.A developer writes `~/.pipelex/inference/backends_override.toml` and `routing_profiles_override.toml`-once, and every project on the machine follows — the gate the boot branches on to fetch gateway-specs sees the override, the model manager's default paths carry it, and deleting the two files+once, and every project on the machine follows — the gate the boot branches on to fetch the managed+gateways' specs sees the override, the model manager's default paths carry it, and deleting the two filesrestores the shipped default. Built on the kit's own inference tree so the shipped defaults are thefixture, and lenient (`needs_inference=False`) so no credential on this machine is a precondition."""@@ -15,17 +15,18 @@ from typing import TYPE_CHECKINGimport pytest+from pipelex.cogt.model_backends.backend import MANIFOLD_MODEL_SPECS_SECTION, PipelexBackendfrom pipelex.cogt.models.model_manager import ModelManagerfrom pipelex.kit.paths import get_kit_configs_dirfrom pipelex.plugins.plugin_model_declarations import PluginModelDeclarationsfrom pipelex.system.configuration.config_loader import CONFIG_DIR_NAME, INFERENCE_DIR_NAME-from pipelex.system.pipelex_service.pipelex_service_config import is_pipelex_gateway_enabled+from pipelex.system.pipelex_service.pipelex_service_config import enabled_managed_gateway_sectionsfrom pipelex.tools.secrets.env_secrets_provider import EnvSecretsProviderif TYPE_CHECKING:from pytest_mock import MockerFixture-GATEWAY_OFF_OVERRIDE = "[pipelex_gateway]\nenabled = false\n"+MANIFOLD_ON_OVERRIDE = "[pipelex_manifold]\nenabled = true\n"ANTHROPIC_PROFILE_OVERRIDE = 'active = "all_anthropic"\n'@@ -58,25 +59,25 @@ class TestInferenceConfigOverridesEndToEnd:return models_manager.routing_profile.name@pytest.mark.usefixtures("global_inference_dir")- def test_the_shipped_default_is_the_gateway(self) -> None:+ def test_the_shipped_default_needs_no_pipelex_account(self) -> None:"""The control, and the state the overrides must restore when deleted."""- assert is_pipelex_gateway_enabled() is True- assert self._active_profile_name() == "all_pipelex_gateway"+ assert enabled_managed_gateway_sections() == {}+ assert self._active_profile_name() == "all_enabled_backends"- def test_two_global_override_files_move_the_machine_off_the_gateway_and_deleting_them_moves_it_back(self, global_inference_dir: Path) -> None:+ def test_two_global_override_files_move_the_machine_onto_the_manifold_and_deleting_them_moves_it_back(self, global_inference_dir: Path) -> None:backends_override = global_inference_dir / "backends_override.toml"routing_override = global_inference_dir / "routing_profiles_override.toml"- backends_override.write_text(GATEWAY_OFF_OVERRIDE, encoding="utf-8")+ backends_override.write_text(MANIFOLD_ON_OVERRIDE, encoding="utf-8")routing_override.write_text(ANTHROPIC_PROFILE_OVERRIDE, encoding="utf-8")- assert is_pipelex_gateway_enabled() is False+ assert enabled_managed_gateway_sections() == {PipelexBackend.MANIFOLD: MANIFOLD_MODEL_SPECS_SECTION}assert self._active_profile_name() == "all_anthropic"backends_override.unlink()routing_override.unlink()- assert is_pipelex_gateway_enabled() is True- assert self._active_profile_name() == "all_pipelex_gateway"+ assert enabled_managed_gateway_sections() == {}+ assert self._active_profile_name() == "all_enabled_backends"def test_a_project_override_wins_over_the_global_one(self, global_inference_dir: Path, tmp_path: Path) -> None:"""The project keeps its own inference files out of it: only its override is added, last."""diff --git a/tests/unit/pipelex/cogt/models/test_model_deck_references.py b/tests/unit/pipelex/cogt/models/test_model_deck_references.pyindex 46bc8e4bf..7d0f928ab 100644--- a/tests/unit/pipelex/cogt/models/test_model_deck_references.py+++ b/tests/unit/pipelex/cogt/models/test_model_deck_references.py@@ -14,6 +14,7 @@ from pipelex.cogt.extract.extract_setting import ExtractSettingfrom pipelex.cogt.img_gen.img_gen_setting import ImgGenSettingfrom pipelex.cogt.judgment.judgment_setting import JudgmentSettingfrom pipelex.cogt.llm.llm_setting import LLMSetting+from pipelex.cogt.model_backends.backend import MANIFOLD_MODEL_SPECS_SECTIONfrom pipelex.cogt.model_backends.model_type import ModelTypefrom pipelex.cogt.models.model_deck import (ModelDeckBlueprint,@@ -44,11 +45,11 @@ class TestModelDeckReferences:@pytest.fixture(scope="class")def all_known_model_handles(self) -> dict[str, ModelType]:- """Collect all valid model handles with their types from local backends + Pipelex Gateway.+ """Collect all valid model handles with their types from local backends + Pipelex Manifold.Sources:1. Local backend TOML files (.pipelex/inference/backends/*.toml)- 2. Pipelex Gateway remote config (uses session-level cache from conftest.py)+ 2. The manifold section of the Pipelex remote config (uses session-level cache from conftest.py)Returns:Mapping of model_handle -> ModelType@@ -58,8 +59,8 @@ class TestModelDeckReferences:# 1. Parse local backend TOML filesknown_handles.update(self._get_local_backend_models())- # 2. Get gateway models from cached remote config- gateway_specs = RemoteConfigFetcher.fetch_remote_config().config.backend_model_specs # Uses cached version+ # 2. Get the manifold models from the cached remote config+ gateway_specs = RemoteConfigFetcher.fetch_remote_config().config.get_model_specs_section(MANIFOLD_MODEL_SPECS_SECTION) or {}# Get default model_type from gateway defaults section (same pattern as local backends)gateway_defaults = gateway_specs.get("defaults", {})diff --git a/tests/unit/pipelex/cogt/models/test_plugin_model_merge.py b/tests/unit/pipelex/cogt/models/test_plugin_model_merge.pyindex 2839fe69b..cc7075f7e 100644--- a/tests/unit/pipelex/cogt/models/test_plugin_model_merge.py+++ b/tests/unit/pipelex/cogt/models/test_plugin_model_merge.py@@ -59,12 +59,13 @@ def _xlsx_plugin_declarations() -> PluginModelDeclarations:class TestPluginModelMerge:@pytest.fixturedef inference_dir(self, tmp_path: Path) -> Path:- """The kit's inference tree, routed to the internal backend so a lenient setup needs no credential and no gateway."""+ """The kit's inference tree, routed to the internal backend so a lenient setup needs no credential."""inference_dir = tmp_path / INFERENCE_DIR_NAMEshutil.copytree(Path(str(get_kit_configs_dir())) / INFERENCE_DIR_NAME, inference_dir)routing_profiles_path = inference_dir / "routing_profiles.toml"routing_profiles = routing_profiles_path.read_text(encoding="utf-8")- routing_profiles_path.write_text(routing_profiles.replace('active = "all_pipelex_gateway"', 'active = "all_internal"', 1), encoding="utf-8")+ assert 'active = "all_enabled_backends"' in routing_profiles+ routing_profiles_path.write_text(routing_profiles.replace('active = "all_enabled_backends"', 'active = "all_internal"', 1), encoding="utf-8")return inference_dir@staticmethoddiff --git a/tests/unit/pipelex/exceptions/test_class_level_metadata.py b/tests/unit/pipelex/exceptions/test_class_level_metadata.pyindex 091779a71..a1a7f4d17 100644--- a/tests/unit/pipelex/exceptions/test_class_level_metadata.py+++ b/tests/unit/pipelex/exceptions/test_class_level_metadata.py@@ -29,7 +29,6 @@ from pipelex.plugins.exceptions import UnknownSecretsMethodError, UnknownStoragefrom pipelex.system.exceptions import EnvVarNotFoundErrorfrom pipelex.system.pipe_run_mode import PipeRunModefrom pipelex.system.pipelex_service.exceptions import (- GatewayTermsNotAcceptedError,PipelexServiceConfigValidationError,PipelexServiceError,RemoteConfigFetchError,@@ -65,7 +64,6 @@ class TestClassLevelMetadata:("service_base", PipelexServiceError("boom"), ErrorDomain.CONFIG),("service_config_validation", PipelexServiceConfigValidationError("boom"), ErrorDomain.CONFIG),("remote_config_fetch", RemoteConfigFetchError("boom"), ErrorDomain.CONFIG),- ("gateway_terms", GatewayTermsNotAcceptedError(), ErrorDomain.CONFIG),("env_var_not_found", EnvVarNotFoundError("boom"), ErrorDomain.CONFIG),],)diff --git a/tests/unit/pipelex/kernel/test_kernel_boot_contract.py b/tests/unit/pipelex/kernel/test_kernel_boot_contract.pyindex 21dbb38c9..395432691 100644--- a/tests/unit/pipelex/kernel/test_kernel_boot_contract.py+++ b/tests/unit/pipelex/kernel/test_kernel_boot_contract.py@@ -34,7 +34,7 @@ Run in a **subprocess** for the reason its two siblings state: a suite-level booprocess singletons, and both hubs are sticky class attributes that `teardown` deliberately does notclear — so an in-process check would answer from a stale `Pipelex` and pass vacuously.-`needs_inference=False` keeps the boot offline (no gateway terms gate, no model-deck validation), and+`needs_inference=False` keeps the boot offline (no remote config fetch, no model-deck validation), and`PipeRunMode.DRY` keeps the call offline: every cogt leaf mocks before a worker is looked up, so eachsetting below names a model the deck never has to resolve. The settings are built literally ratherthan through the `resolve_*_setting` helpers for that same reason — those read the deck, which is adiff --git a/tests/unit/pipelex/kit/test_deck_variants.py b/tests/unit/pipelex/kit/test_deck_variants.pyindex b6a84d99c..62cbb6337 100644--- a/tests/unit/pipelex/kit/test_deck_variants.py+++ b/tests/unit/pipelex/kit/test_deck_variants.py@@ -9,8 +9,8 @@ every variant through the same loader the runtime uses and holds it to the shippthe kit's backend files, because handle retirement is how a parked deck actually goes stale.The second check is scoped to the handles only the variant names. A handle the shipped deck names-too is already exercised at boot, and some of those are gateway-served with no backend section of-their own, so holding them to a backend declaration would fail on a deck that is perfectly live.+too is not held to them here: some are served only through Pipelex Manifold, with no backend section+of their own, and the shipped deck's default aliases have their own guard in `test_shipped_deck_defaults.py`."""from collections.abc import Mapping@@ -209,8 +209,8 @@ class TestDeckVariants:def test_handle_collection_reads_waterfall_entries(self):"""A handle a deck names only inside a waterfall must still reach the retirement check above.- No deck declares a waterfall today, so nothing else in this module would notice the- collector skipping them, and the guard would go quietly blind the moment one does.+ Nothing else in this module would notice the collector skipping them, and the guard would+ go quietly blind to every handle a variant names only inside a waterfall."""blueprint = load_deck_from_dir(kit_deck_dir(), filenames=list(list_managed_kit_files(area=KitManagedArea.DECK)))probe_handle = "handle-named-only-by-a-waterfall"diff --git a/tests/unit/pipelex/kit/test_shipped_deck_defaults.py b/tests/unit/pipelex/kit/test_shipped_deck_defaults.pynew file mode 100644index 000000000..0bb548890--- /dev/null+++ b/tests/unit/pipelex/kit/test_shipped_deck_defaults.py@@ -0,0 +1,78 @@+"""Every default alias of the shipped deck reaches a model that one of the kit's own backend files declares.++Boot only checks that an alias exists, not that anything serves what it names, so a default whose every+candidate is served through a Pipelex-managed service alone loads cleanly and then fails the first pipe+that relies on it, for everyone running on their own keys. A waterfall passes when any one of its entries+is declared, which is how a default can put a managed model first and still resolve without it.+"""++import pytest++from pipelex.cogt.models.deck_manifest import KitManagedArea, kit_deck_dir, list_managed_kit_files+from pipelex.cogt.models.model_deck import JudgmentDeckBlueprint+from pipelex.cogt.models.model_reference import ModelReference, ModelReferenceKind+from tests.unit.pipelex.kit.test_deck_variants import DeckFamilyBlueprint, list_declared_backend_handles, load_deck_from_dir++DEFAULT_ALIAS_PREFIX = "default-"++AnyFamilyBlueprint = DeckFamilyBlueprint | JudgmentDeckBlueprint+++def _shipped_family_blueprints() -> dict[str, AnyFamilyBlueprint]:+ blueprint = load_deck_from_dir(kit_deck_dir(), filenames=list(list_managed_kit_files(area=KitManagedArea.DECK)))+ return {+ "llm": blueprint.llm,+ "extract": blueprint.extract,+ "img_gen": blueprint.img_gen,+ "search": blueprint.search,+ "doc_gen": blueprint.doc_gen,+ "judgment": blueprint.judgment,+ }+++def _candidate_handles(reference: str, *, family_blueprint: AnyFamilyBlueprint, visited: frozenset[str]) -> set[str]:+ """The concrete handles a reference can resolve to, following aliases and every entry of a waterfall."""+ if reference in visited:+ return set()+ visited |= {reference}+ parsed = ModelReference.parse(reference)+ match parsed.kind:+ case ModelReferenceKind.ALIAS:+ return _candidate_handles(family_blueprint.aliases[parsed.name], family_blueprint=family_blueprint, visited=visited)+ case ModelReferenceKind.WATERFALL:+ candidates: set[str] = set()+ for entry in family_blueprint.waterfalls[parsed.name]:+ candidates |= _candidate_handles(entry, family_blueprint=family_blueprint, visited=visited)+ return candidates+ case ModelReferenceKind.PRESET:+ return _candidate_handles(family_blueprint.presets[parsed.name].model, family_blueprint=family_blueprint, visited=visited)+ case ModelReferenceKind.HANDLE:+ return {parsed.name}+++def _default_aliases() -> list[tuple[str, str]]:+ return [+ (family, alias)+ for family, family_blueprint in _shipped_family_blueprints().items()+ for alias in family_blueprint.aliases+ if alias.startswith(DEFAULT_ALIAS_PREFIX)+ ]+++class TestShippedDeckDefaults:+ @pytest.mark.parametrize(("family", "alias"), _default_aliases())+ def test_default_alias_reaches_a_declared_model(self, family: str, alias: str) -> None:+ family_blueprint = _shipped_family_blueprints()[family]+ candidates = _candidate_handles(f"@{alias}", family_blueprint=family_blueprint, visited=frozenset())+ assert candidates & list_declared_backend_handles(), (+ f"{family} alias '{alias}' can only resolve to {sorted(candidates)}, which no backend file of the kit declares"+ )++ def test_a_waterfall_is_read_through_every_entry(self) -> None:+ """The waterfall branch must see past a first entry no backend file declares, or the guard reads it as unserved."""+ extract_blueprint = _shipped_family_blueprints()["extract"]+ extract_blueprint.waterfalls["probe-waterfall"] = ["model-no-backend-declares", "pypdfium2-extract-pdf"]++ candidates = _candidate_handles("~probe-waterfall", family_blueprint=extract_blueprint, visited=frozenset())++ assert candidates == {"model-no-backend-declares", "pypdfium2-extract-pdf"}diff --git a/tests/unit/pipelex/migration/test_backend_directory_walk.py b/tests/unit/pipelex/migration/test_backend_directory_walk.pyindex 226701286..6db846a38 100644--- a/tests/unit/pipelex/migration/test_backend_directory_walk.py+++ b/tests/unit/pipelex/migration/test_backend_directory_walk.py@@ -42,12 +42,14 @@ class TestAFreshMachinesBackendDirectory:def test_every_backend_definition_is_claimed_and_the_documentation_beside_them_is_not(self, tmp_path: Path) -> None:"""The claim rule over the real registry and a real directory listing, not a synthetic one.- The `.md` files are the half that only a real directory can prove: they are there because the- kit ships them next to the backends it documents, and a surface claiming `*.toml` leaves them- alone by extension rather than by an exclusion anybody has to maintain.+ The kit ships no documentation in there, but a machine initialised by an older kit+ still carries the model list it used to copy beside the backends, so one is written next to+ the real files: a surface claiming `*.toml` leaves it alone by extension rather than by an+ exclusion anybody has to maintain."""- seeded = self._seed(root=tmp_path)- assert [path.name for path in seeded if path.suffix == ".md"], "worthless unless the kit still ships documentation in there"+ self._seed(root=tmp_path)+ (tmp_path / INFERENCE_DIR_NAME / BACKENDS_DIR_NAME / "pipelex_gateway_models.md").write_text("# Models\n", encoding="utf-8")+ seeded = sorted((tmp_path / INFERENCE_DIR_NAME / BACKENDS_DIR_NAME).iterdir())claimed = build_config_surface_registry().files_by_surface_in_directory(directory=tmp_path)diff --git a/tests/unit/pipelex/migration/test_migration_run.py b/tests/unit/pipelex/migration/test_migration_run.pyindex d51fc0f16..65bf0e4e5 100644--- a/tests/unit/pipelex/migration/test_migration_run.py+++ b/tests/unit/pipelex/migration/test_migration_run.py@@ -93,16 +93,16 @@ class TestTheWalkIsNotRecursive:"""A subdirectory of a configuration directory holds a different kind of thing.The specimen is real and it is the reason this is pinned rather than assumed:- `.pipelex/inference/backends/pipelex_gateway.toml` matches the `pipelex-config` tier glob+ `.pipelex/inference/backends/pipelex_manifold.toml` matches the `pipelex-config` tier glob`pipelex_*.toml` exactly, and is an inference backend definition rather than a main-configurationtier file. The walk *does* reach it now, because `inference/backends/` has a surface of its own —which makes the directory half of the claim rule load-bearing rather than academic: get it wrongand the main configuration's ledger is replayed over a backend definition and rewrites it."""- SPECIMEN = Path("inference") / "backends" / "pipelex_gateway.toml"+ SPECIMEN = Path("inference") / "backends" / "pipelex_manifold.toml"- def test_the_real_gateway_backend_file_is_claimed_by_its_own_directorys_surface(self, tmp_path: Path) -> None:+ def test_the_real_manifold_backend_file_is_claimed_by_its_own_directorys_surface(self, tmp_path: Path) -> None:specimen = tmp_path / self.SPECIMENspecimen.parent.mkdir(parents=True)specimen.write_text("", encoding="utf-8")diff --git a/tests/unit/pipelex/migration/test_surface_directories.py b/tests/unit/pipelex/migration/test_surface_directories.pyindex 5c250d345..3ddfbb862 100644--- a/tests/unit/pipelex/migration/test_surface_directories.py+++ b/tests/unit/pipelex/migration/test_surface_directories.py@@ -6,7 +6,7 @@ name in two directories is two different files, and only the surface that owns tsits in may claim it.The specimen is real and it is the reason this exists at all:-`inference/backends/pipelex_gateway.toml` matches the `pipelex-config` tier glob `pipelex_*.toml`+`inference/backends/pipelex_manifold.toml` matches the `pipelex-config` tier glob `pipelex_*.toml`exactly. Before the walk reached subdirectories, depth alone kept it safe. Now that the walk goesthere on purpose, the *directory* is what has to keep it safe — and if it ever stops doing so, themain configuration's ledger gets replayed over an inference backend definition and rewrites it.@@ -37,7 +37,7 @@ class TestADirectoryIsHalfTheClaim:(root / "pipelex.toml").write_text("", encoding="utf-8")(root / "pipelex_override.toml").write_text("", encoding="utf-8")(root / BACKENDS).mkdir(parents=True)- (root / BACKENDS / "pipelex_gateway.toml").write_text("", encoding="utf-8")+ (root / BACKENDS / "pipelex_manifold.toml").write_text("", encoding="utf-8")(root / BACKENDS / "openai.toml").write_text("", encoding="utf-8")(root / BACKENDS / "notes.md").write_text("", encoding="utf-8")(root / "inference" / "deck").mkdir(parents=True)@@ -47,7 +47,7 @@ class TestADirectoryIsHalfTheClaim:def test_each_file_goes_to_the_surface_that_owns_the_directory_it_sits_in(self, tmp_path: Path, build_surface: SurfaceBuilder) -> None:"""One assertion for the whole rule, because every line of it is a separate way to get this wrong.- `pipelex_gateway.toml` is claimed by the backend surface and *not* by the root surface whose+ `pipelex_manifold.toml` is claimed by the backend surface and *not* by the root surface whoseglob its name matches; `notes.md` falls out by extension; `deck/` is a directory no surfaceowns and is never entered; `inference/backends.toml` sits one level above the directory thebackend surface owns and is nobody's.@@ -60,19 +60,19 @@ class TestADirectoryIsHalfTheClaim:("pipelex-config", "pipelex.toml"),("pipelex-config", "pipelex_override.toml"),("inference-backend", "inference/backends/openai.toml"),- ("inference-backend", "inference/backends/pipelex_gateway.toml"),+ ("inference-backend", "inference/backends/pipelex_manifold.toml"),]def test_the_same_name_resolves_to_a_different_surface_in_each_directory(self, build_surface: SurfaceBuilder) -> None:"""The claim is the pair, so the specimen's name alone answers nothing.- Without the directory in the question, `pipelex_gateway.toml` is a `pipelex_*.toml` match+ Without the directory in the question, `pipelex_manifold.toml` is a `pipelex_*.toml` matchand the root surface takes it wherever it lives."""registry = self._registry(build_surface)- at_the_root = registry.surface_for_file(subdirectory=Path(), file_name="pipelex_gateway.toml")- in_the_backends_directory = registry.surface_for_file(subdirectory=BACKENDS, file_name="pipelex_gateway.toml")+ at_the_root = registry.surface_for_file(subdirectory=Path(), file_name="pipelex_manifold.toml")+ in_the_backends_directory = registry.surface_for_file(subdirectory=BACKENDS, file_name="pipelex_manifold.toml")assert at_the_root is not Noneassert at_the_root.surface_id == "pipelex-config"@@ -83,7 +83,7 @@ class TestADirectoryIsHalfTheClaim:"""The other direction of the same rule: the backend directory is not the root surface's to claim in."""registry = SurfaceRegistry(surfaces=[build_surface(surface_id="pipelex-config", base_file="pipelex.toml", tier_glob="pipelex_*.toml")])- assert registry.surface_for_file(subdirectory=BACKENDS, file_name="pipelex_gateway.toml") is None+ assert registry.surface_for_file(subdirectory=BACKENDS, file_name="pipelex_manifold.toml") is Noneassert registry.surface_for_file(subdirectory=BACKENDS, file_name="pipelex.toml") is Nonedef test_a_subdirectory_that_does_not_exist_is_skipped_rather_than_refused(self, tmp_path: Path, build_surface: SurfaceBuilder) -> None:diff --git a/tests/unit/pipelex/plugins/test_inference_backend_coverage.py b/tests/unit/pipelex/plugins/test_inference_backend_coverage.pyindex 8965bea03..f20819ac1 100644--- a/tests/unit/pipelex/plugins/test_inference_backend_coverage.py+++ b/tests/unit/pipelex/plugins/test_inference_backend_coverage.py@@ -37,8 +37,8 @@ EXPECTED_BACKENDS: list[tuple[InferenceFamily, str]] = [(InferenceFamily.LLM, "azure_openai"),(InferenceFamily.LLM, "openai_responses"),(InferenceFamily.LLM, "azure_openai_responses"),- (InferenceFamily.LLM, "gateway_completions"),- (InferenceFamily.LLM, "gateway_responses"),+ (InferenceFamily.LLM, "manifold_completions"),+ (InferenceFamily.LLM, "manifold_responses"),(InferenceFamily.LLM, "portkey_completions"),(InferenceFamily.LLM, "portkey_responses"),(InferenceFamily.LLM, "anthropic"),@@ -48,8 +48,8 @@ EXPECTED_BACKENDS: list[tuple[InferenceFamily, str]] = [(InferenceFamily.LLM, "bedrock_aioboto"),(InferenceFamily.LLM, "google"),# IMG_GEN- (InferenceFamily.IMG_GEN, "gateway_img_gen"),- (InferenceFamily.IMG_GEN, "gateway_completions"),+ (InferenceFamily.IMG_GEN, "manifold_img_gen"),+ (InferenceFamily.IMG_GEN, "manifold_completions"),(InferenceFamily.IMG_GEN, "openai_img_gen"),(InferenceFamily.IMG_GEN, "blackboxai_img_gen"),(InferenceFamily.IMG_GEN, "openrouter_img_gen"),@@ -58,14 +58,14 @@ EXPECTED_BACKENDS: list[tuple[InferenceFamily, str]] = [(InferenceFamily.IMG_GEN, "azure_rest_img_gen"),(InferenceFamily.IMG_GEN, "google"),# EXTRACT- (InferenceFamily.EXTRACT, "gateway_extract"),+ (InferenceFamily.EXTRACT, "manifold_extract"),(InferenceFamily.EXTRACT, "mistral"),(InferenceFamily.EXTRACT, "pypdfium2"),(InferenceFamily.EXTRACT, "docling_sdk"),(InferenceFamily.EXTRACT, "linkup_fetch"),# SEARCH(InferenceFamily.SEARCH, "linkup"),- (InferenceFamily.SEARCH, "gateway_search"),+ (InferenceFamily.SEARCH, "manifold_search"),# JUDGMENT(InferenceFamily.JUDGMENT, "typesafe"),]@@ -88,13 +88,13 @@ class TestInferenceBackendCoverage:pytest.param([(InferenceFamily.EXTRACT, "linkup_fetch"), (InferenceFamily.SEARCH, "linkup")], "linkup", id="linkup"),pytest.param([- (InferenceFamily.LLM, "gateway_completions"),- (InferenceFamily.IMG_GEN, "gateway_img_gen"),- (InferenceFamily.EXTRACT, "gateway_extract"),- (InferenceFamily.SEARCH, "gateway_search"),+ (InferenceFamily.LLM, "manifold_completions"),+ (InferenceFamily.IMG_GEN, "manifold_img_gen"),+ (InferenceFamily.EXTRACT, "manifold_extract"),+ (InferenceFamily.SEARCH, "manifold_search"),],- "gateway",- id="gateway",+ "manifold",+ id="manifold",),],)diff --git a/tests/unit/pipelex/providers/gateway/test_extract_gateway_metadata.py b/tests/unit/pipelex/providers/gateway/test_extract_gateway_metadata.pydeleted file mode 100644index 24dc8003d..000000000--- a/tests/unit/pipelex/providers/gateway/test_extract_gateway_metadata.py+++ /dev/null@@ -1,133 +0,0 @@-"""Tests for ``extract_gateway_metadata``.--Distills a Portkey/Gateway SDK exception into a ``ProviderErrorMetadata``.-``APIStatusError`` subclasses carry ``status_code``, ``response`` (httpx),-and ``body``. ``APITimeoutError`` / ``APIConnectionError`` carry only a-request; status fields come back as ``None``.--``body`` is a pre-parsed dict only on the paths that bypass Portkey's own-exception factory; the factory itself puts the message *string* there, so the-error code has to be recovered from the response. Both shapes are pinned below.-"""--from __future__ import annotations--import json--import httpx-from portkey_ai import Portkey-from portkey_ai.api_resources import exceptions as portkey_exc--from pipelex.cogt.inference.error_classification import extract_gateway_metadata---def _make_response(status_code: int, headers: dict[str, str] | None = None) -> httpx.Response:- request = httpx.Request("POST", "https://api.portkey.ai/v1/chat/completions")- return httpx.Response(status_code=status_code, request=request, headers=headers or {})---def _make_status_error(- status_code: int,- body: dict[str, object] | None = None,- headers: dict[str, str] | None = None,-) -> portkey_exc.RateLimitError:- request = httpx.Request("POST", "https://api.portkey.ai/v1/chat/completions")- response = _make_response(status_code, headers)- return portkey_exc.RateLimitError(message="error", request=request, response=response, body=body or {})---class TestExtractGatewayMetadata:- """``extract_gateway_metadata`` produces a populated payload for every shape we care about."""-- def test_extracts_status_code_and_request_id(self) -> None:- exc = _make_status_error(429, headers={"x-request-id": "gw-1"})- metadata = extract_gateway_metadata(exc)-- assert metadata.provider == "gateway"- assert metadata.sdk_exception_type == "RateLimitError"- assert metadata.status_code == 429- assert metadata.request_id == "gw-1"-- def test_falls_back_to_portkey_trace_id(self) -> None:- exc = _make_status_error(429, headers={"x-portkey-trace-id": "trace-2"})- metadata = extract_gateway_metadata(exc)- assert metadata.request_id == "trace-2"-- def test_extracts_retry_after_seconds(self) -> None:- exc = _make_status_error(429, headers={"retry-after": "9"})- metadata = extract_gateway_metadata(exc)- assert metadata.retry_after_seconds == 9.0-- def test_extracts_provider_error_code_from_body(self) -> None:- """``code`` is read before ``type``, which is the opposite of the vendor-facing precedence.-- The gateway is ours, and it puts the *specific* code in ``code`` and a- generic OpenAI-shaped bucket in ``type`` — every refusal on its native- ``/v1/pipelex/*`` routes carries ``type: "invalid_request_error"``. Reading- ``type`` first therefore reports that one bucket for the whole contract- vocabulary and no ``pipelex_*`` code ever reaches the classifier. Anthropic- keeps the other precedence because its error section carries no ``code``.- """- exc = _make_status_error(400, body={"error": {"type": "invalid_request_error", "code": "missing_field"}})- metadata = extract_gateway_metadata(exc)- assert metadata.provider_error_code == "missing_field"-- def test_falls_back_to_type_when_the_body_carries_no_code(self) -> None:- exc = _make_status_error(400, body={"error": {"type": "invalid_request_error"}})- metadata = extract_gateway_metadata(exc)- assert metadata.provider_error_code == "invalid_request_error"-- def test_handles_connection_error_without_response(self) -> None:- request = httpx.Request("POST", "https://api.portkey.ai/v1/chat/completions")- exc = portkey_exc.APIConnectionError(request=request)- metadata = extract_gateway_metadata(exc)- assert metadata.sdk_exception_type == "APIConnectionError"- assert metadata.status_code is None- assert metadata.request_id is None---class TestTheCodeWhenPortkeyDiscardsThePayload:- """``exc.body`` is not the payload on the SDK's own factory — the response still is."""-- @staticmethod- def _as_the_sdk_raises_it(status_code: int, payload: dict[str, object]) -> BaseException:- """Build the exception through Portkey's own factory, not through its constructor.-- The constructor accepts whatever ``body`` it is handed; only the factory- reproduces the string ``body`` the Extract step actually receives.- """- request = httpx.Request("POST", "https://api.portkey.ai/v1/chat/completions")- response = httpx.Response(- status_code=status_code,- request=request,- content=json.dumps(payload).encode(),- headers={"content-type": "application/json"},- )- client = Portkey(api_key="unused-in-this-test", base_url="https://api.portkey.ai/v1")- return client._make_status_error_from_response(request=request, response=response) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- def test_the_code_is_recovered_from_the_response_body(self) -> None:- """Portkey sets ``body`` to ``json.loads(text)["error"]["message"]`` — a string, not the document."""- exc = self._as_the_sdk_raises_it(400, {"error": {"message": "refused", "code": "pig-11"}})-- assert isinstance(getattr(exc, "body", None), str)- metadata = extract_gateway_metadata(exc)-- assert metadata.provider_error_code == "pig-11"- assert isinstance(metadata.body, dict)-- def test_a_response_that_is_not_json_leaves_the_code_unset(self) -> None:- request = httpx.Request("POST", "https://api.portkey.ai/v1/chat/completions")- response = httpx.Response(status_code=502, request=request, content=b"<html>bad gateway</html>")- exc = portkey_exc.APIStatusError(message="error", request=request, response=response, body=None)-- metadata = extract_gateway_metadata(exc)-- assert metadata.provider_error_code is None- assert metadata.status_code == 502-- def test_a_dict_body_still_wins_over_the_response(self) -> None:- """The vendored-OpenAI fallback paths hand a real dict here — it must not be re-parsed away."""- exc = _make_status_error(400, body={"error": {"code": "pig-07"}})-- assert extract_gateway_metadata(exc).provider_error_code == "pig-07"diff --git a/tests/unit/pipelex/providers/gateway/test_gateway_completions_client.py b/tests/unit/pipelex/providers/gateway/test_gateway_completions_client.pydeleted file mode 100644index f3b048af7..000000000--- a/tests/unit/pipelex/providers/gateway/test_gateway_completions_client.py+++ /dev/null@@ -1,102 +0,0 @@-"""Construction tests for the GatewayCompletionsFactory OpenAI client and extras delegation.--These patch the GatewayFactory accessors and the SDK client constructor — they never touch-the network. Transport retry wiring (``max_retries``) is pinned separately in-``tests/unit/pipelex/providers/test_transport_retry_wiring.py``.-"""--from __future__ import annotations--from typing import TYPE_CHECKING, Any--import pytest--from pipelex.providers.gateway.gateway_completions_factory import GatewayCompletionsFactory-from pipelex.providers.gateway.gateway_exceptions import GatewayFactoryError--if TYPE_CHECKING:- from pytest_mock import MockerFixture--_FACTORY_NAMESPACE = "pipelex.providers.gateway.gateway_completions_factory"---def _patch_gateway_accessors(- mocker: MockerFixture,- is_debug_enabled: bool,- endpoint: str,- api_key: str,-) -> None:- mocker.patch(f"{_FACTORY_NAMESPACE}.GatewayFactory.is_debug_enabled", return_value=is_debug_enabled)- mocker.patch(f"{_FACTORY_NAMESPACE}.GatewayFactory.get_endpoint", return_value=endpoint)- mocker.patch(f"{_FACTORY_NAMESPACE}.GatewayFactory.get_api_key", return_value=api_key)- config = mocker.MagicMock()- config.inference.transport_max_retries = 2- mocker.patch(f"{_FACTORY_NAMESPACE}.get_config", return_value=config)---class TestGatewayCompletionsClient:- """Client construction validates the SDK variant and wires Portkey headers."""-- def test_wrong_sdk_variant_raises_factory_error(self, mocker: MockerFixture) -> None:- """A model handle whose sdk is not the completions variant is rejected before any client is built."""- _patch_gateway_accessors(mocker, is_debug_enabled=False, endpoint="https://gateway.test", api_key="gw-test")- mock_client = mocker.patch("openai.AsyncOpenAI")- model_handle = mocker.MagicMock()- model_handle.sdk = "gateway_responses"-- with pytest.raises(GatewayFactoryError, match="is not supported by 'GatewayCompletionsFactory'"):- GatewayCompletionsFactory.make_portkey_openai_client_for_completions(model_handle=model_handle, backend=mocker.MagicMock())-- mock_client.assert_not_called()-- @pytest.mark.parametrize(- ("is_debug_enabled", "expected_debug_header"),- [- (True, "true"),- (False, "false"),- ],- )- def test_happy_path_wires_endpoint_placeholder_key_and_portkey_headers(- self,- mocker: MockerFixture,- is_debug_enabled: bool,- expected_debug_header: str,- ) -> None:- """The client gets the gateway endpoint as base_url, a non-empty placeholder api_key,- and default headers built by createHeaders carrying the Portkey api key and debug flag.- """- _patch_gateway_accessors(mocker, is_debug_enabled=is_debug_enabled, endpoint="https://gateway.example/v1", api_key="pk-secret")- mock_client = mocker.patch("openai.AsyncOpenAI")- model_handle = mocker.MagicMock()- model_handle.sdk = "gateway_completions"-- client = GatewayCompletionsFactory.make_portkey_openai_client_for_completions(model_handle=model_handle, backend=mocker.MagicMock())-- assert client is mock_client.return_value- mock_client.assert_called_once()- call_kwargs = mock_client.call_args.kwargs- assert call_kwargs["base_url"] == "https://gateway.example/v1"- # Auth goes through Portkey headers; the OpenAI SDK still requires a non-empty api_key.- assert call_kwargs["api_key"] == "unused-auth-via-portkey-headers"- default_headers = call_kwargs["default_headers"]- assert default_headers["x-portkey-api-key"] == "pk-secret"- assert default_headers["x-portkey-debug"] == expected_debug_header- assert default_headers["x-portkey-strict-open-ai-compliance"] == "false"-- def test_make_extras_delegates_to_gateway_factory(self, mocker: MockerFixture) -> None:- """The make_extras override passes all three args through to GatewayFactory.make_extras- and returns its result unchanged.- """- expected_extras: tuple[dict[str, str], dict[str, Any]] = ({"x-portkey-provider": "test-backend"}, {"seed": 42})- mock_make_extras = mocker.patch(- f"{_FACTORY_NAMESPACE}.GatewayFactory.make_extras",- return_value=expected_extras,- )- factory = GatewayCompletionsFactory(is_http_url_enabled=True)- inference_model = mocker.MagicMock()- inference_job = mocker.MagicMock()-- result = factory.make_extras(inference_model=inference_model, inference_job=inference_job, output_desc="text")-- assert result is expected_extras- mock_make_extras.assert_called_once_with(inference_model=inference_model, inference_job=inference_job, output_desc="text")diff --git a/tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py b/tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.pydeleted file mode 100644index 6c65c4e68..000000000--- a/tests/unit/pipelex/providers/gateway/test_gateway_completions_extract_output.py+++ /dev/null@@ -1,374 +0,0 @@-"""Tests for GatewayCompletionsFactory extract-output parsing.--Responses are built with ``GenericResponse.model_validate({...})``: the model allows extras,-so custom top-level fields like ``pages`` become attributes — exactly what the-``hasattr(response, "pages")`` branches need. Omitting ``pages`` exercises the-``choices[0].message.content`` fallback that survives Portkey proxying.-"""--from __future__ import annotations--import json-from typing import TYPE_CHECKING, Any--import pytest-from portkey_ai.api_resources.utils import GenericResponse--from pipelex.cogt.extract.extract_output import ExtractOutput-from pipelex.providers.gateway.gateway_completions_factory import GatewayCompletionsFactory-from pipelex.providers.gateway.gateway_exceptions import GatewayExtractResponseError--if TYPE_CHECKING:- from pytest_mock import MockerFixture--_FACTORY_NAMESPACE = "pipelex.providers.gateway.gateway_completions_factory"--_FALSY_CHOICES_PAYLOADS: list[dict[str, Any]] = [- {},- {"choices": []},- {"choices": "nope"},- {"choices": [{}]},- {"choices": [{"message": "nope"}]},- {"choices": [{"message": {"content": 42}}]},- {"choices": [{"message": {"content": '{"key": 1}'}}]},- {"choices": [{"message": {"content": "{not json"}}]},-]---def _response(payload: dict[str, Any]) -> GenericResponse:- return GenericResponse.model_validate(payload)---def _choices_response(content: Any) -> GenericResponse:- """Build a response whose pages/content live in choices[0].message.content."""- return GenericResponse.model_validate({"choices": [{"message": {"content": content}}]})---class TestGatewayCompletionsExtractOutput:- """Extract-protocol dispatch and per-protocol response parsing."""-- # ---- make_extract_output_from_response dispatch ------ @pytest.mark.parametrize(- ("model_handle", "target_method"),- [- ("mistral-document-ai-2505", "_make_extract_output_from_response_mistral"),- ("azure-document-intelligence", "_make_extract_output_from_response_azure"),- ("deepseek-ocr", "_make_extract_output_from_response_deepseek"),- ("linkup-fetch", "_make_extract_output_from_response_linkup_fetch"),- ],- )- def test_dispatch_routes_each_handle_to_its_parser(- self,- mocker: MockerFixture,- model_handle: str,- target_method: str,- ) -> None:- """Each known model handle dispatches to the matching protocol-specific parser."""- sentinel_output = ExtractOutput(pages={})- mock_parser = mocker.patch.object(GatewayCompletionsFactory, target_method, return_value=sentinel_output)- inference_model = mocker.MagicMock()- inference_model.name = model_handle- response = _response({})-- result = GatewayCompletionsFactory.make_extract_output_from_response(inference_model=inference_model, response=response)-- assert result is sentinel_output- mock_parser.assert_called_once_with(response=response)-- def test_dispatch_unknown_handle_raises_value_error(self, mocker: MockerFixture) -> None:- """An unknown model handle is rejected by GatewayExtractProtocol.make_from_model_handle."""- inference_model = mocker.MagicMock()- inference_model.name = "gpt-4o"-- with pytest.raises(ValueError, match="Invalid model ID: gpt-4o"):- GatewayCompletionsFactory.make_extract_output_from_response(inference_model=inference_model, response=_response({}))-- # ---- _extract_pages_from_choices_content ------ def test_extract_pages_from_choices_content_happy_path(self) -> None:- """A JSON list in choices[0].message.content is parsed and returned as page dicts."""- page_dicts = [{"index": 0, "markdown": "hello"}, {"index": 1, "markdown": "world"}]- response = _choices_response(json.dumps(page_dicts))-- result = GatewayCompletionsFactory._extract_pages_from_choices_content(response=response) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert result == page_dicts-- @pytest.mark.parametrize(- "payload",- _FALSY_CHOICES_PAYLOADS,- ids=[- "no-choices",- "empty-choices",- "choices-not-a-list",- "message-missing",- "message-not-a-dict",- "content-not-a-str",- "content-json-not-a-list",- "content-malformed-json",- ],- )- def test_extract_pages_from_choices_content_falsy_paths_return_none(self, payload: dict[str, Any]) -> None:- """Every malformed or missing choices/message/content shape returns None, never raises."""- response = _response(payload)-- result = GatewayCompletionsFactory._extract_pages_from_choices_content(response=response) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert result is None-- # ---- Azure Doc Intel ------ def test_azure_top_level_pages_with_images(self) -> None:- """Top-level pages parse into Pages, mapping image fields into ExtractedImageFromPage."""- response = _response(- {- "pages": [- {- "index": 2,- "markdown": "# Invoice page",- "images": [- {- "base64_str": "QUJD",- "mime_type": "image/png",- "caption": "Company logo",- "bounding_box": {- "top_left_x": 1.0,- "top_left_y": 2.0,- "top_right_x": 30.0,- "top_right_y": 2.0,- "bottom_right_x": 30.0,- "bottom_right_y": 40.0,- "bottom_left_x": 1.0,- "bottom_left_y": 40.0,- },- }- ],- }- ],- },- )-- extract_output = GatewayCompletionsFactory._make_extract_output_from_response_azure(response=response) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert list(extract_output.pages.keys()) == [2]- page = extract_output.pages[2]- assert page.text == "# Invoice page"- assert len(page.extracted_images) == 1- extracted_image = page.extracted_images[0]- assert extracted_image.size is None- assert extracted_image.base64_str == "QUJD"- assert extracted_image.mime_type == "image/png"- assert extracted_image.caption == "Company logo"- assert extracted_image.bounding_box is not None- assert extracted_image.bounding_box.top_left_x == 1.0- assert extracted_image.bounding_box.bottom_right_y == 40.0-- def test_azure_falls_back_to_choices_content(self) -> None:- """Without a top-level pages field, pages are recovered from choices[0].message.content."""- page_dicts: list[dict[str, Any]] = [{"index": 0, "markdown": "Fallback page", "images": []}]- response = _choices_response(json.dumps(page_dicts))-- extract_output = GatewayCompletionsFactory._make_extract_output_from_response_azure(response=response) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert list(extract_output.pages.keys()) == [0]- assert extract_output.pages[0].text == "Fallback page"- assert extract_output.pages[0].extracted_images == []-- def test_azure_without_pages_anywhere_raises(self) -> None:- """Neither a top-level pages field nor a choices fallback means the response is unusable."""- with pytest.raises(GatewayExtractResponseError, match="does not have pages"):- GatewayCompletionsFactory._make_extract_output_from_response_azure(response=_response({"success": True})) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- def test_azure_page_schema_violation_is_wrapped(self) -> None:- """A page dict failing GatewayExtractPageAzure validation is wrapped in GatewayExtractResponseError."""- response = _response({"pages": [{"index": 0, "images": []}]})-- with pytest.raises(GatewayExtractResponseError, match="Azure schema"):- GatewayCompletionsFactory._make_extract_output_from_response_azure(response=response) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- # ---- Mistral Doc AI ------ def test_mistral_without_pages_raises(self) -> None:- """A response with no pages attribute is rejected (Mistral has no choices fallback)."""- with pytest.raises(GatewayExtractResponseError, match="does not have pages"):- GatewayCompletionsFactory._make_extract_output_from_response_mistral(response=_response({"success": True})) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- def test_mistral_pages_with_images_corner_handling(self) -> None:- """Images without base64 are skipped; full corner coords build a BoundingBox; partial coords leave it None."""- response = _response(- {- "pages": [- {- "index": 0,- "markdown": "# Report",- "images": [- {"image_base64": None, "image_annotation": "ghost"},- {- "image_base64": "data:image/png;base64,QUJD",- "top_left_x": 10,- "top_left_y": 20,- "bottom_right_x": 110,- "bottom_right_y": 220,- "image_annotation": "figure 1",- },- {"image_base64": "data:image/png;base64,REVG", "top_left_x": 5},- ],- }- ],- },- )-- extract_output = GatewayCompletionsFactory._make_extract_output_from_response_mistral(response=response) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert list(extract_output.pages.keys()) == [0]- page = extract_output.pages[0]- assert page.text == "# Report"- # The image without image_base64 is skipped entirely- assert len(page.extracted_images) == 2- full_corners_image = page.extracted_images[0]- assert full_corners_image.actual_url_or_prefixed_base64 == "data:image/png;base64,QUJD"- assert full_corners_image.base64_str == "QUJD"- assert full_corners_image.mime_type == "image/png"- assert full_corners_image.caption == "figure 1"- assert full_corners_image.bounding_box is not None- assert full_corners_image.bounding_box.top_left_x == 10.0- assert full_corners_image.bounding_box.top_left_y == 20.0- assert full_corners_image.bounding_box.top_right_x == 110.0- assert full_corners_image.bounding_box.top_right_y == 20.0- assert full_corners_image.bounding_box.bottom_right_x == 110.0- assert full_corners_image.bounding_box.bottom_right_y == 220.0- assert full_corners_image.bounding_box.bottom_left_x == 10.0- assert full_corners_image.bounding_box.bottom_left_y == 220.0- partial_corners_image = page.extracted_images[1]- assert partial_corners_image.bounding_box is None-- def test_mistral_page_schema_violation_is_wrapped(self) -> None:- """A page dict failing GatewayExtractPageMistral validation is wrapped in GatewayExtractResponseError."""- response = _response({"pages": [{"index": 0, "markdown": "missing images field"}]})-- with pytest.raises(GatewayExtractResponseError, match="Mistral schema"):- GatewayCompletionsFactory._make_extract_output_from_response_mistral(response=response) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- # ---- DeepSeek OCR ------ def test_deepseek_top_level_pages_happy_path(self) -> None:- """Top-level pages parse into text-only Pages with no extracted images."""- response = _response({"pages": [{"index": 1, "markdown": "## Page two"}]})-- extract_output = GatewayCompletionsFactory._make_extract_output_from_response_deepseek(response=response) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert list(extract_output.pages.keys()) == [1]- assert extract_output.pages[1].text == "## Page two"- assert extract_output.pages[1].extracted_images == []-- def test_deepseek_scaled_down_image_logs_warning_and_parses(self, mocker: MockerFixture) -> None:- """source_image_info.scaled_down triggers the warning branch without breaking the parse."""- mock_log = mocker.patch(f"{_FACTORY_NAMESPACE}.log")- response = _response(- {- "pages": [- {- "index": 0,- "markdown": "Scaled page",- "source_image_info": {- "original": {"width": 2000, "height": 1000, "bytes": 204800},- "processed": {"width": 1000, "height": 500, "bytes": 51200},- "scaled_down": True,- },- }- ],- },- )-- extract_output = GatewayCompletionsFactory._make_extract_output_from_response_deepseek(response=response) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert extract_output.pages[0].text == "Scaled page"- mock_log.warning.assert_called_once()- warning_message = mock_log.warning.call_args.args[0]- assert "scaled down from 2000x1000" in warning_message- assert "to 1000x500" in warning_message-- def test_deepseek_falls_back_to_choices_content(self) -> None:- """Without a top-level pages field, pages are recovered from choices[0].message.content."""- page_dicts = [{"index": 0, "markdown": "Fallback md"}]- response = _choices_response(json.dumps(page_dicts))-- extract_output = GatewayCompletionsFactory._make_extract_output_from_response_deepseek(response=response) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert list(extract_output.pages.keys()) == [0]- assert extract_output.pages[0].text == "Fallback md"-- def test_deepseek_without_pages_anywhere_raises(self) -> None:- """Neither a top-level pages field nor a choices fallback means the response is unusable."""- with pytest.raises(GatewayExtractResponseError, match="does not have pages"):- GatewayCompletionsFactory._make_extract_output_from_response_deepseek(response=_response({"success": True})) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- def test_deepseek_page_schema_violation_is_wrapped(self) -> None:- """A page dict failing GatewayExtractPageDeepseek validation is wrapped in GatewayExtractResponseError."""- response = _response({"pages": [{"markdown": "missing index"}]})-- with pytest.raises(GatewayExtractResponseError, match="Deepseek schema"):- GatewayCompletionsFactory._make_extract_output_from_response_deepseek(response=response) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- # ---- Linkup fetch ------ def test_linkup_fetch_happy_path(self) -> None:- """A valid fetch result in choices content becomes a single page at index 0,- with markdown, raw_html, and images whose empty alt maps to caption None.- """- fetch_payload = {- "markdown": "# Fetched",- "raw_html": "<html><body>hi</body></html>",- "images": [- {"url": "https://site.example/a.png", "alt": ""},- {"url": "https://site.example/b.png", "alt": "Logo"},- ],- }- response = _choices_response(json.dumps(fetch_payload))-- extract_output = GatewayCompletionsFactory._make_extract_output_from_response_linkup_fetch(response=response) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert list(extract_output.pages.keys()) == [0]- page = extract_output.pages[0]- assert page.text == "# Fetched"- assert page.raw_html == "<html><body>hi</body></html>"- assert len(page.extracted_images) == 2- first_image = page.extracted_images[0]- assert first_image.actual_url == "https://site.example/a.png"- assert first_image.caption is None- assert first_image.mime_type is None- second_image = page.extracted_images[1]- assert second_image.actual_url == "https://site.example/b.png"- assert second_image.caption == "Logo"-- @pytest.mark.parametrize(- "payload",- [- {"choices": [{"message": "nope"}]},- {"choices": [{"message": {"content": 42}}]},- ],- ids=["message-not-a-dict", "content-not-a-str"],- )- def test_extract_content_string_falsy_paths_return_none(self, payload: dict[str, Any]) -> None:- """Malformed message/content shapes yield None from the content-string extractor."""- result = GatewayCompletionsFactory._extract_content_string_from_response(response=_response(payload)) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert result is None-- def test_linkup_fetch_without_content_raises(self) -> None:- """A response with no usable choices content cannot be parsed as a fetch result."""- with pytest.raises(GatewayExtractResponseError, match="does not contain content"):- GatewayCompletionsFactory._make_extract_output_from_response_linkup_fetch(response=_response({"success": True})) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- @pytest.mark.parametrize(- "invalid_content",- ["[1, 2]", "{not valid json"],- ids=["json-but-not-a-fetch-result", "malformed-json"],- )- def test_linkup_fetch_invalid_fetch_result_is_wrapped(self, invalid_content: str) -> None:- """Content that is present but not a valid GatewayFetchResultResponse is wrapped."""- response = _choices_response(invalid_content)-- with pytest.raises(GatewayExtractResponseError, match="Error parsing Gateway fetch response"):- GatewayCompletionsFactory._make_extract_output_from_response_linkup_fetch(response=response) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]diff --git a/tests/unit/pipelex/providers/gateway/test_gateway_completions_messages.py b/tests/unit/pipelex/providers/gateway/test_gateway_completions_messages.pydeleted file mode 100644index a117ddd25..000000000--- a/tests/unit/pipelex/providers/gateway/test_gateway_completions_messages.py+++ /dev/null@@ -1,165 +0,0 @@-"""Tests for GatewayCompletionsFactory.make_simple_messages — the override that sends-documents as ``image_url`` parts (which Portkey/Gateway translates per provider).--File preparation is patched at the factory namespace; no filesystem or network access.-"""--from __future__ import annotations--from typing import TYPE_CHECKING, Any--import pytest--from pipelex.cogt.image.prompt_image import PromptImageDetail-from pipelex.providers.gateway.gateway_completions_factory import GatewayCompletionsFactory-from pipelex.tools.misc.filetype_utils import FileType-from pipelex.tools.uri.prepared_file import PreparedFileBase64, PreparedFileHttpUrl, PreparedFileLocalPath--if TYPE_CHECKING:- from pytest_mock import MockerFixture--_FACTORY_NAMESPACE = "pipelex.providers.gateway.gateway_completions_factory"--_PNG_FILE_TYPE = FileType(extension="png", mime="image/png")-_PDF_FILE_TYPE = FileType(extension="pdf", mime="application/pdf")---def _make_llm_job(- mocker: MockerFixture,- system_text: str | None = None,- user_text: str | None = None,- has_images: bool = False,- has_documents: bool = False,- image_detail: PromptImageDetail | None = None,-) -> Any:- """Create a mock LLM job carrying just the prompt fields make_simple_messages reads."""- job = mocker.MagicMock()- job.llm_prompt.system_text = system_text- job.llm_prompt.user_text = user_text- job.llm_prompt.user_images = [mocker.MagicMock()] if has_images else []- job.llm_prompt.user_documents = [mocker.MagicMock()] if has_documents else []- job.job_params.image_detail = image_detail- return job--[email protected](loop_scope="class")-class TestGatewayCompletionsMessages:- """make_simple_messages builds system + user messages with text, image and document parts."""-- async def test_system_and_user_text(self, mocker: MockerFixture) -> None:- """System text becomes the first message; user text becomes a text content part."""- factory = GatewayCompletionsFactory(is_http_url_enabled=True)- llm_job = _make_llm_job(mocker, system_text="You are concise.", user_text="Summarize this.")-- messages = await factory.make_simple_messages(llm_job=llm_job)-- assert messages == [- {"role": "system", "content": "You are concise."},- {"role": "user", "content": [{"type": "text", "text": "Summarize this."}]},- ]-- @pytest.mark.parametrize(- ("image_detail", "expected_detail"),- [- (None, "auto"),- (PromptImageDetail.HIGH, "high"),- (PromptImageDetail.LOW, "low"),- ],- )- async def test_images_become_image_url_parts(- self,- mocker: MockerFixture,- image_detail: PromptImageDetail | None,- expected_detail: str,- ) -> None:- """Base64 images become data-URL image_url parts, HTTP images keep their raw URL,- and detail comes from job_params.image_detail (defaulting to AUTO).- """- factory = GatewayCompletionsFactory(is_http_url_enabled=True)- llm_job = _make_llm_job(mocker, user_text="Look at these.", has_images=True, image_detail=image_detail)- prepped_images = [- PreparedFileBase64(base64_data="QUJD", file_type=_PNG_FILE_TYPE),- PreparedFileHttpUrl(url="https://img.example/pic.png"),- ]- mock_prep_images = mocker.patch(- f"{_FACTORY_NAMESPACE}.prep_prompt_images",- new_callable=mocker.AsyncMock,- return_value=prepped_images,- )-- messages = await factory.make_simple_messages(llm_job=llm_job)-- mock_prep_images.assert_awaited_once_with(prompt_images=llm_job.llm_prompt.user_images, is_http_url_enabled=True)- assert len(messages) == 1- user_message = messages[0]- assert user_message["role"] == "user"- user_contents = user_message["content"]- assert user_contents == [- {"type": "text", "text": "Look at these."},- {"type": "image_url", "image_url": {"url": "data:image/png;base64,QUJD", "detail": expected_detail}},- {"type": "image_url", "image_url": {"url": "https://img.example/pic.png", "detail": expected_detail}},- ]-- async def test_local_path_image_raises_type_error(self, mocker: MockerFixture) -> None:- """A PreparedFileLocalPath image is rejected — it should have been converted to base64."""- factory = GatewayCompletionsFactory(is_http_url_enabled=True)- llm_job = _make_llm_job(mocker, user_text="text", has_images=True)- mocker.patch(- f"{_FACTORY_NAMESPACE}.prep_prompt_images",- new_callable=mocker.AsyncMock,- return_value=[PreparedFileLocalPath(path="some/local/pic.png")],- )-- with pytest.raises(TypeError, match="PreparedFileLocalPath is not supported for images"):- await factory.make_simple_messages(llm_job=llm_job)-- async def test_base64_document_becomes_image_url_part_with_auto_detail(self, mocker: MockerFixture) -> None:- """Base64 documents are sent as image_url parts with a data URL and detail='auto',- and document preparation always disables HTTP URLs regardless of the factory flag.- """- factory = GatewayCompletionsFactory(is_http_url_enabled=True)- llm_job = _make_llm_job(mocker, user_text="Read this doc.", has_documents=True)- mock_prep_documents = mocker.patch(- f"{_FACTORY_NAMESPACE}.prep_prompt_documents",- new_callable=mocker.AsyncMock,- return_value=[PreparedFileBase64(base64_data="UERG", file_type=_PDF_FILE_TYPE)],- )-- messages = await factory.make_simple_messages(llm_job=llm_job)-- mock_prep_documents.assert_awaited_once_with(prompt_documents=llm_job.llm_prompt.user_documents, is_http_url_enabled=False)- assert messages == [- {- "role": "user",- "content": [- {"type": "text", "text": "Read this doc."},- {"type": "image_url", "image_url": {"url": "data:application/pdf;base64,UERG", "detail": "auto"}},- ],- },- ]-- @pytest.mark.parametrize(- ("prepped_document", "expected_match"),- [- (PreparedFileHttpUrl(url="https://docs.example/file.pdf"), "PreparedFileHttpUrl is not supported for documents"),- (PreparedFileLocalPath(path="some/local/file.pdf"), "PreparedFileLocalPath is not supported for documents"),- ],- ids=["http-url-document", "local-path-document"],- )- async def test_non_base64_document_raises_type_error(- self,- mocker: MockerFixture,- prepped_document: PreparedFileHttpUrl | PreparedFileLocalPath,- expected_match: str,- ) -> None:- """HTTP-URL and local-path documents are rejected — only base64 is supported here."""- factory = GatewayCompletionsFactory(is_http_url_enabled=True)- llm_job = _make_llm_job(mocker, user_text="text", has_documents=True)- mocker.patch(- f"{_FACTORY_NAMESPACE}.prep_prompt_documents",- new_callable=mocker.AsyncMock,- return_value=[prepped_document],- )-- with pytest.raises(TypeError, match=expected_match):- await factory.make_simple_messages(llm_job=llm_job)diff --git a/tests/unit/pipelex/providers/gateway/test_gateway_extract_worker_semantic.py b/tests/unit/pipelex/providers/gateway/test_gateway_extract_worker_semantic.pydeleted file mode 100644index bfa83a3f4..000000000--- a/tests/unit/pipelex/providers/gateway/test_gateway_extract_worker_semantic.py+++ /dev/null@@ -1,133 +0,0 @@-"""Tests for Gateway extract worker provider_metadata + semantic UserActionKind."""--from __future__ import annotations--from typing import TYPE_CHECKING, Any--import httpx-import pytest-from portkey_ai.api_resources import exceptions as portkey_exc--if TYPE_CHECKING:- from pytest_mock import MockerFixture--from pipelex.cogt.exceptions import ExtractJobFailureError, ExtractModelNotFoundError, InferenceErrorCategory-from pipelex.cogt.inference.error_classification import UserActionKind-from pipelex.providers.gateway.gateway_extract_worker import GatewayExtractWorker---def _make_response(status_code: int) -> httpx.Response:- request = httpx.Request("POST", "https://api.portkey.ai/v1/chat/completions")- return httpx.Response(status_code=status_code, request=request, headers={"x-request-id": "pk-extract-1"})---def _make_status_error(exc_cls: type[portkey_exc.APIStatusError], status_code: int, body: dict[str, Any] | None = None) -> portkey_exc.APIStatusError:- request = httpx.Request("POST", "https://api.portkey.ai/v1/chat/completions")- response = _make_response(status_code)- return exc_cls(message=f"http {status_code}", request=request, response=response, body=body or {})---def _make_worker(mocker: MockerFixture) -> GatewayExtractWorker:- worker = object.__new__(GatewayExtractWorker)- mock_model = mocker.MagicMock()- mock_model.model_id = "azure/document-intel"- mock_model.name = "azure-doc-intel"- mock_model.tag = "azure-doc-intel"- mock_model.desc = "test-gateway-extract"- mock_model.extra_headers = {}- mock_model.is_caption_supported_for_extract = False- worker.inference_model = mock_model-- mock_post = mocker.AsyncMock()- mock_options = mocker.MagicMock()- mock_options.post = mock_post- mock_client = mocker.MagicMock()- mock_client.with_options.return_value = mock_options- worker.portkey_client = mock_client- return worker---def _make_extract_job(mocker: MockerFixture) -> Any:- job = mocker.MagicMock()- job.extract_input.document_uri = "https://example.com/page"- job.extract_input.image_uri = None- job.job_params.max_nb_images = None- job.job_params.render_js = False- job.job_params.include_raw_html = False- job.job_params.should_caption_images = False- job.job_report.extract_tokens_usage = None- return job--[email protected](loop_scope="class")-class TestGatewayExtractWorkerSemantic:- """Each Portkey APIError branch carries semantic UserActionKind + provider_metadata."""-- @pytest.mark.parametrize(- ("exc_cls", "status_code", "expected_category", "expected_kind"),- [- (portkey_exc.RateLimitError, 429, InferenceErrorCategory.TRANSIENT, UserActionKind.WAIT_AND_RETRY),- (portkey_exc.AuthenticationError, 401, InferenceErrorCategory.CONFIGURATION, UserActionKind.CHECK_CREDENTIALS),- (portkey_exc.PermissionDeniedError, 403, InferenceErrorCategory.CONFIGURATION, UserActionKind.CHECK_CREDENTIALS),- (portkey_exc.BadRequestError, 400, InferenceErrorCategory.CONTENT, UserActionKind.CHANGE_INPUT),- ],- )- async def test_status_error_carries_semantic_user_action_via_web_fetch(- self,- mocker: MockerFixture,- exc_cls: type[portkey_exc.APIStatusError],- status_code: int,- expected_category: InferenceErrorCategory,- expected_kind: UserActionKind,- ) -> None:- worker = _make_worker(mocker)- sdk_exc = _make_status_error(exc_cls, status_code)- client: Any = worker.portkey_client- client.with_options.return_value.post.side_effect = sdk_exc-- mocker.patch(- "pipelex.providers.gateway.gateway_extract_worker.GatewayDeck.get_config_id",- return_value="linkup-fetch",- )- mocker.patch(- "pipelex.providers.gateway.gateway_extract_worker.GatewayExtractProtocol.make_from_model_handle",- return_value=mocker.MagicMock(),- )-- with pytest.raises(ExtractJobFailureError) as exc_info:- await worker._extract_web_fetch(extract_job=_make_extract_job(mocker)) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert exc_info.value.error_category is expected_category- assert exc_info.value.user_action is not None- assert exc_info.value.user_action.kind is expected_kind- assert exc_info.value.provider_metadata is not None- assert exc_info.value.provider_metadata.provider == "gateway"- assert exc_info.value.provider_metadata.status_code == status_code- assert exc_info.value.provider_metadata.request_id == "pk-extract-1"- assert exc_info.value.__cause__ is sdk_exc-- async def test_genuine_not_found_404_raises_extract_model_not_found_error(self, mocker: MockerFixture) -> None:- """A 404 specializes to ExtractModelNotFoundError (CONFIGURATION, CHANGE_MODEL) so it reroutes."""- worker = _make_worker(mocker)- sdk_exc = _make_status_error(portkey_exc.NotFoundError, 404)- client: Any = worker.portkey_client- client.with_options.return_value.post.side_effect = sdk_exc-- mocker.patch(- "pipelex.providers.gateway.gateway_extract_worker.GatewayDeck.get_config_id",- return_value="linkup-fetch",- )- mocker.patch(- "pipelex.providers.gateway.gateway_extract_worker.GatewayExtractProtocol.make_from_model_handle",- return_value=mocker.MagicMock(),- )-- with pytest.raises(ExtractModelNotFoundError) as exc_info:- await worker._extract_web_fetch(extract_job=_make_extract_job(mocker)) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert exc_info.value.error_category is InferenceErrorCategory.CONFIGURATION- assert exc_info.value.user_action is not None- assert exc_info.value.user_action.kind is UserActionKind.CHANGE_MODEL- assert exc_info.value.model_handle == "azure-doc-intel"- assert exc_info.value.provider_metadata is not None- assert exc_info.value.provider_metadata.status_code == 404diff --git a/tests/unit/pipelex/providers/gateway/test_gateway_img_gen_extras.py b/tests/unit/pipelex/providers/gateway/test_gateway_img_gen_extras.pydeleted file mode 100644index 309a46f11..000000000--- a/tests/unit/pipelex/providers/gateway/test_gateway_img_gen_extras.py+++ /dev/null@@ -1,138 +0,0 @@-"""Tests for GatewayFactory.make_extras on gemini-routed image generation jobs.--The gateway threads the portable size into `extra_body["image_config"]`: a tier maps to-Google's `image_size` token, an exact size derives its grid cell from the model's taxonomy-rules, and an unset size omits `image_size` entirely (provider default, never an upgrade).-"""--from __future__ import annotations--from typing import TYPE_CHECKING, Any--import pytest--if TYPE_CHECKING:- from pytest_mock import MockerFixture--from pipelex.cogt.exceptions import ImgGenParameterError-from pipelex.cogt.image.image_size import ImageSize-from pipelex.cogt.img_gen.img_gen_job import ImgGenJob-from pipelex.cogt.img_gen.img_gen_job_components import AspectRatio, Background, ImgGenJobParams, SizeTier-from pipelex.cogt.img_gen.img_gen_model_rules import AspectRatioTaxonomy, ImgGenArgTopic-from pipelex.providers.gateway.gateway_factory import GatewayFactory--GEMINI_RULES: dict[str, str] = {ImgGenArgTopic.ASPECT_RATIO: AspectRatioTaxonomy.GEMINI_3_FLASH}---def _make_model(mocker: MockerFixture, *, model_id: str = "gemini-3-flash-image", rules: dict[str, str] | None = None) -> Any:- model = mocker.MagicMock()- model.model_id = model_id- model.name = "nano-banana-2"- model.backend_name = "google"- model.extra_headers = {}- model.rules = rules- return model---def _make_img_gen_job(mocker: MockerFixture, *, aspect_ratio: AspectRatio, size: SizeTier | ImageSize | None) -> Any:- job = mocker.MagicMock(spec=ImgGenJob)- job.job_params = ImgGenJobParams(aspect_ratio=aspect_ratio, size=size, background=Background.AUTO)- return job---def disable_gateway_telemetry(mocker: MockerFixture) -> None:- telemetry_manager = mocker.MagicMock()- telemetry_manager.is_pipelex_gateway_portkey_tracing_enabled.return_value = False- mocker.patch("pipelex.providers.gateway.gateway_factory.get_telemetry_manager", return_value=telemetry_manager)--[email protected]("disable_gateway_telemetry")-class TestGatewayImgGenExtras:- def test_tier_threads_image_size_token(self, mocker: MockerFixture) -> None:- """A portable tier lands in extra_body as Google's `image_size` wire token."""- model = _make_model(mocker, rules=GEMINI_RULES)- job = _make_img_gen_job(mocker, aspect_ratio=AspectRatio.SQUARE, size=SizeTier.TWO_K)-- _, extra_body = GatewayFactory.make_extras(model, inference_job=job, output_desc="Image")-- assert extra_body == {"image_config": {"aspect_ratio": "1:1", "image_size": "2K"}}-- def test_unset_size_omits_image_size(self, mocker: MockerFixture) -> None:- """No size on the job -> no `image_size` key at all; the provider applies its own default."""- model = _make_model(mocker, rules=GEMINI_RULES)- job = _make_img_gen_job(mocker, aspect_ratio=AspectRatio.LANDSCAPE_16_9, size=None)-- _, extra_body = GatewayFactory.make_extras(model, inference_job=job, output_desc="Image")-- assert extra_body == {"image_config": {"aspect_ratio": "16:9"}}-- def test_exact_size_derives_grid_cell_from_rules(self, mocker: MockerFixture) -> None:- """An exact WxH derives its (ratio, size) grid cell via the model's taxonomy rules."""- model = _make_model(mocker, rules=GEMINI_RULES)- job = _make_img_gen_job(mocker, aspect_ratio=AspectRatio.SQUARE, size=ImageSize(width=2752, height=1536))-- _, extra_body = GatewayFactory.make_extras(model, inference_job=job, output_desc="Image")-- assert extra_body == {"image_config": {"aspect_ratio": "16:9", "image_size": "2K"}}-- def test_exact_size_without_rules_raises(self, mocker: MockerFixture) -> None:- """An exact size cannot be derived without taxonomy rules — clear error, never a silent drop."""- model = _make_model(mocker, rules=None)- job = _make_img_gen_job(mocker, aspect_ratio=AspectRatio.SQUARE, size=ImageSize(width=2752, height=1536))-- with pytest.raises(ImgGenParameterError, match="rules"):- GatewayFactory.make_extras(model, inference_job=job, output_desc="Image")-- def test_tier_without_rules_raises(self, mocker: MockerFixture) -> None:- """A tier cannot be validated without taxonomy rules — clear error, never a silent forward."""- model = _make_model(mocker, rules=None)- job = _make_img_gen_job(mocker, aspect_ratio=AspectRatio.SQUARE, size=SizeTier.FOUR_K)-- with pytest.raises(ImgGenParameterError, match="rules"):- GatewayFactory.make_extras(model, inference_job=job, output_desc="Image")-- def test_tier_beyond_taxonomy_raises(self, mocker: MockerFixture) -> None:- """A tier the model's taxonomy cannot produce is rejected client-side, same as the native worker."""- model = _make_model(mocker, rules={ImgGenArgTopic.ASPECT_RATIO: AspectRatioTaxonomy.GEMINI_2_5})- job = _make_img_gen_job(mocker, aspect_ratio=AspectRatio.SQUARE, size=SizeTier.TWO_K)-- with pytest.raises(ImgGenParameterError, match="does not support image size"):- GatewayFactory.make_extras(model, inference_job=job, output_desc="Image")-- def test_unset_size_without_rules_keeps_ratio_only_mapping(self, mocker: MockerFixture) -> None:- """With no size requested and no rules to validate against, the plain ratio mapping is kept."""- model = _make_model(mocker, rules=None)- job = _make_img_gen_job(mocker, aspect_ratio=AspectRatio.PORTRAIT_9_16, size=None)-- _, extra_body = GatewayFactory.make_extras(model, inference_job=job, output_desc="Image")-- assert extra_body == {"image_config": {"aspect_ratio": "9:16"}}-- def test_unset_size_with_unknown_taxonomy_keeps_ratio_only_mapping(self, mocker: MockerFixture) -> None:- """A remotely-fetched spec may carry a taxonomy string that predates this factory: with no size- requested, the wire path must abstain (like the support checks) and keep the plain ratio mapping.- """- model = _make_model(mocker, rules={ImgGenArgTopic.ASPECT_RATIO: "legacy_gateway_taxonomy"})- job = _make_img_gen_job(mocker, aspect_ratio=AspectRatio.PORTRAIT_9_16, size=None)-- _, extra_body = GatewayFactory.make_extras(model, inference_job=job, output_desc="Image")-- assert extra_body == {"image_config": {"aspect_ratio": "9:16"}}-- def test_sized_request_with_unknown_taxonomy_raises(self, mocker: MockerFixture) -> None:- """A size cannot be validated against an unknown taxonomy — clear error, never a silent forward."""- model = _make_model(mocker, rules={ImgGenArgTopic.ASPECT_RATIO: "legacy_gateway_taxonomy"})- job = _make_img_gen_job(mocker, aspect_ratio=AspectRatio.SQUARE, size=SizeTier.TWO_K)-- with pytest.raises(ImgGenParameterError, match="unknown aspect_ratio taxonomy"):- GatewayFactory.make_extras(model, inference_job=job, output_desc="Image")-- def test_non_gemini_img_gen_job_gets_no_image_config(self, mocker: MockerFixture) -> None:- """Only gemini-routed img-gen jobs get an `image_config` block."""- model = _make_model(mocker, model_id="gpt-image-1", rules=None)- job = _make_img_gen_job(mocker, aspect_ratio=AspectRatio.SQUARE, size=SizeTier.TWO_K)-- _, extra_body = GatewayFactory.make_extras(model, inference_job=job, output_desc="Image")-- assert extra_body == {}diff --git a/tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_edit_routing.py b/tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_edit_routing.pydeleted file mode 100644index ee596b4cc..000000000--- a/tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_edit_routing.py+++ /dev/null@@ -1,153 +0,0 @@-"""Tests that img2img (input images present) calls route to /images/edits, not /images/generations.--Azure/OpenAI's Images API splits generation and editing across two REST routes, and only-/images/edits accepts the 'image' parameter — /images/generations rejects it with a 400-"Unknown parameter". The args factory maps input images to httpx-style file tuples under-"image"; the worker must send them as a multipart body. Because portkey_ai's-AsyncAPIClient never forwards 'files' to httpx, the worker routes that one call through-the vendored AsyncOpenAI client its AsyncPortkey already carries (scalar args travel as-`body` and are serialized to multipart form fields by the openai SDK).-"""--from __future__ import annotations--import base64-from typing import TYPE_CHECKING, Any--import httpx-import pytest-from portkey_ai.api_resources.utils import GenericResponse--from pipelex.cogt.exceptions import ImgGenParameterError-from pipelex.providers.gateway.gateway_img_gen_worker import GatewayImgGenWorker--if TYPE_CHECKING:- from pytest_mock import MockerFixture--_PNG_BYTES = b"\x89PNG\r\n\x1a\n" + b"\x00" * 8-_PNG_FILE_TUPLE = ("image_0.png", _PNG_BYTES, "image/png")-_PNG_FILE_TUPLE_2 = ("image_1.png", _PNG_BYTES, "image/png")--# Production gateway config style: the explicit endpoint_path field on the model spec,-# with no leading slash (httpx's base_url merge makes the two forms equivalent).-_GENERATIONS_ENDPOINT_PATH = "openai/deployments/gpt-image-1-2025-04-15/images/generations?api-version=2025-04-01-preview"-_EDITS_ENDPOINT_PATH = "openai/deployments/gpt-image-1-2025-04-15/images/edits?api-version=2025-04-01-preview"---def _make_worker(mocker: MockerFixture, *, endpoint_path: str = _GENERATIONS_ENDPOINT_PATH) -> tuple[GatewayImgGenWorker, Any, Any]:- """Build a worker with a mocked AsyncPortkey; return (worker, generations post mock, edits post mock)."""- worker = object.__new__(GatewayImgGenWorker)- mock_model = mocker.MagicMock()- mock_model.model_id = "gpt-image-1"- mock_model.name = "gpt-image-1"- mock_model.desc = "test-gateway-img-model"- mock_model.endpoint_path = endpoint_path- mock_model.extra_headers = {}- mock_model.rules = mocker.MagicMock()- worker.inference_model = mock_model-- mock_generations_post = mocker.AsyncMock()- mock_options = mocker.MagicMock()- mock_options.post = mock_generations_post- mock_client = mocker.MagicMock()- mock_client.with_options.return_value = mock_options- mock_edits_post = mocker.AsyncMock()- mock_client.openai_client.post = mock_edits_post- worker.portkey_client = mock_client- return worker, mock_generations_post, mock_edits_post---def _make_img_gen_job(mocker: MockerFixture) -> Any:- job = mocker.MagicMock()- job.img_gen_prompt.positive_text = "test prompt"- job.job_report.img_gen_tokens_usage = None- return job---def _patch_args(mocker: MockerFixture, *, args_dict: dict[str, Any]) -> None:- mocker.patch(- "pipelex.providers.gateway.gateway_img_gen_worker.ImgGenArgsFactory.make_args_for_model",- new_callable=mocker.AsyncMock,- return_value=args_dict,- )- mocker.patch(- "pipelex.providers.gateway.gateway_img_gen_worker.GatewayDeck.get_config_id",- return_value="cfg-1",- )---def _success_response_dict() -> dict[str, Any]:- b64_json = base64.b64encode(_PNG_BYTES).decode("ascii")- return {"data": [{"b64_json": b64_json}], "output_format": "png", "size": "1024x1024"}---def _make_edits_http_response(mocker: MockerFixture) -> Any:- http_response = mocker.MagicMock()- http_response.json.return_value = _success_response_dict()- return http_response--[email protected](loop_scope="class")-class TestGatewayImgGenWorkerEditRouting:- """When 'image' is present in args_dict, the worker must post a multipart body to /images/edits via the vendored async openai client."""-- async def test_with_input_image_routes_to_edits_with_multipart_body(self, mocker: MockerFixture) -> None:- worker, mock_generations_post, mock_edits_post = _make_worker(mocker)- mock_edits_post.return_value = _make_edits_http_response(mocker)- _patch_args(mocker, args_dict={"prompt": "edit me", "n": 1, "size": "1024x1024", "image": [_PNG_FILE_TUPLE]})-- await worker._gen_image_list(img_gen_job=_make_img_gen_job(mocker), nb_images=1) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- # The edit call goes through the vendored AsyncOpenAI client the AsyncPortkey carries- # (portkey_ai's AsyncAPIClient silently drops 'files'); the portkey post must not be used.- mock_generations_post.assert_not_called()-- call = mock_edits_post.call_args- assert call.args == (_EDITS_ENDPOINT_PATH,)- assert call.kwargs["cast_to"] is httpx.Response- # Scalars travel as `body` (raw, unstringified) — the openai SDK serializes them to- # multipart form fields; the image is removed from the body and sent as a file part.- assert call.kwargs["body"] == {"prompt": "edit me", "n": 1, "size": "1024x1024"}- assert call.kwargs["files"] == [("image", _PNG_FILE_TUPLE)]- headers = call.kwargs["options"]["headers"]- assert headers["x-portkey-config"] == "cfg-1"- assert headers["Content-Type"] == "multipart/form-data"-- async def test_with_multiple_input_images_sends_bracketed_array_field_name(self, mocker: MockerFixture) -> None:- """Multiple input images must travel as 'image[]' parts (OpenAI multipart array convention);- repeated bare 'image' parts are collapsed to one by the server, silently dropping the others.- """- worker, mock_generations_post, mock_edits_post = _make_worker(mocker)- mock_edits_post.return_value = _make_edits_http_response(mocker)- _patch_args(mocker, args_dict={"prompt": "edit me", "image": [_PNG_FILE_TUPLE, _PNG_FILE_TUPLE_2]})-- await worker._gen_image_list(img_gen_job=_make_img_gen_job(mocker), nb_images=1) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- mock_generations_post.assert_not_called()- multipart_files: list[tuple[str, Any]] = mock_edits_post.call_args.kwargs["files"]- assert multipart_files == [("image[]", _PNG_FILE_TUPLE), ("image[]", _PNG_FILE_TUPLE_2)]- assert all(field[0] != "image" for field in multipart_files)-- async def test_without_input_image_routes_to_generations_as_before(self, mocker: MockerFixture) -> None:- worker, mock_generations_post, mock_edits_post = _make_worker(mocker)- mock_generations_post.return_value = GenericResponse.model_validate(_success_response_dict())- _patch_args(mocker, args_dict={"prompt": "generate me", "n": 1})-- await worker._gen_image_list(img_gen_job=_make_img_gen_job(mocker), nb_images=1) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- mock_edits_post.assert_not_called()- call_kwargs = mock_generations_post.call_args.kwargs- assert call_kwargs["url"] == _GENERATIONS_ENDPOINT_PATH- assert "files" not in call_kwargs- assert call_kwargs["prompt"] == "generate me"- assert call_kwargs["n"] == 1-- async def test_with_input_image_but_no_generations_segment_raises(self, mocker: MockerFixture) -> None:- """A model whose endpoint doesn't follow the generations/edits split must fail loud, not silently mis-route."""- worker, _, mock_edits_post = _make_worker(mocker, endpoint_path="/some/other/route")- _patch_args(mocker, args_dict={"prompt": "edit me", "image": [_PNG_FILE_TUPLE]})-- with pytest.raises(ImgGenParameterError):- await worker._gen_image_list(img_gen_job=_make_img_gen_job(mocker), nb_images=1) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- mock_edits_post.assert_not_called()diff --git a/tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_malformed_body.py b/tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_malformed_body.pydeleted file mode 100644index 1c57827e6..000000000--- a/tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_malformed_body.py+++ /dev/null@@ -1,127 +0,0 @@-"""Tests that a malformed Gateway success body surfaces as a categorized-ImgGenGenerationError, not a raw ValueError / binascii.Error / PIL error.--The HTTP request succeeds here — it is the *body* parsing that fails. A raw-exception escaping at this point would slip past the Temporal PipelexError-bridge (``convert_pipelex_errors``), get marked retryable, and resubmit the-non-idempotent image generation — double-billing the user.-"""--from __future__ import annotations--import base64-from typing import TYPE_CHECKING, Any--import pytest-from portkey_ai.api_resources.utils import GenericResponse--from pipelex.cogt.exceptions import ImgGenGenerationError, InferenceErrorCategory-from pipelex.cogt.inference.error_classification import UserActionKind-from pipelex.providers.gateway.gateway_img_gen_worker import GatewayImgGenWorker--if TYPE_CHECKING:- from pytest_mock import MockerFixture--# Valid base64 that decodes to a PNG magic header followed by garbage: file-type-# detection recognizes it as a PNG, but PIL cannot open it (raises OSError).-_PNG_HEADER_GARBAGE = base64.b64encode(b"\x89PNG\r\n\x1a\n" + b"\x00" * 40).decode("ascii")--# Valid base64 that decodes to bytes with no recognizable file signature: file-type-# detection cannot identify it and raises FileTypeError (a PipelexError, not a-# ValueError/OSError) — so it must be in the wrapper's except clause too.-_UNRECOGNIZED_BYTES = base64.b64encode(b"plainly not an image" + b"\x00" * 40).decode("ascii")---def _make_worker(mocker: MockerFixture) -> GatewayImgGenWorker:- worker = object.__new__(GatewayImgGenWorker)- mock_model = mocker.MagicMock()- mock_model.model_id = "gpt-image-1"- mock_model.name = "gpt-image-1"- mock_model.desc = "test-gateway-img-model"- mock_model.endpoint_path = "/gpt-image-1"- mock_model.extra_headers = {}- mock_model.rules = mocker.MagicMock()- worker.inference_model = mock_model-- mock_post = mocker.AsyncMock()- mock_options = mocker.MagicMock()- mock_options.post = mock_post- mock_client = mocker.MagicMock()- mock_client.with_options.return_value = mock_options- worker.portkey_client = mock_client- return worker---def _make_img_gen_job(mocker: MockerFixture) -> Any:- job = mocker.MagicMock()- job.img_gen_prompt.positive_text = "test prompt"- job.job_report.img_gen_tokens_usage = None- return job---def _patch_gateway_success(mocker: MockerFixture, worker: GatewayImgGenWorker, response: GenericResponse) -> None:- """Patch the worker so ``.post()`` succeeds and returns the given GenericResponse body."""- worker.portkey_client.with_options.return_value.post.return_value = response # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue]- mocker.patch(- "pipelex.providers.gateway.gateway_img_gen_worker.ImgGenArgsFactory.make_args_for_model",- new_callable=mocker.AsyncMock,- return_value={"prompt": "test"},- )- mocker.patch(- "pipelex.providers.gateway.gateway_img_gen_worker.GatewayDeck.get_config_id",- return_value="cfg-1",- )--[email protected](loop_scope="class")-class TestGatewayImgGenWorkerMalformedBody:- """A malformed success body is wrapped in a categorized ImgGenGenerationError."""-- @pytest.mark.parametrize("malformed_size", ["axb", "1024xfoo", "wide x tall"])- async def test_gpt_image_malformed_size_is_wrapped(self, mocker: MockerFixture, malformed_size: str) -> None:- """An Azure-GPT-Image body whose ``size`` has non-numeric dimensions must surface as a- categorized ImgGenGenerationError, not a raw ValueError escaping the ``int()`` parse.- """- worker = _make_worker(mocker)- # model_validate keeps the Azure-GPT-Image extras (size / output_format) — the- # GenericResponse constructor does not declare them.- response = GenericResponse.model_validate(- {- "success": True,- "data": [{"b64_json": "aGVsbG8="}],- "size": malformed_size,- "output_format": "png",- },- )- _patch_gateway_success(mocker, worker, response)-- with pytest.raises(ImgGenGenerationError) as exc_info:- await worker._gen_image_list(img_gen_job=_make_img_gen_job(mocker), nb_images=1) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert exc_info.value.error_category is InferenceErrorCategory.UNKNOWN- assert exc_info.value.user_action is not None- assert exc_info.value.user_action.kind is UserActionKind.CHANGE_MODEL- assert "non-numeric" in exc_info.value.message-- @pytest.mark.parametrize(- "malformed_base64",- ["abc", _PNG_HEADER_GARBAGE, _UNRECOGNIZED_BYTES],- ids=["invalid-base64-padding", "corrupt-image-bytes", "unrecognized-file-type"],- )- async def test_flux_2_pro_undecodable_image_is_wrapped(self, mocker: MockerFixture, malformed_base64: str) -> None:- """A Flux-2-Pro body carrying invalid base64, undecodable image bytes, or bytes with no- recognizable file signature must surface as a categorized ImgGenGenerationError, not a raw- binascii.Error / PIL OSError / FileTypeError. The body omits ``size``/``output_format`` so- GPT-Image validation fails and the Flux-2-Pro branch is taken.- """- worker = _make_worker(mocker)- response = GenericResponse.model_validate({"success": True, "data": [{"b64_json": malformed_base64}]})- _patch_gateway_success(mocker, worker, response)-- with pytest.raises(ImgGenGenerationError) as exc_info:- await worker._gen_image_list(img_gen_job=_make_img_gen_job(mocker), nb_images=1) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert exc_info.value.error_category is InferenceErrorCategory.UNKNOWN- assert exc_info.value.user_action is not None- assert exc_info.value.user_action.kind is UserActionKind.CHANGE_MODEL- assert "decode" in exc_info.value.messagediff --git a/tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_semantic.py b/tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_semantic.pydeleted file mode 100644index d3c0d3908..000000000--- a/tests/unit/pipelex/providers/gateway/test_gateway_img_gen_worker_semantic.py+++ /dev/null@@ -1,156 +0,0 @@-"""Tests for Gateway ImgGen worker provider_metadata + semantic UserActionKind."""--from __future__ import annotations--from typing import TYPE_CHECKING, Any--import httpx-import pytest-from portkey_ai.api_resources import exceptions as portkey_exc--if TYPE_CHECKING:- from pytest_mock import MockerFixture--from pipelex.cogt.exceptions import ImgGenGenerationError, ImgGenModelNotFoundError, InferenceErrorCategory-from pipelex.cogt.inference.error_classification import UserActionKind-from pipelex.providers.gateway.gateway_img_gen_worker import GatewayImgGenWorker---def _make_response(status_code: int) -> httpx.Response:- request = httpx.Request("POST", "https://api.portkey.ai/v1/images/generations")- return httpx.Response(status_code=status_code, request=request, headers={"x-request-id": "pk-1"})---def _make_status_error(exc_cls: type[portkey_exc.APIStatusError], status_code: int, body: dict[str, Any] | None = None) -> portkey_exc.APIStatusError:- request = httpx.Request("POST", "https://api.portkey.ai/v1/images/generations")- response = _make_response(status_code)- return exc_cls(message=f"http {status_code}", request=request, response=response, body=body or {})---def _make_worker(mocker: MockerFixture) -> GatewayImgGenWorker:- worker = object.__new__(GatewayImgGenWorker)- mock_model = mocker.MagicMock()- mock_model.model_id = "gpt-image-1"- mock_model.name = "gpt-image-1"- mock_model.desc = "test-gateway-img-model"- mock_model.endpoint_path = "/gpt-image-1"- mock_model.extra_headers = {}- mock_model.rules = mocker.MagicMock()- worker.inference_model = mock_model-- mock_post = mocker.AsyncMock()- mock_options = mocker.MagicMock()- mock_options.post = mock_post- mock_client = mocker.MagicMock()- mock_client.with_options.return_value = mock_options- worker.portkey_client = mock_client- return worker---def _make_img_gen_job(mocker: MockerFixture) -> Any:- job = mocker.MagicMock()- job.img_gen_prompt.positive_text = "test prompt"- job.job_report.img_gen_tokens_usage = None- return job--[email protected](loop_scope="class")-class TestGatewayImgGenWorkerSemantic:- """Each Portkey APIError branch carries semantic UserActionKind + provider_metadata."""-- @pytest.mark.parametrize(- ("exc_cls", "status_code", "expected_category", "expected_kind"),- [- (portkey_exc.RateLimitError, 429, InferenceErrorCategory.TRANSIENT, UserActionKind.WAIT_AND_RETRY),- (portkey_exc.AuthenticationError, 401, InferenceErrorCategory.CONFIGURATION, UserActionKind.CHECK_CREDENTIALS),- (portkey_exc.PermissionDeniedError, 403, InferenceErrorCategory.CONFIGURATION, UserActionKind.CHECK_CREDENTIALS),- (portkey_exc.BadRequestError, 400, InferenceErrorCategory.CONTENT, UserActionKind.CHANGE_INPUT),- ],- )- async def test_status_error_carries_semantic_user_action(- self,- mocker: MockerFixture,- exc_cls: type[portkey_exc.APIStatusError],- status_code: int,- expected_category: InferenceErrorCategory,- expected_kind: UserActionKind,- ) -> None:- worker = _make_worker(mocker)- sdk_exc = _make_status_error(exc_cls, status_code)- worker.portkey_client.with_options.return_value.post.side_effect = sdk_exc # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue]-- mocker.patch(- "pipelex.providers.gateway.gateway_img_gen_worker.ImgGenArgsFactory.make_args_for_model",- new_callable=mocker.AsyncMock,- return_value={"prompt": "test"},- )- mocker.patch(- "pipelex.providers.gateway.gateway_img_gen_worker.GatewayDeck.get_config_id",- return_value="cfg-1",- )-- with pytest.raises(ImgGenGenerationError) as exc_info:- await worker._gen_image_list(img_gen_job=_make_img_gen_job(mocker), nb_images=1) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert exc_info.value.error_category is expected_category- assert exc_info.value.user_action is not None- assert exc_info.value.user_action.kind is expected_kind- assert exc_info.value.provider_metadata is not None- assert exc_info.value.provider_metadata.provider == "gateway"- assert exc_info.value.provider_metadata.status_code == status_code-- async def test_genuine_not_found_404_raises_img_gen_model_not_found_error(self, mocker: MockerFixture) -> None:- """A genuine unknown-model 404 specializes to ImgGenModelNotFoundError (CONFIGURATION, CHANGE_MODEL)."""- worker = _make_worker(mocker)- sdk_exc = _make_status_error(portkey_exc.NotFoundError, 404)- worker.portkey_client.with_options.return_value.post.side_effect = sdk_exc # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue]-- mocker.patch(- "pipelex.providers.gateway.gateway_img_gen_worker.ImgGenArgsFactory.make_args_for_model",- new_callable=mocker.AsyncMock,- return_value={"prompt": "test"},- )- mocker.patch(- "pipelex.providers.gateway.gateway_img_gen_worker.GatewayDeck.get_config_id",- return_value="cfg-1",- )-- with pytest.raises(ImgGenModelNotFoundError) as exc_info:- await worker._gen_image_list(img_gen_job=_make_img_gen_job(mocker), nb_images=1) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert exc_info.value.error_category is InferenceErrorCategory.CONFIGURATION- assert exc_info.value.user_action is not None- assert exc_info.value.user_action.kind is UserActionKind.CHANGE_MODEL- assert exc_info.value.model_handle == "gpt-image-1"- assert exc_info.value.provider_metadata is not None- assert exc_info.value.provider_metadata.status_code == 404-- async def test_quota_keywords_in_rate_limit_message_is_check_billing(self, mocker: MockerFixture) -> None:- worker = _make_worker(mocker)- # The classify path inspects str(exc); the constructor message becomes the str repr.- request = httpx.Request("POST", "https://api.portkey.ai/v1/images/generations")- response = _make_response(429)- sdk_exc = portkey_exc.RateLimitError(- message="insufficient_quota: your credits are exhausted",- request=request,- response=response,- body={"error": {"message": "insufficient_quota: your credits are exhausted"}},- )- worker.portkey_client.with_options.return_value.post.side_effect = sdk_exc # type: ignore[attr-defined] # pyright: ignore[reportAttributeAccessIssue]-- mocker.patch(- "pipelex.providers.gateway.gateway_img_gen_worker.ImgGenArgsFactory.make_args_for_model",- new_callable=mocker.AsyncMock,- return_value={"prompt": "test"},- )- mocker.patch(- "pipelex.providers.gateway.gateway_img_gen_worker.GatewayDeck.get_config_id",- return_value="cfg-1",- )-- with pytest.raises(ImgGenGenerationError) as exc_info:- await worker._gen_image_list(img_gen_job=_make_img_gen_job(mocker), nb_images=1) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert exc_info.value.error_category is InferenceErrorCategory.CAPACITY- assert exc_info.value.user_action is not None- assert exc_info.value.user_action.kind is UserActionKind.CHECK_BILLINGdiff --git a/tests/unit/pipelex/providers/gateway/test_gateway_quota_detection.py b/tests/unit/pipelex/providers/gateway/test_gateway_quota_detection.pydeleted file mode 100644index 32dcb2988..000000000--- a/tests/unit/pipelex/providers/gateway/test_gateway_quota_detection.py+++ /dev/null@@ -1,196 +0,0 @@-"""Tests for Gateway worker Portkey error classification and quota detection."""--from __future__ import annotations--from typing import TYPE_CHECKING--import httpx-import pytest-from portkey_ai.api_resources import exceptions as portkey_exceptions--if TYPE_CHECKING:- from pytest_mock import MockerFixture--from pipelex.cogt.exceptions import ExtractJobFailureError, ImgGenGenerationError, InferenceErrorCategory, SearchJobFailureError-from pipelex.cogt.inference.error_classification import UserActionKind-from pipelex.providers.gateway.gateway_extract_worker import GatewayExtractWorker-from pipelex.providers.gateway.gateway_img_gen_worker import GatewayImgGenWorker-from pipelex.providers.gateway.gateway_protocols import GatewayExtractProtocol-from pipelex.providers.gateway.gateway_search_worker import GatewaySearchWorker---def _make_portkey_exception(exception_type_name: str, status_code: int, message: str) -> portkey_exceptions.APIError:- """Create a Portkey exception by type name for testing."""- request = httpx.Request("POST", "https://api.portkey.ai/v1/test")- response = httpx.Response(status_code=status_code, request=request)-- exception_map: dict[str, type[portkey_exceptions.APIError]] = {- "RateLimitError": portkey_exceptions.RateLimitError,- "AuthenticationError": portkey_exceptions.AuthenticationError,- "PermissionDeniedError": portkey_exceptions.PermissionDeniedError,- "BadRequestError": portkey_exceptions.BadRequestError,- "NotFoundError": portkey_exceptions.NotFoundError,- "APIStatusError": portkey_exceptions.APIStatusError,- }-- if exception_type_name == "APITimeoutError":- return portkey_exceptions.APITimeoutError(request=request)- if exception_type_name == "APIConnectionError":- return portkey_exceptions.APIConnectionError(message=message, request=request)-- exc_class = exception_map.get(exception_type_name)- if exc_class is None:- msg = f"Unknown portkey exception type: {exception_type_name}"- raise ValueError(msg)- return exc_class(message, request=request, response=response, body=None) # type: ignore[call-arg] # pyright: ignore[reportCallIssue]---def _make_gateway_extract_worker(mocker: MockerFixture) -> GatewayExtractWorker:- """Create a minimal GatewayExtractWorker with mocked internals."""- worker = object.__new__(GatewayExtractWorker)- mock_model = mocker.MagicMock()- mock_model.desc = "test-gateway-extract"- mock_model.model_id = "mistral-doc-ai"- mock_model.name = "mistral-doc-ai"- mock_model.tag = "test-extract-tag"- mock_model.extra_headers = {}- worker.inference_model = mock_model-- mock_client = mocker.MagicMock()- worker.portkey_client = mock_client-- return worker---def _make_gateway_img_gen_worker(mocker: MockerFixture) -> GatewayImgGenWorker:- """Create a minimal GatewayImgGenWorker with mocked internals."""- worker = object.__new__(GatewayImgGenWorker)- mock_model = mocker.MagicMock()- mock_model.desc = "test-gateway-imggen"- mock_model.model_id = "gpt-image-1"- mock_model.name = "gpt-image-1"- mock_model.tag = "test-imggen-tag"- mock_model.endpoint_path = "/gpt-image-1"- mock_model.extra_headers = {}- mock_model.rules = mocker.MagicMock()- worker.inference_model = mock_model-- mock_client = mocker.MagicMock()- worker.portkey_client = mock_client-- return worker---def _make_gateway_search_worker(mocker: MockerFixture) -> GatewaySearchWorker:- """Create a minimal GatewaySearchWorker with mocked internals."""- worker = object.__new__(GatewaySearchWorker)- mock_model = mocker.MagicMock()- mock_model.desc = "test-gateway-search"- mock_model.model_id = "linkup/standard"- mock_model.name = "linkup-standard"- mock_model.tag = "test-search-tag"- mock_model.extra_headers = {}- worker.inference_model = mock_model-- mock_client = mocker.MagicMock()- worker.portkey_client = mock_client-- return worker--[email protected](loop_scope="class")-class TestGatewayQuotaDetection:- """Tests for Portkey error classification across gateway workers."""-- async def test_imggen_worker_propagates_rate_limit_as_transient(self, mocker: MockerFixture) -> None:- """GatewayImgGenWorker raises ImgGenGenerationError with TRANSIENT for rate limit."""- worker = _make_gateway_img_gen_worker(mocker)- sdk_exc = _make_portkey_exception("RateLimitError", 429, "Rate limit exceeded")-- mock_options = mocker.MagicMock()- mock_options.post = mocker.AsyncMock(side_effect=sdk_exc)- worker.portkey_client.with_options = mocker.MagicMock(return_value=mock_options) # type: ignore[method-assign]-- mocker.patch(- "pipelex.providers.gateway.gateway_img_gen_worker.ImgGenArgsFactory.make_args_for_model",- new_callable=mocker.AsyncMock,- return_value={"prompt": "test"},- )- mocker.patch(- "pipelex.providers.gateway.gateway_img_gen_worker.GatewayDeck.get_config_id",- return_value="test-config",- )-- img_gen_job = mocker.MagicMock()- img_gen_job.job_report.img_gen_tokens_usage = None-- with pytest.raises(ImgGenGenerationError) as exc_info:- await worker._gen_image_list(img_gen_job=img_gen_job, nb_images=1) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert exc_info.value.error_category is InferenceErrorCategory.TRANSIENT- assert exc_info.value.user_action is not None- assert exc_info.value.user_action.kind is UserActionKind.WAIT_AND_RETRY- assert exc_info.value.__cause__ is sdk_exc-- async def test_search_worker_propagates_auth_error_as_configuration(self, mocker: MockerFixture) -> None:- """GatewaySearchWorker raises SearchJobFailureError with CONFIGURATION for auth error."""- worker = _make_gateway_search_worker(mocker)- sdk_exc = _make_portkey_exception("AuthenticationError", 401, "Invalid API key")-- mock_options = mocker.MagicMock()- mock_options.post = mocker.AsyncMock(side_effect=sdk_exc)- worker.portkey_client.with_options = mocker.MagicMock(return_value=mock_options) # type: ignore[method-assign]-- mocker.patch(- "pipelex.providers.gateway.gateway_search_worker.GatewayDeck.get_config_id",- return_value="test-config",- )-- with pytest.raises(SearchJobFailureError) as exc_info:- await worker._call_relay(model="linkup/standard", content='{"query": "test"}') # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert exc_info.value.error_category is InferenceErrorCategory.CONFIGURATION- assert exc_info.value.__cause__ is sdk_exc-- async def test_extract_worker_propagates_quota_as_capacity(self, mocker: MockerFixture) -> None:- """GatewayExtractWorker raises ExtractJobFailureError with CAPACITY for quota exhaustion."""- worker = _make_gateway_extract_worker(mocker)- sdk_exc = _make_portkey_exception("RateLimitError", 429, "You have exceeded your quota allocation")-- mock_options = mocker.MagicMock()- mock_options.post = mocker.AsyncMock(side_effect=sdk_exc)- worker.portkey_client.with_options = mocker.MagicMock(return_value=mock_options) # type: ignore[method-assign]-- mocker.patch(- "pipelex.providers.gateway.gateway_extract_worker.GatewayDeck.get_config_id",- return_value="test-config",- )- mocker.patch(- "pipelex.providers.gateway.gateway_extract_worker.GatewayFactory.make_extras",- return_value=({}, {"messages": [{"role": "user", "content": "test"}]}),- )- mocker.patch(- "pipelex.providers.gateway.gateway_extract_worker.make_base64_url_from_any_uri",- new_callable=mocker.AsyncMock,- return_value="data:application/pdf;base64,dGVzdA==",- )-- extract_job = mocker.MagicMock()- extract_job.extract_input.image_uri = None- extract_job.extract_input.document_uri = "/tmp/test.pdf" # ruff: ignore[hardcoded-temp-file]- extract_job.job_params.max_nb_images = 0- extract_job.job_params.should_caption_images = False-- mocker.patch(- "pipelex.providers.gateway.gateway_extract_worker.GatewayExtractProtocol.make_from_model_handle",- return_value=GatewayExtractProtocol.MISTRAL_DOC_AI,- )- mocker.patch(- "pipelex.providers.gateway.gateway_extract_worker.get_storage_provider",- )-- with pytest.raises(ExtractJobFailureError) as exc_info:- await worker._extract_document(extract_job=extract_job) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert exc_info.value.error_category is InferenceErrorCategory.CAPACITY- assert exc_info.value.__cause__ is sdk_excdiff --git a/tests/unit/pipelex/providers/gateway/test_gateway_search_worker_semantic.py b/tests/unit/pipelex/providers/gateway/test_gateway_search_worker_semantic.pydeleted file mode 100644index e688fe180..000000000--- a/tests/unit/pipelex/providers/gateway/test_gateway_search_worker_semantic.py+++ /dev/null@@ -1,125 +0,0 @@-"""Tests for Gateway search worker provider_metadata + semantic UserActionKind."""--from __future__ import annotations--from typing import TYPE_CHECKING, Any--import httpx-import pytest-from portkey_ai.api_resources import exceptions as portkey_exc--if TYPE_CHECKING:- from pytest_mock import MockerFixture--from pipelex.cogt.exceptions import InferenceErrorCategory, SearchJobFailureError, SearchModelNotFoundError-from pipelex.cogt.inference.error_classification import UserActionKind-from pipelex.providers.gateway.gateway_search_worker import GatewaySearchWorker---def _make_response(status_code: int) -> httpx.Response:- request = httpx.Request("POST", "https://api.portkey.ai/v1/chat/completions")- return httpx.Response(status_code=status_code, request=request, headers={"x-request-id": "pk-search-1"})---def _make_status_error(exc_cls: type[portkey_exc.APIStatusError], status_code: int) -> portkey_exc.APIStatusError:- request = httpx.Request("POST", "https://api.portkey.ai/v1/chat/completions")- response = _make_response(status_code)- return exc_cls(message=f"http {status_code}", request=request, response=response, body={})---def _make_worker(mocker: MockerFixture) -> GatewaySearchWorker:- worker = object.__new__(GatewaySearchWorker)- mock_model = mocker.MagicMock()- mock_model.model_id = "linkup/standard"- mock_model.name = "linkup-sourced-answer"- mock_model.desc = "test-gateway-search"- mock_model.extra_headers = {}- worker.inference_model = mock_model-- mock_post = mocker.AsyncMock()- mock_options = mocker.MagicMock()- mock_options.post = mock_post- mock_client = mocker.MagicMock()- mock_client.with_options.return_value = mock_options- worker.portkey_client = mock_client- return worker---def _make_search_job(mocker: MockerFixture) -> Any:- job = mocker.MagicMock()- job.query = "test search query"- job.job_params.search_setting.include_images = False- job.job_params.search_setting.include_inline_citations = False- job.job_params.search_setting.max_results = 10- job.job_params.include_domains = None- job.job_params.exclude_domains = None- job.job_params.from_date = None- job.job_params.to_date = None- job.job_report.search_tokens_usage = None- return job--[email protected](loop_scope="class")-class TestGatewaySearchWorkerSemantic:- """Each Portkey APIError branch carries semantic UserActionKind + provider_metadata."""-- @pytest.mark.parametrize(- ("exc_cls", "status_code", "expected_category", "expected_kind"),- [- (portkey_exc.RateLimitError, 429, InferenceErrorCategory.TRANSIENT, UserActionKind.WAIT_AND_RETRY),- (portkey_exc.AuthenticationError, 401, InferenceErrorCategory.CONFIGURATION, UserActionKind.CHECK_CREDENTIALS),- (portkey_exc.PermissionDeniedError, 403, InferenceErrorCategory.CONFIGURATION, UserActionKind.CHECK_CREDENTIALS),- (portkey_exc.BadRequestError, 400, InferenceErrorCategory.CONTENT, UserActionKind.CHANGE_INPUT),- ],- )- async def test_status_error_carries_semantic_user_action(- self,- mocker: MockerFixture,- exc_cls: type[portkey_exc.APIStatusError],- status_code: int,- expected_category: InferenceErrorCategory,- expected_kind: UserActionKind,- ) -> None:- worker = _make_worker(mocker)- sdk_exc = _make_status_error(exc_cls, status_code)- client: Any = worker.portkey_client- client.with_options.return_value.post.side_effect = sdk_exc-- mocker.patch(- "pipelex.providers.gateway.gateway_search_worker.GatewayDeck.get_config_id",- return_value="linkup-sourced-answer",- )-- with pytest.raises(SearchJobFailureError) as exc_info:- await worker._search_sourced_answer(search_job=_make_search_job(mocker)) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert exc_info.value.error_category is expected_category- assert exc_info.value.user_action is not None- assert exc_info.value.user_action.kind is expected_kind- assert exc_info.value.provider_metadata is not None- assert exc_info.value.provider_metadata.provider == "gateway"- assert exc_info.value.provider_metadata.status_code == status_code- assert exc_info.value.provider_metadata.request_id == "pk-search-1"- assert exc_info.value.__cause__ is sdk_exc-- async def test_genuine_not_found_404_raises_search_model_not_found_error(self, mocker: MockerFixture) -> None:- """A 404 specializes to SearchModelNotFoundError (CONFIGURATION, CHANGE_MODEL) so it reroutes."""- worker = _make_worker(mocker)- sdk_exc = _make_status_error(portkey_exc.NotFoundError, 404)- client: Any = worker.portkey_client- client.with_options.return_value.post.side_effect = sdk_exc-- mocker.patch(- "pipelex.providers.gateway.gateway_search_worker.GatewayDeck.get_config_id",- return_value="linkup-sourced-answer",- )-- with pytest.raises(SearchModelNotFoundError) as exc_info:- await worker._search_sourced_answer(search_job=_make_search_job(mocker)) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert exc_info.value.error_category is InferenceErrorCategory.CONFIGURATION- assert exc_info.value.user_action is not None- assert exc_info.value.user_action.kind is UserActionKind.CHANGE_MODEL- assert exc_info.value.model_handle == "linkup-sourced-answer"- assert exc_info.value.provider_metadata is not None- assert exc_info.value.provider_metadata.status_code == 404diff --git a/tests/unit/pipelex/providers/gateway/test_gateway_structured_search_contract.py b/tests/unit/pipelex/providers/gateway/test_gateway_structured_search_contract.pydeleted file mode 100644index 9143d04fc..000000000--- a/tests/unit/pipelex/providers/gateway/test_gateway_structured_search_contract.py+++ /dev/null@@ -1,169 +0,0 @@-"""The gateway's structured search must hand the leaf the bare payload, not the relay's envelope.--The relay asks Linkup for sources alongside the structured payload, so its wire shape is a-``{data, sources}`` envelope — while the leaf validates the result against the caller's output-structure class, which has nowhere to put sources. The worker owes the leaf the unwrapped payload,-and owes a classified search error (not an opaque downstream ``ValidationError``) when the envelope-shape is not there.--No provider is called (the relay call is mocked), so this needs no inference marker.-"""--from __future__ import annotations--import json-from typing import TYPE_CHECKING, Any--import pytest-from pydantic import BaseModel, Field--from pipelex.providers.gateway.gateway_exceptions import GatewaySearchEmptyResultError, GatewaySearchResponseError-from pipelex.providers.gateway.gateway_search_worker import GatewaySearchWorker--if TYPE_CHECKING:- from pytest_mock import MockerFixture---class TopicSummary(BaseModel):- title: str- summary: str---class DataAndSources(BaseModel):- """An output structure that legitimately spells its own fields the way the relay envelope does."""-- data: dict[str, str]- sources: list[str]---class AliasedDataAndSources(BaseModel):- """The same shape, spelled through aliases: it reaches the wire as {data, sources} all the same."""-- body: dict[str, str] = Field(validation_alias="data")- refs: list[str] = Field(validation_alias="sources")---class SerializationAliasedTopicSummary(BaseModel):- """A `serialization_alias` renames the dump, never the schema the provider was handed."""-- title: str = Field(serialization_alias="data")- summary: str = Field(serialization_alias="sources")---def _make_worker(mocker: MockerFixture, *, content: str) -> GatewaySearchWorker:- worker = object.__new__(GatewaySearchWorker)- mock_model = mocker.MagicMock()- mock_model.desc = "test-gateway-search"- mock_model.model_id = "linkup/standard"- mock_model.name = "linkup-standard"- mock_model.extra_headers = None- worker.inference_model = mock_model- mocker.patch.object(GatewaySearchWorker, "_call_relay", mocker.AsyncMock(return_value=mocker.MagicMock()))- mocker.patch.object(GatewaySearchWorker, "_extract_usage", return_value=None)- mocker.patch.object(GatewaySearchWorker, "_extract_content", return_value=content)- return worker---def _make_search_job(mocker: MockerFixture) -> Any:- job = mocker.MagicMock()- job.query = "test search query"- job.job_params.search_setting.include_images = False- job.job_params.search_setting.include_inline_citations = False- job.job_params.search_setting.max_results = 10- job.job_params.include_domains = None- job.job_params.exclude_domains = None- job.job_params.from_date = None- job.job_params.to_date = None- job.job_report.search_tokens_usage = None- return job--[email protected](loop_scope="class")-class TestGatewayStructuredSearchContract:- async def test_the_relay_envelope_is_unwrapped_to_the_bare_payload(self, mocker: MockerFixture) -> None:- """The `{data, sources}` envelope arrives from the relay; the leaf gets the payload alone."""- payload = {"title": "pipelex", "summary": "a language"}- content = json.dumps({"data": payload, "sources": [{"name": "src", "url": "https://example.com", "snippet": "…"}]})- worker = _make_worker(mocker, content=content)-- result = await worker._search_structured(search_job=_make_search_job(mocker), schema=TopicSummary) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert result == payload- # The payload validates against the caller's output structure class — the envelope never could.- validated = TopicSummary.model_validate(result)- assert validated.title == "pipelex"-- async def test_a_bare_payload_passes_through_unwrapped(self, mocker: MockerFixture) -> None:- """The relay dropping sources must not break this worker — the envelope is recognised, not demanded.-- Demanding it would make "relay stops asking Linkup for sources" a coordinated two-sided deploy:- every gateway structured search would fail until both repos shipped together.- """- payload = {"title": "pipelex", "summary": "a language"}- worker = _make_worker(mocker, content=json.dumps(payload))-- result = await worker._search_structured(search_job=_make_search_job(mocker), schema=TopicSummary) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert result == payload-- async def test_an_output_class_that_declares_data_and_sources_is_not_unwrapped(self, mocker: MockerFixture) -> None:- """The one shape a positional `.get("data")` unwrap would silently corrupt."""- payload = {"data": {"nested": "value"}, "sources": ["a"]}- worker = _make_worker(mocker, content=json.dumps(payload))-- result = await worker._search_structured(search_job=_make_search_job(mocker), schema=DataAndSources) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert result == payload, "the caller's own {data, sources} output is its payload, not an envelope around one"-- async def test_an_output_class_whose_wire_names_are_aliases_is_not_unwrapped(self, mocker: MockerFixture) -> None:- """The same shape as above, reached through `validation_alias` rather than plain field names.-- The provider is handed `model_json_schema()`, which pydantic emits by alias, so this class reaches- the wire as {data, sources} exactly like `DataAndSources` — while `field.alias` stays `None` on both- fields. Recognising the envelope from the Python field names alone would mistake this class's own- payload for one and hand the leaf its `data` member: a silent wrong answer of precisely the kind the- structural check exists to prevent.- """- payload = {"data": {"nested": "value"}, "sources": ["a"]}- worker = _make_worker(mocker, content=json.dumps(payload))-- result = await worker._search_structured(search_job=_make_search_job(mocker), schema=AliasedDataAndSources) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert result == payload, "an aliased {data, sources} output class owns those names as much as one that spells them out"- assert AliasedDataAndSources.model_validate(result).body == {"nested": "value"}-- async def test_a_serialization_alias_does_not_make_a_class_own_the_envelope_names(self, mocker: MockerFixture) -> None:- """The other direction: only the alias that reaches the *schema* counts.-- A `serialization_alias` renames the dump, not the property the provider sees, so this class does not- own {data, sources} and a real envelope must still be unwrapped for it. Pinning this stops the guard- from being "fixed" by folding every alias kind into the declared set.- """- payload = {"title": "pipelex", "summary": "a language"}- content = json.dumps({"data": payload, "sources": [{"name": "src", "url": "https://example.com", "snippet": "…"}]})- worker = _make_worker(mocker, content=content)-- result = await worker._search_structured(search_job=_make_search_job(mocker), schema=SerializationAliasedTopicSummary) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- assert result == payload-- async def test_an_envelope_carrying_no_payload_raises_an_empty_result_error(self, mocker: MockerFixture) -> None:- """A search that found nothing is not a malformed response — it must not advise changing model."""- worker = _make_worker(mocker, content=json.dumps({"data": None, "sources": []}))-- with pytest.raises(GatewaySearchEmptyResultError, match="empty structured result"):- await worker._search_structured(search_job=_make_search_job(mocker), schema=TopicSummary) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- async def test_a_non_object_response_raises_a_classified_search_error(self, mocker: MockerFixture) -> None:- """A response that is not a JSON object at all is malformed, and says so."""- worker = _make_worker(mocker, content=json.dumps(["not", "an", "object"]))-- with pytest.raises(GatewaySearchResponseError, match="non-object payload"):- await worker._search_structured(search_job=_make_search_job(mocker), schema=TopicSummary) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-- async def test_a_non_json_body_raises_a_classified_search_error(self, mocker: MockerFixture) -> None:- """The likeliest way the relay contract breaks must not escape as a bare JSONDecodeError."""- worker = _make_worker(mocker, content="<html>502 Bad Gateway</html>")-- with pytest.raises(GatewaySearchResponseError, match="not valid JSON"):- await worker._search_structured(search_job=_make_search_job(mocker), schema=TopicSummary) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]diff --git a/tests/unit/pipelex/providers/manifold/test_manifold_clients.py b/tests/unit/pipelex/providers/manifold/test_manifold_clients.pyindex d320efd5e..d7c875c3a 100644--- a/tests/unit/pipelex/providers/manifold/test_manifold_clients.py+++ b/tests/unit/pipelex/providers/manifold/test_manifold_clients.py@@ -126,7 +126,7 @@ class TestManifoldImageClient:def test_debug_is_read_from_the_backend_and_from_nothing_else(self, mocker: MockerFixture) -> None:"""One configuration block must not govern two services.- The Portkey-path sibling routes this through the telemetry manager's `pipelex_gateway.portkey`+ The Portkey-path sibling routes this through the telemetry manager's Portkey-pathknobs; reading those here would make a change meant for the cloud path silently alter themanifold one."""diff --git a/tests/unit/pipelex/providers/manifold/test_manifold_completions_messages.py b/tests/unit/pipelex/providers/manifold/test_manifold_completions_messages.pyindex f8a8e6028..b8cf3fd89 100644--- a/tests/unit/pipelex/providers/manifold/test_manifold_completions_messages.py+++ b/tests/unit/pipelex/providers/manifold/test_manifold_completions_messages.py@@ -1,18 +1,8 @@-"""`ManifoldCompletionsFactory.make_simple_messages` — the override that is a copy on purpose.+"""`ManifoldCompletionsFactory.make_simple_messages` — the override for a Pipelex-operated gateway.Documents travel to a Pipelex-operated gateway as a `ChatCompletionContentPartImageParam` holding adata URL, not as the OpenAI file part the base class sends: the gateway translates that part intowhatever document format the provider it picked actually wants, and it cannot translate a file part.-The Portkey-path factory makes the same move for the same reason — it is the same gateway codebase-on the other end — and the manifold factory carries its **own copy** rather than subclassing it, so-that retiring the Portkey package stays a deletion.--**The last test here is the one that makes that duplication safe.** A copy that silently drifts from-its original is worse than either sharing or diverging deliberately, and nothing in the package-would notice: the two factories are never used in the same process. Comparing their output is the-only place the equality is stated. It imports from `providers/gateway/` — which the *package* must-not do — and that is correct for a test whose whole subject is the relationship between the two; it-is deleted along with the path it compares against."""from __future__ import annotations@@ -142,37 +132,3 @@ class TestManifoldCompletionsMessages:with pytest.raises(TypeError, match=expected_match):await factory.make_simple_messages(llm_job=llm_job)--[email protected](loop_scope="class")-class TestManifoldCompletionsMessagesMatchTheGatewayPath:- """The copy has not drifted from the original it was taken from.-- Delete this class when the Portkey path is deleted; until then it is the only statement anywhere- that the two overrides agree, and they must, because they talk to the same gateway codebase.- """-- async def test_both_factories_build_the_same_messages_for_the_same_prompt(self, mocker: MockerFixture) -> None:- from pipelex.providers.gateway.gateway_completions_factory import GatewayCompletionsFactory # ruff: ignore[import-outside-top-level]-- gateway_namespace = "pipelex.providers.gateway.gateway_completions_factory"- prepped_images = [PreparedFileBase64(base64_data="QUJD", file_type=_PNG_FILE_TYPE)]- prepped_documents = [PreparedFileBase64(base64_data="UERG", file_type=_PDF_FILE_TYPE)]- for namespace in (_FACTORY_NAMESPACE, gateway_namespace):- mocker.patch(f"{namespace}.prep_prompt_images", new_callable=mocker.AsyncMock, return_value=prepped_images)- mocker.patch(f"{namespace}.prep_prompt_documents", new_callable=mocker.AsyncMock, return_value=prepped_documents)-- def _job() -> Any:- return _make_llm_job(- mocker,- system_text="You are concise.",- user_text="Read these.",- has_images=True,- has_documents=True,- image_detail=PromptImageDetail.HIGH,- )-- manifold_messages = await ManifoldCompletionsFactory(is_http_url_enabled=False).make_simple_messages(llm_job=_job())- gateway_messages = await GatewayCompletionsFactory(is_http_url_enabled=False).make_simple_messages(llm_job=_job())-- assert manifold_messages == gateway_messagesdiff --git a/tests/unit/pipelex/providers/manifold/test_manifold_metadata_scope.py b/tests/unit/pipelex/providers/manifold/test_manifold_metadata_scope.pyindex 066a5014f..144915235 100644--- a/tests/unit/pipelex/providers/manifold/test_manifold_metadata_scope.py+++ b/tests/unit/pipelex/providers/manifold/test_manifold_metadata_scope.py@@ -19,7 +19,6 @@ from pipelex.cogt.llm.llm_job_components import LLMJobConfig, LLMJobParams, LLMJfrom pipelex.cogt.llm.llm_prompt import LLMPromptfrom pipelex.cogt.llm.structured_output import StructureMethodfrom pipelex.providers.anthropic.anthropic_llm_worker import AnthropicLLMWorker-from pipelex.providers.gateway.gateway_factory import GatewayFactoryfrom pipelex.providers.manifold.manifold_constants import MANIFOLD_METADATA_HEADERfrom pipelex.providers.openai.openai_completions_factory import OpenAICompletionsFactoryfrom pipelex.providers.openai.openai_responses_factory import OpenAIResponsesFactory@@ -93,9 +92,8 @@ class TestManifoldMetadataScope:OpenAICompletionsFactory(is_http_url_enabled=False),OpenAIResponsesFactory(is_http_url_enabled=False),PortkeyFactory,- GatewayFactory,],- ids=["openai-completions", "openai-responses", "portkey", "gateway"],+ ids=["openai-completions", "openai-responses", "portkey"],)async def test_other_backends_extras_carry_no_metadata_header(self, mocker: MockerFixture, factory: Any) -> None:model = _model(mocker, backend_name="openai")@@ -106,7 +104,7 @@ class TestManifoldMetadataScope:assert MANIFOLD_METADATA_HEADER not in extra_headersassert "x-portkey-metadata" not in extra_headers- @pytest.mark.parametrize("backend_name", ["anthropic", "bedrock", "pipelex_gateway"])+ @pytest.mark.parametrize("backend_name", ["anthropic", "bedrock"])async def test_direct_claude_sends_no_headers_on_the_text_call(self, mocker: MockerFixture, backend_name: str) -> None:sdk_client = AsyncAnthropic(api_key="test-key")stream = mocker.MagicMock(side_effect=_RequestCapturedError)diff --git a/tests/unit/pipelex/providers/test_instructor_retry_shapes.py b/tests/unit/pipelex/providers/test_instructor_retry_shapes.pyindex 3c37f91dd..c312bc934 100644--- a/tests/unit/pipelex/providers/test_instructor_retry_shapes.py+++ b/tests/unit/pipelex/providers/test_instructor_retry_shapes.py@@ -257,7 +257,7 @@ class TestInstructorRetryShapes:inference_model = mocker.MagicMock()inference_model.name = _MODEL_HANDLEinference_model.model_id = _WIRE_ID- inference_model.desc = f"{_MODEL_HANDLE} → SDK[gateway_completions]•Backend[pipelex_gateway]•Model[{_WIRE_ID}]"+ inference_model.desc = f"{_MODEL_HANDLE} → SDK[manifold_completions]•Backend[pipelex_manifold]•Model[{_WIRE_ID}]"inference_model.thinking_mode = Noneinference_model.listed_constraints = []worker.inference_model = inference_modeldiff --git a/tests/unit/pipelex/providers/test_transport_retry_wiring.py b/tests/unit/pipelex/providers/test_transport_retry_wiring.pyindex 6f4906071..fe041e1c6 100644--- a/tests/unit/pipelex/providers/test_transport_retry_wiring.py+++ b/tests/unit/pipelex/providers/test_transport_retry_wiring.py@@ -13,8 +13,6 @@ from typing import TYPE_CHECKINGfrom mistralai.client.utils import RetryConfigfrom pipelex.providers.anthropic.anthropic_factory import AnthropicFactory-from pipelex.providers.gateway.gateway_completions_factory import GatewayCompletionsFactory-from pipelex.providers.gateway.gateway_responses_factory import GatewayResponsesFactoryfrom pipelex.providers.google.google_factory import GoogleFactoryfrom pipelex.providers.mistral.mistral_factory import MistralFactoryfrom pipelex.providers.openai.openai_client_factory import OpenAIClientFactory@@ -134,35 +132,3 @@ class TestTransportRetryWiring:mock_client.assert_called_once()assert mock_client.call_args.kwargs["max_retries"] == 8-- def test_gateway_completions_factory_passes_max_retries(self, mocker: MockerFixture) -> None:- mocker.patch(- "pipelex.providers.gateway.gateway_completions_factory.get_config",- return_value=_config_with(mocker, 4),- )- mocker.patch("pipelex.providers.gateway.gateway_completions_factory.GatewayFactory.is_debug_enabled", return_value=False)- mocker.patch("pipelex.providers.gateway.gateway_completions_factory.GatewayFactory.get_endpoint", return_value="https://gateway.test")- mocker.patch("pipelex.providers.gateway.gateway_completions_factory.GatewayFactory.get_api_key", return_value="gw-test")- mocker.patch("pipelex.providers.gateway.gateway_completions_factory.GatewayOpenAISdkVariant.is_completions", return_value=True)- mock_client = mocker.patch("openai.AsyncOpenAI")-- GatewayCompletionsFactory.make_portkey_openai_client_for_completions(model_handle=mocker.MagicMock(), backend=mocker.MagicMock())-- mock_client.assert_called_once()- assert mock_client.call_args.kwargs["max_retries"] == 4-- def test_gateway_responses_factory_passes_max_retries(self, mocker: MockerFixture) -> None:- mocker.patch(- "pipelex.providers.gateway.gateway_responses_factory.get_config",- return_value=_config_with(mocker, 9),- )- mocker.patch("pipelex.providers.gateway.gateway_responses_factory.GatewayFactory.is_debug_enabled", return_value=False)- mocker.patch("pipelex.providers.gateway.gateway_responses_factory.GatewayFactory.get_endpoint", return_value="https://gateway.test")- mocker.patch("pipelex.providers.gateway.gateway_responses_factory.GatewayFactory.get_api_key", return_value="gw-test")- mocker.patch("pipelex.providers.gateway.gateway_responses_factory.GatewayOpenAISdkVariant.is_responses", return_value=True)- mock_client = mocker.patch("openai.AsyncOpenAI")-- GatewayResponsesFactory.make_portkey_openai_client_for_responses(model_handle=mocker.MagicMock(), backend=mocker.MagicMock())-- mock_client.assert_called_once()- assert mock_client.call_args.kwargs["max_retries"] == 9diff --git a/tests/unit/pipelex/system/configuration/test_boot_tolerance.py b/tests/unit/pipelex/system/configuration/test_boot_tolerance.pyindex 9159ae8ed..9f9c42ca1 100644--- a/tests/unit/pipelex/system/configuration/test_boot_tolerance.py+++ b/tests/unit/pipelex/system/configuration/test_boot_tolerance.py@@ -652,19 +652,19 @@ class TestTheServiceConfigLoader:migration_dir=synthetic_migration_dir,surface_id=PIPELEX_SERVICE_CONFIG_SURFACE_ID,base_file="pipelex_service.toml",- ops_body='[[migration.ops]]\nkind = "rename_table_key"\ntable_path = []\nkey = "terms"\nnew_key = "agreement"\n',+ ops_body='[[migration.ops]]\nkind = "rename_table_key"\ntable_path = []\nkey = "setup"\nnew_key = "onboarding"\n',)config_dir = tmp_path / "config"config_dir.mkdir()stale = config_dir / "pipelex_service.toml"- stale.write_text("[terms]\nterms_accepted = true\n", encoding="utf-8")+ stale.write_text("[setup]\ninference_setup_completed = true\n", encoding="utf-8")warning = mocker.patch("pipelex.system.pipelex_service.pipelex_service_config.log.warning")config = load_pipelex_service_config_if_exists(config_dir=config_dir)assert config is not None- assert config.agreement.terms_accepted is True- assert stale.read_bytes() == b"[terms]\nterms_accepted = true\n", "a tolerated boot writes nothing"+ assert config.onboarding.inference_setup_completed is True+ assert stale.read_bytes() == b"[setup]\ninference_setup_completed = true\n", "a tolerated boot writes nothing"assert "pipelex migrate" in warning.call_args.args[0]@pytest.mark.usefixtures("synthetic_migration_dir")diff --git a/tests/unit/pipelex/system/pipelex_service/test_gateway_terms_check.py b/tests/unit/pipelex/system/pipelex_service/test_gateway_terms_check.pydeleted file mode 100644index 83e44abdd..000000000--- a/tests/unit/pipelex/system/pipelex_service/test_gateway_terms_check.py+++ /dev/null@@ -1,113 +0,0 @@-"""Regression tests for gateway terms check and first-run inference setup check.--Commands like ``pipelex-agent validate bundle`` use ``needs_inference=False, needs_model_specs=True``-to load model specs for validation without actually calling inference APIs. These commands must-NOT require gateway terms acceptance.--The first-run check (InferenceSetupRequiredError) fires when no service config exists at all,-while the gateway terms check (GatewayTermsNotAcceptedError) fires when the config exists-and inference setup is completed but terms have not been accepted.-"""--from __future__ import annotations--from typing import TYPE_CHECKING--import pytest--from pipelex.cogt.model_backends.backend import LEGACY_GATEWAY_MODEL_SPECS_SECTION, PipelexBackend-from pipelex.pipelex import Pipelex-from pipelex.system.pipelex_service.exceptions import GatewayTermsNotAcceptedError, InferenceSetupRequiredError-from pipelex.system.pipelex_service.pipelex_service_agreement import PipelexServiceAgreement, PipelexServiceOnboarding-from pipelex.system.pipelex_service.pipelex_service_config import PipelexServiceConfig-from pipelex.system.runtime import IntegrationMode--if TYPE_CHECKING:- from pytest_mock import MockerFixture--RUNTIME_BOOT_MODULE = "pipelex.runtime_boot"---class TestGatewayTermsCheck:- """Verify that the terms check and first-run check in Pipelex.setup() behave correctly."""-- @pytest.fixture- def _gateway_enabled_no_config(self, mocker: MockerFixture) -> None:- """Configure mocks: gateway is enabled but no service config exists (first run)."""- mocker.patch(- f"{RUNTIME_BOOT_MODULE}.enabled_managed_gateway_sections",- return_value={PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION},- )- mocker.patch(f"{RUNTIME_BOOT_MODULE}.load_pipelex_service_config_if_exists", return_value=None)-- @pytest.fixture- def _gateway_enabled_setup_done_terms_not_accepted(self, mocker: MockerFixture) -> None:- """Configure mocks: gateway enabled, inference setup completed, but terms NOT accepted."""- config = PipelexServiceConfig(- agreement=PipelexServiceAgreement(terms_accepted=False),- onboarding=PipelexServiceOnboarding(inference_setup_completed=True),- )- mocker.patch(- f"{RUNTIME_BOOT_MODULE}.enabled_managed_gateway_sections",- return_value={PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION},- )- mocker.patch(f"{RUNTIME_BOOT_MODULE}.load_pipelex_service_config_if_exists", return_value=config)-- @pytest.mark.usefixtures("_gateway_enabled_no_config")- def test_first_run_raises_inference_setup_required(self) -> None:- """With no service config at all, setup must raise InferenceSetupRequiredError."""- pipelex_instance = Pipelex.__new__(Pipelex)-- with pytest.raises(InferenceSetupRequiredError):- pipelex_instance.setup(- integration_mode=IntegrationMode.CLI,- needs_inference=True,- needs_model_specs=True,- )-- @pytest.mark.usefixtures("_gateway_enabled_setup_done_terms_not_accepted")- def test_needs_inference_true_raises_when_terms_not_accepted(self) -> None:- """With inference setup done but terms not accepted, setup must raise GatewayTermsNotAcceptedError."""- pipelex_instance = Pipelex.__new__(Pipelex)-- with pytest.raises(GatewayTermsNotAcceptedError):- pipelex_instance.setup(- integration_mode=IntegrationMode.CLI,- needs_inference=True,- needs_model_specs=True,- )-- @pytest.mark.usefixtures("_gateway_enabled_no_config")- def test_needs_inference_false_does_not_raise_when_terms_not_accepted(- self,- mocker: MockerFixture,- ) -> None:- """With needs_inference=False and needs_model_specs=True, setup must NOT raise terms/setup errors.-- It may fail later (e.g., during remote config fetch), but the terms check itself must be skipped.- """- # Mock the remote config fetch so we don't hit the network- mock_remote_config = mocker.MagicMock()- mock_remote_config.backend_model_specs = {}- mock_remote_config.aws_region = "us-east-1"- mock_result = mocker.MagicMock()- mock_result.config = mock_remote_config- mock_result.source = "fresh"- mocker.patch(f"{RUNTIME_BOOT_MODULE}.RemoteConfigFetcher.fetch_remote_config", return_value=mock_result)-- pipelex_instance = Pipelex.__new__(Pipelex)-- # setup() will fail somewhere after the gateway check (telemetry, models, etc.)- # but it must NOT fail with GatewayTermsNotAcceptedError or InferenceSetupRequiredError- try:- pipelex_instance.setup(- integration_mode=IntegrationMode.CLI,- needs_inference=False,- needs_model_specs=True,- )- except (GatewayTermsNotAcceptedError, InferenceSetupRequiredError):- pytest.fail("setup() raised a terms/setup error even though needs_inference=False")- except Exception: # ruff: ignore[try-except-pass]- # Expected: setup() will fail later in the init chain (telemetry, models, etc.)- # We only care that it did NOT fail with terms/setup errors- passdiff --git a/tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py b/tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.pyindex aea97f924..c392f9560 100644--- a/tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py+++ b/tests/unit/pipelex/system/pipelex_service/test_managed_gateway_backends.py@@ -10,9 +10,6 @@ is what declares it one.input;- `build_managed_gateway_configs` cuts the single fetched artifact into one configuration permanaged backend, keeping them apart rather than merging them.--And the narrower question `is_pipelex_gateway_enabled` answers, which is not a special case of the-broad one and must not be folded into it — the last class here is why."""from __future__ import annotations@@ -22,34 +19,33 @@ from typing import TYPE_CHECKINGimport pytestfrom pipelex.cogt.model_backends.backend import (- LEGACY_GATEWAY_MODEL_SPECS_SECTION,MANIFOLD_MODEL_SPECS_SECTION,PipelexBackend,resolve_model_specs_section,)from pipelex.system.pipelex_service.managed_gateway_configs import build_managed_gateway_configs-from pipelex.system.pipelex_service.pipelex_service_config import enabled_managed_gateway_sections, is_pipelex_gateway_enabled-from pipelex.system.pipelex_service.remote_config import PipelexPosthogConfig, RemoteConfig+from pipelex.system.pipelex_service.pipelex_service_config import enabled_managed_gateway_sections+from pipelex.system.pipelex_service.remote_config import RemoteConfigif TYPE_CHECKING:from pathlib import Pathfrom pytest_mock import MockerFixture+# A second managed section, standing in for the next managed service the kit could ship.+OTHER_SECTION = "other_model_specs"+OTHER_BACKEND = "pipelex_other"+def _remote_config(**sections: object) -> RemoteConfig:"""The published artifact, carrying whichever model-specs sections a test hands it."""- return RemoteConfig(- posthog=PipelexPosthogConfig(project_api_key="", endpoint="https://dummy.example.com", is_geoip_enabled=False, is_debug_enabled=False),- aws_region="eu-west-3",- **sections, # pyright: ignore[reportArgumentType]- )+ return RemoteConfig(**sections) # pyright: ignore[reportArgumentType]def _write_backends(tmp_path: Path, body: str) -> Path:"""Write the base document at a config dir and return that dir, which is what the readers take.- Both readers below take a `config_dir` and resolve the document under it — the base+ The reader below takes a `config_dir` and resolves the document under it — the base`inference/backends.toml` plus any `inference/backends_override.toml` — so a test pins adirectory rather than a file."""@@ -63,15 +59,10 @@ class TestResolveModelSpecsSection:def test_a_declared_section_makes_a_backend_managed(self) -> None:assert resolve_model_specs_section(backend_name="whatever", declared_section="some_section") == "some_section"- def test_the_legacy_gateway_resolves_to_its_section_without_declaring_one(self) -> None:- """`backends.toml` is the user's own file, written before the field existed and never rewritten."""- assert resolve_model_specs_section(backend_name=PipelexBackend.GATEWAY, declared_section=None) == LEGACY_GATEWAY_MODEL_SPECS_SECTION-- def test_an_explicit_declaration_wins_even_on_that_name(self) -> None:- assert resolve_model_specs_section(backend_name=PipelexBackend.GATEWAY, declared_section="elsewhere") == "elsewhere"-- def test_every_other_backend_reads_its_own_file(self) -> None:- """No section means not managed, which is every BYOK backend and the internal one."""+ def test_every_backend_without_a_declaration_reads_its_own_file(self) -> None:+ """No section means not managed, which is every BYOK backend and the internal one — and no+ name resolves to a section it did not declare, the manifold's included.+ """assert resolve_model_specs_section(backend_name="anthropic", declared_section=None) is Noneassert resolve_model_specs_section(backend_name=PipelexBackend.MANIFOLD, declared_section=None) is None@@ -80,23 +71,43 @@ class TestEnabledManagedGatewaySections:def test_it_maps_each_enabled_managed_backend_to_its_section(self, tmp_path: Path) -> None:config_dir = _write_backends(tmp_path,- f'[pipelex_gateway]\napi_key = "pk-x"\n\n'f'[pipelex_manifold]\nmodel_specs_section = "{MANIFOLD_MODEL_SPECS_SECTION}"\nendpoint = "https://gw.example.com"\n\n'+ f'[{OTHER_BACKEND}]\nmodel_specs_section = "{OTHER_SECTION}"\n\n'f'[anthropic]\napi_key = "sk-x"\n',)assert enabled_managed_gateway_sections(config_dir=config_dir) == {- PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION,PipelexBackend.MANIFOLD: MANIFOLD_MODEL_SPECS_SECTION,+ OTHER_BACKEND: OTHER_SECTION,}@pytest.mark.parametrize("enabled_value", ["false", "0"])def test_a_disabled_backend_is_absent_reading_enabled_the_way_the_loader_does(self, tmp_path: Path, enabled_value: str) -> None:"""Truthiness, not the literal `true` — the same reading the backend library applies."""- config_dir = _write_backends(tmp_path, f'[pipelex_gateway]\nenabled = {enabled_value}\napi_key = "pk-x"\n')+ config_dir = _write_backends(+ tmp_path, f'[pipelex_manifold]\nenabled = {enabled_value}\nmodel_specs_section = "{MANIFOLD_MODEL_SPECS_SECTION}"\n'+ )assert enabled_managed_gateway_sections(config_dir=config_dir) == {}+ @pytest.mark.parametrize("enabled_value", ["1", '"yes"'])+ def test_an_enabled_value_the_loader_reads_as_true_is_enabled_here_too(self, tmp_path: Path, enabled_value: str) -> None:+ """The two readers of `backends.toml` must agree, or the boot fetches no specs for a backend+ the loader then insists is enabled.+ """+ config_dir = _write_backends(+ tmp_path, f'[pipelex_manifold]\nenabled = {enabled_value}\nmodel_specs_section = "{MANIFOLD_MODEL_SPECS_SECTION}"\n'+ )++ assert enabled_managed_gateway_sections(config_dir=config_dir) == {PipelexBackend.MANIFOLD: MANIFOLD_MODEL_SPECS_SECTION}++ def test_the_override_is_read_over_the_base(self, tmp_path: Path) -> None:+ """The personal override is the loader's document too, so the gate must see it."""+ config_dir = _write_backends(tmp_path, f'[pipelex_manifold]\nenabled = false\nmodel_specs_section = "{MANIFOLD_MODEL_SPECS_SECTION}"\n')+ (config_dir / "inference" / "backends_override.toml").write_text("[pipelex_manifold]\nenabled = true\n", encoding="utf-8")++ assert enabled_managed_gateway_sections(config_dir=config_dir) == {PipelexBackend.MANIFOLD: MANIFOLD_MODEL_SPECS_SECTION}+def test_a_byok_backend_is_never_managed(self, tmp_path: Path) -> None:config_dir = _write_backends(tmp_path, '[anthropic]\napi_key = "sk-x"\n\n[openai]\napi_key = "sk-y"\n')@@ -105,41 +116,15 @@ class TestEnabledManagedGatewaySections:def test_a_missing_file_is_no_managed_backends_rather_than_a_refusal(self, tmp_path: Path) -> None:assert enabled_managed_gateway_sections(config_dir=tmp_path / "absent") == {}--class TestTheTwoQuestionsAreNotTheSameQuestion:- """Which managed backends are live, and whether the *legacy gateway* is — the boot asks both.-- They came apart the moment a second managed backend existed, and the boot line that must keep- asking the narrow one is the telemetry decision: the distinct id is derived from- `PIPELEX_GATEWAY_API_KEY`, which a manifold-only installation has no reason to hold. Asked the- broad way, such an installation is required to produce a gateway key it does not have and fails- to boot on `GatewayApiKeyMissingError` — a refusal with nothing in it naming manifold.-- The beta's own key cannot stand in either, and that is the second half of the verdict: for the- private beta it is one token shared by every participant, so keying on it would report a single- indistinguishable user rather than an identity.- """-- def test_a_manifold_only_installation_is_managed_but_is_not_the_gateway(self, tmp_path: Path) -> None:- config_dir = _write_backends(- tmp_path,- f"[pipelex_gateway]\nenabled = false\n\n"- f'[pipelex_manifold]\nmodel_specs_section = "{MANIFOLD_MODEL_SPECS_SECTION}"\nendpoint = "https://mf.example.com"\n',+ def test_an_override_cannot_stand_in_for_the_base(self, tmp_path: Path) -> None:+ """No document, no managed backend."""+ inference_dir = tmp_path / "inference"+ inference_dir.mkdir(parents=True)+ (inference_dir / "backends_override.toml").write_text(+ f'[pipelex_manifold]\nenabled = true\nmodel_specs_section = "{MANIFOLD_MODEL_SPECS_SECTION}"\n', encoding="utf-8")- assert enabled_managed_gateway_sections(config_dir=config_dir) == {PipelexBackend.MANIFOLD: MANIFOLD_MODEL_SPECS_SECTION}- assert not is_pipelex_gateway_enabled(config_dir=config_dir)-- def test_the_common_beta_case_keeps_both(self, tmp_path: Path) -> None:- """A participant who leaves the legacy gateway on has a real key, and manifold runs ride on it."""- config_dir = _write_backends(- tmp_path,- f'[pipelex_gateway]\napi_key = "pk-x"\n\n'- f'[pipelex_manifold]\nmodel_specs_section = "{MANIFOLD_MODEL_SPECS_SECTION}"\nendpoint = "https://mf.example.com"\n',- )-- assert set(enabled_managed_gateway_sections(config_dir=config_dir)) == {PipelexBackend.GATEWAY, PipelexBackend.MANIFOLD}- assert is_pipelex_gateway_enabled(config_dir=config_dir)+ assert enabled_managed_gateway_sections(config_dir=tmp_path) == {}class TestBuildManagedGatewayConfigs:@@ -147,7 +132,7 @@ class TestBuildManagedGatewayConfigs:"""Two services, two spec maps: a handle one serves and the other does not is legitimate."""remote_config = _remote_config(**{- LEGACY_GATEWAY_MODEL_SPECS_SECTION: {"gpt-5": {"model_id": "gpt-5"}},+ OTHER_SECTION: {"gpt-5": {"model_id": "gpt-5"}},MANIFOLD_MODEL_SPECS_SECTION: {"claude-4-sonnet": {"model_id": "claude-4-sonnet"}},})@@ -155,31 +140,15 @@ class TestBuildManagedGatewayConfigs:configs = build_managed_gateway_configs(remote_config=remote_config,managed_gateway_sections={- PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION,+ OTHER_BACKEND: OTHER_SECTION,PipelexBackend.MANIFOLD: MANIFOLD_MODEL_SPECS_SECTION,},)- assert set(configs) == {PipelexBackend.GATEWAY, PipelexBackend.MANIFOLD}- assert set(configs[PipelexBackend.GATEWAY].model_specs) == {"gpt-5"}+ assert set(configs) == {OTHER_BACKEND, PipelexBackend.MANIFOLD}+ assert set(configs[OTHER_BACKEND].model_specs) == {"gpt-5"}assert set(configs[PipelexBackend.MANIFOLD].model_specs) == {"claude-4-sonnet"}- def test_the_region_belongs_to_the_legacy_slice_alone(self) -> None:- """`aws_region` is a top-level key of the artifact, and only the direct-SDK Bedrock path reads it back."""- empty_sections: dict[str, dict[str, object]] = {LEGACY_GATEWAY_MODEL_SPECS_SECTION: {}, MANIFOLD_MODEL_SPECS_SECTION: {}}- remote_config = _remote_config(**empty_sections)-- configs = build_managed_gateway_configs(- remote_config=remote_config,- managed_gateway_sections={- PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION,- PipelexBackend.MANIFOLD: MANIFOLD_MODEL_SPECS_SECTION,- },- )-- assert configs[PipelexBackend.GATEWAY].aws_region == "eu-west-3"- assert configs[PipelexBackend.MANIFOLD].aws_region is None-def test_a_section_the_artifact_does_not_carry_is_disabled_by_name(self, mocker: MockerFixture) -> None:"""Disabled with a named warning, not fatal: the kit can ship a managed backend declared.@@ -188,17 +157,17 @@ class TestBuildManagedGatewayConfigs:disabled and has nowhere to go."""warning = mocker.patch("pipelex.system.pipelex_service.managed_gateway_configs.log.warning")- remote_config = _remote_config(**{LEGACY_GATEWAY_MODEL_SPECS_SECTION: {"gpt-5": {"model_id": "gpt-5"}}})+ remote_config = _remote_config(**{OTHER_SECTION: {"gpt-5": {"model_id": "gpt-5"}}})configs = build_managed_gateway_configs(remote_config=remote_config,managed_gateway_sections={- PipelexBackend.GATEWAY: LEGACY_GATEWAY_MODEL_SPECS_SECTION,+ OTHER_BACKEND: OTHER_SECTION,PipelexBackend.MANIFOLD: MANIFOLD_MODEL_SPECS_SECTION,},)- assert set(configs) == {PipelexBackend.GATEWAY}+ assert set(configs) == {OTHER_BACKEND}warning.assert_called_once()said = str(warning.call_args.args[0])assert PipelexBackend.MANIFOLD in said@@ -218,7 +187,7 @@ class TestTheSectionLookupIsConfinedToTheArtifact:def test_a_published_section_is_found(self) -> None:sections: dict[str, dict[str, object]] = {- LEGACY_GATEWAY_MODEL_SPECS_SECTION: {},+ OTHER_SECTION: {},MANIFOLD_MODEL_SPECS_SECTION: {"claude-4-sonnet": {"model_id": "claude-4-sonnet"}},}remote_config = _remote_config(**sections)@@ -228,36 +197,26 @@ class TestTheSectionLookupIsConfinedToTheArtifact:assert section is not Noneassert set(section) == {"claude-4-sonnet"}- def test_the_legacy_declared_field_is_found_too(self) -> None:- """It is a declared field rather than an extra, and both halves of the lookup must work."""- remote_config = _remote_config(**{LEGACY_GATEWAY_MODEL_SPECS_SECTION: {"gpt-5": {"model_id": "gpt-5"}}})-- section = remote_config.get_model_specs_section(LEGACY_GATEWAY_MODEL_SPECS_SECTION)-- assert section is not None- assert set(section) == {"gpt-5"}-@pytest.mark.parametrize("attribute_name", ["model_config", "model_fields"])def test_a_pydantic_internal_is_not_a_section(self, attribute_name: str) -> None:"""Both are real dict attributes of any v2 model, and neither is anything the service published."""- legacy_only: dict[str, dict[str, object]] = {LEGACY_GATEWAY_MODEL_SPECS_SECTION: {}}- remote_config = _remote_config(**legacy_only)+ manifold_only: dict[str, dict[str, object]] = {MANIFOLD_MODEL_SPECS_SECTION: {}}+ remote_config = _remote_config(**manifold_only)# Read off the class: instance access to `model_fields` is deprecated in pydantic v2.11,# and the point being made is about the attribute existing as a dict at all.assert isinstance(getattr(RemoteConfig, attribute_name), dict)assert remote_config.get_model_specs_section(attribute_name) is None- def test_a_declared_field_that_is_not_a_spec_map_is_not_a_section(self) -> None:- """`posthog` and `aws_region` are the artifact's own content but the wrong shape."""- legacy_only: dict[str, dict[str, object]] = {LEGACY_GATEWAY_MODEL_SPECS_SECTION: {}}- remote_config = _remote_config(**legacy_only)+ def test_a_published_key_that_is_not_a_spec_map_is_not_a_section(self) -> None:+ """The artifact carries keys for other consumers too, and one of the wrong shape is not a section."""+ sections: dict[str, object] = {MANIFOLD_MODEL_SPECS_SECTION: {}, "aws_region": "eu-west-3"}+ remote_config = _remote_config(**sections)- assert remote_config.get_model_specs_section("posthog") is Noneassert remote_config.get_model_specs_section("aws_region") is Nonedef test_an_unknown_name_is_simply_absent(self) -> None:- legacy_only: dict[str, dict[str, object]] = {LEGACY_GATEWAY_MODEL_SPECS_SECTION: {}}- remote_config = _remote_config(**legacy_only)+ manifold_only: dict[str, dict[str, object]] = {MANIFOLD_MODEL_SPECS_SECTION: {}}+ remote_config = _remote_config(**manifold_only)assert remote_config.get_model_specs_section("no_such_section") is Nonediff --git a/tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py b/tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.pyindex df6e19371..46e09b43a 100644--- a/tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py+++ b/tests/unit/pipelex/system/pipelex_service/test_pipelex_service_config.py@@ -1,126 +1,26 @@"""Unit tests for PipelexServiceConfig."""-import osimport pathlibimport tempfile-from pathlib import Path-import pytest--from pipelex.cogt.exceptions import InferenceBackendLibraryValidationErrorfrom pipelex.system.pipelex_service.pipelex_service_config import (PIPELEX_SERVICE_CONFIG_FILE_NAME,- PipelexServiceAgreement,PipelexServiceConfig,- is_pipelex_gateway_enabled,load_pipelex_service_config_if_exists,)+from pipelex.system.pipelex_service.pipelex_service_onboarding import PipelexServiceOnboardingclass TestPipelexServiceConfig:"""Tests for PipelexServiceConfig and related functions."""- def _write_backends(self, config_dir: Path, *, base: str, override: str | None = None) -> None:- inference_dir = config_dir / "inference"- inference_dir.mkdir(parents=True, exist_ok=True)- (inference_dir / "backends.toml").write_text(base, encoding="utf-8")- if override is not None:- (inference_dir / "backends_override.toml").write_text(override, encoding="utf-8")-- @pytest.mark.parametrize(- ("enabled_value", "expected"),- [- ("true", True),- ("false", False),- # Not booleans, and exactly what the loader also treats as truthy — the two readers of- # `backends.toml` must agree, or the boot fetches no gateway specs for a backend the- # loader then insists is enabled.- ("1", True),- ("0", False),- ('"yes"', True),- ],- )- def test_is_pipelex_gateway_enabled_reads_enabled_the_way_the_loader_does(self, tmp_path: Path, enabled_value: str, expected: bool) -> None:- """A `pipelex_gateway` table with a non-boolean `enabled` is enabled iff the loader would load it.-- `InferenceBackendLibrary.load` gates on the raw value's truthiness before it validates- anything, and `RuntimeBoot` decides whether to fetch the gateway's model specs from *this*- function over the same file. Reading `enabled` as "is the literal `true`" here left `enabled = 1`- in a state the loader could not name: enabled with no specs, so refused as *"remote model specs- were not provided"* on a strict boot, and silently dropped from the deck on a lenient one.- """- self._write_backends(tmp_path, base=f'[pipelex_gateway]\nenabled = {enabled_value}\napi_key = "x"\n')-- assert is_pipelex_gateway_enabled(config_dir=tmp_path) is expected-- def test_is_pipelex_gateway_enabled_defaults_to_enabled_when_the_key_is_absent(self, tmp_path: Path) -> None:- """No `enabled` key means enabled — the loader's default too."""- self._write_backends(tmp_path, base='[pipelex_gateway]\napi_key = "x"\n')-- assert is_pipelex_gateway_enabled(config_dir=tmp_path) is True-- def test_is_pipelex_gateway_enabled_is_false_without_a_gateway_table(self, tmp_path: Path) -> None:- self._write_backends(tmp_path, base='[openai]\napi_key = "x"\n')-- assert is_pipelex_gateway_enabled(config_dir=tmp_path) is False-- def test_is_pipelex_gateway_enabled_is_false_without_a_base_file(self, tmp_path: Path) -> None:- """An override cannot stand in for the base: no document, no gateway."""- inference_dir = tmp_path / "inference"- inference_dir.mkdir(parents=True)- (inference_dir / "backends_override.toml").write_text("[pipelex_gateway]\nenabled = true\n", encoding="utf-8")-- assert is_pipelex_gateway_enabled(config_dir=tmp_path) is False-- @pytest.mark.parametrize(- ("base_enabled", "override_enabled", "expected"),- [- ("true", "false", False),- ("false", "true", True),- # The override is read with the same truthiness as the base.- ("false", "1", True),- ("true", "0", False),- ],- )- def test_is_pipelex_gateway_enabled_reads_the_override_over_the_base(- self, tmp_path: Path, base_enabled: str, override_enabled: str, expected: bool- ) -> None:- """The personal override is the loader's document too, so the gate must see it."""- self._write_backends(- tmp_path,- base=f'[pipelex_gateway]\nenabled = {base_enabled}\napi_key = "x"\n',- override=f"[pipelex_gateway]\nenabled = {override_enabled}\n",- )-- assert is_pipelex_gateway_enabled(config_dir=tmp_path) is expected-- def test_is_pipelex_gateway_enabled_refuses_an_override_that_does_not_parse_with_the_librarys_class(self, tmp_path: Path) -> None:- """A parse error must reach the boot as the library's refusal, which names the file, not as a raw `TomlError`."""- inference_dir = tmp_path / "inference"- inference_dir.mkdir()- (inference_dir / "backends.toml").write_text("[pipelex_gateway]\nenabled = true\n")- override_path = inference_dir / "backends_override.toml"- override_path.write_text("[pipelex_gateway\nenabled = false\n")-- with pytest.raises(InferenceBackendLibraryValidationError) as refused:- is_pipelex_gateway_enabled(config_dir=tmp_path)-- assert str(override_path) in str(refused.value)-- def test_gateway_config_default_terms_not_accepted(self) -> None:- """Test that gateway terms_accepted defaults to False."""- config = PipelexServiceAgreement()- assert config.terms_accepted is False-- def test_gateway_config_terms_accepted(self) -> None:- """Test gateway config with terms_accepted = True."""- config = PipelexServiceAgreement(terms_accepted=True)- assert config.terms_accepted is True+ def test_onboarding_defaults_to_not_completed(self) -> None:+ config = PipelexServiceOnboarding()+ assert config.inference_setup_completed is False- def test_pipelex_service_config_with_gateway(self) -> None:- """Test PipelexServiceConfig with custom gateway config."""- config = PipelexServiceConfig(agreement=PipelexServiceAgreement(terms_accepted=True))- assert config.agreement.terms_accepted is True+ def test_pipelex_service_config_with_onboarding(self) -> None:+ config = PipelexServiceConfig(onboarding=PipelexServiceOnboarding(inference_setup_completed=True))+ assert config.onboarding.inference_setup_completed is Truedef test_load_pipelex_service_config_if_exists_returns_none(self) -> None:"""Test load_pipelex_service_config_if_exists returns None when file doesn't exist."""@@ -131,12 +31,12 @@ class TestPipelexServiceConfig:def test_load_pipelex_service_config_if_exists_returns_config(self) -> None:"""Test load_pipelex_service_config_if_exists returns config when file exists."""with tempfile.TemporaryDirectory() as temp_dir:- config_content = """[agreement]-terms_accepted = false+ config_content = """[onboarding]+inference_setup_completed = false"""- config_path = os.path.join(temp_dir, PIPELEX_SERVICE_CONFIG_FILE_NAME)- pathlib.Path(config_path).write_text(config_content, encoding="utf-8")+ config_path = pathlib.Path(temp_dir) / PIPELEX_SERVICE_CONFIG_FILE_NAME+ config_path.write_text(config_content, encoding="utf-8")config = load_pipelex_service_config_if_exists(config_dir=pathlib.Path(temp_dir))assert config is not None- assert config.agreement.terms_accepted is False+ assert config.onboarding.inference_setup_completed is Falsediff --git a/tests/unit/pipelex/system/pipelex_service/test_remote_config.py b/tests/unit/pipelex/system/pipelex_service/test_remote_config.pyindex add566d7a..f8909579f 100644--- a/tests/unit/pipelex/system/pipelex_service/test_remote_config.py+++ b/tests/unit/pipelex/system/pipelex_service/test_remote_config.py@@ -1,49 +1,34 @@-import pytest-from pydantic import ValidationError+from typing import Any+from pipelex.cogt.model_backends.backend import MANIFOLD_MODEL_SPECS_SECTIONfrom pipelex.system.pipelex_service.remote_config import RemoteConfigclass TestRemoteConfig:- """Tests for GatewayRemoteConfig model."""+ """Tests for the RemoteConfig model."""- def test_remote_config_valid(self) -> None:- """Test creating a valid GatewayRemoteConfig."""- payload = {- "backend_model_specs": {- "defaults": {"sdk": "gateway_completions"},+ def test_remote_config_carries_its_sections_as_extras(self) -> None:+ """The artifact declares no field of its own: every section arrives through `extra="allow"`."""+ payload: dict[str, Any] = {+ MANIFOLD_MODEL_SPECS_SECTION: {+ "defaults": {"sdk": "manifold_completions"},"gpt-4o": {"model_id": "gpt-4o-2024-11-20"},},- "posthog": {- "project_api_key": "test-project-api-key",- "endpoint": "https://test-endpoint.com",- "is_geoip_enabled": True,- "is_debug_enabled": False,- },"aws_region": "us-east-1",}config = RemoteConfig.model_validate(payload)- assert "defaults" in config.backend_model_specs- assert "gpt-4o" in config.backend_model_specs- assert config.aws_region == "us-east-1"+ section = config.get_model_specs_section(MANIFOLD_MODEL_SPECS_SECTION)+ assert section is not None+ assert "defaults" in section+ assert "gpt-4o" in section- def test_remote_config_missing_backend_fails(self) -> None:- """Test that missing backend key raises validation error."""- payload = {"other_key": "value"}- with pytest.raises(ValidationError):- RemoteConfig.model_validate(payload)+ def test_remote_config_tolerates_keys_it_does_not_read(self) -> None:+ """The artifact is shared with other consumers, so a key the runtime never asks for is not a refusal."""+ payload: dict[str, Any] = {"other_key": "value"}+ config = RemoteConfig.model_validate(payload)+ assert config.get_model_specs_section(MANIFOLD_MODEL_SPECS_SECTION) is None- def test_remote_config_empty_backend(self) -> None:- """Test GatewayRemoteConfig with empty backend dict."""- payload = {- "backend_model_specs": {},- "posthog": {- "project_api_key": "test-project-api-key",- "endpoint": "https://test-endpoint.com",- "is_geoip_enabled": True,- "is_debug_enabled": False,- },- "aws_region": "us-east-1",- }+ def test_remote_config_empty_section(self) -> None:+ payload: dict[str, Any] = {MANIFOLD_MODEL_SPECS_SECTION: {}}config = RemoteConfig.model_validate(payload)- assert config.backend_model_specs == {}+ assert config.get_model_specs_section(MANIFOLD_MODEL_SPECS_SECTION) == {}diff --git a/tests/unit/pipelex/system/pipelex_service/test_remote_config_cache.py b/tests/unit/pipelex/system/pipelex_service/test_remote_config_cache.pyindex 1d93fd682..335041667 100644--- a/tests/unit/pipelex/system/pipelex_service/test_remote_config_cache.py+++ b/tests/unit/pipelex/system/pipelex_service/test_remote_config_cache.py@@ -14,6 +14,7 @@ from typing import TYPE_CHECKINGimport pytest+from pipelex.cogt.model_backends.backend import MANIFOLD_MODEL_SPECS_SECTIONfrom pipelex.system.configuration.config_loader import ConfigLoaderfrom pipelex.system.pipelex_service.remote_config import RemoteConfigfrom pipelex.system.pipelex_service.remote_config_cache import (@@ -29,13 +30,7 @@ if TYPE_CHECKING:def _valid_remote_config_payload(extra: dict[str, object] | None = None) -> dict[str, object]:"""Build a minimal remote-config dict that ``RemoteConfig.model_validate`` accepts."""payload: dict[str, object] = {- "posthog": {- "project_api_key": "test-key",- "endpoint": "https://posthog.example.com",- "is_geoip_enabled": False,- "is_debug_enabled": False,- },- "backend_model_specs": {},+ MANIFOLD_MODEL_SPECS_SECTION: {},"aws_region": "eu-west-3",}if extra is not None:@@ -76,7 +71,7 @@ class TestRemoteConfigCache:# to_remote_config() must produce a valid RemoteConfigremote_config = loaded.to_remote_config()assert isinstance(remote_config, RemoteConfig)- assert remote_config.aws_region == "eu-west-3"+ assert remote_config.get_model_specs_section(MANIFOLD_MODEL_SPECS_SECTION) == {}@pytest.mark.usefixtures("isolated_cache_dir")def test_read_missing_returns_none(self) -> None:@@ -155,5 +150,5 @@ class TestRemoteConfigCache:assert loaded.raw_config["unknown_future_key"] == {"hello": "world"}remote_config = loaded.to_remote_config()- # Pydantic ``extra="allow"`` keeps unknown fields accessible via model_extra- assert remote_config.model_extra == {"unknown_future_key": {"hello": "world"}}+ # ``RemoteConfig`` declares no field, so ``extra="allow"`` keeps the whole payload in model_extra+ assert remote_config.model_extra == payloaddiff --git a/tests/unit/pipelex/system/telemetry/test_exception_capture_identity.py b/tests/unit/pipelex/system/telemetry/test_exception_capture_identity.pyindex 9065cfac8..b66027215 100644--- a/tests/unit/pipelex/system/telemetry/test_exception_capture_identity.py+++ b/tests/unit/pipelex/system/telemetry/test_exception_capture_identity.py@@ -27,7 +27,7 @@ from posthog import Posthogfrom pytest_mock import MockerFixturefrom pipelex.system.caller_identity import CallerIdentity, scoped_caller_identity, stamp_caller_identity-from pipelex.system.telemetry.exception_capture import DualClientExceptionCapture+from pipelex.system.telemetry.exception_capture import ExceptionCapturefrom pipelex.system.telemetry.otel_constants import PostHogAttrfrom pipelex.system.telemetry.telemetry_config import PostHogConfig, PostHogMode, TelemetryConfigfrom pipelex.system.telemetry.telemetry_manager import TelemetryManager@@ -48,31 +48,27 @@ def _make_capture(mocker: MockerFixture,mode: PostHogMode,configured_user_id: str | None,- pipelex_distinct_id: str | None = None,-) -> tuple[DualClientExceptionCapture, Any, Any]:+) -> tuple[ExceptionCapture, Any]:"""Resolve the capture the constructor would have built, over stub clients."""manager = TelemetryManager.__new__(TelemetryManager)manager.telemetry_config = TelemetryConfig(custom_posthog=PostHogConfig(mode=mode, user_id=configured_user_id, api_key="phc_test"),)custom_client = mocker.MagicMock(spec=Posthog)- pipelex_client = mocker.MagicMock(spec=Posthog) if pipelex_distinct_id else Nonemanager.custom_posthog_client = custom_client- manager.pipelex_posthog_client = pipelex_client- manager._pipelex_distinct_id = pipelex_distinct_id # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]capture = manager._make_exception_capture() # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]- return capture, custom_client, pipelex_client+ return capture, custom_client-def _crash(*, capture: DualClientExceptionCapture) -> None:+def _crash(*, capture: ExceptionCapture) -> None:capture._capture_exception((ValueError, ValueError("boom"), None)) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]_CALLER = CallerIdentity(user_id="caller-7", extras={"organization": "org_caller"})-def _crash_with(*, capture: DualClientExceptionCapture, error: BaseException) -> None:+def _crash_with(*, capture: ExceptionCapture, error: BaseException) -> None:capture._capture_exception((type(error), error, None)) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]@@ -95,7 +91,7 @@ class TestExceptionCaptureIdentity:validator requires one only for `identified` and never forbids one under`anonymous`, so a stale id after a mode switch is the reachable state."""- capture, custom_client, _ = _make_capture(+ capture, custom_client = _make_capture(mocker=mocker,mode=PostHogMode.ANONYMOUS,configured_user_id="configured-id",@@ -109,7 +105,7 @@ class TestExceptionCaptureIdentity:def test_an_identified_stream_captures_an_exception_under_the_configured_id(self, mocker: MockerFixture) -> None:"""An exception belongs to no run, so the operator's stream reports it under the fallback."""- capture, custom_client, _ = _make_capture(+ capture, custom_client = _make_capture(mocker=mocker,mode=PostHogMode.IDENTIFIED,configured_user_id="configured-id",@@ -119,37 +115,9 @@ class TestExceptionCaptureIdentity:assert custom_client.capture_exception.call_args.kwargs["distinct_id"] == "configured-id"- def test_the_pipelex_stream_captures_an_exception_under_its_fallback(self, mocker: MockerFixture) -> None:- """No run means no caller and no groups, so the stream's fallback is the person."""- capture, _, pipelex_client = _make_capture(- mocker=mocker,- mode=PostHogMode.IDENTIFIED,- configured_user_id="configured-id",- pipelex_distinct_id="gateway-hash",- )-- _crash(capture=capture)-- capture_kwargs = pipelex_client.capture_exception.call_args.kwargs- assert capture_kwargs["distinct_id"] == "gateway-hash"- assert capture_kwargs["groups"] is None-- def test_the_pipelex_stream_is_unaffected_by_the_operators_anonymous_mode(self, mocker: MockerFixture) -> None:- """The two streams answer to different settings, and anonymity on one is not anonymity on the other."""- capture, _, pipelex_client = _make_capture(- mocker=mocker,- mode=PostHogMode.ANONYMOUS,- configured_user_id="configured-id",- pipelex_distinct_id="gateway-hash",- )-- _crash(capture=capture)-- assert pipelex_client.capture_exception.call_args.kwargs["distinct_id"] == "gateway-hash"-def test_an_exception_carrying_no_value_is_not_captured(self, mocker: MockerFixture) -> None:"""`threading.excepthook` can hand over a null value, and a null exception is not an event."""- capture, custom_client, _ = _make_capture(+ capture, custom_client = _make_capture(mocker=mocker,mode=PostHogMode.IDENTIFIED,configured_user_id="configured-id",@@ -161,7 +129,7 @@ class TestExceptionCaptureIdentity:def test_a_failing_capture_never_reaches_the_app(self, mocker: MockerFixture) -> None:"""Telemetry must not turn one crash into two."""- capture, custom_client, _ = _make_capture(+ capture, custom_client = _make_capture(mocker=mocker,mode=PostHogMode.IDENTIFIED,configured_user_id="configured-id",@@ -172,7 +140,7 @@ class TestExceptionCaptureIdentity:def test_a_crash_inside_a_run_is_attributed_to_the_runs_caller(self, mocker: MockerFixture) -> None:"""The hosted plane's constant must not stand in for a caller the run knew."""- capture, custom_client, _ = _make_capture(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-worker")+ capture, custom_client = _make_capture(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-worker")_crash_with(capture=capture, error=_escaped_from_a_run())@@ -182,7 +150,7 @@ class TestExceptionCaptureIdentity:def test_a_host_error_raised_from_the_runs_error_keeps_the_caller(self, mocker: MockerFixture) -> None:"""A host wraps the run's failure in its own error, and that outer error is what reaches the hook."""- capture, custom_client, _ = _make_capture(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-worker")+ capture, custom_client = _make_capture(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-worker")host_error = RuntimeError("the pipeline failed")host_error.__cause__ = _escaped_from_a_run()@@ -192,7 +160,7 @@ class TestExceptionCaptureIdentity:def test_an_error_raised_while_a_caller_is_in_scope_is_attributed_to_it(self, mocker: MockerFixture) -> None:"""A thread that inherited a caller's context crashes with the scope still open."""- capture, custom_client, _ = _make_capture(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-worker")+ capture, custom_client = _make_capture(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-worker")with scoped_caller_identity(caller_identity=_CALLER):_crash_with(capture=capture, error=ValueError("boom"))@@ -200,7 +168,7 @@ class TestExceptionCaptureIdentity:assert custom_client.capture_exception.call_args.kwargs["distinct_id"] == "caller-7"def test_the_stamp_wins_over_the_caller_in_scope(self, mocker: MockerFixture) -> None:- capture, custom_client, _ = _make_capture(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-worker")+ capture, custom_client = _make_capture(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-worker")error = ValueError("boom")stamp_caller_identity(exception=error, caller_identity=_CALLER)@@ -210,7 +178,7 @@ class TestExceptionCaptureIdentity:assert custom_client.capture_exception.call_args.kwargs["distinct_id"] == "caller-7"def test_an_error_that_belongs_to_no_caller_reports_under_the_fallback(self, mocker: MockerFixture) -> None:- capture, custom_client, _ = _make_capture(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-worker")+ capture, custom_client = _make_capture(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-worker")_crash_with(capture=capture, error=ValueError("boom outside any run"))@@ -219,22 +187,10 @@ class TestExceptionCaptureIdentity:assert capture_kwargs["groups"] is Nonedef test_an_anonymous_stream_identifies_nobody_even_for_a_known_caller(self, mocker: MockerFixture) -> None:- capture, custom_client, _ = _make_capture(mocker=mocker, mode=PostHogMode.ANONYMOUS, configured_user_id="configured-id")+ capture, custom_client = _make_capture(mocker=mocker, mode=PostHogMode.ANONYMOUS, configured_user_id="configured-id")_crash_with(capture=capture, error=_escaped_from_a_run())capture_kwargs = custom_client.capture_exception.call_args.kwargsassert "distinct_id" not in capture_kwargsassert capture_kwargs["properties"][PostHogAttr.PROCESS_PERSON_PROFILE] is False-- def test_the_pipelex_stream_resolves_the_caller_under_its_own_policy(self, mocker: MockerFixture) -> None:- capture, _, pipelex_client = _make_capture(- mocker=mocker,- mode=PostHogMode.IDENTIFIED,- configured_user_id="pipelex-worker",- pipelex_distinct_id="gateway-hash",- )-- _crash_with(capture=capture, error=_escaped_from_a_run())-- assert pipelex_client.capture_exception.call_args.kwargs["distinct_id"] == "caller-7"diff --git a/tests/unit/pipelex/system/telemetry/test_exception_capture_sdk_contract.py b/tests/unit/pipelex/system/telemetry/test_exception_capture_sdk_contract.pyindex afbb5d810..327701c65 100644--- a/tests/unit/pipelex/system/telemetry/test_exception_capture_sdk_contract.py+++ b/tests/unit/pipelex/system/telemetry/test_exception_capture_sdk_contract.py@@ -1,13 +1,12 @@"""Unit tests for what the real PostHog SDK does with the crash this class hands it.-The module beside this one pins the identity each stream resolves, and it does+The module beside this one pins the identity the stream resolves, and it doesso against `MagicMock(spec=Posthog)` — which is the right stub for that question-and a blind one for this. Two defects lived underneath those mocks: the SDK-drops a capture of an error it has already sent, so whichever stream went second-received nothing; and the privacy wrapper redacted a `PipelexError` handed over-bare but not the `(type, value, traceback)` triple an excepthook is given, which-is the only form this path has. A mock answers neither, because neither happens-until the SDK runs.+and a blind one for this. A defect lived underneath those mocks: the privacy+wrapper redacted a `PipelexError` handed over bare but not the+`(type, value, traceback)` triple an excepthook is given, which is the only form+this path has. A mock answers that not at all, because none of it happens until+the SDK runs.So these tests use real `Posthog` clients with only `capture` stubbed — the onecall that would put an event on the wire. Everything above it is the production@@ -26,7 +25,7 @@ from posthog import Posthogfrom pytest_mock import MockerFixturefrom pipelex.system.exceptions import ToolError-from pipelex.system.telemetry.exception_capture import DualClientExceptionCapture+from pipelex.system.telemetry.exception_capture import ExceptionCapturefrom pipelex.system.telemetry.telemetry_config import PostHogConfig, PostHogMode, TelemetryConfigfrom pipelex.system.telemetry.telemetry_manager import TelemetryManager@@ -50,29 +49,26 @@ def _make_stubbed_client(*, mocker: MockerFixture, api_key: str) -> tuple[Posthoreturn client, capture-def _make_dual_capture(*, custom_client: Posthog, pipelex_client: Posthog) -> DualClientExceptionCapture:+def _make_capture(*, custom_client: Posthog) -> ExceptionCapture:"""Assemble the capture the constructor would have built, over the two given clients.The manager is built without its constructor, as in the module beside thisone, because `TelemetryManager.__init__` creates live clients, writes`posthog.default_client` and registers a process-wide singleton. The two- steps under test are its own: wrapping each client for privacy, then- resolving each stream's runless identity.+ steps under test are its own: wrapping the client for privacy, then+ fixing the stream's identity rule."""manager = TelemetryManager.__new__(TelemetryManager)manager.telemetry_config = TelemetryConfig(custom_posthog=PostHogConfig(mode=PostHogMode.IDENTIFIED, user_id="operator-user", api_key="phc_custom"),)manager.custom_posthog_client = custom_client- manager.pipelex_posthog_client = pipelex_client- manager._pipelex_distinct_id = "gateway-hash" # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]manager._wrap_capture_exception(custom_client) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]- manager._wrap_capture_exception(pipelex_client) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]return manager._make_exception_capture() # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]-def _crash(*, capture: DualClientExceptionCapture, error: BaseException) -> None:+def _crash(*, capture: ExceptionCapture, error: BaseException) -> None:"""Hand the capture the triple an excepthook would, which is all it ever receives."""capture._capture_exception((type(error), error, None)) # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]@@ -84,8 +80,8 @@ def _sent_exception_values(*, capture_mock: Any) -> str:@pytest.mark.usefixtures("restore_excepthooks")class TestExceptionCaptureSdkContract:- def test_both_streams_record_one_crash(self, mocker: MockerFixture) -> None:- """Both streams record the crash, which is the whole point of capturing to two.+ def test_the_stream_records_one_crash(self, mocker: MockerFixture) -> None:+ """The crash reaches the operator's stream exactly once.A `PipelexError` is handed to each client as its own redacted stand-in,so the SDK never sees one object twice on this path and its@@ -93,33 +89,27 @@ class TestExceptionCaptureSdkContract:test below, and that is the one the clearing is there for."""custom_client, custom_capture = _make_stubbed_client(mocker=mocker, api_key="phc_custom")- pipelex_client, pipelex_capture = _make_stubbed_client(mocker=mocker, api_key="phc_pipelex")- capture = _make_dual_capture(custom_client=custom_client, pipelex_client=pipelex_client)+ capture = _make_capture(custom_client=custom_client)_crash(capture=capture, error=ToolError(_CONFIDENTIAL_MESSAGE))assert custom_capture.call_count == 1- assert pipelex_capture.call_count == 1- def test_both_streams_record_a_crash_that_is_not_a_pipelex_error(self, mocker: MockerFixture) -> None:- """The SDK drops an error it has already sent, and both streams are handed the same object.+ def test_the_stream_records_a_crash_that_is_not_a_pipelex_error(self, mocker: MockerFixture) -> None:+ """An error with no redacted stand-in is the object PostHog stamps, and it still travels once.- A `ValueError` is never redacted and so never copied: it is the object- PostHog stamps, and the stamp is still on it when the second stream- asks. Left in place, the stream that goes second — always Pipelex's, on- a machine that also reports to an operator's own project — returns- before building an event, and the crash is recorded nowhere on it.+ A `ValueError` is never redacted and so never copied: the client is+ handed the live error, stamps it, and the stamp is what stops anything+ downstream from sending the same object a second time."""custom_client, custom_capture = _make_stubbed_client(mocker=mocker, api_key="phc_custom")- pipelex_client, pipelex_capture = _make_stubbed_client(mocker=mocker, api_key="phc_pipelex")- capture = _make_dual_capture(custom_client=custom_client, pipelex_client=pipelex_client)+ capture = _make_capture(custom_client=custom_client)_crash(capture=capture, error=ValueError("boom"))assert custom_capture.call_count == 1- assert pipelex_capture.call_count == 1- def test_no_stream_is_sent_the_message_as_it_was_written(self, mocker: MockerFixture) -> None:+ def test_the_message_is_never_sent_as_it_was_written(self, mocker: MockerFixture) -> None:"""A `PipelexError` message repeats what the caller passed in, so it does not travel.The redaction was written for an error handed over bare and was never@@ -128,42 +118,37 @@ class TestExceptionCaptureSdkContract:sending the message verbatim."""custom_client, custom_capture = _make_stubbed_client(mocker=mocker, api_key="phc_custom")- pipelex_client, pipelex_capture = _make_stubbed_client(mocker=mocker, api_key="phc_pipelex")- capture = _make_dual_capture(custom_client=custom_client, pipelex_client=pipelex_client)+ capture = _make_capture(custom_client=custom_client)_crash(capture=capture, error=ToolError(_CONFIDENTIAL_MESSAGE))- for capture_mock in (custom_capture, pipelex_capture):- sent = _sent_exception_values(capture_mock=capture_mock)- assert _CONFIDENTIAL_MESSAGE not in sent- assert TelemetryManager.PRIVACY_NOTICE in sent+ capture_mock = custom_capture+ sent = _sent_exception_values(capture_mock=capture_mock)+ assert _CONFIDENTIAL_MESSAGE not in sent+ assert TelemetryManager.PRIVACY_NOTICE in sentdef test_the_stand_in_keeps_the_class_that_failed(self, mocker: MockerFixture) -> None:"""Redaction costs the message, not the diagnosis: the error's own class still travels."""custom_client, custom_capture = _make_stubbed_client(mocker=mocker, api_key="phc_custom")- pipelex_client, _ = _make_stubbed_client(mocker=mocker, api_key="phc_pipelex")- capture = _make_dual_capture(custom_client=custom_client, pipelex_client=pipelex_client)+ capture = _make_capture(custom_client=custom_client)_crash(capture=capture, error=ToolError(_CONFIDENTIAL_MESSAGE))assert ToolError.__name__ in _sent_exception_values(capture_mock=custom_capture)- def test_each_stream_is_recorded_under_its_own_identity(self, mocker: MockerFixture) -> None:- """Both streams emitting is only worth having if each still emits as itself."""+ def test_the_crash_is_recorded_under_the_streams_identity(self, mocker: MockerFixture) -> None:+ """A crash is attributed like every other capture: under the identity the stream resolved."""custom_client, custom_capture = _make_stubbed_client(mocker=mocker, api_key="phc_custom")- pipelex_client, pipelex_capture = _make_stubbed_client(mocker=mocker, api_key="phc_pipelex")- capture = _make_dual_capture(custom_client=custom_client, pipelex_client=pipelex_client)+ capture = _make_capture(custom_client=custom_client)_crash(capture=capture, error=ToolError(_CONFIDENTIAL_MESSAGE))assert custom_capture.call_args.kwargs["distinct_id"] == "operator-user"- assert pipelex_capture.call_args.kwargs["distinct_id"] == "gateway-hash"def test_a_pipelex_error_raised_as_the_cause_is_redacted(self, mocker: MockerFixture) -> None:"""PostHog sends every error it reaches through `__cause__`, not only the one at the top."""custom_client, custom_capture = _make_stubbed_client(mocker=mocker, api_key="phc_custom")- pipelex_client, pipelex_capture = _make_stubbed_client(mocker=mocker, api_key="phc_pipelex")- capture = _make_dual_capture(custom_client=custom_client, pipelex_client=pipelex_client)+ capture = _make_capture(custom_client=custom_client)try:try:@@ -174,17 +159,16 @@ class TestExceptionCaptureSdkContract:except RuntimeError as crash:_crash(capture=capture, error=crash)- for capture_mock in (custom_capture, pipelex_capture):- sent = _sent_exception_values(capture_mock=capture_mock)- assert _CONFIDENTIAL_MESSAGE not in sent- assert TelemetryManager.PRIVACY_NOTICE in sent- assert "wrapper" in sent+ capture_mock = custom_capture+ sent = _sent_exception_values(capture_mock=capture_mock)+ assert _CONFIDENTIAL_MESSAGE not in sent+ assert TelemetryManager.PRIVACY_NOTICE in sent+ assert "wrapper" in sentdef test_a_pipelex_error_being_handled_when_another_is_raised_is_redacted(self, mocker: MockerFixture) -> None:"""An error raised inside `except PipelexError` carries it as `__context__`, which PostHog sends too."""custom_client, custom_capture = _make_stubbed_client(mocker=mocker, api_key="phc_custom")- pipelex_client, pipelex_capture = _make_stubbed_client(mocker=mocker, api_key="phc_pipelex")- capture = _make_dual_capture(custom_client=custom_client, pipelex_client=pipelex_client)+ capture = _make_capture(custom_client=custom_client)try:try:@@ -195,21 +179,20 @@ class TestExceptionCaptureSdkContract:except RuntimeError as crash:_crash(capture=capture, error=crash)- for capture_mock in (custom_capture, pipelex_capture):- assert _CONFIDENTIAL_MESSAGE not in _sent_exception_values(capture_mock=capture_mock)+ capture_mock = custom_capture+ assert _CONFIDENTIAL_MESSAGE not in _sent_exception_values(capture_mock=capture_mock)def test_a_pipelex_error_inside_an_exception_group_is_redacted(self, mocker: MockerFixture) -> None:"""PostHog expands an exception group's members, and a `TaskGroup` wraps whatever its tasks raised."""custom_client, custom_capture = _make_stubbed_client(mocker=mocker, api_key="phc_custom")- pipelex_client, pipelex_capture = _make_stubbed_client(mocker=mocker, api_key="phc_pipelex")- capture = _make_dual_capture(custom_client=custom_client, pipelex_client=pipelex_client)+ capture = _make_capture(custom_client=custom_client)_crash(capture=capture, error=ExceptionGroup("tasks failed", [ToolError(_CONFIDENTIAL_MESSAGE), ValueError("other")]))- for capture_mock in (custom_capture, pipelex_capture):- sent = _sent_exception_values(capture_mock=capture_mock)- assert _CONFIDENTIAL_MESSAGE not in sent- assert TelemetryManager.PRIVACY_NOTICE in sent+ capture_mock = custom_capture+ sent = _sent_exception_values(capture_mock=capture_mock)+ assert _CONFIDENTIAL_MESSAGE not in sent+ assert TelemetryManager.PRIVACY_NOTICE in sentdef test_a_capture_with_no_argument_is_redacted(self, mocker: MockerFixture) -> None:"""Given `None`, the SDK reads `sys.exc_info()` itself, past any wrapper that did not resolve it first.@@ -230,8 +213,7 @@ class TestExceptionCaptureSdkContract:def test_the_live_exception_is_left_as_it_was(self, mocker: MockerFixture) -> None:"""Only a copy of the chain is redacted: the interpreter prints the original after the hook returns."""custom_client, _ = _make_stubbed_client(mocker=mocker, api_key="phc_custom")- pipelex_client, _ = _make_stubbed_client(mocker=mocker, api_key="phc_pipelex")- capture = _make_dual_capture(custom_client=custom_client, pipelex_client=pipelex_client)+ capture = _make_capture(custom_client=custom_client)pipelex_error = ToolError(_CONFIDENTIAL_MESSAGE)crash = RuntimeError("wrapper")crash.__cause__ = pipelex_error@@ -244,21 +226,18 @@ class TestExceptionCaptureSdkContract:def test_an_error_the_host_already_captured_is_not_sent_again(self, mocker: MockerFixture) -> None:"""A host that captures an error and re-raises it has sent it once, and the hook must not add a second."""custom_client, custom_capture = _make_stubbed_client(mocker=mocker, api_key="phc_custom")- pipelex_client, pipelex_capture = _make_stubbed_client(mocker=mocker, api_key="phc_pipelex")- capture = _make_dual_capture(custom_client=custom_client, pipelex_client=pipelex_client)+ capture = _make_capture(custom_client=custom_client)error = ValueError("boom")custom_client.capture_exception(error)_crash(capture=capture, error=error)assert custom_capture.call_count == 1- assert pipelex_capture.call_count == 0def test_a_redacted_error_the_host_already_captured_is_not_sent_again(self, mocker: MockerFixture) -> None:"""The SDK marks the redacted copy it sent, so the mark has to reach the error the host holds."""custom_client, custom_capture = _make_stubbed_client(mocker=mocker, api_key="phc_custom")- pipelex_client, pipelex_capture = _make_stubbed_client(mocker=mocker, api_key="phc_pipelex")- capture = _make_dual_capture(custom_client=custom_client, pipelex_client=pipelex_client)+ capture = _make_capture(custom_client=custom_client)error = ToolError(_CONFIDENTIAL_MESSAGE)custom_client.capture_exception(error)@@ -266,7 +245,6 @@ class TestExceptionCaptureSdkContract:_crash(capture=capture, error=error)assert custom_capture.call_count == 1- assert pipelex_capture.call_count == 0def test_an_argument_less_capture_of_a_redacted_error_is_not_sent_again(self, mocker: MockerFixture) -> None:"""`capture_exception()` inside `except`, which passes `None`, is the SDK's documented form, and the mark must reach the error it resolved.@@ -278,8 +256,7 @@ class TestExceptionCaptureSdkContract:sent it again."""custom_client, custom_capture = _make_stubbed_client(mocker=mocker, api_key="phc_custom")- pipelex_client, pipelex_capture = _make_stubbed_client(mocker=mocker, api_key="phc_pipelex")- capture = _make_dual_capture(custom_client=custom_client, pipelex_client=pipelex_client)+ capture = _make_capture(custom_client=custom_client)error = ToolError(_CONFIDENTIAL_MESSAGE)try:@@ -290,7 +267,6 @@ class TestExceptionCaptureSdkContract:_crash(capture=capture, error=error)assert custom_capture.call_count == 1- assert pipelex_capture.call_count == 0def test_a_chain_longer_than_the_recursion_limit_is_still_sent(self, mocker: MockerFixture) -> None:"""PostHog walks a chain with a loop, so the check deciding whether it needs redacting must not recurse either.diff --git a/tests/unit/pipelex/system/telemetry/test_gateway_portkey_follows_stream.py b/tests/unit/pipelex/system/telemetry/test_gateway_portkey_follows_stream.pydeleted file mode 100644index 59ee2803a..000000000--- a/tests/unit/pipelex/system/telemetry/test_gateway_portkey_follows_stream.py+++ /dev/null@@ -1,64 +0,0 @@-import pytest--from pipelex.system.telemetry.otel_constants import OTelConstants-from pipelex.system.telemetry.telemetry_config import (- PipelexGatewayTelemetryConfig,- PortkeyConfig,- PostHogConfig,- PostHogMode,- TelemetryConfig,-)-from pipelex.system.telemetry.telemetry_manager import TelemetryManager---def _make_manager(*, is_stream_enabled: bool, force_flags: bool) -> TelemetryManager:- """Assemble a manager whose custom stream is on, as a test run allows, bypassing the constructor's global side effects."""- telemetry_config = TelemetryConfig(- custom_posthog=PostHogConfig(mode=PostHogMode.ANONYMOUS, api_key="phc_test"),- pipelex_gateway=PipelexGatewayTelemetryConfig(- posthog=PostHogConfig(mode=PostHogMode.OFF),- portkey=PortkeyConfig(force_debug_enabled=force_flags, force_tracing_enabled=force_flags),- ),- )- manager = TelemetryManager.__new__(TelemetryManager)- manager.telemetry_config = telemetry_config- manager._pipelex_telemetry_enabled = is_stream_enabled # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]- return manager---def without_do_not_track(monkeypatch: pytest.MonkeyPatch) -> None:- """`DO_NOT_TRACK` turns both answers off by itself, which would hide what these tests are about."""- monkeypatch.delenv(OTelConstants.DO_NOT_TRACK_ENV_VAR_KEY, raising=False)--[email protected]("without_do_not_track")-class TestGatewayPortkeyFollowsStream:- @pytest.mark.parametrize("force_flags", [True, False])- def test_backend_debug_does_not_log_while_the_stream_is_off(self, force_flags: bool) -> None:- """A test run keeps the Gateway stream off, and the backend's `debug` must not reopen Portkey logging behind it."""- manager = _make_manager(is_stream_enabled=False, force_flags=force_flags)-- assert manager.is_pipelex_gateway_portkey_logging_enabled(is_debug_configured=True) is False-- def test_force_debug_flag_does_not_log_while_the_stream_is_off(self) -> None:- manager = _make_manager(is_stream_enabled=False, force_flags=True)-- assert manager.is_pipelex_gateway_portkey_logging_enabled(is_debug_configured=False) is False-- def test_force_tracing_flag_does_not_trace_while_the_stream_is_off(self) -> None:- manager = _make_manager(is_stream_enabled=False, force_flags=True)-- assert manager.is_pipelex_gateway_portkey_tracing_enabled() is False-- def test_the_flags_still_apply_while_the_stream_is_on(self) -> None:- manager = _make_manager(is_stream_enabled=True, force_flags=True)-- assert manager.is_pipelex_gateway_portkey_logging_enabled(is_debug_configured=False) is True- assert manager.is_pipelex_gateway_portkey_tracing_enabled() is True-- def test_backend_debug_still_applies_while_the_stream_is_on(self) -> None:- manager = _make_manager(is_stream_enabled=True, force_flags=False)-- assert manager.is_pipelex_gateway_portkey_logging_enabled(is_debug_configured=True) is True- assert manager.is_pipelex_gateway_portkey_tracing_enabled() is Falsediff --git a/tests/unit/pipelex/system/telemetry/test_telemetry_manager_identity.py b/tests/unit/pipelex/system/telemetry/test_telemetry_manager_identity.pyindex db1913f4a..07481ffbf 100644--- a/tests/unit/pipelex/system/telemetry/test_telemetry_manager_identity.py+++ b/tests/unit/pipelex/system/telemetry/test_telemetry_manager_identity.py@@ -42,9 +42,8 @@ def _make_manager(mocker: MockerFixture,mode: PostHogMode,configured_user_id: str | None,- pipelex_distinct_id: str | None = None,tracing_enabled: bool = True,-) -> tuple[TelemetryManager, Any, Any]:+) -> tuple[TelemetryManager, Any]:"""Assemble a manager with stub clients, bypassing the constructor's global side effects."""telemetry_config = TelemetryConfig(custom_posthog=PostHogConfig(@@ -57,12 +56,8 @@ def _make_manager(manager = TelemetryManager.__new__(TelemetryManager)manager.telemetry_config = telemetry_configcustom_client = mocker.MagicMock(spec=Posthog)- pipelex_client = mocker.MagicMock(spec=Posthog) if pipelex_distinct_id else Nonemanager.custom_posthog_client = custom_client- manager.pipelex_posthog_client = pipelex_client- manager._pipelex_telemetry_enabled = pipelex_distinct_id is not None # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]- manager._pipelex_distinct_id = pipelex_distinct_id # ruff: ignore[private-member-access] # pyright: ignore[reportPrivateUsage]- return manager, custom_client, pipelex_client+ return manager, custom_client_CALLER = CallerIdentity(user_id="caller-7", extras={"organization": "org_caller"})@@ -70,7 +65,7 @@ _CALLER = CallerIdentity(user_id="caller-7", extras={"organization": "org_callerclass TestTelemetryManagerIdentity:def test_an_event_from_a_run_is_attributed_to_the_runs_user(self, mocker: MockerFixture) -> None:- manager, custom_client, _ = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="configured-id")+ manager, custom_client = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="configured-id")manager.track_event(EventName.PIPE_RUN,@@ -83,7 +78,7 @@ class TestTelemetryManagerIdentity:def test_an_event_with_no_run_reports_under_the_configured_id(self, mocker: MockerFixture) -> None:"""A CLI command, a dry-run sweep — the configured id is what "no run" means."""- manager, custom_client, _ = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="configured-id")+ manager, custom_client = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="configured-id")manager.track_event(EventName.PIPES_LIST)@@ -92,7 +87,7 @@ class TestTelemetryManagerIdentity:assert capture_kwargs["groups"] is Nonedef test_an_anonymous_mode_does_not_apply_the_runs_identity(self, mocker: MockerFixture) -> None:- manager, custom_client, _ = _make_manager(mocker=mocker, mode=PostHogMode.ANONYMOUS, configured_user_id=None)+ manager, custom_client = _make_manager(mocker=mocker, mode=PostHogMode.ANONYMOUS, configured_user_id=None)manager.track_event(EventName.PIPE_RUN,@@ -105,62 +100,15 @@ class TestTelemetryManagerIdentity:assert capture_kwargs["properties"][PostHogAttr.PROCESS_PERSON_PROFILE] is Falsedef test_an_off_mode_captures_nothing(self, mocker: MockerFixture) -> None:- manager, custom_client, _ = _make_manager(mocker=mocker, mode=PostHogMode.OFF, configured_user_id=None)+ manager, custom_client = _make_manager(mocker=mocker, mode=PostHogMode.OFF, configured_user_id=None)manager.track_event(EventName.PIPE_RUN, run_metadata=_run_metadata())custom_client.capture.assert_not_called()- def test_the_pipelex_stream_sends_the_runs_user_and_groups_as_they_are(self, mocker: MockerFixture) -> None:- """The run's `user_id` is the `distinct_id` and its groups ride the capture, unchanged."""- manager, _, pipelex_client = _make_manager(- mocker=mocker,- mode=PostHogMode.OFF,- configured_user_id=None,- pipelex_distinct_id="gateway-hash",- )- assert pipelex_client is not None-- manager.track_event(- EventName.PIPE_RUN,- run_metadata=_run_metadata(extras={"organization": "org_acme"}),- )-- capture_kwargs = pipelex_client.capture.call_args.kwargs- assert capture_kwargs["distinct_id"] == "user-42"- assert capture_kwargs["groups"] == {"organization": "org_acme"}-- def test_an_event_with_no_run_falls_back_to_the_gateway_hash(self, mocker: MockerFixture) -> None:- manager, _, pipelex_client = _make_manager(- mocker=mocker,- mode=PostHogMode.OFF,- configured_user_id=None,- pipelex_distinct_id="gateway-hash",- )- assert pipelex_client is not None-- manager.track_event(EventName.PIPES_LIST)-- assert pipelex_client.capture.call_args.kwargs["distinct_id"] == "gateway-hash"-- def test_an_anonymous_custom_capture_does_not_mark_the_pipelex_capture(self, mocker: MockerFixture) -> None:- """Both streams are offered the same properties dict; one branch used to stamp the other's."""- manager, _, pipelex_client = _make_manager(- mocker=mocker,- mode=PostHogMode.ANONYMOUS,- configured_user_id=None,- pipelex_distinct_id="gateway-hash",- )- assert pipelex_client is not None-- manager.track_event(EventName.PIPE_RUN, run_metadata=_run_metadata())-- pipelex_properties = pipelex_client.capture.call_args.kwargs["properties"]- assert PostHogAttr.PROCESS_PERSON_PROFILE not in pipelex_properties-def test_the_trace_start_is_attributed_to_the_run(self, mocker: MockerFixture) -> None:"""It is the first event of the trace, so it has to land on the same person its spans will."""- manager, custom_client, _ = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="configured-id")+ manager, custom_client = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="configured-id")manager.handle_trace_start(trace_name="some_pipe_abc12345",@@ -174,14 +122,14 @@ class TestTelemetryManagerIdentity:assert capture_kwargs["groups"] == {"organization": "org_acme"}def test_without_a_run_it_keeps_the_configured_identity(self, mocker: MockerFixture) -> None:- manager, custom_client, _ = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="configured-id")+ manager, custom_client = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="configured-id")manager.handle_trace_start(trace_name="some_pipe_abc12345", trace_name_redacted="abc12345", trace_id=1234)assert custom_client.capture.call_args.kwargs["distinct_id"] == "configured-id"def test_an_anonymous_operator_stream_still_identifies_nobody(self, mocker: MockerFixture) -> None:- manager, custom_client, _ = _make_manager(mocker=mocker, mode=PostHogMode.ANONYMOUS, configured_user_id=None)+ manager, custom_client = _make_manager(mocker=mocker, mode=PostHogMode.ANONYMOUS, configured_user_id=None)manager.handle_trace_start(trace_name="some_pipe_abc12345",@@ -201,7 +149,7 @@ class TestTelemetryManagerIdentity:fallback, a stream documented as identifying nobody created a personprofile on every capture but its ordinary events."""- manager, custom_client, _ = _make_manager(mocker=mocker, mode=PostHogMode.ANONYMOUS, configured_user_id="left-behind-id")+ manager, custom_client = _make_manager(mocker=mocker, mode=PostHogMode.ANONYMOUS, configured_user_id="left-behind-id")manager.handle_trace_start(trace_name="some_pipe_abc12345",@@ -214,29 +162,8 @@ class TestTelemetryManagerIdentity:assert "distinct_id" not in capture_kwargsassert capture_kwargs["properties"][PostHogAttr.PROCESS_PERSON_PROFILE] is False- def test_the_pipelex_stream_trace_start_is_attributed_like_its_spans(self, mocker: MockerFixture) -> None:- """The trace's first event has to land on the same person its spans will."""- manager, _, pipelex_client = _make_manager(- mocker=mocker,- mode=PostHogMode.OFF,- configured_user_id=None,- pipelex_distinct_id="gateway-hash",- )- assert pipelex_client is not None-- manager.handle_trace_start(- trace_name="some_pipe_abc12345",- trace_name_redacted="abc12345",- trace_id=1234,- run_metadata=_run_metadata(extras={"organization": "org_acme"}),- )-- capture_kwargs = pipelex_client.capture.call_args.kwargs- assert capture_kwargs["distinct_id"] == "user-42"- assert capture_kwargs["groups"] == {"organization": "org_acme"}-def test_the_identity_never_becomes_a_property(self, mocker: MockerFixture) -> None:- manager, custom_client, _ = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="configured-id")+ manager, custom_client = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="configured-id")manager.handle_trace_start(trace_name="some_pipe_abc12345",@@ -250,7 +177,7 @@ class TestTelemetryManagerIdentity:assert "org_acme" not in rendereddef test_an_event_with_no_run_is_attributed_to_the_caller_in_scope(self, mocker: MockerFixture) -> None:- manager, custom_client, _ = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-runner")+ manager, custom_client = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-runner")with scoped_caller_identity(caller_identity=_CALLER):manager.track_event(EventName.PIPE_DRY_RUN)@@ -261,7 +188,7 @@ class TestTelemetryManagerIdentity:def test_the_run_in_hand_wins_over_the_caller_in_scope(self, mocker: MockerFixture) -> None:"""The run the emitter holds is the most specific fact there is."""- manager, custom_client, _ = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-runner")+ manager, custom_client = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-runner")with scoped_caller_identity(caller_identity=_CALLER):manager.track_event(EventName.PIPE_RUN, run_metadata=_run_metadata())@@ -270,7 +197,7 @@ class TestTelemetryManagerIdentity:def test_a_placeholder_caller_in_scope_still_reports_under_the_configured_id(self, mocker: MockerFixture) -> None:"""A local runtime states `local`, which names nobody — the CLI keeps reporting as it did."""- manager, custom_client, _ = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="configured-id")+ manager, custom_client = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="configured-id")with scoped_caller_identity(caller_identity=CallerIdentity(user_id=LOCAL_USER_ID)):manager.track_event(EventName.PIPE_DRY_RUN)@@ -278,7 +205,7 @@ class TestTelemetryManagerIdentity:assert custom_client.capture.call_args.kwargs["distinct_id"] == "configured-id"def test_an_anonymous_stream_identifies_nobody_whatever_the_scope_says(self, mocker: MockerFixture) -> None:- manager, custom_client, _ = _make_manager(mocker=mocker, mode=PostHogMode.ANONYMOUS, configured_user_id="configured-id")+ manager, custom_client = _make_manager(mocker=mocker, mode=PostHogMode.ANONYMOUS, configured_user_id="configured-id")with scoped_caller_identity(caller_identity=_CALLER):manager.track_event(EventName.PIPE_DRY_RUN)@@ -288,7 +215,7 @@ class TestTelemetryManagerIdentity:assert capture_kwargs["properties"][PostHogAttr.PROCESS_PERSON_PROFILE] is Falsedef test_the_caller_in_scope_never_becomes_a_property(self, mocker: MockerFixture) -> None:- manager, custom_client, _ = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="configured-id")+ manager, custom_client = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="configured-id")with scoped_caller_identity(caller_identity=_CALLER):manager.track_event(EventName.PIPE_DRY_RUN)@@ -297,22 +224,8 @@ class TestTelemetryManagerIdentity:assert "caller-7" not in repr(properties)assert "org_caller" not in repr(properties)- def test_the_pipelex_stream_resolves_the_caller_in_scope_under_its_own_policy(self, mocker: MockerFixture) -> None:- manager, _, pipelex_client = _make_manager(- mocker=mocker,- mode=PostHogMode.OFF,- configured_user_id=None,- pipelex_distinct_id="gateway-hash",- )- assert pipelex_client is not None-- with scoped_caller_identity(caller_identity=_CALLER):- manager.track_event(EventName.PIPE_DRY_RUN)-- assert pipelex_client.capture.call_args.kwargs["distinct_id"] == "caller-7"-def test_a_trace_start_with_no_run_is_attributed_to_the_caller_in_scope(self, mocker: MockerFixture) -> None:- manager, custom_client, _ = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-runner")+ manager, custom_client = _make_manager(mocker=mocker, mode=PostHogMode.IDENTIFIED, configured_user_id="pipelex-runner")with scoped_caller_identity(caller_identity=_CALLER):manager.handle_trace_start(trace_name="some_pipe_abc12345", trace_name_redacted="abc12345", trace_id=1234)diff --git a/tests/unit/pipelex/system/test_integration_mode.py b/tests/unit/pipelex/system/test_integration_mode.pydeleted file mode 100644index 5602584b6..000000000--- a/tests/unit/pipelex/system/test_integration_mode.py+++ /dev/null@@ -1,29 +0,0 @@-import pytest--from pipelex.system.runtime import IntegrationMode--IS_TEST_HARNESS_BY_MODE: dict[IntegrationMode, bool] = {- IntegrationMode.CI: True,- IntegrationMode.CLI: False,- IntegrationMode.DOCKER: False,- IntegrationMode.FASTAPI: False,- IntegrationMode.MCP: False,- IntegrationMode.N8N: False,- IntegrationMode.PYTEST: True,- IntegrationMode.PYTHON: False,-}---class TestIntegrationModeIsTestHarness:- @pytest.mark.parametrize(("integration_mode", "expected"), list(IS_TEST_HARNESS_BY_MODE.items()))- def test_is_test_harness(self, integration_mode: IntegrationMode, expected: bool) -> None:- """The boot keeps the Gateway telemetry stream off in a harness mode, so each mode's answer is a telemetry decision.-- A deployment mode classified as a harness would silence real usage; a harness mode classified as- a deployment would send test runs to the production analytics project.- """- assert integration_mode.is_test_harness is expected-- def test_the_table_covers_every_mode(self) -> None:- """A mode added later fails here until someone decides whether it is a test harness."""- assert set(IS_TEST_HARNESS_BY_MODE) == set(IntegrationMode)diff --git a/tests/unit/pipelex/test_runtime_boot_closure.py b/tests/unit/pipelex/test_runtime_boot_closure.pyindex a0c77cf74..e476f6a4c 100644--- a/tests/unit/pipelex/test_runtime_boot_closure.py+++ b/tests/unit/pipelex/test_runtime_boot_closure.py@@ -31,7 +31,7 @@ from tests.unit.pipelex.test_kernel_layer_import_closure import INTERPRETER_PACKSUBPROCESS_TIMEOUT_SECONDS = 300#: Boot the kernel layer in a fresh interpreter, then answer the three questions this module exists-#: to ask. `needs_inference=False` keeps it offline: no gateway terms gate, no model-deck validation.+#: to ask. `needs_inference=False` keeps it offline: no remote config fetch, no model-deck validation.#: The `sys.modules` sweep runs *before* `pipelex.interpreter_hub` is imported for the hub assertion,#: so importing it to ask the question cannot be what makes the answer wrong._BOOTED_RUNTIME_SCRIPT = textwrap.dedent(diff --git a/tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.py b/tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.pydeleted file mode 100644index cf15a0bec..000000000--- a/tests/unit/pipelex/test_runtime_boot_pipelex_telemetry.py+++ /dev/null@@ -1,76 +0,0 @@-import pytest--from pipelex.runtime_boot import RuntimeBoot-from pipelex.runtime_hub import get_telemetry_manager-from pipelex.system.runtime import IntegrationMode--# Spelled out rather than derived from `is_test_harness`, so this table does not lean on the property it-# depends on; `test_integration_mode.py` pins the property itself.-HARNESS_MODES = [IntegrationMode.CI, IntegrationMode.PYTEST]-DEPLOYMENT_MODES = [mode for mode in IntegrationMode if mode not in HARNESS_MODES]---class TestRuntimeBootPipelexTelemetry:- @pytest.mark.parametrize("integration_mode", DEPLOYMENT_MODES)- def test_a_deployment_mode_with_every_condition_met_enables_the_stream(self, integration_mode: IntegrationMode) -> None:- assert RuntimeBoot.should_enable_pipelex_telemetry(- integration_mode=integration_mode,- is_unit_testing=False,- is_gateway_enabled=True,- needs_inference=True,- is_gateway_config_cached=False,- )-- @pytest.mark.parametrize(- ("is_unit_testing", "is_gateway_enabled", "needs_inference", "is_gateway_config_cached"),- [- pytest.param(True, True, True, False, id="unit-testing-run-mode"),- pytest.param(False, False, True, False, id="gateway-disabled"),- pytest.param(False, True, False, False, id="no-inference"),- pytest.param(False, True, True, True, id="cached-config"),- ],- )- def test_each_condition_alone_disables_the_stream(- self,- is_unit_testing: bool,- is_gateway_enabled: bool,- needs_inference: bool,- is_gateway_config_cached: bool,- ) -> None:- """The `unit-testing-run-mode` row is the suite that boots in the default `PYTHON` mode, as the shared plugin's recipe does."""- assert not RuntimeBoot.should_enable_pipelex_telemetry(- integration_mode=IntegrationMode.PYTHON,- is_unit_testing=is_unit_testing,- is_gateway_enabled=is_gateway_enabled,- needs_inference=needs_inference,- is_gateway_config_cached=is_gateway_config_cached,- )-- @pytest.mark.parametrize("integration_mode", HARNESS_MODES)- def test_a_test_harness_mode_disables_the_stream_even_with_every_other_condition_met(self, integration_mode: IntegrationMode) -> None:- """Test runs are not usage, and their fixture user ids must not become persons in the production project.-- Before this condition, every pytest run with `pipelex_gateway` enabled and a fresh remote config- sent its pipe runs to the Gateway's production analytics project, because the stream's enabling- condition never read the integration mode. The run mode is left false here: a harness that boots- without the shared pytest plugin, such as the pipelex-js conformance scripts, has only its mode.- """- assert not RuntimeBoot.should_enable_pipelex_telemetry(- integration_mode=integration_mode,- is_unit_testing=False,- is_gateway_enabled=True,- needs_inference=True,- is_gateway_config_cached=False,- )-- def test_the_suite_boot_has_the_gateway_stream_off(self) -> None:- """The boot this suite runs under must not send the Gateway stream: the bug's symptom, stated directly.-- This passes trivially on a machine where `pipelex_gateway` is disabled, or where the remote- config came from the cache, because the stream is off there for those reasons already; the- table tests above and the setup-level tests in `test_setup_gateway_telemetry.py` are the precise- guards. It asserts on the Gateway stream alone, not on the manager being a no-op, because a- developer may deliberately allow the custom stream under `pytest` in their own- `telemetry_allowed_modes`.- """- assert not get_telemetry_manager().is_pipelex_telemetry_enabled