Skip to content

fix(agentic_rag): return calculate tool result - #19012

Merged
yingfeng merged 1 commit into
infiniflow:mainfrom
yzl0ng:fix/action-calculate-value
Aug 30, 2026
Merged

yingfeng merged 1 commit into
infiniflow:mainfrom
yzl0ng:fix/action-calculate-value

Conversation

@yzl0ng

@yzl0ng yzl0ng commented Aug 30, 2026

Copy link
Copy Markdown
Contributor

Summary

  • return the value produced by compute_from_facts as the calculate tool result
  • remove response fields backed by keys that the arithmetic helper never returns
  • add an async regression test for the action-session result contract

Problem

compute_from_facts returns successful calculations under its documented value key. _exec_calculate instead read result and computed_value, so every successful calculation was sent back to the action model with null result fields.

This is a focused follow-up to the agentic search refactor in #19000.

Test plan

  • uv run --no-project --python 3.13 --with pytest --with pytest-asyncio --with langchain-core --with langgraph --with json-repair pytest --confcutdir=test/unit_test/rag/advanced_rag test/unit_test/rag/advanced_rag/test_action_session.py -q
  • uvx ruff check test/unit_test/rag/advanced_rag/test_action_session.py
  • uvx ruff check --select E9,F63,F7,F82 rag/advanced_rag/harness/action_session.py
  • uvx ruff format --check rag/advanced_rag/harness/action_session.py test/unit_test/rag/advanced_rag/test_action_session.py

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. 🌈 python Pull requests that update Python code 🐞 bug Something isn't working, pull request that fix bug. 🧪 test Pull requests that update test cases. labels Aug 30, 2026
@coderabbitai

coderabbitai Bot commented Aug 30, 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: 5d434cb3-7434-4ef2-8b1e-e9aee78286d7

📥 Commits

Reviewing files that changed from the base of the PR and between 6129839 and 3d7d3e3.

📒 Files selected for processing (2)
  • rag/advanced_rag/harness/action_session.py
  • test/unit_test/rag/advanced_rag/test_action_session.py

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


📝 Walkthrough

Walkthrough

The calculate executor now reads the result from res.value and removes the computed field. An async unit test verifies the calculation inputs, result, and empty evidence IDs.

Changes

Calculate result handling

Layer / File(s) Summary
Update calculate result contract and coverage
rag/advanced_rag/harness/action_session.py, test/unit_test/rag/advanced_rag/test_action_session.py
_exec_calculate returns res.value as result and no longer returns computed. The test verifies mocked inputs, the calculated result, and empty evidence IDs.

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

Merge Risk: ⚪ Minimal · up to 3d7d3

This focused fix restores calculated values in the existing tool response and adds regression coverage without changing access, dispatch, persistence, dependencies, or deployment behavior. No actionable merge-blocking risk remains.

Suggested reviewers: yingfeng

Poem

A rabbit checked the sums at dawn

The old computed field was gone
Value hopped into result bright
Evidence IDs stayed light
Tests thumped their paws: all right!

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 50.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 4 functions across 2 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly identifies the primary change: fixing the calculate tool to return its result.
Description check ✅ Passed The description includes the required Summary section and clearly explains the problem, solution, scope, and test plan.
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.
  • Fix all pre-merge checks with AI

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.

@yingfeng yingfeng added the ci Continue Integration label Aug 30, 2026
@codecov

codecov Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 39.07%. Comparing base (6129839) to head (3d7d3e3).

Additional details and impacted files
@@            Coverage Diff             @@
##             main   #19012      +/-   ##
==========================================
+ Coverage   30.43%   39.07%   +8.64%     
==========================================
  Files          54       54              
  Lines       14911    14911              
  Branches      117      117              
==========================================
+ Hits         4538     5827    +1289     
+ Misses      10361     9058    -1303     
- Partials       12       26      +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.

@yingfeng
yingfeng merged commit a39b6ec into infiniflow:main Aug 30, 2026
15 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration 🌈 python Pull requests that update Python code size:XS This PR changes 0-9 lines, ignoring generated files. 🧪 test Pull requests that update test cases.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants