Skip to content

feat(websearch): native Go in-process websearch, no Python dependency (#381) - #404

Closed
Delqhi wants to merge 1 commit into
mainfrom
feat/native-websearch
Closed

feat(websearch): native Go in-process websearch, no Python dependency (#381)#404
Delqhi wants to merge 1 commit into
mainfrom
feat/native-websearch

Conversation

@Delqhi

@Delqhi Delqhi commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator

Pure stdlib DuckDuckGo HTML fetch + parse + LRU cache + rate limit. 22 tests race-clean.

Implements a pure-Go, stdlib-only web search inside the sin-code binary
so the legacy external Python sin-websearch skill is no longer required
to satisfy the research surface of the agent loop. The package honours
mandate M2 (single static binary, no CGO, no Python) and M7 (race-safe:
-LOOK_TEST below).

What ships:
- cmd/sin-code/internal/native_websearch/cache.go    — LRU + 15 min TTL
- cmd/sin-code/internal/native_websearch/rate_limit.go — token-bucket
  limiter implemented with stdlib sync/atomic + sync.Cond; no
  golang.org/x/time/rate dependency required
- cmd/sin-code/internal/native_websearch/search.go    — DuckDuckGo HTML
  fetcher + parser (pure string-scan, no x/net/html), cache + limiter
  wiring, robots.txt honour with per-host snapshot (1 h TTL)
- *_test.go: 22 race-clean tests covering parsing, rate limit,
  cache hit avoidance, robots Disallow, ctx cancellation, nil-safety,
  and concurrent burn-in for cache + limiter

What wires up:
- mcpclient/registry.go: adds internal_native_websearch goNative entry
  mapping to the native_websearch server name and shortName so the
  tool prefix is enumerated as native_websearch__search
- catalog/source_external.go: parallel catalog entry so the operator
  surface lists the in-process fallback
- permission_defaults.go: native_websearch__* -> allow (read-only)

Constraints honoured:
- M2: pure stdlib (net/http, net/url, container/list, sync, sync/atomic,
  time) — no CGO, no Python dependency, no extra go.mod lines needed
- M5: module path github.com/OpenSIN-Code/SIN-Code/...
- M7: cache.LRU + rate_limit.TokenBucket verified under -race -count=1
  with 16 + 32 goroutines burn-in; TestCacheRaceClean and
  TestRateLimiterRaceClean run every release

All 22 tests pass: go test -race -count=1 ./cmd/sin-code/internal/native_websearch/...
@Delqhi Delqhi added the enhancement New feature or request label Jun 18, 2026
@vercel

vercel Bot commented Jun 18, 2026

Copy link
Copy Markdown
Contributor

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
sin-code Ready Ready Preview, Comment, Open in v0 Jun 18, 2026 6:13pm

@github-actions

Copy link
Copy Markdown

🏆 CEO Audit — A+ (100.0/100)

Metric Value
Grade A+
Score 100.0/100
Critical findings 0
High findings 0
Profile QUICK
Min grade gate B

📥 Download full report (Markdown)
📊 Download SARIF (for Code Scanning)

Run ~/.config/opencode/skills/ceo-audit/scripts/audit.sh . --profile=QUICK locally to reproduce.

@github-actions

Copy link
Copy Markdown

🏆 CEO Audit — A+ (100.0/100)

Metric Value
Grade A+
Score 100.0/100
Critical findings 0
High findings 0
Medium findings 0
Profile QUICK
Min grade gate B

📥 Download full report (Markdown)

Run ID: 27779950725 · Commit: ${github.sha}

Run ~/.config/opencode/skills/ceo-audit/scripts/audit.sh . --profile=QUICK locally to reproduce.

@Delqhi

Delqhi commented Jun 18, 2026

Copy link
Copy Markdown
Collaborator Author

Closing as duplicate. Issue #381 (Native Go web search) was already shipped by a parallel agent on main:

  • Already committed: cmd/sin-code/internal/{native_websearch,websearch}/
  • This branch feat/native-websearch was created from an older snapshot of main; merging would create conflicts and risk deleting parallel agent work.
  • The shipped implementation lives on current main (see commits by parallel agents).

@Delqhi Delqhi closed this Jun 18, 2026
@Delqhi
Delqhi deleted the feat/native-websearch branch June 22, 2026 16:46
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant