Skip to content

ai: enforce response cache TTL on lookup - #747

Draft
OllieinCanada wants to merge 1 commit into
sashiko-dev:mainfrom
OllieinCanada:fix/response-cache-live-expiry
Draft

OllieinCanada wants to merge 1 commit into
sashiko-dev:mainfrom
OllieinCanada:fix/response-cache-live-expiry

Conversation

@OllieinCanada

Copy link
Copy Markdown
Contributor

A running daemon can replay responses older than response_cache_ttl_days because expiration is checked only when the cache opens.

Retain the TTL and filter expired responses on every lookup. Preserve existing cache keys and schema. Safe duration conversion also prevents very large accepted TTLs from deleting fresh entries.

Two offline regressions fail before the fix and pass afterward. All seven cache tests pass. Rust 1.90.0: make check-pr passed with 1150 tests passed, two ignored, formatting and three Clippy profiles. The inherited RUST_LOG override was unset.

DRAFT: required local model self-review remains incomplete because provider authentication failed. No clean local review is claimed. Keep as draft until required review completes.

Base: d7c69ae
Head: 4139008

The daemon reuses its cached provider across reviews. Startup cleanup
alone lets that provider replay responses after their configured TTL.

Retain the TTL and check creation time on every lookup. Expired responses
follow the existing miss path and are replaced after a successful refresh.
Saturate duration arithmetic so large accepted TTL values cannot wrap
and cause startup cleanup to delete fresh entries.

Add offline regressions for expiry without reopening and large TTLs.
Check fresh hits, token accounting and persistence after refresh, and
document validity checks separately from physical cleanup.

Fixes: 7ff827d ("ai: add local response cache provider")
Signed-off-by: Ollie Slapinski <oliverslapinski@hotmail.com>
@OllieinCanada
OllieinCanada marked this pull request as draft October 26, 2026 00:58
@sashiko-bot

sashiko-bot Bot commented Oct 26, 2026

Copy link
Copy Markdown

Sashiko review

✓ No issues found across 1 commit.

Full review log on sashiko.sashiko.dev

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant