Skip to content

feat(cache): bypass tool cache when user asks for fresh data#515

Merged
yuga-hashimoto merged 1 commit into
mainfrom
feat/cache-bypass-refresh
Apr 22, 2026
Merged

feat(cache): bypass tool cache when user asks for fresh data#515
yuga-hashimoto merged 1 commit into
mainfrom
feat/cache-bypass-refresh

Conversation

@yuga-hashimoto

Copy link
Copy Markdown
Owner

Priority 1 — Smart home device feel

Summary

The read-only tool cache (#505) is a big latency win for back-to-back follow-ups ("what's the weather?" → "will I need a coat?"). But it also serves stale data when the user explicitly asks for fresh: "what's the latest weather?" or "最新の天気を教えて" would still be answered from the 5-minute-old cache entry, silently defeating user intent.

RefreshIntent scans the user utterance for narrow English / Japanese freshness markers ("latest", "refresh", "update", "right now", "current", "最新", "今の", "更新", "再読み込み", "リロード"). When matched, VoicePipeline.processUserInput clears the entire CachingToolExecutor before routing, so both fast-path and LLM paths hit the underlying tool delegate. The cache rebuilds naturally on the next identical query.

Narrow-by-design

False positives would silently defeat the latency win of the cache. "Weather" alone doesn't qualify — only explicit freshness markers. Word-boundary English regex prevents substring traps ("updatevehicle" won't trigger). Japanese stays substring-matched but the set is small enough to avoid incidental matches.

Test plan

  • New RefreshIntentTest covers: English keywords, Japanese keywords, neutral queries don't trigger, empty/blank, case-insensitivity, word-boundary guard.
  • ./gradlew :app:testStandardDebugUnitTest — green
  • ./gradlew :app:assembleStandardDebug — green

## Priority 1 — Smart home device feel

The read-only tool cache (#505) is a big latency win for back-to-back
follow-ups ("what's the weather?" → "will I need a coat?"). But it
also serves stale data when the user *explicitly* asks for fresh:
"what's the LATEST weather?" or "最新の天気を教えて" would still be
answered from the 5-minute-old cache entry, silently defeating user
intent.

RefreshIntent scans the user utterance for narrow English / Japanese
freshness markers ("latest", "refresh", "update", "right now",
"current", "最新", "今の", "更新", "再読み込み", "リロード"). When
matched, VoicePipeline.processUserInput clears the entire
CachingToolExecutor before routing, so both fast-path and LLM paths
hit the underlying tool delegate. The cache rebuilds naturally on
the next identical query within the TTL.

Keywords are kept narrow on purpose: false positives would silently
defeat the latency win of the cache. "Weather" alone doesn't qualify,
only explicit freshness markers.

Word-boundary English regex prevents substring traps ("updatevehicle"
won't trigger). Japanese stays substring-matched (no word boundaries)
but the set is small enough to avoid incidental matches.
@yuga-hashimoto yuga-hashimoto merged commit e17a4ab into main Apr 22, 2026
2 checks passed
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