Skip to content

fix(memory): honor custom extraction prompts - #18461

Merged
JinHai-CN merged 2 commits into
infiniflow:mainfrom
yzl0ng:fix/memory-custom-extraction-prompts
Aug 19, 2026
Merged

JinHai-CN merged 2 commits into
infiniflow:mainfrom
yzl0ng:fix/memory-custom-extraction-prompts

Conversation

@yzl0ng

@yzl0ng yzl0ng commented Aug 18, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Forward each memory's stored system_prompt and user_prompt to extract_by_llm.
  • Cover both immediate save and queued extraction paths with focused regression tests.
  • Preserve the existing default-prompt fallback when stored prompts are empty.

Fixes #18413.

Testing

  • Added two async regression tests covering both call sites.
  • Verified both tests fail before the fix and pass after it.
  • Ruff check and format validation pass for the changed test and files.

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. python Pull requests that update python code labels Aug 18, 2026
@coderabbitai

coderabbitai Bot commented Aug 18, 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: 99d3afad-7e83-45d0-832c-3c7447c002a1

📥 Commits

Reviewing files that changed from the base of the PR and between f1e6b22 and b596e44.

📒 Files selected for processing (2)
  • api/db/joint_services/memory_message_service.py
  • test/unit_test/api/db/joint_services/test_memory_message_service.py

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


📝 Walkthrough

Walkthrough

The memory save paths now pass configured system and user prompts to LLM extraction. New asynchronous unit tests verify prompt forwarding and return behavior for direct and task-based extraction.

Changes

Memory prompt forwarding

Layer / File(s) Summary
Forward prompts from memory save paths
api/db/joint_services/memory_message_service.py
Both memory extraction call sites pass memory.system_prompt and memory.user_prompt to extract_by_llm.
Validate prompt forwarding
test/unit_test/api/db/joint_services/test_memory_message_service.py
Asynchronous tests verify forwarded prompts and successful or no-extraction results for both save paths.

Estimated code review effort: 2 (Simple) | ~10 minutes

Merge Risk: ⚪ Minimal · up to b596e

This change forwards stored extraction prompts through both immediate and queued memory-save paths while preserving defaults for empty prompts; no actionable merge-blocking risk remains beyond normal checks and review.

Suggested reviewers: lynn-inf, buua436

Poem

A rabbit hops through prompts so bright,
System and user now guide the flight.
Two save paths carry words along,
Tests confirm the routing strong.
Extraction follows the configured song.

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the fix for custom memory extraction prompts.
Description check ✅ Passed The description includes the required Summary section and clearly explains the change, testing, and fallback behavior.
Linked Issues check ✅ Passed The PR passes stored prompts at both extraction call sites and preserves fallback behavior required by issue #18413.
Out of Scope Changes check ✅ Passed The code and regression tests are directly related to the linked issue and stated objectives.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

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.

@JinHai-CN
JinHai-CN requested a review from Lynn-Inf August 19, 2026 04:33

@Lynn-Inf Lynn-Inf left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@Lynn-Inf Lynn-Inf added the ci Continue Integration label Aug 19, 2026
@codecov

codecov Bot commented Aug 19, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 90.65%. Comparing base (f1e6b22) to head (b596e44).
⚠️ Report is 26 commits behind head on main.

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

☔ 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.

@JinHai-CN
JinHai-CN merged commit bf9f06c into infiniflow:main Aug 19, 2026
9 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ci Continue Integration python Pull requests that update python code size:XS This PR changes 0-9 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Memory system_prompt and user_prompt are stored and returned by the API but never reach the extraction LLM

3 participants