Replace memory service timestamp sleeps with monotonic busy-wait #10789

Closed
HAL9000 wants to merge 1 commit from fix/issue-9963-memory-service-timestamp-guards into main
Owner

Summary

Replace time.sleep() timestamp guards in memory_service_coverage_steps.py with a monotonic busy-wait helper that spins on the monotonic clock until UTC timestamps advance. This improves test reliability by eliminating fixed sleep durations and ensuring deterministic clock advancement detection.

Changes

  • Added _wait_for_clock_advance() helper: A shared utility function in memory_service_coverage_steps.py that busy-waits on the monotonic clock until UTC timestamps advance or a deadline is exceeded
  • Replaced four time.sleep(0.01) guards: Updated entity tracking steps to use the new helper instead of fixed sleep durations, improving test determinism
  • Introduced memory_service_clock_wait.feature: A targeted Behave feature that verifies the helper correctly raises an assertion when the clock stays frozen beyond the deadline

Testing

  • nox -e lint
  • nox -e typecheck
  • nox -e unit_tests -- features/memory_service_clock_wait.feature

Issue Reference

Closes #9963


Automated by CleverAgents Bot
Agent: implementation-worker

## Summary Replace `time.sleep()` timestamp guards in `memory_service_coverage_steps.py` with a monotonic busy-wait helper that spins on the monotonic clock until UTC timestamps advance. This improves test reliability by eliminating fixed sleep durations and ensuring deterministic clock advancement detection. ## Changes - **Added `_wait_for_clock_advance()` helper**: A shared utility function in `memory_service_coverage_steps.py` that busy-waits on the monotonic clock until UTC timestamps advance or a deadline is exceeded - **Replaced four `time.sleep(0.01)` guards**: Updated entity tracking steps to use the new helper instead of fixed sleep durations, improving test determinism - **Introduced `memory_service_clock_wait.feature`**: A targeted Behave feature that verifies the helper correctly raises an assertion when the clock stays frozen beyond the deadline ## Testing - ✅ `nox -e lint` - ✅ `nox -e typecheck` - ✅ `nox -e unit_tests -- features/memory_service_clock_wait.feature` ## Issue Reference Closes #9963 --- **Automated by CleverAgents Bot** Agent: implementation-worker
- add _wait_for_clock_advance helper in memory_service_coverage_steps
- replace time.sleep guards with monotonic busy-wait calls in entity tracking steps
- add Behave feature ensuring the helper raises when clock freeze breaches deadline

ISSUES CLOSED: #9963
HAL9000 scheduled this pull request to auto merge when all checks succeed 2026-04-19 17:55:56 +00:00
freemo closed this pull request 2026-04-19 18:02:45 +00:00

Pull request closed

Sign in to join this conversation.
No reviewers
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
cleveragents/cleveragents-core!10789
No description provided.