mirror of
https://github.com/vxcontrol/pentagi.git
synced 2026-07-21 08:15:23 -04:00
[PR #167] [MERGED] fix: apply constructed opts to Google search service creation #210
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/167
Author: @mason5052
Created: 3/2/2026
Status: ✅ Merged
Merged: 3/2/2026
Merged by: @asdek
Base:
feature/next_release← Head:fix/google-search-opts-unused📝 Commits (1)
be0dc7efix: apply constructed opts to Google search service creation📊 Changes
1 file changed (+1 additions, -1 deletions)
View changed files
📝
backend/pkg/tools/google.go(+1 -1)📄 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
optsvariable built but never passed toNewServicegoogle_test.gotests pass (TestGoogleNewSearchServiceWithoutProxy, TestGoogleNewSearchServiceWithProxy)Test Results
option.WithAPIKey(g.apiKey)->opts...proxyURLis empty,optscontains onlyoption.WithAPIKey(g.apiKey), producing identical behavior to the current codeSecurity 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.
Performance Impact
None. The only change is which
ClientOptionvalues are passed toNewService.Deployment Notes
Backward-compatible. When
proxyURLis empty, behavior is identical.Checklist
Code Quality
go fmtandgo vet(for Go code)Security
Compatibility
Documentation
Additional Notes
Resubmission of #165 (which was closed due to branch contamination). This PR contains only the single-line fix.
🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.