Skip to content

Add TimeProvider-based timing to SafeFileCache crash-loop bypass#417

Merged
mattklein123 merged 3 commits intomainfrom
file_cache
Mar 6, 2026
Merged

Add TimeProvider-based timing to SafeFileCache crash-loop bypass#417
mattklein123 merged 3 commits intomainfrom
file_cache

Conversation

@mattklein123
Copy link
Contributor

Summary

This updates SafeFileCache to use bd_time::TimeProvider for crash-loop timeout logic and makes the 4-hour same-nonce bypass deterministic in tests.

Changes

  • Add TimeProvider injection to SafeFileCache via new_with_time_provider(...) while keeping new(...) on SystemTimeProvider.
  • Persist and evaluate last_successful_cache_at using provider-backed wall clock in crash-loop guard decisions.
  • Update safe_file_cache_test.rs to use TestTimeProvider and strengthen assertions around retry reset and guard re-engagement.
  • Thread provider-aware constructors through bd-runtime and bd-logger (ConfigLoader::new_with_time_provider, Config::new_with_time_provider, and builder wiring).
  • Update bd-client-common/AGENTS.md with full algorithm details for TimeProvider-based behavior and bypass flow.

Signed-off-by: Matt Klein <mklein@bitdrift.io>
Signed-off-by: Matt Klein <mklein@bitdrift.io>
Signed-off-by: Matt Klein <mklein@bitdrift.io>
@mattklein123 mattklein123 merged commit 3ff3b3b into main Mar 6, 2026
6 checks passed
@mattklein123 mattklein123 deleted the file_cache branch March 6, 2026 19:49
@github-actions github-actions bot locked and limited conversation to collaborators Mar 6, 2026
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants