Skip to content

fix(agent): stop remember() wiping the readonly replay cache for unrelated tools - #2310

Open
Shizoqua wants to merge 1 commit into
HKUDS:mainfrom
Shizoqua:fix/remember-call-wipes-readonly-replay-cache
Open

Shizoqua wants to merge 1 commit into
HKUDS:mainfrom
Shizoqua:fix/remember-call-wipes-readonly-replay-cache

Conversation

@Shizoqua

Copy link
Copy Markdown
Contributor

The bug

_finalize_tool_result clears the whole run-scoped readonly replay cache after any successful non-readonly tool call. remember is non-readonly because it mutates ~/.vibe-trading/memory/, which has no relationship to what read_url, web_search, or session_search would return -- but the system prompt encourages the model to call it often, so every remember() call forces every readonly result since the last compaction to be re-fetched instead of replayed.

The fix

Added an invalidates_readonly_cache flag (default True, preserving today's behavior) and opted RememberTool out of it, since its writes never touch workspace/run_dir state a readonly tool reads.

Tests

Added a case with an unrelated remember() call interleaved between a readonly call and its post-compaction repeat, confirming it's still served from the cache. All 16 existing readonly-replay tests still pass, including the one confirming a genuine write still invalidates the cache.

Fixes #2309

…lated tools

Signed-off-by: Lanre Shittu <136805224+Shizoqua@users.noreply.github.com>

This branch has not been deployed

No deployments
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.

[Bug] remember() wipes the readonly replay cache for completely unrelated tools

1 participant