Repository navigation
Go CLI: fix list provider models - #16493
Conversation
Signed-off-by: Jin Hai <[email protected]>
|
Caution Review failedAn 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. Comment |
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
📝 WalkthroughWalkthroughThe CLI command dispatcher now matches ChangesCLI Command Routing
Estimated code review effort: 1 (Trivial) | ~2 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
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. Comment |
Codecov Report✅ All modified and coverable lines are covered by tests. 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. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
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 winDon’t overwrite the admin cleanup trap.
Line 525 replaces the trap from Line 516, so
build.sh --runcan 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
| rm -f "$RAGFLOW_MAIN_BINARY" | ||
| rm -f "$RAGFLOW_CLI_BINARY" |
There was a problem hiding this comment.
🎯 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.
| 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.
| "$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 |
There was a problem hiding this comment.
🎯 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 cmdRepository: 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
fiRepository: 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.goRepository: 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.
Summary
As title.