Fix order-dependent `plan_reminder` framing-tag warning failing `main` CI

Merged
DM
1mo ago
+6-0
  • No issue: fixes a CI failure on main.

Why

main CI, and every merge-queue run since, fails tests/harness/test_skill_examples.py on a lowest-versions shard:

UserWarning: Framing tag 'plan_reminder' was registered after framing tags were first escaped, ...

pydantic_ai_harness.planning._toolset registers plan_reminder at import time, but the harness imports Planning lazily, through the package __getattr__. In a test process, the first import of Planning can come after another test has already escaped framing text, and register_tag then warns, which filterwarnings = error turns into a failure. Whether that happens depends only on which modules share a shard. The shard split is based on module durations, and the most recent merge changed them, so this ordering now occurs.

Reproduced on main: pytest tests/test_framing.py tests/harness/test_skill_examples.py -p no:randomly fails exactly as CI does, while test_skill_examples.py on its own passes.

Change

tests/harness/conftest.py imports pydantic_ai_harness.planning. Pytest imports conftest files during collection, before any test runs, so the tag is registered before anything is escaped. Test-only change.

Verification

  • The reproduction above now passes (717 tests).
  • tests/harness passes in full (11,384 tests), and no test depends on the tag being registered late.

Note for the harness owner

The same order can happen outside tests: in a notebook or long-lived process, running an agent first and then using Planning for the first time warns the same way. Registering harness framing tags in a module the package imports eagerly would avoid that. This PR doesn't change product behavior.

Checklist

  • No breaking changes in accordance with the version policy.
  • Any permitted compatibility impact has a label, warning, migration and release note, and an exact API-check waiver if the gate reports it.
  • PR title is fit for the release changelog.