Skip to content

fix: return call failed when LLM not available - #16518

Merged
JinHai-CN merged 2 commits into
infiniflow:mainfrom
Haruko386:made
Jul 1, 2026
Merged

JinHai-CN merged 2 commits into
infiniflow:mainfrom
Haruko386:made

Conversation

@Haruko386

Copy link
Copy Markdown
Member

Summary

As title:
return LLM cal failed when failed instead of return northing

image

@Haruko386 Haruko386 added 🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration labels Jul 1, 2026
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jul 1, 2026
@Haruko386
Haruko386 marked this pull request as draft July 1, 2026 03:53
@coderabbitai

coderabbitai Bot commented Jul 1, 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

Run ID: 4374fcc8-871d-4da4-880e-07f1e5227e26

📥 Commits

Reviewing files that changed from the base of the PR and between 828c578 and e4b967f.

📒 Files selected for processing (2)
  • internal/service/ask_service.go
  • internal/service/ask_service_test.go

📝 Walkthrough

Walkthrough

Adds a validation step in AskService's stream finalization that trims the extracted visible answer and, if empty, logs a warning and emits an AskDeltaError instead of continuing to citation insertion and final result emission. Includes a new test covering this scenario.

Changes

Empty LLM Answer Guard

Layer / File(s) Summary
Guard against empty LLM answers
internal/service/ask_service.go, internal/service/ask_service_test.go
Adds strings import and a finalization check that trims the visible answer, emitting AskDeltaError with "LLM call failed" and returning early when empty; adds a test verifying this behavior when the LLM stream yields no chunks.

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

Sequence Diagram(s)

sequenceDiagram
  participant Client
  participant AskService
  participant LLM

  Client->>AskService: Stream(request)
  AskService->>LLM: stream chunks
  LLM-->>AskService: no chunks returned
  AskService->>AskService: trim visible answer
  AskService-->>Client: AskDeltaError ("LLM call failed")
Loading

Poem

A rabbit checked the answer twice,
found it empty, not so nice.
Instead of hopping on ahead,
it warns you with a message said:
"LLM call failed" — hop, we halt! 🐇⚠️

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. 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 matches the PR's main change: returning an LLM call failure error when the model is unavailable.
Description check ✅ Passed The description includes the required Summary section and correctly describes the behavior change, though it is brief and has a typo.
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.

@Haruko386
Haruko386 marked this pull request as ready for review July 1, 2026 03:53
@codecov

codecov Bot commented Jul 1, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 93.16%. Comparing base (b8e960e) to head (653f93b).
⚠️ Report is 9 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16518   +/-   ##
=======================================
  Coverage   93.16%   93.16%           
=======================================
  Files          10       10           
  Lines         717      717           
  Branches      118      118           
=======================================
  Hits          668      668           
  Misses         29       29           
  Partials       20       20           

☔ 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 4a72c97 into infiniflow:main Jul 1, 2026
5 of 6 checks passed
@Haruko386
Haruko386 deleted the made branch July 15, 2026 02:55
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 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