fix(memory): skip non-text parts and use millis timestamps in memory search - #1468
fix(memory): skip non-text parts and use millis timestamps in memory search#1468rootkiller6788 wants to merge 1 commit into
Conversation
|
Hi @rootkiller6788, thank you for your contribution and for taking the time to submit this PR. You're right that One ask for the scope then: once #1465 lands, could you rebase this down to just the |
|
Thanks for the review, @sherryfox. I've narrowed the PR down to just the formatTimestamp fix as you suggested.
The timestamp test passes against the core module (1 test, no failures). Could you please take another look? |
|
Two mechanical things @rootkiller6788: |
8ae0daa to
5269b87
Compare
|
Fix: memory search timestamps were parsed as seconds, not millis InMemoryMemoryService.formatTimestamp() was decoding timestamps with Instant.ofEpochSecond(...). The timestamps going Changed it to Instant.ofEpochMilli(...), which is what the values actually are. Tests
This is the narrowed version of the earlier fix — just the timestamp bug, nothing else. |
Summary
InMemoryMemoryService.searchMemoryhad two bugs:Crash on non-text parts. It called
Part.text().get()unconditionally for every part in a stored event. When a session contains tool activity, the stored events includefunctionCall/functionResponseparts whosetext()Optional is empty, so the nextloadMemorysearch threwNoSuchElementExceptionand the memory tool failed.Wrong timestamp unit.
formatTimestampusedInstant.ofEpochSecond, butEvent.timestamp()is epoch milliseconds (Event.build()defaults toInstant.now().toEpochMilli()), so returned memory timestamps were ~1000× in the future.Changes
Instant.ofEpochMilli.InMemoryMemoryServiceTestcovering both regressions.Verification
InMemoryMemoryServiceTest(2 tests).AgentWithMemoryTeststill passes.coremodule suite: 1776 tests, only pre-existing Windows path-separator failure inLocalSkillSourceTest.testListResources(fails on untouched HEAD too).