Repository navigation
fix(go-agent): ArXiv component registration and request parity - #16808
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Run ID: 📒 Files selected for processing (4)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughThe ArXiv tool now supports node-level result-count and sort configuration. A registered ArXiv canvas component invokes it, formats returned papers into JSON and text outputs, and validates configuration and queries. Tests cover registration, requests, formatting, empty input, and tool metadata. ChangesArXiv integration
Estimated code review effort: 3 (Moderate) | ~25 minutes Sequence Diagram(s)sequenceDiagram
participant Canvas as arxivComponent
participant Tool as ArxivTool
participant API as ArXiv API
Canvas->>Tool: Invoke query with top_n and sort_by
Tool->>API: Send search_query, max_results, sortBy
API-->>Tool: Return Atom XML
Tool-->>Canvas: Return results
Canvas-->>Canvas: Render formalized_content and json
Suggested labels: Poem
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
There was a problem hiding this comment.
🧹 Nitpick comments (1)
internal/agent/component/universe_a_wrappers.go (1)
1431-1447: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick winEliminate duplicated default constants by deferring to
NewArxivToolWithParams.
newArxivComponenthardcodestopN := 12andsortBy := "submittedDate", duplicatingdefaultArxivTopNanddefaultArxivSortByfrom thetoolpackage. SinceNewArxivToolWithParamsalready applies these exact defaults whentopN <= 0orsortBy == "", the component can pass zero values when params are absent and let the constructor handle defaults. This prevents drift if the tool defaults ever change.♻️ Proposed refactor
func newArxivComponent(params map[string]any) (Component, error) { - topN := 12 - if v, ok := params["top_n"]; ok { - topN = toIntParam(v) - } - if topN <= 0 { - return nil, fmt.Errorf("canvas: ArXiv: top_n must be a positive integer") - } - sortBy := "submittedDate" - if v, ok := params["sort_by"].(string); ok && strings.TrimSpace(v) != "" { - sortBy = strings.TrimSpace(v) - } - if !agenttool.ArxivSortBySupported(sortBy) { - return nil, fmt.Errorf("canvas: ArXiv: unsupported sort_by %q", sortBy) - } + topN := 0 + if v, ok := params["top_n"]; ok { + topN = toIntParam(v) + if topN <= 0 { + return nil, fmt.Errorf("canvas: ArXiv: top_n must be a positive integer") + } + } + sortBy := "" + if v, ok := params["sort_by"].(string); ok { + sortBy = strings.TrimSpace(v) + } + if sortBy != "" && !agenttool.ArxivSortBySupported(sortBy) { + return nil, fmt.Errorf("canvas: ArXiv: unsupported sort_by %q", sortBy) + } return &arxivComponent{inner: agenttool.NewArxivToolWithParams(nil, topN, sortBy)}, 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/universe_a_wrappers.go` around lines 1431 - 1447, Remove the hardcoded topN and sortBy defaults from newArxivComponent, using zero/empty values when the corresponding params are absent so agenttool.NewArxivToolWithParams applies its defaults. Preserve validation for explicitly provided invalid top_n and unsupported sort_by values, while allowing absent values to reach the constructor unchanged.
🤖 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.
Nitpick comments:
In `@internal/agent/component/universe_a_wrappers.go`:
- Around line 1431-1447: Remove the hardcoded topN and sortBy defaults from
newArxivComponent, using zero/empty values when the corresponding params are
absent so agenttool.NewArxivToolWithParams applies its defaults. Preserve
validation for explicitly provided invalid top_n and unsupported sort_by values,
while allowing absent values to reach the constructor unchanged.
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro
Run ID: 756cbd42-69b8-4081-b753-25b333096b8f
📒 Files selected for processing (7)
internal/agent/component/arxiv_component_test.gointernal/agent/component/fixture_stubs.gointernal/agent/component/universe_a_wrappers.gointernal/agent/component/verify_p1_test.gointernal/agent/tool/arxiv.gointernal/agent/tool/arxiv_test.gointernal/agent/tool/registry.go
|
LGTM |
Summary
ArXivcanvas component and add its input formqueryin runtime args and movingtop_n/sort_byto node paramsTest
bash build.sh --test ./internal/agent/tool ./internal/agent/component