Skip to content

feat(warming): replace per-window survival with commitment-based warming model#280

Merged
BYK merged 1 commit into
mainfrom
byk/cache-warming-commitment-model
May 13, 2026
Merged

feat(warming): replace per-window survival with commitment-based warming model#280
BYK merged 1 commit into
mainfrom
byk/cache-warming-commitment-model

Conversation

@BYK
Copy link
Copy Markdown
Owner

@BYK BYK commented May 13, 2026

Summary

  • Bug fix: 1h TTL cache_write cost now correctly uses 2× base price in buildAnthropicProfile() — was using the 5m price for both tiers
  • Bug fix: Cost threshold corrected from read/write to read/(write-read), accounting for the cache read paid on user return (~8.7% for 5m TTL, ~4.2% for 1h TTL)
  • Bug fix: /keep mode now respects break-even cap — was running indefinitely (e.g. 2 hours on a 5m TTL session)
  • New model: Replaces per-window survival analysis with a two-phase commitment model that fuses multiple signals (survival, text-only turns, break fraction, session length) to decide whether to warm, then enforces a hard break-even cap across continuation windows

Key behavioral changes

TTL Max cycles Max warming duration
5m 11 ~55 minutes
1h 24 ~24 hours

New helpers

  • breakFraction() — splits histogram at 3min floor (active coding vs breaks)
  • pSessionFinished() — log-linear signal fusion with sigmoid output
  • expectedWarmupCycles() — forward-looking cost via conditional survival
  • costThreshold() / maxProfitableCycles() — corrected cost model

Other changes

  • Pipeline resets warmupCount on user return for fresh break-even analysis
  • Dashboard shows new commitment model fields (P(finished), P(returns), break fraction, cycles spent/max, warming phase)
  • Config comment updated with corrected threshold values

…, dead-session cap

- Guard warmupCount reset and dead-session re-enable with !isSubagentTurn
  to prevent subagent turns from falsely resetting the break-even counter
- Add missing /keep mode notWarmingReason cases (break-even exceeded,
  cooldown active) so dashboard never shows 'Unknown' for forced sessions
- expectedWarmupCycles returns maxCycles+1 for dead sessions so the
  continuation cap check correctly blocks instead of being a no-op
- Fix warming overview table: show pReturns (new model) not pReturnDampened
  (legacy) to match session detail view
@BYK BYK force-pushed the byk/cache-warming-commitment-model branch from 797051d to 793ef0e Compare May 13, 2026 09:34
@BYK BYK merged commit 128c625 into main May 13, 2026
7 checks passed
@BYK BYK deleted the byk/cache-warming-commitment-model branch May 13, 2026 09:37
This was referenced May 13, 2026
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