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/Httpx2-log-levels · L-261010-e9f3a2 (#1396)
Louis Choquelcffad243fde8
diff --git a/.drift/acks/config-docs.toml b/.drift/acks/config-docs.tomlindex a4bdd14ca..917a1bd23 100644--- a/.drift/acks/config-docs.toml+++ b/.drift/acks/config-docs.toml@@ -1,8 +1,8 @@contract = "config-docs"-digest = "sha256:befa3b014fb06f0fd7cdc943212d7d5b86f7eca17b5e8c7b8bb9b001af97b375"+digest = "sha256:cf7d6bb91764d7e38386d38f133a9b721ac88591be65f4679a807eeb077c67cf"reviewed_by = "Claude (Opus 5.5)"-reviewed_at = "2026-10-10T00:27:59Z"-rationale = "real-catch: StaleConfigurationWarning.emit in config_surface.py now words its messages 'and nothing was written' and has two more messages for a file with blocked steps, reached by pipelex migrate or not. Re-read docs/configuration: inference-backend-config.md quoted the old 'without being rewritten' line and now quotes the reached, unblocked message as the code emits it; telemetry-config.md and logging-config.md only say the boot warns and writes nothing, which still holds. No config model, default, validator or ledger entry moved: configs.py, config_cogt.py and pipelex/migration/ledgers/ are untouched."+reviewed_at = "2026-10-10T01:52:31Z"+rationale = "real-catch: pipelex/pipelex.toml gained two shipped defaults under [runtime.log.package_log_levels], httpx2 = WARNING and httpcore2 = INFO. Re-read docs/configuration: logging-config.md's Package-Specific Log Levels section now says the HTTP clients under the inference SDKs default to httpx WARNING and httpcore INFO with the same levels for their forks; its quantified claims (OFF silences only the loggers the section does not pin, silence for everything takes every entry of that section at OFF) are about the section as a set and still hold; the override example and the best-practice list name no default. No other configuration page names a package level. No model moved: configs.py and config_cogt.py are untouched, package_log_levels is an open dict[str, LogLevel] node, check-migration-schemas reported the fingerprint moved additively with no entry needed, and the head goldens defaults@7 and fingerprint@7 were regenerated with make umig; the ledgers need no entry."[trigger_files]"pipelex/cogt/config_cogt.py" = "blob:02f71cb4a6b01aebda59c2e31f262ef9c865e17b"@@ -10,7 +10,7 @@ rationale = "real-catch: StaleConfigurationWarning.emit in config_surface.py now"pipelex/graph/graph_config.py" = "blob:dc0939a6d2730c0a10b88aa1a6e0b2dd583462a6""pipelex/language/mthds_config.py" = "blob:353009ad8c59dc5266bdd9dfa42b1ad18b67dca7""pipelex/methods/methods_config.py" = "blob:76ca9a0e64f8c10ef6a355aafd0d79d36b09f06a"-"pipelex/pipelex.toml" = "blob:af0f9f1f117c404333866b8c60ae61d95afab962"+"pipelex/pipelex.toml" = "blob:c9de2007e32ec4e0043fd9a153f0d4aabe3ae04a""pipelex/system/configuration/__init__.py" = "blob:8b137891791fe96927ad78e64b0aad7bded08bdc""pipelex/system/configuration/config_check.py" = "blob:2d5de29aba3d2ce205d3d82b4623f37b53108332""pipelex/system/configuration/config_loader.py" = "blob:2850f6b39df6ad2afafefc4d431672cb6ee91ced"diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 480b1c48e..0200a7655 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -18,6 +18,7 @@### Fixed- **Model descriptions and credential errors carry no backslashes**: a model's description in an error message or a log line, such as `gpt-5 → SDK[openai]•Backend[openai]•Model[gpt-5-2025]`, no longer has a backslash before each bracket, and the error naming a backend's missing credentials tells you to add `enabled = false` under `[openai]` rather than `\[openai]`. `pipelex run` prints a failed run's message exactly as written rather than reading it as markup.+- **No HTTP request line per inference call**: at the default `INFO` level an inference call made through openai 3.x no longer logs an `HTTP Request: POST https://… "HTTP/1.1 200 OK"` line, carrying the provider's endpoint URL and the HTTP status, on the console or in the `json` sink. The defaults under `[runtime.log.package_log_levels]` now give `httpx2` and `httpcore2`, the HTTP client forks openai 3.x sends its requests through, the levels `httpx` and `httpcore` already had, `WARNING` and `INFO`; set `httpx2 = "INFO"` there to see the line again.- **An empty list's output panel says so**: the title of the panel showing an operator pipe's output ends with `[empty list]` when the pipe produced an empty list, a label the console used to drop, as it already showed `[1 item]` or `[3 items]`.### Removeddiff --git a/docs/configuration/config-practical/logging-config.md b/docs/configuration/config-practical/logging-config.mdindex db76a69a8..1d0fcfb8b 100644--- a/docs/configuration/config-practical/logging-config.md+++ b/docs/configuration/config-practical/logging-config.md@@ -34,6 +34,7 @@ pipelex = "INFO"```- Override log levels for specific packages+- The defaults keep the HTTP clients under the inference SDKs quiet: `httpx = "WARNING"` and `httpcore = "INFO"`, with the same levels for `httpx2` and `httpcore2`, the forks openai 3.x sends its requests through, so an inference call prints no line of its own carrying the provider's endpoint URL- Use `-` instead of `.` in package names (e.g., `urllib3-connectionpool`)- A key works at any depth of the logger hierarchy, because Pipelex names every logger after the emitting module: `pipelex` governs the whole runtime, and `pipelex-pipe_operators-pipe_llm = "DEBUG"` opens one module while the rest of `pipelex` stays at its leveldiff --git a/pipelex/migration/goldens/pipelex-config/[email protected] b/pipelex/migration/goldens/pipelex-config/[email protected]index af0f9f1f1..c9de2007e 100644--- a/pipelex/migration/goldens/pipelex-config/[email protected]+++ b/pipelex/migration/goldens/pipelex-config/[email protected]@@ -82,6 +82,11 @@ botocore-credentials = "WARNING"google = "INFO"httpx = "WARNING"httpcore = "INFO"+# openai 3.x sends its requests through the httpx2 and httpcore2 forks, which log under their own+# names, so they get the levels of the packages they fork: otherwise every inference call prints an+# INFO line carrying the provider's endpoint URL and the HTTP status.+httpx2 = "WARNING"+httpcore2 = "INFO"openai = "INFO"instructor = "INFO"urllib3-connectionpool = "INFO"diff --git a/pipelex/migration/goldens/pipelex-config/[email protected] b/pipelex/migration/goldens/pipelex-config/[email protected]index df37e96a7..bf6a6a423 100644--- a/pipelex/migration/goldens/pipelex-config/[email protected]+++ b/pipelex/migration/goldens/pipelex-config/[email protected]@@ -1123,6 +1123,8 @@"google": "INFO","httpx": "WARNING","httpcore": "INFO",+ "httpx2": "WARNING",+ "httpcore2": "INFO","openai": "INFO","instructor": "INFO","urllib3-connectionpool": "INFO",diff --git a/pipelex/pipelex.toml b/pipelex/pipelex.tomlindex af0f9f1f1..c9de2007e 100644--- a/pipelex/pipelex.toml+++ b/pipelex/pipelex.toml@@ -82,6 +82,11 @@ botocore-credentials = "WARNING"google = "INFO"httpx = "WARNING"httpcore = "INFO"+# openai 3.x sends its requests through the httpx2 and httpcore2 forks, which log under their own+# names, so they get the levels of the packages they fork: otherwise every inference call prints an+# INFO line carrying the provider's endpoint URL and the HTTP status.+httpx2 = "WARNING"+httpcore2 = "INFO"openai = "INFO"instructor = "INFO"urllib3-connectionpool = "INFO"diff --git a/tests/unit/pipelex/tools/test_log_package_level_defaults.py b/tests/unit/pipelex/tools/test_log_package_level_defaults.pynew file mode 100644index 000000000..24ddbc9d8--- /dev/null+++ b/tests/unit/pipelex/tools/test_log_package_level_defaults.py@@ -0,0 +1,123 @@+from __future__ import annotations++import logging+from contextlib import contextmanager+from pathlib import Path+from typing import TYPE_CHECKING++import pytest++from pipelex.system.configuration.config_loader import ConfigLoader+from pipelex.system.configuration.configs import PipelexConfig+from pipelex.tools.log.log import Log+from pipelex.tools.log.log_levels import LOGGING_LEVEL_VERBOSE++if TYPE_CHECKING:+ from collections.abc import Generator++ from pytest_mock import MockerFixture++ from pipelex.tools.log.log_config import LogConfig++pytestmark = pytest.mark.usefixtures("no_pipelex_home")++PROJECT_FILE_AT_DEBUG = """\+[runtime.log]+default_log_level = "DEBUG"+"""++STDLIB_LEVELS = (LOGGING_LEVEL_VERBOSE, logging.DEBUG, logging.INFO, logging.WARNING, logging.ERROR)++REQUEST_LINE = 'HTTP Request: POST https://endpoint.invalid/openai/responses?api-version=preview "HTTP/1.1 200 OK"'+++def _boot_log_config(*, tmp_path: Path, mocker: MockerFixture, project_file_text: str | None) -> LogConfig:+ """The log configuration the boot's loader reads for an empty home and a project holding at most ``project_file_text``.++ The home and the project are faked so that no configuration of the machine running the tests takes part.+ """+ fake_home = tmp_path / "home"+ (fake_home / ".pipelex").mkdir(parents=True)+ project_root = tmp_path / "project"+ (project_root / ".git").mkdir(parents=True)+ if project_file_text is not None:+ project_config_dir = project_root / ".pipelex"+ project_config_dir.mkdir()+ (project_config_dir / "pipelex.toml").write_text(project_file_text, encoding="utf-8")+ mocker.patch.object(Path, "home", return_value=fake_home)+ mocker.patch.object(Path, "cwd", return_value=project_root)+ return ConfigLoader().load_config_validated(config_cls=PipelexConfig).runtime.log+++@contextmanager+def _configured_as_the_boot_does(*, log_config: LogConfig) -> Generator[None]:+ """``configure`` on a fresh ``Log``, with the handler it installs and every logger level it sets put back afterwards."""+ touched_logger_names = ["", *(package_name.replace("-", ".") for package_name in log_config.package_log_levels)]+ saved_levels = {logger_name: logging.getLogger(logger_name).level for logger_name in touched_logger_names}+ fresh_log = Log()+ fresh_log.configure(log_config=log_config)+ try:+ yield+ finally:+ fresh_log.reset()+ for logger_name, saved_level in saved_levels.items():+ logging.getLogger(logger_name).setLevel(saved_level)+++def _levels_passed_by(*, logger_name: str) -> list[int]:+ logger = logging.getLogger(logger_name)+ return [level for level in STDLIB_LEVELS if logger.isEnabledFor(level)]+++class TestHttpClientForkLogLevels:+ @pytest.mark.parametrize(+ "project_file_text",+ [None, PROJECT_FILE_AT_DEBUG],+ ids=["shipped-default-level", "default-level-debug"],+ )+ @pytest.mark.parametrize(+ ("fork_name", "original_name"),+ [+ ("httpx2", "httpx"),+ ("httpcore2", "httpcore"),+ ],+ )+ def test_a_fork_passes_exactly_the_levels_its_original_passes(+ self,+ tmp_path: Path,+ mocker: MockerFixture,+ project_file_text: str | None,+ fork_name: str,+ original_name: str,+ ) -> None:+ """The forks openai 3.x logs through, httpx2 and httpcore2, must log what httpx and httpcore log.++ Checked at the shipped default level and with the default opened to DEBUG, where an unpinned fork would follow the root.+ """+ log_config = _boot_log_config(tmp_path=tmp_path, mocker=mocker, project_file_text=project_file_text)++ with _configured_as_the_boot_does(log_config=log_config):+ passed_by_fork = _levels_passed_by(logger_name=fork_name)+ passed_by_original = _levels_passed_by(logger_name=original_name)++ assert passed_by_fork == passed_by_original++ def test_httpx2_drops_the_request_line_of_an_inference_call(+ self,+ tmp_path: Path,+ mocker: MockerFixture,+ caplog: pytest.LogCaptureFixture,+ ) -> None:+ """The line httpx2 logs per request, at INFO with the provider's endpoint in it, emits no record; a warning would still pass.++ The capture is opened at INFO, the root level the boot sets, so an unpinned httpx2 would be captured.+ """+ log_config = _boot_log_config(tmp_path=tmp_path, mocker=mocker, project_file_text=None)++ with _configured_as_the_boot_does(log_config=log_config), caplog.at_level(logging.INFO):+ httpx2_logger = logging.getLogger("httpx2")+ httpx2_logger.info(REQUEST_LINE)+ passes_warnings = httpx2_logger.isEnabledFor(logging.WARNING)++ assert [record for record in caplog.records if record.name == "httpx2"] == []+ assert passes_warnings