Rename `CurrentTime` to `AnnounceCurrentTime`, keeping `CurrentTime` as a deprecated alias

Merged
DO
4d ago
+265-68

Refs #14427

Renames the harness capability CurrentTime to AnnounceCurrentTime, so it follows the harness naming convention (capability-authoring.md, "Naming Capabilities"): a capability that acts on the run is named with an imperative verb phrase. It matches AnnounceWorkingDirectory (#14427), the other capability that only adds a line to the instructions.

[!WARNING]
Compatibility impact: Existing code that imports CurrentTime gets a HarnessDeprecationWarning, and CurrentTime is now a subclass of AnnounceCurrentTime rather than the class itself, so isinstance(AnnounceCurrentTime(), CurrentTime) is False and type(c) is CurrentTime no longer matches instances built as AnnounceCurrentTime.

Why this can ship in a minor release: Pydantic AI Harness is on 0.x, whose version policy allows renames that keep a deprecated alias; the old name, import path, spec block name and id keep working.

Migration: Replace CurrentTime with AnnounceCurrentTime (and pydantic_ai_harness.current_time with pydantic_ai_harness.announce_current_time); in agent specs, rename the CurrentTime block to AnnounceCurrentTime. The options are unchanged.

The deprecation follows #13245 (DockerSandbox → DockerContainer):

  • The module moves to pydantic_ai_harness.announce_current_time. pydantic_ai_harness.current_time is now a shim that emits a HarnessDeprecationWarning (warn_module_renamed).
  • CurrentTime is a @deprecated subclass of AnnounceCurrentTime (announce_current_time/_deprecated.py), so constructing it warns and agent specs with a CurrentTime block still load via custom_capability_types=[CurrentTime].
  • The root pydantic_ai_harness.CurrentTime resolves lazily through the shim and stays out of __all__, so a star import doesn't warn.
  • The docs page moves to harness/announce-current-time, with harness/current-time kept as a navigation alias, and gains a "Renamed from CurrentTime" section.

What doesn't change

  • The default id stays current_time, so conversations recorded before the rename keep their instruction key, and the instruction text is unchanged.
  • Code using CurrentTime keeps working, with a deprecation warning.

Verification

  • tests/harness/announce_current_time/test_deprecated_names.py: the shim warns and aliases the old name; the root name resolves to it and stays out of __all__; constructing the old class warns and keeps the id; a subclass keeps its own spec name; an old spec block loads.
  • The capability case registry lists the deprecated alias as combining the same way.

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.

šŸ¤– Generated with Claude Code


Summary by cubic

Renames the harness capability CurrentTime to AnnounceCurrentTime so it follows the harness naming convention, which names a capability that acts on the run with a verb phrase, matching AnnounceWorkingDirectory. The old name still works, with a HarnessDeprecationWarning.