Repository navigation
Conversation
|
Note Reviews pausedIt looks like this branch is under active development. To avoid overwhelming you with review comments due to an influx of new commits, CodeRabbit has automatically paused this review. You can configure this behavior by changing the Use the following commands to manage reviews:
Use the checkboxes below for quick actions:
📝 WalkthroughWalkthroughThis PR migrates canvas execution, component messaging, tool metadata, harness graph/runtime behavior, service resume wiring, and tracing from earlier APIs to harness-based graphs, interrupts, middleware tool contribution, and local message/tool contracts. ChangesAgent and harness migration
Estimated code review effort🎯 5 (Critical) | ⏱️ ~120 minutes Possibly related PRs
Poem
🚥 Pre-merge checks | ✅ 3 | ❌ 2❌ Failed checks (2 warnings)
✅ Passed checks (3 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. 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 |
There was a problem hiding this comment.
Actionable comments posted: 19
Note
Due to the large number of review comments, Critical, Major severity comments were prioritized as inline comments.
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (9)
internal/agent/tool/exesql_decoder_test.go (1)
48-56:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winRestore explicit error checking in the success-path decode test.
Ignoring the
NewExeSQLConnParamserror here can turn constructor regressions into misleading field/assert failures.Suggested patch
- conn, _ := NewExeSQLConnParams(map[string]any{ + conn, err := NewExeSQLConnParams(map[string]any{ "db_type": "postgres", "host": "db.example.com", "port": 5432, "database": "ragflow", "username": "rag", "password": "secret", "max_records": 100, }) + if err != nil { + t.Fatalf("NewExeSQLConnParams: %v", err) + }🤖 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 `@internal/agent/tool/exesql_decoder_test.go` around lines 48 - 56, In the success-path decode test, the call to NewExeSQLConnParams is currently ignoring the error return value using a blank identifier. Instead of discarding the error with underscore, capture it explicitly and add a proper error check (using require.NoError or similar) to ensure the constructor call succeeds before proceeding with the test assertions. This will ensure that any regressions in the NewExeSQLConnParams constructor are caught immediately rather than causing misleading failures in subsequent field assertions.internal/agent/tool/exesql_trino_test.go (1)
184-208:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAvoid permanently disabling the Trino happy-path test.
An unconditional
t.Skipremoves regression coverage for this flow. Prefer conditional skip (driver presence) and keep assertingInvokableRunerror.Suggested patch
import ( "context" + "database/sql" "strings" "testing" "github.com/DATA-DOG/go-sqlmock" ) @@ func TestExeSQL_Trino_HappyPath(t *testing.T) { - t.Skip("trino driver not registered yet - needs _ \"github.com/trinodb/trino-go-client/trino\" import for end-to-end test") + hasTrino := false + for _, d := range sql.Drivers() { + if d == "trino" { + hasTrino = true + break + } + } + if !hasTrino { + t.Skip("trino driver not registered") + } t.Setenv("TRINO_USE_TLS", "") @@ - out, _ := tool.InvokableRun(context.Background(), + out, err := tool.InvokableRun(context.Background(), `{"sql":"SELECT id, name FROM catalog.tiny.users"}`) + if err != nil { + t.Fatalf("InvokableRun: %v", err) + }🤖 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 `@internal/agent/tool/exesql_trino_test.go` around lines 184 - 208, The TestExeSQLTrino test has an unconditional t.Skip call that permanently disables regression coverage for the Trino happy-path flow. Replace the unconditional t.Skip with a conditional check that only skips if the Trino driver is not available (check driver registration status), allowing the test to run when the driver is properly imported. Keep the existing test logic including the tool.InvokableRun invocation and any assertions that validate the output to maintain coverage of the happy path.internal/agent/tool/google.go (1)
19-25:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winTreat whitespace-only
queryas empty input.
p.Query == ""lets" "through; validate withstrings.TrimSpaceto align with expected required-query behavior.Suggested patch
import ( "context" "encoding/json" "fmt" "net/http" "net/url" + "strings" ) @@ - if p.Query == "" { + if strings.TrimSpace(p.Query) == "" { return googleErrJSON(fmt.Errorf("query is required")), fmt.Errorf("google: query is required") }Also applies to: 137-140
🤖 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 `@internal/agent/tool/google.go` around lines 19 - 25, The query validation in the Google tool is not properly handling whitespace-only input. Currently, the check `p.Query == ""` only catches completely empty strings but allows queries containing only whitespace characters to pass through. Add the "strings" package to the imports if not already present, then find all instances where the query is validated (at lines 137-140 and similar locations) and replace the check `p.Query == ""` with `strings.TrimSpace(p.Query) == ""` to ensure whitespace-only queries are treated as empty and rejected as required input.internal/agent/tool/http_helper_test.go (1)
514-517:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winCheck
x509.CreateCertificateerrors in fixture generation.Line 514 captures
errbut never validates it. If certificate generation fails, later TLS assertions fail with indirect symptoms.✅ Suggested fix
der, err := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv) + if err != nil { + t.Fatalf("x509.CreateCertificate: %v", err) + } return tls.Certificate{🤖 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 `@internal/agent/tool/http_helper_test.go` around lines 514 - 517, The error returned by x509.CreateCertificate is captured in the err variable but not validated before proceeding with the certificate creation. Add an error check after the x509.CreateCertificate call to ensure the certificate generation succeeded, and if not, return an appropriate error or fail the test. This will catch certificate generation failures at the source rather than allowing malformed certificates to propagate and cause indirect failures in later TLS assertions.internal/harness/core/react_graph.go (1)
100-120:⚠️ Potential issue | 🟠 Major | ⚡ Quick winGraph
prepare_inputcomputes merged tools but uses unmerged context.Line 118/119 still passes
agentCfg.ToolsandagentCfg.ReturnDirectlyintoBeforeAgent, so contributor-provided tools/flags are invisible there. AlsoallToolsexcludesagentCfg.ToolsConfig.Tools, which drops valid tools in graph mode.💡 Suggested fix
- allTools := make([]Tool, 0, len(agent.config.Tools)) + allTools := make([]Tool, 0, len(agent.config.Tools)) allTools = append(allTools, agent.config.Tools...) + if agent.config.ToolsConfig != nil { + allTools = append(allTools, agent.config.ToolsConfig.Tools...) + } rc := &ReActAgentContext{ Instruction: s.Instruction, - Tools: agentCfg.Tools, - ReturnDirectly: agentCfg.ReturnDirectly, + Tools: allTools, + ReturnDirectly: allRD, }🤖 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 `@internal/harness/core/react_graph.go` around lines 100 - 120, The prepare_input node function merges tools and return-directly flags from both config and contributor sources into allTools and allRD, but then ignores these merged versions when constructing the ReActAgentContext, instead passing the unmerged agentCfg.Tools and agentCfg.ReturnDirectly. Additionally, allTools does not include agentCfg.ToolsConfig.Tools which drops valid tools. Fix this by: (1) including agentCfg.ToolsConfig.Tools when building the allTools slice along with agent.config.Tools and ec.contribTools, and (2) updating the ReActAgentContext creation to use allTools instead of agentCfg.Tools and allRD instead of agentCfg.ReturnDirectly so that contributor-provided tools and flags are properly passed through BeforeAgent.internal/service/agent.go (1)
788-793:⚠️ Potential issue | 🟠 Major | ⚡ Quick winDo not mark expected interrupt pauses as failed runs.
The code path says interrupts are not failures, but Line 792 still records
MarkFailed, which mislabels normal wait-for-user pauses in run tracking.Suggested fix
if err != nil { if canvas.IsInterruptError(err) { // Interrupt: not a failure. Return state + // interrupt error so Runner.Run can extract the // InterruptCtx list and emit waiting_for_user. - s.markRunFailed(ctx2, runID, "interrupt: "+err.Error()) return state, err }🤖 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 `@internal/service/agent.go` around lines 788 - 793, In the interrupt error handling block where canvas.IsInterruptError(err) is checked, remove the call to s.markRunFailed() that records the interrupt as a failed run. Interrupts are expected pauses for user input and should not be marked as failures in run tracking. Keep the return statement that returns the state and error to allow Runner.Run to properly extract the InterruptCtx list and emit the waiting_for_user status.internal/agent/canvas/node_body.go (1)
168-191:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winPotential nil map passed to component's Invoke.
At line 170, if the input is not a
map[string]any,inMapwill be nil. This nil map is then passed tocomp.Invoke(cctx, inMap)at line 174. While some components may handle nil input gracefully, others may panic or behave unexpectedly.Consider initializing an empty map when the type assertion fails:
return func(ctx context.Context, in any) (any, error) { - inMap, _ := in.(map[string]any) + inMap, ok := in.(map[string]any) + if !ok || inMap == nil { + inMap = map[string]any{} + } timeout := resolveTimeout(componentClass)🤖 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 `@internal/agent/canvas/node_body.go` around lines 168 - 191, In the realComponentBody function, the type assertion on line 170 discards the success flag, allowing a nil map to be passed to comp.Invoke when the input is not of type map[string]any. Instead of using the blank identifier to ignore the second return value from the type assertion, capture it and check whether the assertion succeeded; if it failed, initialize inMap as an empty map using make(map[string]any) to ensure comp.Invoke always receives a valid map rather than nil.internal/handler/agent_wait_for_user_test.go (1)
431-444:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAdd the positive harness-interrupt assertion in this renamed test.
TestIsInterruptError_RecognisesHarnessSignalcurrently validates only non-interrupt cases, so a regression in the positive classification path would still pass.💡 Suggested patch
func TestIsInterruptError_RecognisesHarnessSignal(t *testing.T) { + err := harnessInterrupt(map[string]any{"kind": "user_fill_up", "cpn_id": "answer-1"}) + if err == nil { + t.Fatalf("expected harness interrupt error, got nil") + } + if !canvas.IsInterruptError(err) { + t.Errorf("harness interrupt should be classified as interrupt") + } + // Plain error — not an interrupt. if canvas.IsInterruptError(errors.New("boom")) { t.Errorf("plain error should not be classified as interrupt") }🤖 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 `@internal/handler/agent_wait_for_user_test.go` around lines 431 - 444, The test function TestIsInterruptError_RecognisesHarnessSignal currently only validates negative cases where IsInterruptError should return false (plain errors, context.Canceled, and nil). Add a positive assertion that verifies IsInterruptError correctly returns true when given an actual harness interrupt signal or error to prevent regressions in the positive classification path.internal/agent/canvas/loop_subgraph.go (1)
165-213:⚠️ Potential issue | 🟠 Major | ⚡ Quick winStop swallowing sub-graph edge wiring errors.
AddEdgefailures are currently discarded, which can mask malformed topology and yield hard-to-debug loop behavior. Fail fast with context instead of ignoring these errors.🔧 Suggested patch
for _, up := range upstreams { if up == loopID || members[up] { target := up if up == loopID { target = loopInitKey } - if err := sg.AddEdge(target, cpnID); err != nil { - // Ignore errors from mid-construction edges - _ = err - } + if err := sg.AddEdge(target, cpnID); err != nil { + return nil, fmt.Errorf("canvas: loop %q edge %q->%q: %w", loopID, target, cpnID, err) + } wired = true } } if !wired { // No in-subgraph upstream: wire from init. - _ = sg.AddEdge(loopInitKey, cpnID) + if err := sg.AddEdge(loopInitKey, cpnID); err != nil { + return nil, fmt.Errorf("canvas: loop %q edge %q->%q: %w", loopID, loopInitKey, cpnID, err) + } } } @@ - _ = sg.AddEdge(cpnID, constants.End) + if err := sg.AddEdge(cpnID, constants.End); err != nil { + return nil, fmt.Errorf("canvas: loop %q edge %q->%q: %w", loopID, cpnID, constants.End, err) + } hasEnd = true } if !hasEnd { - _ = sg.AddEdge(loopInitKey, constants.End) + if err := sg.AddEdge(loopInitKey, constants.End); err != nil { + return nil, fmt.Errorf("canvas: loop %q edge %q->%q: %w", loopID, loopInitKey, constants.End, err) + } } @@ - _ = sg.AddEdge(constants.Start, loopInitKey) + if err := sg.AddEdge(constants.Start, loopInitKey); err != nil { + return nil, fmt.Errorf("canvas: loop %q edge %q->%q: %w", loopID, constants.Start, loopInitKey, err) + }🤖 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 `@internal/agent/canvas/loop_subgraph.go` around lines 165 - 213, Remove all instances where AddEdge errors are being silently ignored (using `_ = sg.AddEdge(...)`) throughout the wiring logic in this block. Replace each occurrence with proper error handling that checks the error return value and returns it with context about which edge failed to be added. Specifically, handle errors from AddEdge calls in the upstream wiring loop, the loopInitKey fallback, the downstream to End wiring, the loopInitKey to End fallback, and the Start to loopInitKey connection. Include descriptive error messages that specify the source node, destination node, and operation context to aid debugging of topology issues.
🟡 Minor comments (24)
internal/observability/otel/handler.go-17-22 (1)
17-22:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winDoc comment references non-existent function name.
The package doc mentions
RecordErrorbut the actual exported function isEndSpanWithError.📝 Suggested fix
// Package otel provides OpenTelemetry tracing infrastructure for // agent runs. After the eino-to-harness migration, this package // exposes context helpers (WithRunID / WithSessionID) and a span -// lifecycle API (StartSpan / EndSpan / RecordError) that harness +// lifecycle API (StartSpan / EndSpan / EndSpanWithError) that harness // middlewares and other agent runtime components can use directly // — independent of any framework's callback system.🤖 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 `@internal/observability/otel/handler.go` around lines 17 - 22, The package documentation comment for the otel package references a non-existent function `RecordError` in the list of exported APIs. Update the package doc comment to replace the reference to `RecordError` with the correct function name `EndSpanWithError` to accurately reflect the actual exported functions available (StartSpan, EndSpan, and EndSpanWithError).internal/observability/otel/handler_test.go-92-104 (1)
92-104:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winTest leaves global state as nil without cleanup.
SetTracerProvider(nil)modifies package-level state that persists across tests. While tests in the same package run sequentially by default, this creates fragile test ordering dependencies. Consider adding a cleanup to restore state.Additionally, the test only verifies no panic occurs. It could be strengthened by verifying that no spans are emitted (using a recorder set before the nil provider).
💡 Suggested improvement
func TestStartEndSpan_NoopWithoutProvider(t *testing.T) { - // Ensure default noop state. + // Capture any existing recorder, reset to nil, and restore after test. + recorder := tracetest.NewSpanRecorder() + provider := sdktrace.NewTracerProvider(sdktrace.WithSpanProcessor(recorder)) SetTracerProvider(nil) + t.Cleanup(func() { + SetTracerProvider(provider) + _ = provider.Shutdown(context.Background()) + }) ctx := context.Background() ctx = StartSpan(ctx, "ghost") ctx = EndSpan(ctx) - // If no panic occurs, the test passes. + // Should produce no recorded spans since provider is nil. + if len(recorder.Ended()) != 0 { + t.Errorf("expected 0 spans with nil provider, got %d", len(recorder.Ended())) + } }🤖 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 `@internal/observability/otel/handler_test.go` around lines 92 - 104, In TestStartEndSpan_NoopWithoutProvider, the call to SetTracerProvider(nil) modifies global package state without cleanup, creating test ordering dependencies. Save the original tracer provider before the test starts and use t.Cleanup() to restore it after the test completes. Additionally, strengthen the test by setting up a span recorder before calling SetTracerProvider(nil), then verify that the StartSpan and EndSpan function calls produce no actual spans in the recorder, rather than only checking that no panic occurs.internal/agent/component/agent_test.go-175-178 (1)
175-178:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winRemove duplicate error check.
Lines 175-177 duplicate the error check at lines 169-173. The second check is unreachable dead code.
Suggested fix
_, err := c.Invoke(context.Background(), map[string]any{ "user_prompt": "x", }) if err == nil { t.Fatal("expected error for unknown tool") } - if err == nil { - t.Fatal("expected error for unknown tool, got nil") - } }🤖 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 `@internal/agent/component/agent_test.go` around lines 175 - 178, The error check at lines 175-177 that validates if err is nil and calls t.Fatal with the message "expected error for unknown tool, got nil" is a duplicate of the identical error check that appears earlier at lines 169-173. Remove the duplicate error check block (the second occurrence) to eliminate the unreachable dead code and keep only the first instance of this validation.internal/agent/component/agent_test.go-282-284 (1)
282-284:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winUse
SetDefaultChatInvokerfor thread-safe test isolation.Direct assignment to
defaultChatInvokerbypasses the mutex protection provided bySetDefaultChatInvoker. If tests run in parallel (t.Parallel()), this could cause data races.Suggested fix
- old := defaultChatInvoker - defaultChatInvoker = &exhaustMockInvoker{} - defer func() { defaultChatInvoker = old }() + SetDefaultChatInvoker(&exhaustMockInvoker{}) + t.Cleanup(func() { SetDefaultChatInvoker(nil) })🤖 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 `@internal/agent/component/agent_test.go` around lines 282 - 284, Instead of directly assigning to the defaultChatInvoker variable, use the SetDefaultChatInvoker method to ensure thread-safe test isolation with proper mutex protection. Replace the direct assignment `defaultChatInvoker = &exhaustMockInvoker{}` with a call to SetDefaultChatInvoker passing the exhaustMockInvoker instance, and update the defer cleanup function to restore the original value through SetDefaultChatInvoker as well rather than direct assignment.internal/agent/component/vision_test.go-25-33 (1)
25-33:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winRemove stale test-declaration comments or restore the missing tests.
Lines 25-33 and 130-133 describe
Test...guards, but there are no corresponding test functions here. This creates a false signal of coverage for the message-boundary regressions.Proposed cleanup
-// TestToEinoMessages_PreservesMultiContent guards against the -// regression where toEinoMessages dropped MultiContent at the -// LLM-component → chat-invoker boundary. Without this guard, vision -// inputs would pass the component-level test (which asserts on -// ChatInvokeRequest.Messages, the value slice) but be silently stripped -// before reaching the eino chat model layer. - -// TestToEinoMessages_EmptyMultiContent verifies the no-images path -// produces a clean *ComponentMessage (no nil slice leak). @@ -// TestToEinoMessages_URLPointerIsolation verifies that mutating the -// URL string in the cloned message does NOT affect the source — guards -// against the shallow-copy footgun surfaced by code review.Also applies to: 130-133
🤖 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 `@internal/agent/component/vision_test.go` around lines 25 - 33, The file contains orphaned test documentation comments describing TestToEinoMessages_PreservesMultiContent and TestToEinoMessages_EmptyMultiContent (at lines 25-33 and another instance at lines 130-133) but the actual test functions are not implemented. Remove these stale comments entirely if the tests are no longer needed, or implement the missing test functions based on what the comments describe to ensure coverage for the message-boundary regressions they document.internal/agent/runtime/state.go-86-88 (1)
86-88:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winIncomplete/dangling documentation comment after init() removal.
The comment at lines 86-87 reads "init registers CanvasState with harness internal type registry so that the StatePre/Post handler chain (which uses its own" — but the sentence is incomplete (no closing clause), and line 88 starts a separate comment about
canvasStateJSON. This suggests the init() function was removed but the old comment was only partially updated.Recommend cleaning up the orphaned comment fragment:
-// init registers CanvasState with harness internal type registry so -// that the StatePre/Post handler chain (which uses its own // canvasStateJSON is the wire shape used by MarshalJSON / UnmarshalJSON.🤖 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 `@internal/agent/runtime/state.go` around lines 86 - 88, The comment block starting with "init registers CanvasState with harness internal type registry so that the StatePre/Post handler chain (which uses its own" is incomplete and appears to be orphaned from a removed init() function. Remove these incomplete comment lines that reference the init() function, but keep the following comment about canvasStateJSON on line 88 which describes the actual wire shape used by MarshalJSON and UnmarshalJSON methods.internal/agent/component/switch.go-19-20 (1)
19-20:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winMalformed documentation comment at line 20.
Line 20 reads
// Lambda dependency). It walks...which appears to be a documentation fragment left over from refactoring. The opening parenthesis is unmatched and "Lambda dependency" context is unclear.Recommend clarifying or completing this sentence:
-// Switch is a multi-condition router implemented in pure Go. -// Lambda dependency). It walks a list of AND/OR-combined condition groups +// Switch is a multi-condition router that evaluates AND/OR-combined +// condition groups against the current CanvasState.🤖 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 `@internal/agent/component/switch.go` around lines 19 - 20, The documentation comment for the Switch type has a malformed second line with an unmatched closing parenthesis and unclear reference to "Lambda dependency". Fix the comment by removing the unmatched parenthesis and rephrasing line 20 to clearly complete the description of what Switch does, specifically explaining how it processes AND/OR-combined conditions in the list it walks through.internal/agent/tool/duckduckgo_test.go-166-169 (1)
166-169:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winComment is grammatically incomplete.
The comment fragment on line 169 appears to be left over from a partial edit: "validates the HTTP-based tool InvokableRun produces results." Consider rewriting for clarity.
📝 Suggested fix
// TestDuckDuckGo_RealReactAgent_ExecutesTool drives a real eino // react.NewAgent with the real DuckDuckGoTool (httptest-stubbed -// upstream) and a scripted chat model. Proves the HTTP-based tool is -// validates the HTTP-based tool InvokableRun produces results. +// upstream). Validates that InvokableRun produces results. func TestDuckDuckGo_RealReactAgent_ExecutesTool(t *testing.T) {🤖 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 `@internal/agent/tool/duckduckgo_test.go` around lines 166 - 169, The comment block for the TestDuckDuckGo_RealReactAgent_ExecutesTool function has a grammatical error on line 169. The sentence fragment "validates the HTTP-based tool InvokableRun produces results." is incomplete and does not flow from the previous line which ends with "Proves the HTTP-based tool is". Rewrite the entire comment block to be grammatically complete and clearly describe that the test drives a real react.NewAgent with the real DuckDuckGoTool (with httptest stubbing) and a scripted chat model, and that it verifies the HTTP-based tool's InvokableRun method produces expected results.internal/agent/tool/deepl_test.go-55-56 (1)
55-56:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winSilently ignoring
InvokableRunerror masks test failures.The test validates request details and parses output, but if
InvokableRunreturns an error, these assertions become unreliable. Check the error for clearer diagnostics.🐛 Proposed fix
- out, _ := tool.InvokableRun(context.Background(), + out, err := tool.InvokableRun(context.Background(), `{"api_key":"key-xyz:fx","text":"Hello world","source_lang":"en","target_lang":"de"}`) + if err != nil { + t.Fatalf("InvokableRun: %v", err) + }🤖 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 `@internal/agent/tool/deepl_test.go` around lines 55 - 56, The InvokableRun method call in the test is ignoring its error return value using the blank identifier, which masks test failures and makes diagnostics unclear. Capture the error returned by InvokableRun instead of discarding it, then check if it is not nil and fail the test appropriately using the testing framework's error reporting mechanism to ensure any errors during the invocation are caught and reported rather than silently ignored.internal/agent/tool/crawler_test.go-63-64 (1)
63-64:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winSilently ignoring
InvokableRunerror masks test failures.If the tool returns an error, the test proceeds to parse potentially invalid output as JSON, masking the root cause. Check the error to get clearer test diagnostics.
🐛 Proposed fix
- out, _ := c.InvokableRun(context.Background(), + out, err := c.InvokableRun(context.Background(), `{"url":`+jsonString(srv.URL)+`,"max_depth":0}`) + if err != nil { + t.Fatalf("InvokableRun: %v", err) + }🤖 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 `@internal/agent/tool/crawler_test.go` around lines 63 - 64, The error return value from the InvokableRun method call is being silently ignored using underscore, which masks test failures when the tool returns an error. Instead of ignoring the error, capture it and add an assertion to check that it is nil using a test assertion function like require.NoError. This will ensure that any errors from InvokableRun are properly caught and reported, providing clearer test diagnostics when failures occur.internal/agent/tool/email_test.go-126-126 (1)
126-126:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winSilently ignoring
InvokableRunerror reduces test reliability.If the tool fails, the test continues with potentially invalid output. Check the error for clearer failure diagnostics.
🐛 Proposed fix
- out, _ := tool.InvokableRun(context.Background(), string(argsJSON)) + out, err := tool.InvokableRun(context.Background(), string(argsJSON)) + if err != nil { + t.Fatalf("InvokableRun: %v", err) + }🤖 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 `@internal/agent/tool/email_test.go` at line 126, The InvokableRun method call is ignoring the returned error by using a blank identifier, which prevents the test from detecting failures and continuing with invalid data. Instead of discarding the error with underscore, capture it in a variable and check it explicitly (for example, using require.NoError or a simple if err != nil check). This ensures the test fails immediately if InvokableRun encounters an error, improving test reliability and debugging clarity.internal/agent/tool/github_test.go-103-104 (1)
103-104:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winCheck
InvokableRunerror in the success-path test.Ignoring the returned error can hide request/execution failures behind downstream JSON assertions.
Suggested patch
- out, _ := tool.InvokableRun(context.Background(), + out, err := tool.InvokableRun(context.Background(), `{"query":"ragflow","max_results":5,"token":"ghp_xyz"}`) + if err != nil { + t.Fatalf("InvokableRun: %v", err) + }🤖 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 `@internal/agent/tool/github_test.go` around lines 103 - 104, The error returned by the InvokableRun method call is being ignored with an underscore, which can hide request or execution failures. Capture the error return value instead of discarding it, then add an assertion to verify that no error occurred (using require.NoError or similar test assertion), ensuring that any failures in the request/execution are properly caught by the test.internal/agent/tool/github_test.go-65-65 (1)
65-65:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winAssert URL parsing succeeds before URL field checks.
Dropping
url.Parseerrors weakens this test and can mask malformed URL regressions.Suggested patch
- u, _ := url.Parse(got) + u, err := url.Parse(got) + if err != nil { + t.Fatalf("url.Parse(%q): %v", got, err) + }🤖 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 `@internal/agent/tool/github_test.go` at line 65, In the github_test.go file, the url.Parse call is ignoring its error return value by using the blank identifier. Instead of dropping the error, capture it and assert that url.Parse succeeds before performing any URL field checks. This ensures that malformed URLs are properly caught during testing and prevents regression of URL parsing failures.internal/agent/tool/google_test.go-73-73 (1)
73-73:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winDon’t discard parse/invocation errors in this test.
Line 73 and Line 115 ignore errors, which degrades failure signal and can produce cascading failures instead of an immediate, actionable test failure.
✅ Suggested fix
- u, _ := url.Parse(got) + u, err := url.Parse(got) + if err != nil { + t.Fatalf("parse URL %q: %v", got, err) + } ... - out, _ := tool.InvokableRun(context.Background(), + out, err := tool.InvokableRun(context.Background(), `{"query":"ragflow","api_key":"K","cx":"C","max_results":5}`) + if err != nil { + t.Fatalf("InvokableRun failed: %v (out=%s)", err, out) + }Also applies to: 115-116
🤖 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 `@internal/agent/tool/google_test.go` at line 73, In the test file, the url.Parse function calls are ignoring errors by using the blank identifier instead of properly checking them. Locate all instances where url.Parse is called with a discarded error (including the one around line 73 and the ones around lines 115-116), and refactor each to capture the error in a named variable, then add proper error checking using an appropriate test assertion method such as require.NoError or a conditional check with t.Fatal or t.Errorf to ensure parse failures immediately halt the test with a clear error message rather than cascading into undefined behavior.internal/agent/tool/google_scholar_test.go-91-91 (1)
91-91:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winRestore explicit error checks in the test path.
Line 91 and Line 122 currently discard errors. That makes failures harder to diagnose and can produce panics/secondary failures instead of a clear assertion failure.
✅ Suggested fix
- u, _ := url.Parse(got) + u, err := url.Parse(got) + if err != nil { + t.Fatalf("parse URL %q: %v", got, err) + } ... - out, _ := tool.InvokableRun(context.Background(), + out, err := tool.InvokableRun(context.Background(), `{"query":"transformer","max_results":5}`) + if err != nil { + t.Fatalf("InvokableRun failed: %v (out=%s)", err, out) + }Also applies to: 122-123
🤖 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 `@internal/agent/tool/google_scholar_test.go` at line 91, The url.Parse calls on line 91 and lines 122-123 are discarding errors by using blank identifiers instead of capturing them. Replace the blank identifier with an actual error variable in the url.Parse assignment, then immediately add an error assertion or test failure check to ensure the parsing succeeds. This way, if url.Parse fails, the test will produce a clear assertion failure rather than a secondary panic when trying to use the unparsed result, making the failure easier to diagnose.internal/agent/tool/tushare_test.go-122-123 (1)
122-123:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winIgnoring
InvokableRunerror masks potential failures.The test validates the output JSON but discards the error. If the tool returns an error (e.g., due to transport issues), the test may fail with a confusing JSON unmarshal error instead of surfacing the actual problem. Since the test server returns valid data, the tool should succeed.
Proposed fix
- out, _ := tool.InvokableRun(context.Background(), + out, err := tool.InvokableRun(context.Background(), `{"token":"T-test","api_name":"stock_basic","params":{"list_status":"L"}}`) + if err != nil { + t.Fatalf("InvokableRun failed: %v", err) + }🤖 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 `@internal/agent/tool/tushare_test.go` around lines 122 - 123, The test for InvokableRun is discarding the error return value by using a blank identifier, which masks potential failures and can lead to confusing error messages during test execution. Capture the error returned by the InvokableRun method call and add an assertion to check that it is nil, ensuring that actual failures in the tool execution are properly surfaced rather than hidden by subsequent JSON unmarshal errors.internal/agent/tool/yahoo_finance_test.go-100-101 (1)
100-101:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winIgnoring
InvokableRunerror masks potential failures.The test validates output structure but discards the error. Same pattern issue as other test files.
Proposed fix
- out, _ := tool.InvokableRun(context.Background(), + out, err := tool.InvokableRun(context.Background(), `{"symbols":["AAPL","MSFT"]}`) + if err != nil { + t.Fatalf("InvokableRun failed: %v", err) + }🤖 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 `@internal/agent/tool/yahoo_finance_test.go` around lines 100 - 101, The InvokableRun method call in the test is discarding the error return value by using a blank identifier instead of capturing it. Modify the line to capture the error returned by InvokableRun and add an assertion to verify that the error is nil, ensuring the function call succeeds as expected rather than silently ignoring potential failures.internal/agent/tool/yahoo_finance_test.go-60-60 (1)
60-60:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winIgnoring
url.Parseerror risks nil-pointer panic.Same issue as other test files. If parse fails,
uis nil and subsequent field access panics.Proposed fix
- u, _ := url.Parse(got) + u, err := url.Parse(got) + if err != nil { + t.Fatalf("url.Parse failed: %v (url=%s)", err, got) + }🤖 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 `@internal/agent/tool/yahoo_finance_test.go` at line 60, The url.Parse call is ignoring its error return value by using the blank identifier, which means if parsing fails, u will be nil and any subsequent field access will cause a nil-pointer panic. Fix this by capturing the error return value from url.Parse in the line with u, _ := url.Parse(got), check if the error is not nil, and use t.Fatalf() or t.Errorf() to fail the test with an appropriate error message before proceeding with using u.internal/agent/tool/tushare_test.go-66-66 (1)
66-66:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winIgnoring error from
buildTushareRequestBodyreduces test coverage.The error return is now discarded. If
buildTushareRequestBodyfails for a valid test case, the test will proceed with a nil/empty body and may pass or fail for the wrong reason.Proposed fix
- body, _ := buildTushareRequestBody(tc.params) + body, err := buildTushareRequestBody(tc.params) + if err != nil { + t.Fatalf("buildTushareRequestBody failed: %v", err) + }🤖 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 `@internal/agent/tool/tushare_test.go` at line 66, The error return value from the buildTushareRequestBody function call at line 66 is being ignored with the blank identifier, which can mask failures and reduce test coverage. Capture the error return value from buildTushareRequestBody(tc.params) into a named variable instead of discarding it with underscore, then add an appropriate assertion or check to verify the error is nil for valid test cases, ensuring the test fails if the function unexpectedly errors.internal/agent/tool/wikipedia_test.go-115-115 (1)
115-115:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winIgnoring
InvokableRunerror masks potential failures.The test validates the output JSON structure but discards the error return. If the tool fails, the test may report a confusing JSON unmarshal failure instead of the actual error.
Proposed fix
- out, _ := tool.InvokableRun(context.Background(), `{"query":"RAG","lang":"en","max_results":5}`) + out, err := tool.InvokableRun(context.Background(), `{"query":"RAG","lang":"en","max_results":5}`) + if err != nil { + t.Fatalf("InvokableRun failed: %v", err) + }🤖 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 `@internal/agent/tool/wikipedia_test.go` at line 115, The InvokableRun method call in the test is discarding the error return value with a blank identifier, which can mask actual tool failures and lead to confusing error messages. Instead of using the blank identifier for the error return value, capture the error and add a proper error check using the testing framework (such as require.NoError or similar) to fail the test immediately if InvokableRun encounters an error, ensuring any actual failures are properly reported rather than hidden.internal/agent/tool/wikipedia_test.go-69-69 (1)
69-69:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winIgnoring
url.Parseerror risks nil-pointer panic.If
url.Parsefails,uis nil andu.Hoston line 70 will panic. WhilebuildWikipediaURLis expected to return valid URLs, checking the error provides better failure diagnostics.Proposed fix
- u, _ := url.Parse(got) + u, err := url.Parse(got) + if err != nil { + t.Fatalf("url.Parse failed: %v (url=%s)", err, got) + }🤖 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 `@internal/agent/tool/wikipedia_test.go` at line 69, The error returned by url.Parse is being ignored in the line "u, _ := url.Parse(got)", which means if parsing fails, u will be nil and accessing u.Host on the next line will cause a nil-pointer panic. Modify the code to capture the error from url.Parse instead of ignoring it with the blank identifier, and add a check to handle the error case appropriately (such as using a test assertion or t.Fatalf) before proceeding to access properties of the url.URL object. This ensures that if buildWikipediaURL returns an invalid URL, the test will fail with clear diagnostics rather than panicking.internal/agent/tool/wikipedia_test.go-140-141 (1)
140-141:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winIgnoring
url.Parseerror in test helper risks nil-pointer panic.If
url.Parse(srvURL)fails,uis nil andu.Hoston line 141 will panic. Whilehttptest.Server.URLis always valid, explicit error handling improves robustness if this helper is reused.Proposed fix
func rewriteHostTransport(srvURL string) http.RoundTripper { - u, _ := url.Parse(srvURL) + u, err := url.Parse(srvURL) + if err != nil { + panic(fmt.Sprintf("rewriteHostTransport: invalid URL %q: %v", srvURL, err)) + } return &hostSwapRT{inner: http.DefaultTransport, host: u.Host, scheme: u.Scheme} }🤖 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 `@internal/agent/tool/wikipedia_test.go` around lines 140 - 141, The url.Parse call in the test helper is ignoring the error return value, which could cause a nil-pointer panic if parsing fails (when accessing u.Host on the next line). Add proper error handling by capturing both return values from url.Parse, checking if the error is not nil, and either returning an error from the helper function or failing the test appropriately (using t.Fatalf or similar) if the error occurs. This improves robustness even though httptest.Server.URL is typically valid.internal/harness/core/tool_contributor_test.go-386-389 (1)
386-389:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winDon’t swallow runtime errors in
drainTestFinal.Line 387 only logs
ev.Errand continues, so tests can succeed despite agent failures. Mark test failure when an event error is observed.💡 Suggested fix
- if ev.Err != nil { - t.Logf("event error: %v", ev.Err) - continue - } + if ev.Err != nil { + t.Errorf("event error: %v", ev.Err) + continue + }🤖 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 `@internal/harness/core/tool_contributor_test.go` around lines 386 - 389, In the drainTestFinal function, when checking if ev.Err is not nil, the code currently only logs the error using t.Logf and continues, allowing the test to pass despite agent failures. Instead of just logging the error, call t.Fail() to mark the test as failed, or replace t.Logf with t.Errorf to both log and fail the test immediately. This ensures that any event errors are properly surfaced as test failures rather than being silently logged and ignored.internal/agent/canvas/scheduler.go-133-155 (1)
133-155:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winInput parameter mutation:
c.Componentsis modified in place.The pre-pass at lines 137-155 modifies
c.Componentsby appending toUpstreamslices. This mutates the caller'sCanvasobject, which could cause unexpected behavior if the sameCanvasis reused or if the caller expects it to remain unchanged.Consider working with a defensive copy if this mutation is unintentional, or document this side effect clearly if it's by design.
🤖 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 `@internal/agent/canvas/scheduler.go` around lines 133 - 155, The pre-pass loop that modifies entry.Upstream and updates c.Components[down] is mutating the caller's original Canvas object. Either create a defensive copy of c.Components before the pre-pass loop begins (if this mutation is unintentional), or add clear documentation to the scheduler function signature explaining that the Canvas object is mutated as a side effect. If using a defensive copy, ensure all subsequent code references the copied map instead of the original.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 467e9172-4d80-4002-94c1-45bdb96c9e2b
📒 Files selected for processing (139)
cmd/server_main.gointernal/agent/canvas/canvas.gointernal/agent/canvas/canvas_test.gointernal/agent/canvas/checkpoint_store.gointernal/agent/canvas/compile.gointernal/agent/canvas/interrupt_resume.gointernal/agent/canvas/interrupt_resume_test.gointernal/agent/canvas/loop_semantics_test.gointernal/agent/canvas/loop_subgraph.gointernal/agent/canvas/multibranch.gointernal/agent/canvas/multibranch_test.gointernal/agent/canvas/node_body.gointernal/agent/canvas/node_body_timeout_test.gointernal/agent/canvas/run_tracker.gointernal/agent/canvas/runner.gointernal/agent/canvas/scheduler.gointernal/agent/canvas/scheduler_test.gointernal/agent/canvas/state_serializer.gointernal/agent/component/agent.gointernal/agent/component/agent_meta_test.gointernal/agent/component/agent_test.gointernal/agent/component/begin.gointernal/agent/component/categorize.gointernal/agent/component/fixture_stubs.gointernal/agent/component/grounding_test.gointernal/agent/component/history_window_test.gointernal/agent/component/llm.gointernal/agent/component/llm_retry.gointernal/agent/component/llm_test.gointernal/agent/component/loop.gointernal/agent/component/parallel.gointernal/agent/component/sampler_params_test.gointernal/agent/component/switch.gointernal/agent/component/tool_call_memory_test.gointernal/agent/component/tool_dispatch_test.gointernal/agent/component/types.gointernal/agent/component/universe_a_wrappers.gointernal/agent/component/vision_test.gointernal/agent/runtime/context.gointernal/agent/runtime/selector.gointernal/agent/runtime/state.gointernal/agent/tool/akshare.gointernal/agent/tool/akshare_test.gointernal/agent/tool/arxiv.gointernal/agent/tool/arxiv_test.gointernal/agent/tool/code_exec.gointernal/agent/tool/code_exec_test.gointernal/agent/tool/crawler.gointernal/agent/tool/crawler_test.gointernal/agent/tool/deepl.gointernal/agent/tool/deepl_test.gointernal/agent/tool/duckduckgo.gointernal/agent/tool/duckduckgo_test.gointernal/agent/tool/email.gointernal/agent/tool/email_test.gointernal/agent/tool/exesql.gointernal/agent/tool/exesql_decoder_test.gointernal/agent/tool/exesql_mock_test.gointernal/agent/tool/exesql_test.gointernal/agent/tool/exesql_trino_stub.gointernal/agent/tool/exesql_trino_test.gointernal/agent/tool/github.gointernal/agent/tool/github_test.gointernal/agent/tool/google.gointernal/agent/tool/google_scholar.gointernal/agent/tool/google_scholar_test.gointernal/agent/tool/google_test.gointernal/agent/tool/http_helper.gointernal/agent/tool/http_helper_test.gointernal/agent/tool/jin10.gointernal/agent/tool/jin10_test.gointernal/agent/tool/mcp.gointernal/agent/tool/mcp_test.gointernal/agent/tool/pubmed.gointernal/agent/tool/pubmed_test.gointernal/agent/tool/qweather.gointernal/agent/tool/qweather_test.gointernal/agent/tool/registry.gointernal/agent/tool/registry_test.gointernal/agent/tool/retrieval.gointernal/agent/tool/retrieval_service_test.gointernal/agent/tool/retrieval_test.gointernal/agent/tool/retrieval_wiring_test.gointernal/agent/tool/searxng.gointernal/agent/tool/searxng_test.gointernal/agent/tool/ssrf_test.gointernal/agent/tool/tavily.gointernal/agent/tool/tavily_test.gointernal/agent/tool/tushare.gointernal/agent/tool/tushare_test.gointernal/agent/tool/types.gointernal/agent/tool/wencai.gointernal/agent/tool/wencai_test.gointernal/agent/tool/wikipedia.gointernal/agent/tool/wikipedia_test.gointernal/agent/tool/yahoo_finance.gointernal/agent/tool/yahoo_finance_test.gointernal/agent/workflowx/loop.gointernal/agent/workflowx/loop_example_test.gointernal/agent/workflowx/loop_integration_test.gointernal/agent/workflowx/loop_options_test.gointernal/agent/workflowx/loop_test.gointernal/agent/workflowx/parallel.gointernal/agent/workflowx/parallel_helpers_test.gointernal/agent/workflowx/parallel_integration_test.gointernal/agent/workflowx/parallel_options_test.gointernal/agent/workflowx/parallel_test.gointernal/handler/agent.gointernal/handler/agent_wait_for_user_test.gointernal/harness/README.mdinternal/harness/core/cancel.gointernal/harness/core/graph_integration_test.gointernal/harness/core/middlewares/dynamictool/toolsearch/toolsearch.gointernal/harness/core/middlewares/filesystem/filesystem.gointernal/harness/core/middlewares/skill/skill.gointernal/harness/core/middlewares/subagent/subagent.gointernal/harness/core/model_chain.gointernal/harness/core/model_chain_retry_failover_test.gointernal/harness/core/model_chain_test.gointernal/harness/core/prebuilt/coding/coding.gointernal/harness/core/profile/profile.gointernal/harness/core/react_agent.gointernal/harness/core/react_graph.gointernal/harness/core/react_graph_test.gointernal/harness/core/react_loop.gointernal/harness/core/stability_integration_test.gointernal/harness/core/tool_contributor.gointernal/harness/core/tool_contributor_test.gointernal/harness/graph/graph/graph.gointernal/harness/graph/graph/loop.gointernal/harness/graph/graph/parallel.gointernal/harness/graph/pregel/engine.gointernal/harness/graph/pregel/retry.gointernal/harness/harness.gointernal/observability/otel/handler.gointernal/observability/otel/handler_test.gointernal/service/agent.gointernal/service/agent_run_e2e_test.gointernal/service/agent_sessions.go
💤 Files with no reviewable changes (10)
- internal/agent/workflowx/parallel_helpers_test.go
- internal/agent/workflowx/loop_example_test.go
- internal/agent/workflowx/loop_options_test.go
- internal/agent/workflowx/loop.go
- internal/agent/workflowx/parallel.go
- internal/agent/workflowx/parallel_test.go
- internal/agent/workflowx/loop_test.go
- internal/agent/workflowx/parallel_integration_test.go
- internal/agent/workflowx/parallel_options_test.go
- internal/agent/workflowx/loop_integration_test.go
|
@CodeRabbit review |
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (1)
internal/harness/core/model_chain_test.go (1)
65-77: ⚡ Quick winAdd explicit coverage for
allToolInfospropagation into middleware context.Line 76 still calls
BuildModelWrapperChain(..., nil), so this suite doesn’t verify the newTypedModelContext.Toolswiring path introduced by the signature change.Suggested test adjustment
func TestBuildModelWrapperChain_WithMiddleware(t *testing.T) { var wrapCalled bool + toolInfos := []*schema.ToolInfo{{Name: "calc"}} mw := &testMiddleware{} mw.wrapModel = func(ctx context.Context, m Model[*schema.Message], mc *ModelContext) (Model[*schema.Message], error) { wrapCalled = true + if len(mc.Tools) != 1 || mc.Tools[0].Name != "calc" { + t.Errorf("unexpected middleware tools: %+v", mc.Tools) + } return m, nil } @@ - model := BuildModelWrapperChain(base, nil, cfg, nil) + model := BuildModelWrapperChain(base, nil, cfg, toolInfos)🤖 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 `@internal/harness/core/model_chain_test.go` around lines 65 - 77, The TestBuildModelWrapperChain_WithMiddleware test currently passes nil for the allToolInfos parameter to BuildModelWrapperChain, so it does not verify that tool information is properly propagated to the middleware context through TypedModelContext.Tools. Create a test tool info slice with sample tools, pass it to BuildModelWrapperChain instead of nil, and update the testMiddleware's wrapModel function to assert that the ModelContext.Tools field is correctly populated with the expected tools. This ensures the new TypedModelContext.Tools wiring is properly tested end-to-end.
🤖 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 `@internal/harness/core/cancel.go`:
- Around line 571-574: The case block receiving from channel ch is silently
returning when encountering stream errors (when !ok is true or v.Err is not
nil), which prevents these errors from being propagated to downstream consumers.
Instead of simply returning in the if !ok || v.Err != nil condition, properly
propagate the underlying error state by sending the error information or the
zero-value with error details downstream, so that downstream consumers receive
and handle the actual stream error rather than interpreting the closure as a
normal completion.
---
Nitpick comments:
In `@internal/harness/core/model_chain_test.go`:
- Around line 65-77: The TestBuildModelWrapperChain_WithMiddleware test
currently passes nil for the allToolInfos parameter to BuildModelWrapperChain,
so it does not verify that tool information is properly propagated to the
middleware context through TypedModelContext.Tools. Create a test tool info
slice with sample tools, pass it to BuildModelWrapperChain instead of nil, and
update the testMiddleware's wrapModel function to assert that the
ModelContext.Tools field is correctly populated with the expected tools. This
ensures the new TypedModelContext.Tools wiring is properly tested end-to-end.
🪄 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: 70c6f921-2454-42dd-baa5-80eb12a857db
📒 Files selected for processing (22)
internal/agent/component/agent_meta_test.gointernal/agent/tool/duckduckgo_test.gointernal/agent/tool/exesql_test.gointernal/agent/tool/qweather_test.gointernal/agent/tool/registry_test.gointernal/handler/agent_wait_for_user_test.gointernal/harness/core/cancel.gointernal/harness/core/graph_integration_test.gointernal/harness/core/middlewares/dynamictool/toolsearch/toolsearch.gointernal/harness/core/middlewares/filesystem/filesystem.gointernal/harness/core/middlewares/skill/skill.gointernal/harness/core/middlewares/subagent/subagent.gointernal/harness/core/model_chain.gointernal/harness/core/model_chain_test.gointernal/harness/core/prebuilt/coding/coding.gointernal/harness/core/react_agent.gointernal/harness/core/react_graph.gointernal/harness/core/react_graph_test.gointernal/harness/core/react_loop.gointernal/harness/core/stability_integration_test.gointernal/harness/core/tool_contributor_test.gointernal/harness/graph/pregel/retry.go
💤 Files with no reviewable changes (3)
- internal/agent/component/agent_meta_test.go
- internal/agent/tool/qweather_test.go
- internal/agent/tool/duckduckgo_test.go
🚧 Files skipped from review as they are similar to previous changes (15)
- internal/harness/core/prebuilt/coding/coding.go
- internal/handler/agent_wait_for_user_test.go
- internal/harness/core/middlewares/filesystem/filesystem.go
- internal/harness/graph/pregel/retry.go
- internal/harness/core/graph_integration_test.go
- internal/agent/tool/registry_test.go
- internal/harness/core/react_graph.go
- internal/harness/core/middlewares/dynamictool/toolsearch/toolsearch.go
- internal/harness/core/react_loop.go
- internal/harness/core/middlewares/skill/skill.go
- internal/agent/tool/exesql_test.go
- internal/harness/core/tool_contributor_test.go
- internal/harness/core/react_graph_test.go
- internal/harness/core/react_agent.go
- internal/harness/core/middlewares/subagent/subagent.go
✅ Action performedReview finished.
|
There was a problem hiding this comment.
Actionable comments posted: 1
Caution
Some comments are outside the diff and can’t be posted inline due to platform limitations.
⚠️ Outside diff range comments (4)
internal/agent/tool/crawler_test.go (1)
66-67:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winDon’t ignore
InvokableRunerrors in the success-path test.If fetch/validation fails, this test should fail at the call site instead of trying to unmarshal an empty or error payload.
🐛 Proposed fix
- out, _ := c.InvokableRun(context.Background(), + out, err := c.InvokableRun(context.Background(), `{"url":`+jsonString(srv.URL)+`,"max_depth":0}`) + if err != nil { + t.Fatalf("InvokableRun: %v", err) + }🤖 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 `@internal/agent/tool/crawler_test.go` around lines 66 - 67, The error return value from the InvokableRun method call is being ignored using the blank identifier. Capture the error return value instead of ignoring it, then check if the error is not nil and fail the test appropriately using the testing framework (such as t.Fatalf) with a descriptive error message. This ensures that any fetch or validation failures are caught immediately at the call site rather than attempting to process empty or error payloads in subsequent operations.internal/harness/core/middlewares/filesystem/filesystem_test.go (1)
189-199:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winMake the
read_filetests fail on missing tools and swallowed errors.
TestTool_ReadErrorcurrently passes whenInvokereturns nil, and both read-file tests can fall through successfully ifread_fileis not contributed.🐛 Proposed fix
func TestTool_ReadError(t *testing.T) { mw := New(&Config{Backend: &testBackend{readErr: errors.New("permission denied")}}) for _, tool := range getTools(mw) { if tool.Name() == "read_file" { _, err := tool.Invoke(context.Background(), "secret.txt") - if err != nil { - t.Logf("read error propagated: %v", err) + if err == nil { + t.Fatal("expected read_file to propagate backend error") + } + if !strings.Contains(err.Error(), "permission denied") { + t.Fatalf("err = %v, want permission denied", err) } return } } + t.Fatal("read_file tool not found") } @@ for _, tool := range getTools(mw) { if tool.Name() == "read_file" { result, err := tool.Invoke(context.Background(), "short.txt") @@ return } } + t.Fatal("read_file tool not found") }Also applies to: 217-235
🤖 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 `@internal/harness/core/middlewares/filesystem/filesystem_test.go` around lines 189 - 199, The TestTool_ReadError test does not properly validate that an error is returned and can pass even if the read_file tool is never found. Add an assertion to verify that the error returned from tool.Invoke is not nil (using t.Errorf or t.Fatalf to fail the test if err is nil), and add an assertion before the return statement to fail the test if read_file was never found in the tool list (such as using t.Fatalf if the loop completes without finding the tool). Apply the same fixes to the other read-file test mentioned in the comment range 217-235.internal/agent/canvas/compile.go (1)
47-50:⚠️ Potential issue | 🔴 Critical | ⚡ Quick winMake checkpoint serialization round-trip symmetric.
Putpersists JSON for the checkpoint map, butGetreturns those bytes as__raw__instead of unmarshalling them back to the checkpoint map. A saved checkpoint resumes as{"__raw__": <json bytes>}rather than the harness checkpoint that was written.🐛 Proposed fix
- // Deserialize raw bytes into map - result := make(map[string]interface{}) - result["__raw__"] = data + result := make(map[string]interface{}) + if err := json.Unmarshal(data, &result); err != nil { + return nil, fmt.Errorf("checkpoint unmarshal %q: %w", id, err) + } + if result == nil { + result = make(map[string]interface{}) + } result["thread_id"] = id return result, nilAlso applies to: 62-67
🤖 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 `@internal/agent/canvas/compile.go` around lines 47 - 50, The checkpoint serialization is asymmetric between `Put` and `Get` operations. The `Put` function serializes the checkpoint map to JSON, but the `Get` function (at lines 62-67) stores the retrieved bytes as `__raw__` instead of unmarshalling them back into the checkpoint map structure. To fix this, in the `Get` function, after retrieving the raw bytes from storage, unmarshal the JSON back into the result map using json.Unmarshal so that the checkpoint data is properly deserialized and matches the structure that was originally persisted, ensuring the round-trip serialization is symmetric.internal/observability/otel/handler.go (1)
90-110:⚠️ Potential issue | 🟠 MajorKeep
initTracerandtracerunder the same lock.
resolveTracerreleasestpMuat line 102 before callinginitTracer.Do()at line 103, whileSetTracerProvidercan concurrently resetinitTracerat line 93. IfSetTracerProviderexecutes between the unlock and theDo()call, it creates a freshsync.Oncethat will execute the closure again, allowing stale tracer values to be cached since the write totracerhappens outside the lock.🔒 Proposed fix
var ( tpMu sync.Mutex tp *sdktrace.TracerProvider tracer trace.Tracer - initTracer sync.Once ) @@ func SetTracerProvider(provider *sdktrace.TracerProvider) { tpMu.Lock() defer tpMu.Unlock() tp = provider - initTracer = sync.Once{} // reset so resolveTracer re-initialises + tracer = tracerForProvider(provider) } + +func tracerForProvider(provider *sdktrace.TracerProvider) trace.Tracer { + if provider == nil { + return noop.NewTracerProvider().Tracer(TracerName) + } + return provider.Tracer(TracerName) +} @@ func resolveTracer() trace.Tracer { tpMu.Lock() - tpVal := tp - tpMu.Unlock() - initTracer.Do(func() { - if tpVal == nil { - tracer = noop.NewTracerProvider().Tracer(TracerName) - return - } - tracer = tpVal.Tracer(TracerName) - }) + defer tpMu.Unlock() + if tracer == nil { + tracer = tracerForProvider(tp) + } return tracer }🤖 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 `@internal/observability/otel/handler.go` around lines 90 - 110, The race condition occurs because in the resolveTracer function, the tpMu lock is released before calling initTracer.Do(), allowing SetTracerProvider to reset initTracer concurrently. This causes stale tracer values to be cached when the reset sync.Once executes the closure again. Keep the lock held by moving the initTracer.Do() call to occur while tpMu is still locked, ensuring that SetTracerProvider cannot reset initTracer between the unlock at line 101 and the Do() call at line 103, and protecting all writes to the tracer variable from concurrent modification.
🤖 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 `@internal/agent/canvas/interrupt_resume.go`:
- Around line 52-58: The interrupt.Interrupt call in the UserFillUpNodeBody
function currently passes only inputSpec to the interrupt context, which causes
downstream FirstInterruptID to lose the component ID information and instead see
a generic map structure. Modify the value passed to interrupt.Interrupt to
include the cpnID parameter along with inputSpec, so that
MustExtractInterruptContexts can properly extract and track which UserFillUp
component is waiting. Apply the same fix to the other occurrence mentioned at
lines 97-101.
---
Outside diff comments:
In `@internal/agent/canvas/compile.go`:
- Around line 47-50: The checkpoint serialization is asymmetric between `Put`
and `Get` operations. The `Put` function serializes the checkpoint map to JSON,
but the `Get` function (at lines 62-67) stores the retrieved bytes as `__raw__`
instead of unmarshalling them back into the checkpoint map structure. To fix
this, in the `Get` function, after retrieving the raw bytes from storage,
unmarshal the JSON back into the result map using json.Unmarshal so that the
checkpoint data is properly deserialized and matches the structure that was
originally persisted, ensuring the round-trip serialization is symmetric.
In `@internal/agent/tool/crawler_test.go`:
- Around line 66-67: The error return value from the InvokableRun method call is
being ignored using the blank identifier. Capture the error return value instead
of ignoring it, then check if the error is not nil and fail the test
appropriately using the testing framework (such as t.Fatalf) with a descriptive
error message. This ensures that any fetch or validation failures are caught
immediately at the call site rather than attempting to process empty or error
payloads in subsequent operations.
In `@internal/harness/core/middlewares/filesystem/filesystem_test.go`:
- Around line 189-199: The TestTool_ReadError test does not properly validate
that an error is returned and can pass even if the read_file tool is never
found. Add an assertion to verify that the error returned from tool.Invoke is
not nil (using t.Errorf or t.Fatalf to fail the test if err is nil), and add an
assertion before the return statement to fail the test if read_file was never
found in the tool list (such as using t.Fatalf if the loop completes without
finding the tool). Apply the same fixes to the other read-file test mentioned in
the comment range 217-235.
In `@internal/observability/otel/handler.go`:
- Around line 90-110: The race condition occurs because in the resolveTracer
function, the tpMu lock is released before calling initTracer.Do(), allowing
SetTracerProvider to reset initTracer concurrently. This causes stale tracer
values to be cached when the reset sync.Once executes the closure again. Keep
the lock held by moving the initTracer.Do() call to occur while tpMu is still
locked, ensuring that SetTracerProvider cannot reset initTracer between the
unlock at line 101 and the Do() call at line 103, and protecting all writes to
the tracer variable from concurrent modification.
🪄 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: 9aebc04a-084c-4682-b94c-f612e27b2fd3
📒 Files selected for processing (16)
cmd/server_main.gointernal/agent/canvas/checkpoint_store.gointernal/agent/canvas/compile.gointernal/agent/canvas/interrupt_resume.gointernal/agent/canvas/loop_subgraph.gointernal/agent/component/llm.gointernal/agent/tool/crawler_test.gointernal/agent/tool/email_test.gointernal/harness/core/cancel.gointernal/harness/core/middlewares/filesystem/filesystem.gointernal/harness/core/middlewares/filesystem/filesystem_test.gointernal/harness/core/middlewares/subagent/subagent.gointernal/harness/core/react_loop.gointernal/harness/graph/graph/parallel.gointernal/observability/otel/handler.gointernal/service/agent.go
✅ Files skipped from review due to trivial changes (1)
- internal/agent/canvas/checkpoint_store.go
🚧 Files skipped from review as they are similar to previous changes (7)
- internal/agent/tool/email_test.go
- internal/harness/core/react_loop.go
- internal/harness/graph/graph/parallel.go
- internal/harness/core/middlewares/subagent/subagent.go
- internal/harness/core/middlewares/filesystem/filesystem.go
- internal/harness/core/cancel.go
- internal/agent/component/llm.go
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## main #16165 +/- ##
=======================================
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 (3)
internal/agent/tool/exesql_decoder_test.go (1)
48-56:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winDon’t ignore constructor errors in the all-fields decode test.
Line 48 drops
err, which weakens this test’s guarantee that valid full input decodes without errors.Suggested fix
- conn, _ := NewExeSQLConnParams(map[string]any{ + conn, err := NewExeSQLConnParams(map[string]any{ "db_type": "postgres", "host": "db.example.com", "port": 5432, "database": "ragflow", "username": "rag", "password": "secret", "max_records": 100, }) + if err != nil { + t.Fatalf("NewExeSQLConnParams(all fields) returned error: %v", err) + }🤖 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 `@internal/agent/tool/exesql_decoder_test.go` around lines 48 - 56, The test is ignoring the error return value from NewExeSQLConnParams by using a blank identifier, which means the test doesn't verify that valid input decodes without errors. Capture the error return value from the NewExeSQLConnParams call instead of discarding it with underscore, and add an assertion to verify that the error is nil (for example using require.NoError or similar test assertion). This strengthens the test to guarantee that the valid full input actually decodes successfully.internal/agent/tool/ssrf_test.go (1)
89-95:⚠️ Potential issue | 🟠 Major | ⚡ Quick winReinstate the success-path
errassertion inliteral_public_ip.Line 89 ignores
err, which can let this SSRF regression test pass even if validation starts failing unexpectedly.Suggested fix
- host, ip, _ := ResolveAndValidate("https://1.1.1.1/foo") + host, ip, err := ResolveAndValidate("https://1.1.1.1/foo") + if err != nil { + t.Fatalf("ResolveAndValidate(literal public IP) = %v, want nil", err) + } if host != "1.1.1.1" { t.Errorf("host = %q, want 1.1.1.1", host) }🤖 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 `@internal/agent/tool/ssrf_test.go` around lines 89 - 95, The test for the success path in literal_public_ip is ignoring the error return value from the ResolveAndValidate function call by using the underscore blank identifier. Replace the underscore with a named error variable to capture the error return value, then add an assertion to verify that the error is nil. This ensures that the test properly validates the success path and will catch any unexpected failures in the ResolveAndValidate function that could indicate a regression.internal/agent/tool/http_helper_test.go (1)
532-537:⚠️ Potential issue | 🟠 Major | ⚡ Quick winIgnoring
x509.CreateCertificateerror silently returns invalid certificate.If
CreateCertificatefails,derwill beniland the returnedtls.Certificatewill be invalid, causing cryptic TLS handshake failures in tests that use this helper. The error should be checked and the test should fail explicitly.🐛 Proposed fix
der, err := x509.CreateCertificate(rand.Reader, &template, &template, &priv.PublicKey, priv) + if err != nil { + t.Fatalf("x509.CreateCertificate: %v", err) + } return tls.Certificate{ Certificate: [][]byte{der}, PrivateKey: priv, }🤖 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 `@internal/agent/tool/http_helper_test.go` around lines 532 - 537, The error returned from x509.CreateCertificate is not being checked before the result is used. If the CreateCertificate call fails, der will be nil and the returned tls.Certificate will be invalid, causing unclear failures downstream. Add an error check immediately after the x509.CreateCertificate call in the certificate creation helper function, and handle the error appropriately by either returning it from the function (if you update the return signature to include error) or failing the test explicitly using t.Fatalf or similar mechanism to provide clear diagnostic information rather than allowing invalid certificates to propagate.
🤖 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 `@internal/agent/component/llm.go`:
- Around line 204-210: The message conversion loop that populates ragMsgs only
copies the Role and Content fields from req.Messages into models.Message, but
multimodal content (such as images) is stored in the MultiContent field which is
intentionally used in the message preparation logic. When constructing each
models.Message in the loop (around line 206), you need to also copy the
MultiContent field from the source message m to preserve all multimodal message
parts before passing the messages to cm.ModelDriver.ChatWithMessages.
In `@internal/agent/tool/http_helper_test.go`:
- Around line 466-467: The net.Listen call ignores its error return value, which
means if it fails, ln will be nil and the defer ln.Close() statement will panic.
Check the error returned by net.Listen after calling it and fail the test
explicitly using t.Fatal or t.Fatalf if an error occurs, ensuring the test fails
gracefully rather than causing a nil pointer panic.
---
Outside diff comments:
In `@internal/agent/tool/exesql_decoder_test.go`:
- Around line 48-56: The test is ignoring the error return value from
NewExeSQLConnParams by using a blank identifier, which means the test doesn't
verify that valid input decodes without errors. Capture the error return value
from the NewExeSQLConnParams call instead of discarding it with underscore, and
add an assertion to verify that the error is nil (for example using
require.NoError or similar test assertion). This strengthens the test to
guarantee that the valid full input actually decodes successfully.
In `@internal/agent/tool/http_helper_test.go`:
- Around line 532-537: The error returned from x509.CreateCertificate is not
being checked before the result is used. If the CreateCertificate call fails,
der will be nil and the returned tls.Certificate will be invalid, causing
unclear failures downstream. Add an error check immediately after the
x509.CreateCertificate call in the certificate creation helper function, and
handle the error appropriately by either returning it from the function (if you
update the return signature to include error) or failing the test explicitly
using t.Fatalf or similar mechanism to provide clear diagnostic information
rather than allowing invalid certificates to propagate.
In `@internal/agent/tool/ssrf_test.go`:
- Around line 89-95: The test for the success path in literal_public_ip is
ignoring the error return value from the ResolveAndValidate function call by
using the underscore blank identifier. Replace the underscore with a named error
variable to capture the error return value, then add an assertion to verify that
the error is nil. This ensures that the test properly validates the success path
and will catch any unexpected failures in the ResolveAndValidate function that
could indicate a regression.
🪄 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: 28693fb8-0bd2-42b5-8143-e89e39107987
📒 Files selected for processing (136)
cmd/server_main.gointernal/agent/canvas/canvas.gointernal/agent/canvas/canvas_test.gointernal/agent/canvas/checkpoint_store.gointernal/agent/canvas/compile.gointernal/agent/canvas/interrupt_resume.gointernal/agent/canvas/interrupt_resume_test.gointernal/agent/canvas/loop_semantics_test.gointernal/agent/canvas/loop_subgraph.gointernal/agent/canvas/multibranch.gointernal/agent/canvas/multibranch_test.gointernal/agent/canvas/node_body.gointernal/agent/canvas/node_body_timeout_test.gointernal/agent/canvas/run_tracker.gointernal/agent/canvas/runner.gointernal/agent/canvas/scheduler.gointernal/agent/canvas/scheduler_test.gointernal/agent/canvas/state_serializer.gointernal/agent/component/agent.gointernal/agent/component/agent_meta_test.gointernal/agent/component/agent_test.gointernal/agent/component/begin.gointernal/agent/component/categorize.gointernal/agent/component/fixture_stubs.gointernal/agent/component/grounding_test.gointernal/agent/component/history_window_test.gointernal/agent/component/llm.gointernal/agent/component/llm_retry.gointernal/agent/component/llm_test.gointernal/agent/component/loop.gointernal/agent/component/parallel.gointernal/agent/component/sampler_params_test.gointernal/agent/component/switch.gointernal/agent/component/tool_call_memory_test.gointernal/agent/component/tool_dispatch_test.gointernal/agent/component/types.gointernal/agent/component/universe_a_wrappers.gointernal/agent/component/vision_test.gointernal/agent/runtime/context.gointernal/agent/runtime/selector.gointernal/agent/runtime/state.gointernal/agent/tool/akshare.gointernal/agent/tool/akshare_test.gointernal/agent/tool/arxiv.gointernal/agent/tool/arxiv_test.gointernal/agent/tool/code_exec.gointernal/agent/tool/code_exec_test.gointernal/agent/tool/crawler.gointernal/agent/tool/crawler_test.gointernal/agent/tool/deepl.gointernal/agent/tool/deepl_test.gointernal/agent/tool/duckduckgo.gointernal/agent/tool/duckduckgo_test.gointernal/agent/tool/email.gointernal/agent/tool/email_test.gointernal/agent/tool/exesql.gointernal/agent/tool/exesql_decoder_test.gointernal/agent/tool/exesql_mock_test.gointernal/agent/tool/exesql_test.gointernal/agent/tool/exesql_trino_stub.gointernal/agent/tool/exesql_trino_test.gointernal/agent/tool/github.gointernal/agent/tool/github_test.gointernal/agent/tool/google.gointernal/agent/tool/google_scholar.gointernal/agent/tool/google_scholar_test.gointernal/agent/tool/google_test.gointernal/agent/tool/http_helper.gointernal/agent/tool/http_helper_test.gointernal/agent/tool/jin10.gointernal/agent/tool/jin10_test.gointernal/agent/tool/mcp.gointernal/agent/tool/mcp_test.gointernal/agent/tool/pubmed.gointernal/agent/tool/pubmed_test.gointernal/agent/tool/qweather.gointernal/agent/tool/qweather_test.gointernal/agent/tool/registry.gointernal/agent/tool/registry_test.gointernal/agent/tool/retrieval.gointernal/agent/tool/retrieval_service_test.gointernal/agent/tool/retrieval_test.gointernal/agent/tool/retrieval_wiring_test.gointernal/agent/tool/searxng.gointernal/agent/tool/searxng_test.gointernal/agent/tool/ssrf_test.gointernal/agent/tool/tavily.gointernal/agent/tool/tavily_test.gointernal/agent/tool/tushare.gointernal/agent/tool/tushare_test.gointernal/agent/tool/types.gointernal/agent/tool/wencai.gointernal/agent/tool/wencai_test.gointernal/agent/tool/wikipedia.gointernal/agent/tool/wikipedia_test.gointernal/agent/tool/yahoo_finance.gointernal/agent/tool/yahoo_finance_test.gointernal/agent/workflowx/loop.gointernal/agent/workflowx/loop_example_test.gointernal/agent/workflowx/loop_integration_test.gointernal/agent/workflowx/loop_options_test.gointernal/agent/workflowx/loop_test.gointernal/agent/workflowx/parallel.gointernal/agent/workflowx/parallel_helpers_test.gointernal/agent/workflowx/parallel_integration_test.gointernal/agent/workflowx/parallel_options_test.gointernal/agent/workflowx/parallel_test.gointernal/handler/agent.gointernal/handler/agent_wait_for_user_test.gointernal/harness/core/cancel.gointernal/harness/core/graph_integration_test.gointernal/harness/core/middlewares/dynamictool/toolsearch/toolsearch.gointernal/harness/core/middlewares/filesystem/filesystem.gointernal/harness/core/middlewares/filesystem/filesystem_test.gointernal/harness/core/middlewares/skill/skill.gointernal/harness/core/middlewares/subagent/subagent.gointernal/harness/core/model_chain.gointernal/harness/core/model_chain_test.gointernal/harness/core/prebuilt/coding/coding.gointernal/harness/core/react_agent.gointernal/harness/core/react_graph.gointernal/harness/core/react_graph_test.gointernal/harness/core/react_loop.gointernal/harness/core/stability_integration_test.gointernal/harness/core/tool_contributor_test.gointernal/harness/graph/graph/graph.gointernal/harness/graph/graph/loop.gointernal/harness/graph/graph/parallel.gointernal/harness/graph/pregel/engine.gointernal/harness/graph/pregel/retry.gointernal/harness/harness.gointernal/observability/otel/handler.gointernal/observability/otel/handler_test.gointernal/service/agent.gointernal/service/agent_run_e2e_test.gointernal/service/agent_sessions.go
💤 Files with no reviewable changes (10)
- internal/agent/workflowx/loop.go
- internal/agent/workflowx/parallel_integration_test.go
- internal/agent/workflowx/loop_example_test.go
- internal/agent/workflowx/parallel_helpers_test.go
- internal/agent/workflowx/loop_options_test.go
- internal/agent/workflowx/parallel_test.go
- internal/agent/workflowx/parallel.go
- internal/agent/workflowx/loop_test.go
- internal/agent/workflowx/parallel_options_test.go
- internal/agent/workflowx/loop_integration_test.go
✅ Files skipped from review due to trivial changes (15)
- internal/agent/canvas/run_tracker.go
- internal/agent/component/llm_retry.go
- internal/agent/component/fixture_stubs.go
- internal/agent/component/parallel.go
- internal/agent/component/agent_meta_test.go
- internal/agent/canvas/canvas.go
- internal/agent/component/llm_test.go
- internal/agent/runtime/context.go
- internal/agent/runtime/selector.go
- internal/handler/agent.go
- internal/agent/component/loop.go
- internal/agent/canvas/checkpoint_store.go
- internal/agent/component/switch.go
- internal/agent/runtime/state.go
- internal/agent/tool/http_helper.go
🚧 Files skipped from review as they are similar to previous changes (97)
- internal/agent/component/begin.go
- internal/agent/tool/wencai_test.go
- internal/agent/tool/arxiv_test.go
- internal/agent/tool/akshare_test.go
- internal/agent/canvas/scheduler_test.go
- internal/agent/tool/jin10_test.go
- internal/agent/tool/tushare_test.go
- internal/agent/tool/crawler_test.go
- internal/agent/component/sampler_params_test.go
- internal/agent/tool/retrieval_service_test.go
- internal/agent/tool/types.go
- internal/agent/canvas/canvas_test.go
- internal/agent/canvas/node_body_timeout_test.go
- internal/agent/component/grounding_test.go
- internal/agent/tool/retrieval_wiring_test.go
- internal/agent/canvas/state_serializer.go
- internal/agent/tool/wikipedia_test.go
- internal/harness/graph/pregel/retry.go
- internal/agent/tool/mcp_test.go
- internal/agent/tool/exesql_mock_test.go
- internal/harness/core/prebuilt/coding/coding.go
- internal/agent/tool/github_test.go
- internal/agent/component/history_window_test.go
- internal/harness/core/graph_integration_test.go
- internal/agent/component/types.go
- internal/agent/tool/google_scholar_test.go
- internal/agent/tool/wikipedia.go
- internal/agent/tool/exesql_trino_stub.go
- internal/agent/tool/tavily_test.go
- internal/agent/tool/qweather.go
- internal/agent/component/tool_call_memory_test.go
- internal/agent/tool/code_exec_test.go
- internal/agent/component/categorize.go
- internal/agent/tool/duckduckgo.go
- internal/agent/tool/tavily.go
- internal/agent/tool/arxiv.go
- internal/agent/tool/crawler.go
- internal/agent/tool/yahoo_finance.go
- internal/agent/tool/mcp.go
- internal/agent/tool/pubmed_test.go
- internal/agent/tool/searxng_test.go
- internal/agent/tool/searxng.go
- internal/harness/core/react_graph_test.go
- internal/agent/canvas/loop_semantics_test.go
- internal/agent/tool/exesql.go
- internal/agent/tool/duckduckgo_test.go
- internal/agent/tool/google_test.go
- internal/agent/canvas/node_body.go
- internal/harness/core/react_loop.go
- internal/agent/tool/akshare.go
- internal/harness/core/stability_integration_test.go
- internal/agent/tool/email.go
- internal/agent/canvas/multibranch_test.go
- internal/agent/tool/tushare.go
- internal/agent/canvas/multibranch.go
- internal/agent/canvas/interrupt_resume_test.go
- internal/agent/tool/pubmed.go
- internal/agent/component/universe_a_wrappers.go
- internal/agent/canvas/runner.go
- internal/agent/tool/deepl.go
- internal/agent/tool/wencai.go
- internal/harness/core/tool_contributor_test.go
- internal/agent/canvas/scheduler.go
- internal/handler/agent_wait_for_user_test.go
- internal/agent/tool/registry_test.go
- cmd/server_main.go
- internal/harness/graph/graph/loop.go
- internal/agent/tool/jin10.go
- internal/harness/harness.go
- internal/agent/tool/qweather_test.go
- internal/agent/tool/exesql_trino_test.go
- internal/agent/tool/deepl_test.go
- internal/harness/graph/graph/parallel.go
- internal/agent/tool/code_exec.go
- internal/agent/component/vision_test.go
- internal/harness/graph/graph/graph.go
- internal/agent/tool/retrieval.go
- internal/agent/tool/yahoo_finance_test.go
- internal/agent/tool/google_scholar.go
- internal/agent/tool/registry.go
- internal/agent/canvas/compile.go
- internal/agent/tool/github.go
- internal/harness/core/middlewares/subagent/subagent.go
- internal/harness/core/middlewares/filesystem/filesystem_test.go
- internal/harness/core/model_chain_test.go
- internal/harness/core/react_graph.go
- internal/agent/canvas/interrupt_resume.go
- internal/harness/core/react_agent.go
- internal/harness/core/cancel.go
- internal/harness/core/middlewares/dynamictool/toolsearch/toolsearch.go
- internal/harness/core/model_chain.go
- internal/agent/canvas/loop_subgraph.go
- internal/agent/component/agent.go
- internal/harness/graph/pregel/engine.go
- internal/agent/component/agent_test.go
- internal/harness/core/middlewares/filesystem/filesystem.go
- internal/agent/tool/google.go
| // Convert to models.Message | ||
| ragMsgs := make([]models.Message, len(req.Messages)) | ||
| for i, m := range req.Messages { | ||
| ragMsgs[i] = models.Message{Role: m.Role, Content: m.Content} | ||
| } | ||
| msgs := ragMsgs | ||
| resp, err := cm.ModelDriver.ChatWithMessages(*cm.ModelName, msgs, cm.APIConfig, chatCfg) |
There was a problem hiding this comment.
Multimodal message parts are dropped before driver invocation.
Lines 204-208 copy only Role and Content into models.Message. But Lines 666-673 intentionally move user text/images into MultiContent and clear Content, so image prompts can be sent as empty/plain messages and lose all image parts.
Also applies to: 666-673
🤖 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 `@internal/agent/component/llm.go` around lines 204 - 210, The message
conversion loop that populates ragMsgs only copies the Role and Content fields
from req.Messages into models.Message, but multimodal content (such as images)
is stored in the MultiContent field which is intentionally used in the message
preparation logic. When constructing each models.Message in the loop (around
line 206), you need to also copy the MultiContent field from the source message
m to preserve all multimodal message parts before passing the messages to
cm.ModelDriver.ChatWithMessages.
| ln, _ := net.Listen("tcp", "127.0.0.1:0") | ||
| defer ln.Close() |
There was a problem hiding this comment.
Ignoring net.Listen error can cause nil pointer panic.
If net.Listen fails, ln will be nil, and ln.Close() on line 467 will panic. The test should fail explicitly.
🐛 Proposed fix
- ln, _ := net.Listen("tcp", "127.0.0.1:0")
+ ln, err := net.Listen("tcp", "127.0.0.1:0")
+ if err != nil {
+ t.Fatalf("net.Listen: %v", err)
+ }
defer ln.Close()📝 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.
| ln, _ := net.Listen("tcp", "127.0.0.1:0") | |
| defer ln.Close() | |
| ln, err := net.Listen("tcp", "127.0.0.1:0") | |
| if err != nil { | |
| t.Fatalf("net.Listen: %v", err) | |
| } | |
| defer ln.Close() |
🤖 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 `@internal/agent/tool/http_helper_test.go` around lines 466 - 467, The
net.Listen call ignores its error return value, which means if it fails, ln will
be nil and the defer ln.Close() statement will panic. Check the error returned
by net.Listen after calling it and fail the test explicitly using t.Fatal or
t.Fatalf if an error occurs, ensuring the test fails gracefully rather than
causing a nil pointer panic.
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 (2)
internal/agent/tool/ssrf_test.go (1)
88-95:⚠️ Potential issue | 🟡 Minor | ⚡ Quick winSilently discarding the error return may mask test failures.
The test now ignores any error from
ResolveAndValidate. If the function fails for a valid public IP (e.g., due to DNS issues in CI), this test would still pass as long ashostandiphappen to match—even though the validation failed. Consider at least logging the error or usingt.Skipffor transient resolve errors (as done inhostname_resolves_to_public):Suggested improvement
t.Run("literal_public_ip", func(t *testing.T) { - host, ip, _ := ResolveAndValidate("https://1.1.1.1/foo") + host, ip, err := ResolveAndValidate("https://1.1.1.1/foo") + if err != nil { + t.Fatalf("ResolveAndValidate(1.1.1.1) unexpected error: %v", err) + } if host != "1.1.1.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 `@internal/agent/tool/ssrf_test.go` around lines 88 - 95, The ResolveAndValidate function call in the literal_public_ip test is silently discarding the error return value using a blank identifier, which means test failures due to DNS resolution issues will be masked. Instead of ignoring the error, check the return value and handle it appropriately—either fail the test using t.Fatalf if the error indicates a real problem, or skip the test using t.Skipf if it's a transient resolution error, following the same pattern used in the hostname_resolves_to_public test for consistency.internal/harness/core/react_agent.go (1)
556-561:⚠️ Potential issue | 🟠 Major | ⚡ Quick winStream errors are silently dropped in
streamWithCancel.When
v.Err != nil, the function returns without forwarding the error to the output stream. This matches the issue that was fixed incancel.goat lines 575-577 wherer.Send(v.Data, v.Err)is now called before returning. The same fix should be applied here for consistency.🐛 Proposed fix to propagate stream errors
case v := <-ch: if v.Err != nil { + r.Send(v.Data, v.Err) return } r.Send(v.Data, nil)🤖 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 `@internal/harness/core/react_agent.go` around lines 556 - 561, In the `streamWithCancel` function's channel receive case statement, when an error is received (v.Err != nil), the function currently returns without propagating the error. Instead of returning immediately, call r.Send(v.Data, v.Err) before returning to forward both the data and error to the output stream, matching the pattern already implemented in cancel.go. This ensures stream errors are properly communicated rather than silently dropped.
🧹 Nitpick comments (2)
internal/agent/tool/exesql_trino_stub.go (1)
93-102: 💤 Low valueRedundant conditional branches.
Lines 98-99 and 100-101 both execute
user = url.User(username). Theelse ifcondition is unnecessary:var user *url.Userinfo if scheme == "https" && p.Password != "" { user = url.UserPassword(username, p.Password) -} else if scheme == "https" || username == "" { - user = url.User(username) } else { user = url.User(username) }Or more explicitly documenting the intent:
var user *url.Userinfo if scheme == "https" && p.Password != "" { user = url.UserPassword(username, p.Password) } else { + // Over plain HTTP or when no password: omit credentials to avoid cleartext leakage user = url.User(username) }🤖 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 `@internal/agent/tool/exesql_trino_stub.go` around lines 93 - 102, The conditional logic for setting the user variable contains redundant branches where both the else if condition on line 99 and the else block on line 101 execute the same statement url.User(username). Consolidate these into a single else branch by removing the else if condition entirely, keeping only one else block that calls url.User(username). This simplifies the logic since whenever the first condition (scheme == "https" && p.Password != "") is false, the code should always use url.User(username) regardless of the other conditions.internal/agent/tool/crawler_test.go (1)
66-67: 💤 Low valueSilently discarding the error may hide test failures.
The error from
InvokableRunis discarded. If the call fails for an unexpected reason (e.g., network issue, resolver bug), the test will only see JSON unmarshal failures later, obscuring the root cause. Consider at least logging the error or verifying it matches an expected condition.💡 Suggested improvement
- out, _ := c.InvokableRun(context.Background(), + out, err := c.InvokableRun(context.Background(), `{"url":`+jsonString(srv.URL)+`,"max_depth":0}`) + if err != nil { + t.Logf("InvokableRun returned error (may be expected): %v", err) + }🤖 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 `@internal/agent/tool/crawler_test.go` around lines 66 - 67, The error return value from the InvokableRun method call is being discarded with the blank identifier, which can hide unexpected test failures and make debugging difficult. Instead of ignoring the error, capture it and handle it appropriately by either asserting that it is nil (or an expected error condition), or failing the test with a descriptive error message if an unexpected error occurs. This will ensure that any network issues, resolver bugs, or other unexpected failures in InvokableRun are caught immediately rather than obscured by later failures.
🤖 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 `@internal/agent/tool/retrieval_wiring_test.go`:
- Around line 48-49: Three test functions in the retrieval wiring test are
discarding errors by using blank identifiers instead of asserting on the error
values. In TestRetrievalTool_SimpleServiceReturnsChunks,
TestSimpleRetrievalService_EmptyQuery, and
TestSimpleRetrievalService_RespectsTopN, capture the error return value from
tool.InvokableRun() and other operations instead of ignoring it with an
underscore, then add explicit assertions (such as require.NoError() or
assert.Nil()) to verify the expected error behavior. This ensures that if these
operations unexpectedly fail, the test will catch the regression rather than
silently passing.
In `@internal/harness/core/react_loop.go`:
- Around line 37-48: The type assertions in the message handling loop are unsafe
and will panic if the actual types don't match expectations. Replace the unsafe
type assertions in the loop where state.Messages elements are cast to Message
(any(m).(Message)) and where modified elements are cast to M (any(m).(M)) with
safe type assertions using the comma-ok idiom. For each assertion, check if the
type conversion succeeds before using the value, and handle the case where the
conversion fails appropriately (either skip the element, return an error, or log
and continue depending on your error handling strategy).
---
Outside diff comments:
In `@internal/agent/tool/ssrf_test.go`:
- Around line 88-95: The ResolveAndValidate function call in the
literal_public_ip test is silently discarding the error return value using a
blank identifier, which means test failures due to DNS resolution issues will be
masked. Instead of ignoring the error, check the return value and handle it
appropriately—either fail the test using t.Fatalf if the error indicates a real
problem, or skip the test using t.Skipf if it's a transient resolution error,
following the same pattern used in the hostname_resolves_to_public test for
consistency.
In `@internal/harness/core/react_agent.go`:
- Around line 556-561: In the `streamWithCancel` function's channel receive case
statement, when an error is received (v.Err != nil), the function currently
returns without propagating the error. Instead of returning immediately, call
r.Send(v.Data, v.Err) before returning to forward both the data and error to the
output stream, matching the pattern already implemented in cancel.go. This
ensures stream errors are properly communicated rather than silently dropped.
---
Nitpick comments:
In `@internal/agent/tool/crawler_test.go`:
- Around line 66-67: The error return value from the InvokableRun method call is
being discarded with the blank identifier, which can hide unexpected test
failures and make debugging difficult. Instead of ignoring the error, capture it
and handle it appropriately by either asserting that it is nil (or an expected
error condition), or failing the test with a descriptive error message if an
unexpected error occurs. This will ensure that any network issues, resolver
bugs, or other unexpected failures in InvokableRun are caught immediately rather
than obscured by later failures.
In `@internal/agent/tool/exesql_trino_stub.go`:
- Around line 93-102: The conditional logic for setting the user variable
contains redundant branches where both the else if condition on line 99 and the
else block on line 101 execute the same statement url.User(username).
Consolidate these into a single else branch by removing the else if condition
entirely, keeping only one else block that calls url.User(username). This
simplifies the logic since whenever the first condition (scheme == "https" &&
p.Password != "") is false, the code should always use url.User(username)
regardless of the other conditions.
🪄 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: 04306ef1-8dd0-4482-9073-0773fad0713c
📒 Files selected for processing (136)
cmd/server_main.gointernal/agent/canvas/canvas.gointernal/agent/canvas/canvas_test.gointernal/agent/canvas/checkpoint_store.gointernal/agent/canvas/compile.gointernal/agent/canvas/interrupt_resume.gointernal/agent/canvas/interrupt_resume_test.gointernal/agent/canvas/loop_semantics_test.gointernal/agent/canvas/loop_subgraph.gointernal/agent/canvas/multibranch.gointernal/agent/canvas/multibranch_test.gointernal/agent/canvas/node_body.gointernal/agent/canvas/node_body_timeout_test.gointernal/agent/canvas/run_tracker.gointernal/agent/canvas/runner.gointernal/agent/canvas/scheduler.gointernal/agent/canvas/scheduler_test.gointernal/agent/canvas/state_serializer.gointernal/agent/component/agent.gointernal/agent/component/agent_meta_test.gointernal/agent/component/agent_test.gointernal/agent/component/begin.gointernal/agent/component/categorize.gointernal/agent/component/fixture_stubs.gointernal/agent/component/grounding_test.gointernal/agent/component/history_window_test.gointernal/agent/component/llm.gointernal/agent/component/llm_retry.gointernal/agent/component/llm_test.gointernal/agent/component/loop.gointernal/agent/component/parallel.gointernal/agent/component/sampler_params_test.gointernal/agent/component/switch.gointernal/agent/component/tool_call_memory_test.gointernal/agent/component/tool_dispatch_test.gointernal/agent/component/types.gointernal/agent/component/universe_a_wrappers.gointernal/agent/component/vision_test.gointernal/agent/runtime/context.gointernal/agent/runtime/selector.gointernal/agent/runtime/state.gointernal/agent/tool/akshare.gointernal/agent/tool/akshare_test.gointernal/agent/tool/arxiv.gointernal/agent/tool/arxiv_test.gointernal/agent/tool/code_exec.gointernal/agent/tool/code_exec_test.gointernal/agent/tool/crawler.gointernal/agent/tool/crawler_test.gointernal/agent/tool/deepl.gointernal/agent/tool/deepl_test.gointernal/agent/tool/duckduckgo.gointernal/agent/tool/duckduckgo_test.gointernal/agent/tool/email.gointernal/agent/tool/email_test.gointernal/agent/tool/exesql.gointernal/agent/tool/exesql_decoder_test.gointernal/agent/tool/exesql_mock_test.gointernal/agent/tool/exesql_test.gointernal/agent/tool/exesql_trino_stub.gointernal/agent/tool/exesql_trino_test.gointernal/agent/tool/github.gointernal/agent/tool/github_test.gointernal/agent/tool/google.gointernal/agent/tool/google_scholar.gointernal/agent/tool/google_scholar_test.gointernal/agent/tool/google_test.gointernal/agent/tool/http_helper.gointernal/agent/tool/http_helper_test.gointernal/agent/tool/jin10.gointernal/agent/tool/jin10_test.gointernal/agent/tool/mcp.gointernal/agent/tool/mcp_test.gointernal/agent/tool/pubmed.gointernal/agent/tool/pubmed_test.gointernal/agent/tool/qweather.gointernal/agent/tool/qweather_test.gointernal/agent/tool/registry.gointernal/agent/tool/registry_test.gointernal/agent/tool/retrieval.gointernal/agent/tool/retrieval_service_test.gointernal/agent/tool/retrieval_test.gointernal/agent/tool/retrieval_wiring_test.gointernal/agent/tool/searxng.gointernal/agent/tool/searxng_test.gointernal/agent/tool/ssrf_test.gointernal/agent/tool/tavily.gointernal/agent/tool/tavily_test.gointernal/agent/tool/tushare.gointernal/agent/tool/tushare_test.gointernal/agent/tool/types.gointernal/agent/tool/wencai.gointernal/agent/tool/wencai_test.gointernal/agent/tool/wikipedia.gointernal/agent/tool/wikipedia_test.gointernal/agent/tool/yahoo_finance.gointernal/agent/tool/yahoo_finance_test.gointernal/agent/workflowx/loop.gointernal/agent/workflowx/loop_example_test.gointernal/agent/workflowx/loop_integration_test.gointernal/agent/workflowx/loop_options_test.gointernal/agent/workflowx/loop_test.gointernal/agent/workflowx/parallel.gointernal/agent/workflowx/parallel_helpers_test.gointernal/agent/workflowx/parallel_integration_test.gointernal/agent/workflowx/parallel_options_test.gointernal/agent/workflowx/parallel_test.gointernal/handler/agent.gointernal/handler/agent_wait_for_user_test.gointernal/harness/core/cancel.gointernal/harness/core/graph_integration_test.gointernal/harness/core/middlewares/dynamictool/toolsearch/toolsearch.gointernal/harness/core/middlewares/filesystem/filesystem.gointernal/harness/core/middlewares/filesystem/filesystem_test.gointernal/harness/core/middlewares/skill/skill.gointernal/harness/core/middlewares/subagent/subagent.gointernal/harness/core/model_chain.gointernal/harness/core/model_chain_test.gointernal/harness/core/prebuilt/coding/coding.gointernal/harness/core/react_agent.gointernal/harness/core/react_graph.gointernal/harness/core/react_graph_test.gointernal/harness/core/react_loop.gointernal/harness/core/stability_integration_test.gointernal/harness/core/tool_contributor_test.gointernal/harness/graph/graph/graph.gointernal/harness/graph/graph/loop.gointernal/harness/graph/graph/parallel.gointernal/harness/graph/pregel/engine.gointernal/harness/graph/pregel/retry.gointernal/harness/harness.gointernal/observability/otel/handler.gointernal/observability/otel/handler_test.gointernal/service/agent.gointernal/service/agent_run_e2e_test.gointernal/service/agent_sessions.go
💤 Files with no reviewable changes (10)
- internal/agent/workflowx/loop.go
- internal/agent/workflowx/loop_test.go
- internal/agent/workflowx/parallel.go
- internal/agent/workflowx/parallel_integration_test.go
- internal/agent/workflowx/parallel_helpers_test.go
- internal/agent/workflowx/parallel_test.go
- internal/agent/workflowx/loop_example_test.go
- internal/agent/workflowx/loop_options_test.go
- internal/agent/workflowx/parallel_options_test.go
- internal/agent/workflowx/loop_integration_test.go
✅ Files skipped from review due to trivial changes (14)
- internal/agent/component/llm_retry.go
- internal/agent/component/begin.go
- internal/agent/tool/http_helper.go
- internal/agent/canvas/run_tracker.go
- internal/agent/component/parallel.go
- internal/agent/component/loop.go
- internal/agent/runtime/selector.go
- internal/agent/canvas/canvas.go
- internal/agent/component/fixture_stubs.go
- internal/agent/canvas/state_serializer.go
- internal/agent/canvas/checkpoint_store.go
- internal/agent/runtime/context.go
- internal/handler/agent.go
- internal/agent/component/switch.go
🚧 Files skipped from review as they are similar to previous changes (96)
- internal/agent/tool/exesql_trino_test.go
- internal/agent/tool/retrieval_test.go
- internal/agent/tool/exesql_mock_test.go
- internal/agent/tool/akshare_test.go
- internal/agent/component/llm_test.go
- internal/agent/tool/types.go
- internal/agent/tool/google_test.go
- internal/agent/component/agent_meta_test.go
- internal/agent/tool/deepl_test.go
- internal/agent/tool/google_scholar_test.go
- internal/agent/tool/retrieval_service_test.go
- internal/harness/graph/pregel/retry.go
- internal/agent/component/tool_dispatch_test.go
- internal/agent/tool/searxng_test.go
- internal/agent/component/categorize.go
- internal/agent/component/sampler_params_test.go
- internal/agent/tool/tavily_test.go
- internal/agent/tool/pubmed_test.go
- internal/agent/tool/duckduckgo_test.go
- internal/agent/tool/registry_test.go
- internal/agent/component/tool_call_memory_test.go
- internal/agent/tool/code_exec_test.go
- internal/agent/tool/github_test.go
- internal/agent/tool/mcp_test.go
- internal/agent/canvas/node_body_timeout_test.go
- internal/harness/core/prebuilt/coding/coding.go
- internal/agent/tool/arxiv_test.go
- internal/agent/tool/pubmed.go
- internal/agent/tool/wikipedia_test.go
- internal/agent/tool/wencai_test.go
- internal/harness/core/stability_integration_test.go
- internal/agent/canvas/canvas_test.go
- internal/agent/runtime/state.go
- internal/agent/tool/tushare_test.go
- internal/agent/tool/registry.go
- internal/agent/canvas/interrupt_resume_test.go
- internal/agent/tool/yahoo_finance_test.go
- internal/agent/tool/deepl.go
- internal/agent/tool/google_scholar.go
- internal/agent/tool/mcp.go
- internal/agent/tool/retrieval.go
- internal/agent/component/types.go
- internal/agent/tool/exesql_decoder_test.go
- internal/agent/tool/google.go
- internal/agent/canvas/runner.go
- internal/agent/component/universe_a_wrappers.go
- internal/agent/tool/wikipedia.go
- internal/agent/component/history_window_test.go
- internal/agent/canvas/loop_semantics_test.go
- internal/agent/tool/http_helper_test.go
- internal/agent/tool/email.go
- internal/agent/tool/qweather_test.go
- internal/harness/core/graph_integration_test.go
- internal/agent/tool/duckduckgo.go
- internal/harness/core/tool_contributor_test.go
- internal/agent/tool/tushare.go
- internal/agent/canvas/multibranch.go
- internal/harness/graph/graph/loop.go
- internal/agent/tool/github.go
- internal/agent/tool/tavily.go
- internal/agent/canvas/scheduler_test.go
- internal/agent/tool/email_test.go
- internal/agent/component/grounding_test.go
- internal/agent/component/vision_test.go
- internal/agent/tool/wencai.go
- internal/agent/tool/akshare.go
- internal/harness/core/model_chain_test.go
- internal/agent/tool/arxiv.go
- internal/harness/core/middlewares/subagent/subagent.go
- internal/agent/canvas/node_body.go
- internal/agent/tool/code_exec.go
- internal/handler/agent_wait_for_user_test.go
- internal/agent/component/llm.go
- internal/harness/core/react_graph_test.go
- internal/harness/core/react_graph.go
- internal/agent/tool/exesql_test.go
- internal/agent/canvas/interrupt_resume.go
- internal/agent/canvas/multibranch_test.go
- internal/agent/component/agent.go
- internal/agent/tool/crawler.go
- internal/harness/graph/graph/parallel.go
- internal/harness/core/middlewares/filesystem/filesystem_test.go
- internal/observability/otel/handler.go
- internal/agent/tool/qweather.go
- internal/harness/core/model_chain.go
- internal/agent/tool/yahoo_finance.go
- internal/harness/core/middlewares/dynamictool/toolsearch/toolsearch.go
- internal/agent/tool/jin10.go
- internal/agent/canvas/loop_subgraph.go
- internal/harness/core/middlewares/skill/skill.go
- internal/agent/component/agent_test.go
- internal/agent/canvas/scheduler.go
- cmd/server_main.go
- internal/harness/core/middlewares/filesystem/filesystem.go
- internal/agent/canvas/compile.go
- internal/harness/graph/pregel/engine.go
36824c1 to
fffda9d
Compare
### Summary As title. --------- Signed-off-by: Jin Hai <[email protected]>
…iflow#17350) ## Description This PR fixes Title Case capitalization matching for Table of Contents items in `README.md`. ## Details Updated TOC entries (`Build a Docker image` -> `Build a Docker Image`, `Launch service from source` -> `Launch Service from Source`) to match section headers. Co-authored-by: ferkans-amir <[email protected]>
…nfiniflow#17342) ### Summary Add graph keyword search and fix dataset synthesizing issue.
…e resume (infiniflow#17351) ## Summary - Root cause: Pipeline.Run keys the eino checkpoint by taskID only. Resuming a failed run after the user edits the pipeline DSL recompiles a graph with different topology, but the old checkpoint (bound to the previous graph's node ids / wiring) is restored, causing eino to error. - Fix: fingerprint the DSL file (full canvas DSL) and the runtime override_params, persisted next to the eino checkpoint. On resume, if either fingerprint differs, discard the stale checkpoint + interrupt marker and re-run from scratch. The warning log distinguishes a DSL-file edit from a runtime-override edit. ## Test plan - TestPipelineRunResumableDSLChanged: editing the DSL between runs discards the checkpoint and re-runs from scratch. - TestPipelineRunResumableOverrideChanged: editing only the runtime override does the same. - TestClassifyDSLChange: unit-tests the mismatch-reason classifier. - bash build.sh --test ./internal/ingestion/pipeline/... passes. ## Notes - Component-code changes (e.g. a component's output contract) are not covered by the DSL fingerprint; that is a separate, smaller-blast-radius gap noted in code comments. --------- Signed-off-by: xugangqiang <[email protected]> Co-authored-by: CodeBuddy <[email protected]>
## Summary - Preserve all streamed Agent deltas when Message consumes deferred output. - Prevent duplicate final answers while keeping Agent and Message event ordering consistent. - Add regression coverage for complete deferred streaming output. ## Testing - `CGO_ENABLED=0 go test ./internal/agent/component ./internal/agent/runtime -count=1`
### Summary As title
### Summary As title --------- Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
### Summary enterprise tests.yml add gitee secret token
## Description This PR fixes grammar and missing articles in `SECURITY.md`. ## Details Updated sentence phrasing (`numpy module has...` $\to$ `the numpy module has...` and `function directly execute` $\to$ `function to directly execute`). Co-authored-by: ferkans-amir <[email protected]>
Signed-off-by: Jin Hai <[email protected]>
…w#17366) ## Summary Remediates four CVEs in `lxml` and `lxml_html_clean` by upgrading transitive dependency constraints and bumping `crawl4ai` to unblock the resolution. | CVE | Severity | Package | Installed | Fixed in | |---|---|---|---|---| | CVE-2026-41066 | HIGH | lxml | 5.4.0 | 6.1.0 | | CVE-2026-49825 | HIGH | lxml_html_clean | 0.4.3 | 0.4.5 | | CVE-2026-28348 | MEDIUM | lxml_html_clean | 0.4.3 | 0.4.5 | | CVE-2026-28350 | MEDIUM | lxml_html_clean | 0.4.3 | 0.4.5 | - Bumped `crawl4ai` from `>=0.9.0,<0.9.1` to `>=0.9.2,<0.9.3`, version 0.9.2 relaxes lxml constraint to `>=5.3,<7`. The strict `<0.9.3` upper bound on crawl4ai is maintained per project convention - Added `inscriptis>=2.7.3` to `constraint-dependencies`, version 2.7.3 relaxes lxml constraint to `>=5.4.0,<6.2.0` - Added `lxml>=6.1.0` to `constraint-dependencies` - Added `lxml_html_clean>=0.4.5` to `constraint-dependencies` `exclude-dependencies` entry for `unclecode-litellm` (still declared by crawl4ai 0.9.2) continues to prevent the namespace collision that previously crashed RAGFlow. ## Verification - `lxml` is used widely across the codebase for HTML/XML parsing. The 5.x → 6.x upgrade maintains API compatibility for standard usage (`lxml.html`, `lxml.etree`). - `lxml_html_clean` API is unchanged between 0.4.3 and 0.4.5. - `crawl4ai` 0.9.2 is a patch bump from 0.9.0 with no API changes affecting RAGFlow's usage. - `inscriptis` 2.7.3 is a patch bump from 2.7.0. ## Testing - Full unit test suite passes - `uv sync` resolves cleanly - Verified `crawl4ai` imports without litellm namespace collision
…+ PDF coordinate chain + Chunker) (infiniflow#17349) ## Summary Aligns the Go ingestion pipeline with the Python implementation, closing several behavioral gaps found during the Python→Go migration (tracked in `docs/migration_python_go_diff.md`). Covers parser/media dispatch alignment, the PDF coordinate-chain (preview images, outline→title, chunk coordinate finalization), and the Chunker Token/QA batches below. Commits are grouped as follows. ### 1. Fix parser params (c524f45) Fixes parser/media wiring and several dispatch gaps: - **docx/pdf vision dispatch**: correct parameter handling and VLM invocation. - **markdown vision (diff 2.5)**: also enhance items whose `doc_type_kwd` is `table`, not only `image` (parser/utils.py:181). - **media audio (diff 2.11)**: when `output_format` is `json`, carry the ASR transcription as a JSON item instead of only the `Text` field (the Invoke switch had no `json` branch and dropped it). - **email (diff 2.2)**: default `output_format` is `json` (parser.py:212), not `text`. - **tokenizer**: handle empty/whitespace-only names; trim before embedding. - **extractor**: tag-matching parameter wiring. - **split**: keyword-split regex now covers CJK/English separators. - **parser.go**: parser-param plumbing. ### 2. fix parser gap (373537d) Image dispatch now mirrors `rag/app/picture.py:chunk()`: - Always OCR the image (PaddleOCR or local ONNX). - When OCR text is short, also call VLM (`describe`) and combine `OCR + VLM` text. - Emits a **structured JSON item** carrying the image data-URI and `doc_type_kwd:"image"`, instead of a bare `Text` string. This fixes the payload being rejected downstream by OneChunker/TokenChunker (JSON=nil). ### 3. PDF coordinate-chain fixes (55367a8, 727f816) Closes three items from the migration tracker in the chunker/tokenizer/task layer: - **(Chunker-1.3) `restore_pdf_text_previews`** — `needsCrop` now also returns true for `text` chunks that carry PDF positions (`pdfcrop_cgo.go`), so text blocks get a rendered preview image uploaded to storage via `imageUploadDecorator`/`ChunkImageUploader`, matching Python `restore_pdf_text_previews` + `image2id`. - **(Chunker-1.5) PDF outline → title levels** — `title.go` adds `outlineSimilarity` (rune-bigram Jaccard, mirroring `common.py:_outline_similarity`), `resolveOutlineLevels` (matches text lines to outline entries at similarity > 0.8, with a sparse guard `len(outline)/len(records) <= 0.03`), and `outlineFromInputs` (reads `file.outline`). Wired into `newLevelContext` in both `group.go` and `hierarchy.go`; falls back to the title-shape heuristic when no outline is present. - **(Tokenizer-(T)1) `finalize_pdf_chunk`** — the coordinate → `position_int`/`page_num_int`/`top_int` conversion is owned by the task layer (`processChunkPositions`→`AddPositions`), which runs *after* the tokenizer and consumes the tokenizer-owned fields. The tokenizer only preserves the raw `positions`/`_pdf_positions` (no duplicate conversion), pinned by `TestChunkDocsToMaps_PreservesPDFPositions`. ### 4. Integration test made environment-free (`internal/ingestion/task/pipeline_real_integration_test.go`) - Removed the `//go:build integration` tag so the contract tests run under the default `build.sh --test` (which does not pass `-tags integration`). - External dependencies replaced with in-memory substitutes so no MySQL/MinIO/ES is required: - MySQL → on-disk sqlite (`glebarez/sqlite`) with the needed tables auto-migrated. - MinIO → `storage.NewMemoryStorage()`. - Elasticsearch → chunks captured via `WithInsertFunc` instead of `engine.InsertChunks`/`Search`. - `requireTokenizerPool` still skips gracefully when the native tokenizer pool is unavailable; `WithLogCreateFunc(noop)` avoids depending on the operation-log table. - Added `taskChunkFieldEqualsStr` to tolerate `kb_id` being a `[]string`/`[]any` in the raw chunk payload (the search engine flattens it to a string on read). ### 5. TokenChunker alignment — Batch 1 (`internal/ingestion/component/chunker/token.go`) Closes four Chunker items from the migration tracker: - **(Chunker-2.1) sentence delimiter** — the boundary regex now also breaks on ASCII `!`/`?`. Extracted to a package-level `var sentenceDelimiter` and used in `mergeByTokenSize`, matching Python's full delimiter set. - **(Chunker-2.2) overlap tag leakage** — when a new chunk starts, its overlap prefix is taken from the previous chunk *after* `removeTag`, in both the text path (`mergeByTokenSize`) and the JSON path (`mergeByTokenSizeFromJSON`). Parser tags (`@@…##`) no longer leak into the overlap region (mirrors `nlp/__init__.py:1181`). - **(Chunker-2.11) empty-text merge** — merging a non-empty chunk into an empty previous chunk now assigns the text directly instead of being skipped (`mergeByTokenSizeFromJSON`), mirroring `token_chunker.py:236-239`. - **(Chunker-2.4) overlap token counting** — `takeFromEnd`/`takeFromStart` now count tokens exactly via `tokenizeStr` instead of the 4-bytes/token heuristic, fixing over-counting for CJK text. ### 6. QA Chunker alignment — Batch 2 (`internal/ingestion/component/chunker/qa.go` + `schema`) Closes three Chunker items from the migration tracker: - **(Chunker-2.13) default language** — an empty `lang` now defaults to Chinese prefixes (`问题:`/`回答:`) instead of English, matching `qa.py:299`. - **(Chunker-2.12) `rmQAPrefix` regex** — the separator is changed to `[\t:: ]+` (one-or-more), matching `qa.py:241`, so multiple separators (e.g. `Q:: answer`) are fully stripped. - **(Chunker-1.8 QA) missing chunk fields** — QA chunks now preserve: - `top_int` — the source row/record index, threaded through the tab/csv/markdown extractors (mirrors `qa.py` `beAdoc(..., row_num=i)`); - `image` + `doc_type_kwd:"image"`; - `_pdf_positions` / `positions` carried from the upstream JSON item. `schema.ChunkDoc` gains a `TopInt []int` field (serialized as `top_int`, registered in `UnmarshalJSON`). Note: the Tag/Table/Presentation/One chunker field gaps under 1.8 remain pending. ## Test plan - Added/updated unit tests: `pdfcrop_cgo_test.go` (`TestNeedsCrop`, `TestRestorePDFTextPreview`), `title_test.go` (`TestResolveOutlineLevels`, `TestResolveOutlineLevels_SparseGuard`, `TestNewLevelContext_OutlineBranch`, `TestOutlineFromInputs`), `tokenizer_unit_test.go` (`TestChunkDocsToMaps_PreservesPDFPositions`), `token_pdfpos_test.go`. - **Batch 1** — `token_batch1_test.go`: `TestSentenceDelimiterMatchesBangAndQuestion`, `TestMergeByTokenSizeFromJSON_OverlapStripsTags`, `TestMergeByTokenSizeFromJSON_EmptyPrevKeepsChunk`, `TestTakeFromEndRespectsTokenCount`, `TestTakeFromStartRespectsTokenCount`. - **Batch 2** — `qa_batch2_test.go`: `TestQAChunker_DefaultLangIsChinese`, `TestRmQAPrefixStripsMultipleSeparators`, `TestQAChunker_SetsTopInt`, `TestQAChunker_CarriesImageAndPositions`. Existing `qa_test.go` expectations were updated to the corrected language default / separator behavior. - `pipeline_real_integration_test.go` (`TestPipelineExecutor_Run_RealCanvasDSL_UsesGeneralPipeline`, `TestPipelineExecutor_Run_RealPDF_ProducesIndexedChunks`, `TestRunPipeline_RealPipelineOutput_ProducesIndexFields`) now runs without any external service. - `bash build.sh --test ./internal/ingestion/...` passes. - No files deleted.
### Summary feat: add BASE_URL to TencentHunYuan
… model" mis-tag (infiniflow#5782, infiniflow#7075) (infiniflow#17057) ### What problem does this PR solve? Adds first-class support for **Mistral OCR** (`POST /v1/ocr`) as a document parser, and fixes the long-standing bug where selecting `mistral-ocr-latest` fails with `Can't find model for <tenant>/image2text/mistral-ocr-latest`. `mistral-ocr-latest` is Mistral's dedicated document-OCR endpoint, not a vision-chat (`image2text`) model, but the catalog tagged it `image2text` — so it resolved to the `CvModel` registry, which has no `Mistral` entry, and there was no `OcrModel` entry either. This PR registers it correctly and wires it end to end. Closes infiniflow#17056 Closes infiniflow#5782 Closes infiniflow#7075 **What it does** 1. **`MistralParser` + `MistralOcrModel`** (`deepdoc/parser/mistral_parser.py`, `rag/llm/ocr_model.py`) — a proper `OcrModel` factory `Mistral OCR`, mirroring the SoMark cloud-OCR template. Tables stay inline as HTML; the page range maps to Mistral's native `pages` selector (absolute page indices, billed per selected page, so multi-task documents do not re-OCR the whole file); documents over the inline limit go through the `/v1/files` signed-URL flow with cleanup. 2. **Removes the `image2text` mis-tag** for `mistral-ocr-latest` from the `Mistral` factory in `conf/llm_factories.json` (it now lives only in the `Mistral OCR` factory, typed `ocr`). This is what closes the `Can't find model` path. 3. **`MistralCV`** (`rag/llm/cv_model.py`) — a thin `GptV4` subclass over Mistral's OpenAI-compatible endpoint, registering a `Mistral` entry in the `CvModel` registry so Mistral vision models (`pixtral-*`) become usable as `image2text` at all. 4. **Figure description** — Mistral-OCR-extracted figures are captioned using the tenant's configured `image2text` model (any provider), matching MinerU/deepdoc behaviour. 5. **Wires the parser into every chunking method** (`naive`, `paper`, `book`, `laws`, `manual`, `one`, `presentation`) and the `rag/flow` DAG path. This also fixes a related latent gap where those chunkers forwarded only `mineru_llm_name`, so any model-based OCR provider selected on a non-`naive` method silently fell through. **Notes on the API contract** (verified against the live Mistral API): `pages` is a selector (returns absolute `index`, bills only the requested pages); `include_blocks: true` returns per-block bounding boxes usable for chunk highlighting and figure cropping; large files use `POST /v1/files` → signed URL → OCR → `DELETE`. **Testing**: new unit tests cover the response→sections contract (both the 2-tuple `naive` path and the typed 3-tuple DAG path), the position-tag rescale, the HTTP client incl. upload failure/cleanup paths, `parse_pdf` page-range threading, registry registration, env config, the suffix normalization, the factory catalog entry, `MistralCV` registration, and figure-description injection. Verified end to end against the live Mistral API on real PDFs (table extraction, page-selector cost avoidance, figure captioning). ### Type of change - [x] Bug Fix (non-breaking change which fixes an issue) - [x] New Feature (non-breaking change which adds functionality)
Signed-off-by: Jin Hai <[email protected]>
…finiflow#17362) ## Description This PR fixes a typo in comment text and a missing verb in error output in `show_env.sh`. ## Details 1. Fixed typo in comment (`lsd_release` $\to$ `lsb_release`). 2. Added missing verb in fallback output string (`It NOT a Git repo` $\to$ `It is NOT a Git repo`). --------- Co-authored-by: ferkans-amir <[email protected]>
### Summary This PR adds **aimlapi.com** as a model provider, so a RAGFlow user can enter one API key in the model settings and use AIMLAPI's models across the app. AIMLAPI ([aimlapi.com](https://aimlapi.com)) is an OpenAI-compatible aggregator that serves 700+ models (LLM, embedding, vision, TTS, ASR) from many providers behind a single API. The change mirrors the repo's existing "add provider" pattern (e.g. FuturMix / OpenRouter): provider logic lives in the same files those providers use, and shared / UI files get only registration entries. **Backend** - `conf/llm_factories.json` — the `aimlapi.com` factory entry. - `rag/llm/__init__.py`, `rag/llm/{chat,embedding,cv}_model.py` — LiteLLM adapters (chat, embedding, image2text) with a production base URL, overridable via `AIMLAPI_API_URL`. - `rag/llm/model_meta.py` — an `AIMLAPI` model-meta so the provider lists its full `/v1/models` catalog dynamically (classified by the endpoint `type`), the same way OpenRouter does. - `api/apps/restful_apis/aimlapi_api.py` — an optional "Get API key" flow using AIMLAPI's agent-authorization (OAuth 2.0 Device Authorization Grant, RFC 8628). The device code is kept server-side (Redis); only the issued key reaches the browser. **Frontend (`web/`)** - Provider registration (constant, icon allowlist, brand logo), the model picker (`LIST_MODEL_PROVIDERS` + a `buildLocalConfig` entry), and the "Get API key" button in the provider dialog. Locales added to `en` and `zh`. **Configuration** — production defaults are compiled in; endpoints and the partner id are overridable through `AIMLAPI_*` environment variables, so the same build works across environments. **Testing** — the `web` build passes; chat, embedding and dynamic model listing were smoke-tested against the live API.
Bumps [pypdf](https://github.com/py-pdf/pypdf) from 6.13.1 to 6.14.2. Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
What problem does this PR solve?
As title
Type of change