Files
AstrBot/openspec/changes/fix-runtime-status-star-spec-compliance/tasks.md
2026-03-24 17:43:12 +08:00

1.3 KiB

Tasks: Fix RuntimeStatusStar Spec Compliance

Implementation Tasks

1. Update Orchestrator for message tracking

  • Add _message_count: int = 0 to __init__
  • Add _last_activity_timestamp: float | None = None to __init__
  • Add record_activity() method that increments count and updates timestamp
  • Add record_activity() method (infrastructure ready, caller integration separate)

2. Update RuntimeStatusStar.get_protocol_status

  • Add name field to each protocol's return dict
  • Verify format matches: {"connected": bool, "name": "xxx-client"}

3. Update RuntimeStatusStar.get_stats

  • Import datetime for timestamp formatting
  • Return total_messages from orchestrator's _message_count
  • Return last_activity as ISO formatted timestamp from _last_activity_timestamp
  • Keep uptime_seconds for backward compatibility

4. Update Tests

  • Update test_get_protocol_status to verify name field exists and has correct value
  • Update test_get_stats to verify total_messages and last_activity fields exist
  • Add test for record_activity() method

5. Verification

  • Run uv run pytest tests/unit/test_runtime_status_star.py -v
  • Run uv run pytest tests/unit/test_internal_runtime.py -v
  • Run full test suite: uv run pytest --cov=astrbot tests/