Skip to content

feat(go-agent): merge Google Scholar node params with runtime inputs - #16802

Merged
yuzhichang merged 2 commits into
infiniflow:mainfrom
Harry-Hz-Zhang:fix/agent-google-scholar
Jul 10, 2026
Merged

yuzhichang merged 2 commits into
infiniflow:mainfrom
Harry-Hz-Zhang:fix/agent-google-scholar

Conversation

@Harry-Hz-Zhang

Copy link
Copy Markdown
Contributor

Summary

  • align the Go Google Scholar component with the Python-side config pattern
  • merge node-level params with runtime inputs so canvas defaults are preserved and per-run inputs can override them
  • add tests covering node param fallback and runtime override behavior

Verification

  • bash build.sh --test ./internal/agent/component/... -run TestGoogleScholar
image

@dosubot dosubot Bot added the size:L This PR changes 100-499 lines, ignoring generated files. label Jul 10, 2026
@coderabbitai

coderabbitai Bot commented Jul 10, 2026 •

Copy link
Copy Markdown
Contributor

Review Change Stack

📝 Walkthrough

Walkthrough

Google Scholar now supports expanded search filters, node-level defaults, the google_scholar_search alias, and a registered canvas component that invokes the tool and renders formatted results.

Changes

Google Scholar integration

Layer / File(s) Summary
Parameterized tool execution
internal/agent/tool/google_scholar.go, internal/agent/tool/google_scholar_test.go
Google Scholar parameters now include result limits, sorting, year bounds, and patent visibility, with default merging, URL construction, parsing, and coverage tests.
Tool registry and alias wiring
internal/agent/tool/registry.go, internal/agent/tool/registry_test.go
Registry construction validates node parameters, supports configured defaults, and maps google_scholar_search to google_scholar.
Canvas component integration
internal/agent/component/universe_a_wrappers.go, internal/agent/component/fixture_stubs.go, internal/agent/component/google_scholar_component_test.go, internal/agent/component/verify_p1_test.go
The Google Scholar component merges inputs with node parameters, invokes the tool, renders results, registers the component, and adds invocation tests.

Estimated code review effort: 4 (Complex) | ~45 minutes

Suggested labels: 💞 feature

Suggested reviewers: yuzhichang

Poem

A rabbit hops through Scholar’s gate,
With trimmed-up queries, filters straight.
Defaults bloom and results appear,
Wrapped in canvas, crisp and clear.
“Search complete!” the bunny cheers.

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 26.92% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes the main change: merging Google Scholar node params with runtime inputs.
Description check ✅ Passed The description matches the required Summary section and includes purpose, behavior changes, verification, and a screenshot.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@Harry-Hz-Zhang Harry-Hz-Zhang added 🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration labels Jul 10, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🧹 Nitpick comments (1)
internal/agent/component/universe_a_wrappers.go (1)

1517-1518: 🩺 Stability & Availability | 🔵 Trivial | 💤 Low value

json.Marshal error is silently ignored.

If marshaling fails (unlikely for basic types but not impossible), the tool receives empty JSON and returns a parse error that is harder to trace.

♻️ Suggested fix
-	argsJSON, _ := json.Marshal(args)
+	argsJSON, err := json.Marshal(args)
+	if err != nil {
+		return nil, fmt.Errorf("canvas: GoogleScholar: marshal args: %w", err)
+	}
 	out, err := c.inner.InvokableRun(ctx, string(argsJSON))
🤖 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 1517 - 1518,
Handle the error returned by json.Marshal in the wrapper containing InvokableRun
instead of discarding it. Check the marshal error before calling
c.inner.InvokableRun, return or propagate it with appropriate context, and only
pass string(argsJSON) when marshaling succeeds.
🤖 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 1517-1518: Handle the error returned by json.Marshal in the
wrapper containing InvokableRun instead of discarding it. Check the marshal
error before calling c.inner.InvokableRun, return or propagate it with
appropriate context, and only pass string(argsJSON) when marshaling succeeds.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: ea7b2491-561f-497f-b040-5e56b3103132

📥 Commits

Reviewing files that changed from the base of the PR and between eca8e87 and 2d8e033.

📒 Files selected for processing (8)
  • internal/agent/component/fixture_stubs.go
  • internal/agent/component/google_scholar_component_test.go
  • internal/agent/component/universe_a_wrappers.go
  • internal/agent/component/verify_p1_test.go
  • internal/agent/tool/google_scholar.go
  • internal/agent/tool/google_scholar_test.go
  • internal/agent/tool/registry.go
  • internal/agent/tool/registry_test.go

@Harry-Hz-Zhang
Harry-Hz-Zhang marked this pull request as draft July 10, 2026 04:51
@Harry-Hz-Zhang
Harry-Hz-Zhang marked this pull request as ready for review July 10, 2026 04:51
@Harry-Hz-Zhang
Harry-Hz-Zhang marked this pull request as draft July 10, 2026 04:56
@Harry-Hz-Zhang
Harry-Hz-Zhang marked this pull request as ready for review July 10, 2026 04:56
@yuzhichang

Copy link
Copy Markdown
Member

LGTM

@yuzhichang
yuzhichang merged commit 5797f81 into infiniflow:main Jul 10, 2026
8 of 10 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

🐞 bug Something isn't working, pull request that fix bug. ci Continue Integration size:L This PR changes 100-499 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants