Skip to content

add reflex_episode_chache_bytes_total gauge + helper and EpisodeCache… - #106

Merged
AniketR10 merged 1 commit into
mainfrom
episode-cache-bytes-metric
May 5, 2026
Merged

add reflex_episode_chache_bytes_total gauge + helper and EpisodeCache…#106
AniketR10 merged 1 commit into
mainfrom
episode-cache-bytes-metric

Conversation

@AniketR10

@AniketR10 AniketR10 commented May 4, 2026

Copy link
Copy Markdown
Collaborator

… to track bytes + emit Promotheus

Description

Type of Change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation update
  • Infrastructure / CI update

How Has This Been Tested?

  • pytest tests/ passes locally
  • reflex doctor sanity check
  • Other (please specify):

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my own code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • I have kept the PR scoped to a single concern (one concern per PR)

@AniketR10
AniketR10 requested a review from rylinjames as a code owner May 4, 2026 16:56
@DsThakurRawat
DsThakurRawat self-requested a review May 5, 2026 06:22
@DsThakurRawat
DsThakurRawat enabled auto-merge (squash) May 5, 2026 06:25
@DsThakurRawat
DsThakurRawat disabled auto-merge May 5, 2026 06:25
@DsThakurRawat
DsThakurRawat enabled auto-merge (rebase) May 5, 2026 06:41
@DsThakurRawat
DsThakurRawat disabled auto-merge May 5, 2026 06:41
@DsThakurRawat
DsThakurRawat enabled auto-merge (squash) May 5, 2026 06:42
@DsThakurRawat
DsThakurRawat disabled auto-merge May 5, 2026 06:42
@DsThakurRawat
DsThakurRawat enabled auto-merge (rebase) May 5, 2026 06:42
@AniketR10
AniketR10 force-pushed the episode-cache-bytes-metric branch from 26b8c30 to 0c23767 Compare May 5, 2026 06:51
@AniketR10
AniketR10 disabled auto-merge May 5, 2026 10:34
@AniketR10
AniketR10 enabled auto-merge (squash) May 5, 2026 10:34
@AniketR10
AniketR10 disabled auto-merge May 5, 2026 17:03
@AniketR10
AniketR10 merged commit af56d0a into main May 5, 2026
4 of 6 checks passed
@AniketR10
AniketR10 deleted the episode-cache-bytes-metric branch May 5, 2026 17:04
huynna12 added a commit to huynna12/reflex-vla that referenced this pull request Jul 7, 2026
insert() never checked whether (episode_id, lang_hash) already existed
in the cache. Re-inserting an existing key would:
  - leak _total_bytes (old entry's bytes never subtracted before the
    new entry's bytes were added), permanently inflating the
    tether_episode_cache_bytes_total gauge from FastCrest#106
  - potentially evict an unrelated LRU entry at capacity, since the
    eviction check runs off len(_cache), which doesn't grow on replace
  - inflate stats.episode_count, documented as "unique episodes seen"

Not reachable via the current production caller (predict_action_chunk
only calls insert() after a lookup() miss), but insert() is public API
on the class FastCrest#103 asked to make byte-accurate, so this closes that gap
directly rather than leaving it latent.

Adds three regression tests; confirmed each fails against the prior
implementation (assert 1032 == 516, episode_count 2 vs 1, evictions 1
vs 0) before passing with the fix.

Also drops two pre-existing unused imports (dataclasses.field,
tests/test_episode_cache_bytes.py's pytest) in the files touched here —
mechanical, zero behavior change.
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