mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-21 08:15:23 -04:00
[PR #165] [CLOSED] fix: apply constructed opts to Google search service creation #206
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/vxcontrol/pentagi/pull/165
Author: @mason5052
Created: 3/2/2026
Status: ❌ Closed
Base:
master← Head:fix/google-proxy-opts-unused📝 Commits (10+)
c68f933fix: treat screenshot failure as non-critical in browser tool5720402fix: propagate container lookup error in GetTool for terminal/file toolse36f47ffix: prevent http.DefaultClient mutation in search toolsc716ec6test: remove unused test server and dead imports in search tool testsddd0b0etest: add unit tests for perplexity and google search toolsc538b80test: address review feedback on search tool tests8354f7echore(deps): bump rollupf4da45echore(deps): bump go.opentelemetry.io/otel/sdk1c3f149feat: add Novita AI as optional LLM provider47e1469chore: expand .gitignore with IDE and OS patterns📊 Changes
20 files changed (+1904 additions, -165 deletions)
View changed files
📝
.gitignore(+9 -0)📝
.vscode/launch.json(+2 -0)📝
Dockerfile(+1 -0)📝
README.md(+10 -4)📝
backend/cmd/ftester/worker/executor.go(+8 -2)📝
backend/go.mod(+9 -8)📝
backend/go.sum(+18 -16)📝
backend/pkg/tools/browser.go(+14 -10)📝
backend/pkg/tools/browser_test.go(+191 -0)📝
backend/pkg/tools/google.go(+1 -1)➕
backend/pkg/tools/google_test.go(+172 -0)➕
backend/pkg/tools/perplexity_test.go(+349 -0)📝
backend/pkg/tools/tavily.go(+5 -3)➕
backend/pkg/tools/tavily_test.go(+148 -0)📝
backend/pkg/tools/terminal.go(+1 -1)📝
backend/pkg/tools/traversaal.go(+5 -3)➕
backend/pkg/tools/traversaal_test.go(+140 -0)➕
examples/configs/novita.provider.yml(+146 -0)➕
examples/tests/novita-report.md(+537 -0)📝
frontend/package-lock.json(+138 -117)📄 Description
Description of the Change
Problem
In
newSearchService()(backend/pkg/tools/google.go), theoptsslice is correctly constructed with both the API key and (when configured) a proxy HTTP client:However, the actual service creation call ignores
optsentirely and passes a hardcodedoption.WithAPIKey(g.apiKey):This means proxy configuration has no effect on Google search requests, even when
proxyURLis set.Solution
Replace the hardcoded argument with
opts...:This ensures the proxy HTTP client (when configured) is actually applied to the Google Custom Search API client.
Type of Change
Areas Affected
Testing and Verification
Test Configuration
Test Steps
google.goand identifiedoptsvariable never passed toNewServicegoogle_test.gotests pass (TestGoogleNewSearchServiceWithoutProxy, TestGoogleNewSearchServiceWithProxy)Test Results
option.WithAPIKey(g.apiKey)->opts...TestGoogleNewSearchServiceWithProxynow actually verifies that the proxy client option is applied (previously the test passed vacuously because the proxy opts were built but silently dropped)Security Considerations
This fix improves security by ensuring proxy configuration is honored. When a proxy is configured (e.g., for traffic inspection or network isolation), the current code silently bypasses it. After this fix, Google search traffic correctly routes through the configured proxy.
Performance Impact
None. The only change is which
ClientOptionvalues are passed toNewService.Documentation Updates
No documentation changes required.
Deployment Notes
Backward-compatible. When
proxyURLis empty,optscontains onlyoption.WithAPIKey(g.apiKey), producing identical behavior to the current code.Checklist
Code Quality
go fmtandgo vet(for Go code)Security
Compatibility
Documentation
Additional Notes
This bug was spotted during Copilot code review on PR #153 (google_test.go), which noted: "The production code at google.go:141 calls NewService with only option.WithAPIKey, ignoring the opts slice that was built to include the proxy client."
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.