Skip to content

Fix: get memory size cache rightly - #18370

Merged
wangq8 merged 1 commit into
infiniflow:mainfrom
Lynn-Inf:fix/get-memory-size-cache
Aug 17, 2026
Merged

wangq8 merged 1 commit into
infiniflow:mainfrom
Lynn-Inf:fix/get-memory-size-cache

Conversation

@Lynn-Inf

Copy link
Copy Markdown
Contributor

Summary

As title.

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Aug 17, 2026
@Lynn-Inf
Lynn-Inf requested a review from wangq8 August 17, 2026 08:20
@Lynn-Inf Lynn-Inf added the ci Continue Integration label Aug 17, 2026
@coderabbitai

coderabbitai Bot commented Aug 17, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro Plus

Run ID: 1405db8a-bd46-417d-b542-848b614633ed

📥 Commits

Reviewing files that changed from the base of the PR and between 57b907c and 52c57b1.

📒 Files selected for processing (1)
  • api/db/joint_services/memory_message_service.py

Included review availability: Your plan includes up to 10 reviews per rolling hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

The change corrects the argument order in the memory-size cache lookup within embed_and_save. It now passes memory.id before memory.tenant_id.

Changes

Memory cache lookup correction

Layer / File(s) Summary
Correct cache lookup arguments
api/db/joint_services/memory_message_service.py
The get_memory_size_cache call now passes memory.id first and memory.tenant_id second.

Estimated code review effort: 1 (Trivial) | ~2 minutes

Merge Risk: ⚪ Minimal · up to 52c57

This is a narrowly scoped cache fix with no actionable merge-blocking risk remaining; it is merge-ready after normal checks and review.

Suggested reviewers: buua436, wangq8

Poem

A rabbit checks the cache with care,
Memory first, tenant there.
The lookup order now is right,
One small fix, the path is bright.
Hop, hop—clean data in sight!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description includes the required heading but only says "As title" and omits the problem context and intended fix. Replace "As title" with a brief description of the incorrect argument order and the correction to pass memory.id and memory.tenant_id.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title identifies the memory size cache fix and matches the pull request's primary change.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@wangq8 wangq8 left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Verified against the signature get_memory_size_cache(memory_id: str, uid: str) in api/db/joint_services/memory_message_service.py.

The function builds the Redis key from the first argument (memory_{memory_id}) and passes [memory_id], [uid] to MessageService.calculate_memory_size. The old call get_memory_size_cache(memory.tenant_id, memory.id) therefore:

  • used the wrong Redis key (memory_{tenant_id} instead of memory_{memory_id}), and
  • swapped the calculate_memory_size arguments.

The new order get_memory_size_cache(memory.id, memory.tenant_id) matches the signature and is consistent with the other call sites (init_memory_size_cache and line 341). This is a correct, minimal fix. LGTM.

@codecov

codecov Bot commented Aug 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.65%. Comparing base (554fb11) to head (52c57b1).
⚠️ Report is 18 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #18370      +/-   ##
==========================================
- Coverage   94.56%   90.65%   -3.91%     
==========================================
  Files          10       10              
  Lines         717      717              
  Branches      118      118              
==========================================
- Hits          678      650      -28     
- Misses         25       39      +14     
- Partials       14       28      +14     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@wangq8
wangq8 merged commit 238b1ae into infiniflow:main Aug 17, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants