Repository navigation
Description
Problem
Four tests in tests/test_review.py start the Logfire SDK's credential check:
test_review_path_workflowtest_review_branch_workflowtest_review_pr_workflowtest_review_path_watch_mode
The check runs in a background thread, which tries to reach https://logfire-us.pydantic.dev/v1/info. The conftest DNS guard blocks it, so nothing leaves the machine. Every full run still prints the warning, and two builders and one reviewer each flagged it as a possible network call on 2026-10-02:
logfire/_internal/config.py:1884: UserWarning: Logfire API is unreachable ... Failed to resolve 'logfire-us.pydantic.dev' ([Errno -2] External DNS lookup blocked during test execution ...)
Reproduce (about 60 s): uv run pytest -p no:cacheprovider -q -n 0 tests/test_review.py -W "error::UserWarning:logfire".
What is known
- devops-cli does not call
logfire.configurein these tests. Withlogfire.configureandlogfire._internal.config.configureboth wrapped to print their stack, neither was called duringtest_review_path_workflow, yet the warning appeared._init_logfire_if_enabled(commands/review.py:155) returns early, because the test config sets notelemetry.logfire. - No
LOGFIRE_TOKENis set in the environment, and no.logfire/credentials directory exists in the home directory or the checkout. - So the SDK configures itself lazily on some other path, most likely pydantic-ai's instrumentation or a
logfirespan reached from the review workflow, and finds a token somewhere the test does not isolate.
Acceptance criteria
- The cause is found and named in the PR: which call configures Logfire, and where it reads the token.
- A test run never configures the Logfire SDK unless a test asks for it. The conftest isolates whatever the cause reads, or the code stops configuring Logfire implicitly.
- The reproduction above passes with the warning raised as an error.
uv run devops cipasses.
A fifth affected test, and the cause (2026-10-07)
Measured at 36cfbbb; the cited lines were re-read at 5c45b1e (release/v0.2.28), where none of these files has changed.
-
Fifth test.
tests/test_review_stage_flags.py::test_review_cli_stage_flags_propagation(:90) prints the same warning.uv run pytest -q -n0 -W default tests/test_review_stage_flags.pyshows it for that test only [measured]. -
The cause, found by wrapping
logfire.configure. All five tests reach it through devops-cli:- each patches
devops_cli.commands.review.load_settingswith a bareMagicMock(tests/test_review.py:47,:73,:98,:431;tests/test_review_stage_flags.py:93), sosettings.telemetry.logfireis truthy; _init_logfire_if_enabled(commands/review.py:171-185, called at:316,:543and:867) therefore callsLogfireBridge.configure;- the bridge resolves a non-empty token from the mock and calls
logfire.configure(send_to_logfire=True, ...)(telemetry/logfire.py:206); - the SDK then starts its
check_logfire_tokenthread.
This corrects "What is known" above, which saw no
logfire.configurecall at an earlier commit. - each patches
-
The reproduction above passes instead of failing. pytest anchors the
-Wmodule field, soerror::UserWarning:logfirematches only a module named exactlylogfire. The warning comes fromlogfire._internal.config, in a background thread. This command fails exactly the five tests (5 failed, 28 passed) [measured]:
uv run pytest -p no:cacheprovider -q -n 0 tests/test_review.py tests/test_review_stage_flags.py -W "error:Logfire API is unreachable:UserWarning" -W "error::pytest.PytestUnhandledThreadExceptionWarning" -
test(cli): the hermetic floor fails a test that reaches an edge without a fake and resets all process-wide state after every test #1310 may resolve it. Its hermetic floor turns telemetry export off by default and adds the
configfixture that replacesload_settingspatches. That default cannot reach a test whose settings object is aMagicMock. Once these five tests read the floor's config instead,telemetry.logfireis off and the cause is gone, with no product change. test(ai): devops review, devops analyze and the devops ai commands are thin adapters tested over the model seam and edge fakes #1326 moves them offload_settingspatches when it migrates thecommands/reviewtests, unless this item does so first.
Strategic alignment (added).
- Related: test(cli): the hermetic floor fails a test that reaches an edge without a fake and resets all process-wide state after every test #1310 (the hermetic floor, its telemetry-off default and its
configfixture); test(ai): devops review, devops analyze and the devops ai commands are thin adapters tested over the model seam and edge fakes #1326 (migrates thecommands/reviewtests); test(cli): tests double only process edges and mirror the source tree #1307 (the test design that found the fifth test).
Metadata
Metadata
Assignees
Labels
Type
Projects
- StatusShow more project fieldsDone
Activity
dan-petty commentedon Oct 8, 2026
Placed in v0.2.32 on 2026-10-08 at the owner's request ("Populate 10 security and ci issues into each v0.2.30, v0.2.31, and v0.2.32 milestone"). This is a person's placement. Release theme: URLs and host keys read by the library that dials, ollama hardening, and pull-request test-quality tooling. Position 5 of 10 in the release's planned merge order. Its board Status is set to Ready, so the release-start fill keeps it.
dan-petty commentedon Oct 9, 2026
New failure mode (2026-10-09): it now fails an unrelated test
On PR #1460 (CI run 37875213508, job 113642121902),
tests/test_roadmap_dry_runs.py::test_a_dry_run_through_the_entry_point_starts_no_process_and_opens_no_connection[migrate]failed with["getaddrinfo: ('logfire-us.pydantic.dev', 443)"] != []. That test replacessocket.getaddrinfowith a recorder, so the Logfire credential-check thread started by an earlier test resolved its host inside this test's window and was recorded as the dry run's own connection. The PR's change (#900,devops branches create) touches neither telemetry nor roadmap; the same test passed on the eight PRs merged into release/v0.2.30 the same hour, and a rerun is expected to pass.So the background thread is no longer just noise: it makes any test that records socket calls flaky. The fix this item plans (stop the SDK's credential check from starting in tests, or join it before the test ends) removes both.
fix(ci): review workflow tests start the logfire SDK's credential che…
dan-petty-bot commentedon Oct 9, 2026
What changed
#1505, merged into
release/v0.2.32as 1f1a5f8.6 file(s) changed.
How it was verified
Check runs at 9c749a8:
Acceptance Criteria of
docs/agent/tasks/task-965-review-tests-start-no-logfire-token-check.md:MagicMocksettings made_init_logfire_if_enabledcallLogfireBridge.configure, which read the token from the mock throughget_logfire_tokenand calledlogfire.configure, starting thecheck_logfire_tokenthread.filterwarningsentries inpyproject.tomlfail any test that starts the token check, andtests/test_review.pyandtests/test_review_stage_flags.pypass with them.uv run pytest -p no:cacheprovider -q -n 0 tests/test_review.py tests/test_review_stage_flags.py -W "error:Logfire API is unreachable:UserWarning" -W "error::pytest.PytestUnhandledThreadExceptionWarning".uv run devops cipasses: the pre-push gate and the PR's checks run it.feat(release): v0.2.32 (#1516)