Repository navigation
Keep Mentor profiles separate by lookback window - #1754
Conversation
Use the requested window in the profile cache key so a cached brief cannot answer a request for a different window. Keep automatic hints on the default profile. Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
zlareb1
left a comment
There was a problem hiding this comment.
The cache keeps a separate entry for each lookback window, and automatic hints still use the default profile. The regression covers three windows, repeated cache hits, and default-window eviction.
There was a problem hiding this comment.
Biome rejects the same assignment in docs/pages/adoption.astro on this head and clean main. The pinned formatter passes with the tracked repair. PR format job · Main format job · Repair #1706
The extraction classification test also fails on clean main because changed_files has no content classification. The same assertion passes with the tracked repair. PR unit job · Main unit job · Repair #1747
zlareb1
left a comment
There was a problem hiding this comment.
The new CI attempt found a cache fixture outside the Mentor unit tests that still uses the old key. The ordinary cached case passes on clean main and fails with this diff. The private-request assertions still pass.
zlareb1
left a comment
There was a problem hiding this comment.
The sender census reports the same stale plugin client fingerprints on this CI merge and on clean main. The test passes locally with both fingerprint repairs. PR job · Main job · Plugin repair #1773 · SDK repair #1706
zlareb1
left a comment
There was a problem hiding this comment.
The tunable-constant gate flags the same duplicate coverage limit on this head and on clean main. The coverage repair keeps the store's existing bounds. PR job · Main job · Coverage repair #1722
The adoption directory test fails on this head and on clean main because ClickHouse expires its fixed snapshot rows. The repair derives fixture dates from UTC. PR job · Main job · Adoption repair #1740
Use the same cache key as production so the privacy test can verify an ordinary request reuses its profile without warming it. Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
Signed-off-by: zhangxiaoyu.york <zhangxiaoyu.york@bytedance.com>
zlareb1
left a comment
There was a problem hiding this comment.
The cache keeps each requested lookback window separate, and automatic hints use the default window. The mirror advice fixture uses the new cache key and still checks that private requests leave advice state untouched. The nine focused cache and mirror advice tests pass on this head.
zlareb1
left a comment
There was a problem hiding this comment.
The resolver attestation test fails at the same superseder assertion on this CI merge and on clean main with ClickHouse 26.11.5.8. The fixture needs a successor of equal standing to exercise the timestamp assertion. The integration shard passes on the repair. PR job · Main job · Repair #1781 · Passing shard
Keep Mentor profiles separate by lookback window
Closes: #1753
Changelog category (leave one):
Changelog entry:
mentor.briefuses the requested lookback window even when a brief for a different window is cached.Why
A seven-day brief followed by a one-hour brief returned the seven-day result twice. The profile cache used the same entry for both requests.
Scope and risk
The cache keys include the requested window. Automatic hints still read the default window. Both kinds of profile share the existing cache size limit.
Compatibility, rollout and rollback
Tests
604800and3600seconds on consecutive requests.AI assistance in the code
AI-generated: TRAE authored the change and ran the checks above.
I can explain every line of this diff and how it interacts with the rest of Loom.
Checklist
Note
Medium Risk
In-memory cache behavior changes for mentor profiles; incorrect caching could misreport usage windows until TTL, though wire shapes are unchanged and hints still use the default window.
Overview
Fixes a cache bug where
mentor.brief(andmentor_profile) could return a profile computed for one lookback window when a differentwindow_secondswas requested — e.g. a 7-day brief served again after asking for 1 hour.Profile cache keys now include
window_secondsas a fourth tuple element._cache_putandmentor_profilestore and look up by(org, namespace, agent, window).cached_profile,warm_profile, pack sections, and per-call hints still use only the default 7-day window; non-default windows are cached separately and do not update_profile_shown(that map stays on the 3-tuple identity and is evicted only when a default-window entry is dropped).A regression test asserts 1h, 7d, and 30d profiles stay distinct with no extra store reads on cache hits; eviction and mirror tests were adjusted for the new
_cache_putAPI.Reviewed by Cursor Bugbot for commit 858e12e. Bugbot is set up for automated code reviews on this repo. Configure here.