Skip to content

Go CLI: fix list provider models - #16493

Merged
JinHai-CN merged 5 commits into
infiniflow:mainfrom
JinHai-CN:fix511
Jul 1, 2026
Merged

JinHai-CN merged 5 commits into
infiniflow:mainfrom
JinHai-CN:fix511

Conversation

@JinHai-CN

Copy link
Copy Markdown
Member

Summary

As title.

Signed-off-by: Jin Hai <[email protected]>
@JinHai-CN JinHai-CN added the ci Continue Integration label Jun 30, 2026
@JinHai-CN
JinHai-CN marked this pull request as ready for review June 30, 2026 08:52
@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Jun 30, 2026
@coderabbitai

coderabbitai Bot commented Jun 30, 2026

Copy link
Copy Markdown
Contributor

Caution

Review failed

An error occurred during the review process. Please try again later.


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.

@coderabbitai

coderabbitai Bot commented Jun 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

Run ID: 16dd6165-7699-4389-aa06-29f3c482594e

📥 Commits

Reviewing files that changed from the base of the PR and between 78c4c43 and 7ad33aa.

📒 Files selected for processing (1)
  • internal/cli/cli_http.go
🚧 Files skipped from review as they are similar to previous changes (1)
  • internal/cli/cli_http.go

📝 Walkthrough

Walkthrough

The CLI command dispatcher now matches api_list_provider_models instead of list_provider_models for the provider-model listing command, while continuing to call the same handler.

Changes

CLI Command Routing

Layer / File(s) Summary
Dispatch label update
internal/cli/cli_http.go
Switch case label for listing provider models changed from "list_provider_models" to "api_list_provider_models", still routing to CommonListModelsCommand.

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

Possibly related PRs

Poem

A tiny hop, a label swap,
The CLI gave one name a pop.
Same handler waits, calm and bright,
For models listed just right.
🐇

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Description check ⚠️ Warning The description only says "As title" and does not provide the required summary or background context from the template. Expand the Summary section with a brief problem statement, what changed, and any relevant background or impact.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly matches the main change: fixing the Go CLI provider-models listing command.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.
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.

@JinHai-CN
JinHai-CN marked this pull request as draft June 30, 2026 08:57
@JinHai-CN
JinHai-CN marked this pull request as ready for review June 30, 2026 08:57
@codecov

codecov Bot commented Jun 30, 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 (7ad33aa).
⚠️ Report is 4 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main   #16493   +/-   ##
=======================================
  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.

@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Jul 1, 2026

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
build.sh (1)

514-525: 🩺 Stability & Availability | 🟠 Major | ⚡ Quick win

Don’t overwrite the admin cleanup trap.

Line 525 replaces the trap from Line 516, so build.sh --run can leave the admin process running after exit or interruption.

Proposed cleanup fix
     print_section "Starting admin server (background)"
     "$RAGFLOW_MAIN_BINARY" --admin &
     ADMIN_PID=$!
-    trap 'kill "$ADMIN_PID" 2>/dev/null || true' EXIT INT TERM
+    cleanup_children() {
+        [ -n "${ADMIN_PID:-}" ] && kill "$ADMIN_PID" 2>/dev/null || true
+        [ -n "${INGESTOR_PID:-}" ] && kill "$INGESTOR_PID" 2>/dev/null || true
+    }
+    trap cleanup_children EXIT INT TERM
@@
     print_section "Starting ingestor (background)"
     "$RAGFLOW_MAIN_BINARY" --ingestor &
     INGESTOR_PID=$!
-    trap 'kill "$INGESTOR_PID" 2>/dev/null || true' EXIT INT TERM
     sleep 1
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@build.sh` around lines 514 - 525, The cleanup trap in the startup flow is
being overwritten when the ingestor is launched, so the admin process may not be
terminated on exit or interruption. Update the trap logic around the admin and
ingestor startup sequence to preserve both cleanup actions by using a single
trap that handles ADMIN_PID and INGESTOR_PID together. Keep the change localized
to the startup block that sets the traps after launching the --admin and
--ingestor processes.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@build.sh`:
- Around line 492-493: The cleanup step only removes the main and CLI binaries,
so stale legacy server/admin/ingestor artifacts can remain after --clean. Update
the clean logic in build.sh to also remove the legacy Go binaries alongside
RAGFLOW_MAIN_BINARY and RAGFLOW_CLI_BINARY, keeping the cleanup behavior
complete during the single-binary transition.
- Around line 523-529: The startup commands in build.sh are using unsupported
mode arguments with RAGFlow main, since cmd/admin_server.go, cmd/ingestor.go,
and cmd/server_main.go only parse flags and do not dispatch on --admin,
--ingestor, or a positional mode after --. Update the script to invoke the
actual entrypoint binaries directly, or add a dispatcher in the Go command layer
that recognizes these modes and routes to the correct server/ingestor/admin
startup logic. Use the existing launch block around the ingestor and server_main
calls to locate and replace the incorrect invocation pattern.

---

Outside diff comments:
In `@build.sh`:
- Around line 514-525: The cleanup trap in the startup flow is being overwritten
when the ingestor is launched, so the admin process may not be terminated on
exit or interruption. Update the trap logic around the admin and ingestor
startup sequence to preserve both cleanup actions by using a single trap that
handles ADMIN_PID and INGESTOR_PID together. Keep the change localized to the
startup block that sets the traps after launching the --admin and --ingestor
processes.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: 8f7897a3-ab7a-41f7-9325-f2d71c32bef6

📥 Commits

Reviewing files that changed from the base of the PR and between d2db637 and bce6865.

📒 Files selected for processing (1)
  • build.sh

Comment thread build.sh Outdated
Comment on lines 492 to 493
rm -f "$RAGFLOW_MAIN_BINARY"
rm -f "$RAGFLOW_CLI_BINARY"

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.

🎯 Functional Correctness | 🟡 Minor | ⚡ Quick win

Keep clean removing the legacy Go binaries.

After this change, --clean leaves stale server/admin/ingestor binaries from previous builds, which makes cleanup misleading during the single-binary transition.

Proposed cleanup extension
     rm -rf "$BUILD_DIR"
     rm -f "$RAGFLOW_MAIN_BINARY"
     rm -f "$RAGFLOW_CLI_BINARY"
+    rm -f "$PROJECT_ROOT/bin/ragflow_server"
+    rm -f "$PROJECT_ROOT/bin/admin_server"
+    rm -f "$PROJECT_ROOT/bin/ragflow_ingestor"
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
rm -f "$RAGFLOW_MAIN_BINARY"
rm -f "$RAGFLOW_CLI_BINARY"
rm -f "$RAGFLOW_MAIN_BINARY"
rm -f "$RAGFLOW_CLI_BINARY"
rm -f "$PROJECT_ROOT/bin/ragflow_server"
rm -f "$PROJECT_ROOT/bin/admin_server"
rm -f "$PROJECT_ROOT/bin/ragflow_ingestor"
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@build.sh` around lines 492 - 493, The cleanup step only removes the main and
CLI binaries, so stale legacy server/admin/ingestor artifacts can remain after
--clean. Update the clean logic in build.sh to also remove the legacy Go
binaries alongside RAGFLOW_MAIN_BINARY and RAGFLOW_CLI_BINARY, keeping the
cleanup behavior complete during the single-binary transition.

Comment thread build.sh Outdated
Comment on lines +523 to +529
"$RAGFLOW_MAIN_BINARY" --ingestor &
INGESTOR_PID=$!
trap 'kill "$INGESTOR_PID" 2>/dev/null || true' EXIT INT TERM
sleep 1

print_section "Starting RAGFlow server (foreground)"
"$RAGFLOW_SERVER_BINARY"
"$RAGFLOW_MAIN_BINARY" -- api

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.

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
set -euo pipefail

main_file="$(fd -p 'cmd/ragflow_main.go' . | head -n 1)"
if [ -z "$main_file" ]; then
  echo "cmd/ragflow_main.go not found"
  exit 1
fi

echo "Inspecting $main_file"
ast-grep outline "$main_file" --view expanded || true

rg -n -C3 -- '--ingestor|ingestor|--admin|case "api"|case "--ingestor"|flag\.|os\.Args' "$main_file" internal/cli cmd

Repository: infiniflow/ragflow

Length of output: 186


🏁 Script executed:

#!/bin/bash
set -euo pipefail

echo "Top-level files:"
git ls-files | sed -n '1,200p'

echo
echo "Locate build.sh and likely entrypoints:"
fd -a 'build.sh|main\.go|ragflow.*go|cli\.go|entrypoint' .

echo
echo "Search for mode handling and binary names:"
rg -n -C3 -- 'ingestor|--ingestor|-- admin|-- api|case "api"|case "ingestor"|RAGFLOW_MAIN_BINARY|RAGFLOW_.*BINARY|os\.Args|flag\.' .

echo
echo "Inspect build.sh around the cited lines if present:"
if [ -f build.sh ]; then
  sed -n '500,545p' build.sh | cat -n
fi

Repository: infiniflow/ragflow

Length of output: 50374


🏁 Script executed:

#!/bin/bash
set -euo pipefail

for f in cmd/admin_server.go cmd/ingestor.go cmd/server_main.go; do
  echo "===== $f ====="
  sed -n '1,140p' "$f" | cat -n
  echo
done

echo "===== flag/args usage ====="
rg -n -C2 'flag\.Parse\(\)|flag\.Args\(\)|os\.Args|Usage:|case .*api|switch .*Args|len\(args\)' cmd/admin_server.go cmd/ingestor.go cmd/server_main.go

Repository: infiniflow/ragflow

Length of output: 19624


Use the actual entrypoints here. cmd/admin_server.go, cmd/ingestor.go, and cmd/server_main.go only parse flags; none of them accepts --admin, --ingestor, or a positional mode after --. Update build.sh to launch the dedicated binaries or add a dispatcher that handles those modes.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@build.sh` around lines 523 - 529, The startup commands in build.sh are using
unsupported mode arguments with RAGFlow main, since cmd/admin_server.go,
cmd/ingestor.go, and cmd/server_main.go only parse flags and do not dispatch on
--admin, --ingestor, or a positional mode after --. Update the script to invoke
the actual entrypoint binaries directly, or add a dispatcher in the Go command
layer that recognizes these modes and routes to the correct
server/ingestor/admin startup logic. Use the existing launch block around the
ingestor and server_main calls to locate and replace the incorrect invocation
pattern.

@dosubot dosubot Bot added size:XS This PR changes 0-9 lines, ignoring generated files. and removed size:M This PR changes 30-99 lines, ignoring generated files. labels Jul 1, 2026
@JinHai-CN
JinHai-CN merged commit f4f9e44 into infiniflow:main Jul 1, 2026
5 of 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.

1 participant