Rename `CurrentTime` to `AnnounceCurrentTime`, keeping `CurrentTime` as a deprecated alias
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_timeis now a shim that emits aHarnessDeprecationWarning(warn_module_renamed). CurrentTimeis a@deprecatedsubclass ofAnnounceCurrentTime(announce_current_time/_deprecated.py), so constructing it warns and agent specs with aCurrentTimeblock still load viacustom_capability_types=[CurrentTime].- The root
pydantic_ai_harness.CurrentTimeresolves 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, withharness/current-timekept as a navigation alias, and gains a "Renamed fromCurrentTime" section.
What doesn't change
- The default
idstayscurrent_time, so conversations recorded before the rename keep their instruction key, and the instruction text is unchanged. - Code using
CurrentTimekeeps 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 theid; 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.