Skip to content

Keep agent web_search on runtime provider resolution#88684

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
alexzhu0:fix/agent-web-search-provider-resolution
Jun 24, 2026
Merged

Keep agent web_search on runtime provider resolution#88684
vincentkoc merged 1 commit into
openclaw:mainfrom
alexzhu0:fix/agent-web-search-provider-resolution

Conversation

@alexzhu0

@alexzhu0 alexzhu0 commented May 31, 2026

Copy link
Copy Markdown
Contributor

Fixes #87347

What Problem This Solves

Fixes an issue where agent-side web_search could report that no provider was
available even when the configured provider was loaded in the live runtime.

Why This Change Was Made

The agent tool was making a manifest-owner decision before runWebSearch could
use the active runtime provider registry. Search now stays runtime-first at the
agent boundary; runWebSearch remains responsible for downstream provider
scoping. web_fetch keeps its existing bundled-owner behavior.

User Impact

Configured manifest-owned search providers remain available to agent-side
web_search when their plugin is loaded in the current runtime.

Evidence

  • Current main: 4d034639adfdcfd58ac8d793fdea625c88897428
  • Focused Vitest: 4 files, 48 tests passed
  • Changed-file oxlint: passed
  • git diff --check: passed
  • Production resolver smoke: search preferRuntimeProviders=true; bundled fetch false
  • Autoreview: 0 findings
  • No live Brave request was run; credentials were not available

@openclaw-barnacle openclaw-barnacle Bot added agents Agent runtime and tooling size: S triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. labels May 31, 2026
@clawsweeper

clawsweeper Bot commented May 31, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs real behavior proof before merge. Reviewed June 24, 2026, 8:02 AM ET / 12:02 UTC.

Summary
The branch changes the agent web tool runtime context helper and tests so agent web_search always keeps runtime provider discovery enabled while web_fetch retains bundled-owner manifest gating.

PR surface: Source -4, Tests -22. Total -26 across 3 files.

Reproducibility: yes. at source level: current main can set preferRuntimeProviders false for a manifest-owned configured search provider, and createWebSearchTool forwards that into runWebSearch. I did not live-reproduce the multi-hour gateway uptime failure.

Review metrics: 1 noteworthy metric.

  • Provider precedence split: 1 changed, 1 preserved. The diff changes agent web_search discovery precedence while preserving web_fetch bundled-owner handling, which is the compatibility choice maintainers need to review.

Stored data model
Persistent data-model change detected: vector/embedding metadata: src/agents/tools/web-tool-runtime-context.test.ts. Confirm migration or upgrade compatibility proof before merge.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #87347
Summary: This PR is the direct open fix candidate for the canonical agent-side web_search runtime-provider divergence; the broader explicit-provider routing PR overlaps but is not the clean canonical landing path right now.

Members:

Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything.

Merge readiness
Overall: 🦪 silver shellfish
Proof: 🦪 silver shellfish
Patch quality: 🐚 platinum hermit
Result: blocked until stronger real behavior proof is added.

Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch.

Rank-up moves:

  • [P1] Add redacted live Brave-backed agent or gateway web_search terminal output, logs, or a recording from this head; redact API keys, IP addresses, phone numbers, non-public endpoints, and other private details.
  • Have provider/runtime ownership confirm the intended split: web_search runtime-first at the agent boundary, web_fetch still bundled-owner gated.
  • Coordinate landing order with [codex] Fix explicit custom web_search provider routing #77736 so explicit web_search routing semantics do not diverge.

Proof guidance:

  • [P1] Needs stronger real behavior proof before merge: The PR body provides tests and a summarized resolver smoke, but no inspectable redacted agent/gateway web_search output for the changed provider path. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.

Risk before merge

  • [P1] The PR intentionally changes agent web_search provider-resolution precedence, so maintainers should confirm no supported configured search setup depends on the old manifest-owner gate before runtime registry lookup.
  • [P1] The public proof is still not inspectable real behavior proof for the changed path; tests and a summarized resolver smoke do not show redacted Brave-backed agent or gateway web_search output from this head.
  • [P2] [codex] Fix explicit custom web_search provider routing #77736 overlaps explicit web_search routing semantics, so landing order should avoid contradictory provider-precedence or fallback behavior.

Maintainer options:

  1. Require provider-path proof (recommended)
    Ask for redacted live Brave-backed agent or gateway web_search terminal output, logs, or a recording from this exact head showing the configured provider resolves through the runtime registry while web_fetch remains bundled-owner gated.
  2. Accept maintainer-owned validation
    Maintainers can intentionally land with the public proof gap only if they have separately validated the provider path and own that evidence outside the PR.
  3. Coordinate with broader routing work
    Pause this PR or land it first only if the broader explicit-provider routing PR rebases around the runtime-first search contract.

Next step before merge

  • [P1] Manual review remains because the blocker is real behavior proof plus provider/runtime owner confirmation, not a narrow code repair an automated worker can safely apply.

Security
Cleared: The diff changes provider-resolution control flow and tests only; it adds no dependency, workflow, lockfile, package, secret-handling, or supply-chain surface.

Review details

Best possible solution:

Land this narrow runtime-first search fix after provider/runtime owner review, redacted real behavior proof, and coordination with the broader explicit-provider routing PR; keep web_fetch's bundled-owner gate intact.

Do we have a high-confidence way to reproduce the issue?

Yes, at source level: current main can set preferRuntimeProviders false for a manifest-owned configured search provider, and createWebSearchTool forwards that into runWebSearch. I did not live-reproduce the multi-hour gateway uptime failure.

Is this the best way to solve the issue?

Yes, this looks like the narrowest maintainable fix shape: keep agent web_search runtime-first and leave search manifest-owner scoping to runWebSearch, while preserving web_fetch's bundled-owner path. The remaining blockers are proof, owner confirmation, and coordination with the overlapping routing PR.

AGENTS.md: found and applied where relevant.

Codex review notes: model internal, reasoning high; reviewed against 2a484a3ff10d.

Label changes

Label justifications:

  • P1: The PR targets a high-impact regression where channel-driven agents can lose web_search provider routing even though the configured provider remains loaded.
  • merge-risk: 🚨 compatibility: Changing provider-resolution precedence can affect existing configured web_search setups during upgrade or long-running gateway operation.
  • merge-risk: 🚨 auth-provider: The changed behavior directly affects provider routing and which configured web_search provider receives the agent tool call.
  • rating: 🦪 silver shellfish: Overall readiness is 🦪 silver shellfish; proof is 🦪 silver shellfish and patch quality is 🐚 platinum hermit.
  • status: 📣 needs proof: The PR needs real behavior proof before ClawSweeper can clear the contributor ask. Needs stronger real behavior proof before merge: The PR body provides tests and a summarized resolver smoke, but no inspectable redacted agent/gateway web_search output for the changed provider path. After adding proof, update the PR body; ClawSweeper should re-review automatically. If it does not, the PR author or someone with repository write access can comment @clawsweeper re-review.
Evidence reviewed

PR surface:

Source -4, Tests -22. Total -26 across 3 files.

View PR surface stats
Area Files Added Removed Net
Source 1 5 9 -4
Tests 2 15 37 -22
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 3 20 46 -26

What I checked:

  • Repository policy applied: Root AGENTS.md and scoped agent/tool AGENTS.md were read; provider routing, fallback behavior, and PR proof are compatibility-sensitive review surfaces for this change. (AGENTS.md:25, 2a484a3ff10d)
  • Current main source-level failure path: Current main resolves manifest ownership for both search and fetch before returning preferRuntimeProviders, so a manifest-owned configured search provider can disable runtime-provider discovery before runWebSearch executes. (src/agents/tools/web-tool-runtime-context.ts:43, 2a484a3ff10d)
  • Agent entry point forwards the decision: createWebSearchTool forwards the resolved preferRuntimeProviders flag directly into runWebSearch on the embedded agent tool path. (src/agents/tools/web-search.ts:97, 2a484a3ff10d)
  • Downstream runtime owns search provider scoping: runWebSearch uses preferRuntimeProviders to choose runtime versus plugin provider loading, while explicit search provider ownership is already scoped inside the web-search runtime. (src/web-search/runtime.ts:321, 2a484a3ff10d)
  • PR head keeps search runtime-first: At the PR head, shouldPreferRuntimeProviders returns true for search before manifest-owner lookup and leaves the remaining owner lookup limited to webFetchProviders. (src/agents/tools/web-tool-runtime-context.ts:42, bf13efd81834)
  • PR tests cover the split: PR-head tests assert manifest-owned configured search providers keep runtime discovery enabled, while the fetch test still expects bundled-owner lookup to disable runtime providers. (src/agents/tools/web-tool-runtime-context.test.ts:117, bf13efd81834)

Likely related people:

  • vincentkoc: Current blame on the provider-preference gate and downstream search scoping points to a Vincent Koc commit in this checkout, and GitHub history shows recent explicit provider/runtime refactors in the same files. (role: recent area contributor; confidence: high; commits: d42b86421969, 0668f1e003ed, e122cd09ab0f; files: src/agents/tools/web-tool-runtime-context.ts, src/web-search/runtime.ts)
  • steipete: GitHub history shows Peter Steinberger introduced the shared web-tool runtime provider context and earlier web provider discovery/runtime work adjacent to this fix. (role: feature-history contributor; confidence: high; commits: 128cc2c84b6e, 8838fdc91625, 4bba2888e7c1; files: src/agents/tools/web-tool-runtime-context.ts, src/web-search/runtime.ts, src/plugins/web-provider-runtime-shared.ts)
  • joeykrug: Earlier merged work by Joey Krug addressed first-class web_search runtime providers disappearing at the same agent/runtime no-provider boundary. (role: adjacent runtime-selection contributor; confidence: medium; commits: c76d8f5a7c3b, ab24e9357374; files: src/agents/tools/web-search.ts, src/plugins/web-provider-runtime-shared.ts)
What the crustacean ranks mean
  • 🦀 challenger crab: rare, exceptional readiness with strong proof, clean implementation, and convincing validation.
  • 🦞 diamond lobster: very strong readiness with only minor maintainer review expected.
  • 🐚 platinum hermit: good normal PR, likely mergeable with ordinary maintainer review.
  • 🦐 gold shrimp: useful signal, but proof or patch confidence is still limited.
  • 🦪 silver shellfish: thin signal; proof, validation, or implementation needs work.
  • 🧂 unranked krab: not merge-ready because proof is missing/unusable or there are serious correctness or safety concerns.
  • 🌊 off-meta tidepool: rating does not apply to this item.

Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics.

How this review workflow works
  • ClawSweeper keeps one durable marker-backed review comment per issue or PR.
  • Re-runs edit this comment so the latest verdict, findings, and automation markers stay together instead of adding duplicate bot comments.
  • A fresh review can be triggered by eligible @clawsweeper re-review comments, exact-item GitHub events, scheduled/background review runs, or manual workflow dispatch.
  • PR/issue authors and users with repository write access can comment @clawsweeper re-review or @clawsweeper re-run on an open PR or issue to request a fresh review only.
  • Maintainers can also comment @clawsweeper review to request a fresh review only.
  • Fresh-review commands do not start repair, autofix, rebase, CI repair, or automerge.
  • Maintainer-only repair and merge flows require explicit commands such as @clawsweeper autofix, @clawsweeper automerge, @clawsweeper fix ci, or @clawsweeper address review.
  • Maintainers can comment @clawsweeper explain to ask for more context, or @clawsweeper stop to stop active automation.

@clawsweeper clawsweeper Bot added rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P1 High-priority user-facing bug, regression, or broken workflow. labels May 31, 2026
@byungskers

Copy link
Copy Markdown

This direction makes sense to me. Search is much more sensitive to the live runtime registry than fetch, so keeping web_search runtime-first while leaving the bundled-owner fetch gate alone looks like the right split.

The main thing I’d want maintainers to sanity-check is whether there are any scenarios where a configured search provider is intentionally not supposed to use an already-loaded runtime instance. If the answer is “no,” then dropping the early manifest-owner lookup here seems like the cleanest way to bring agent web_search back in line with infer web / runtime inspection behavior.

@alexzhu0
alexzhu0 marked this pull request as ready for review June 1, 2026 02:05
@clawsweeper clawsweeper Bot added the merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. label Jun 1, 2026
@alexzhu0
alexzhu0 force-pushed the fix/agent-web-search-provider-resolution branch from df9990d to 3d604b7 Compare June 1, 2026 02:23
@openclaw-barnacle openclaw-barnacle Bot added proof: supplied External PR includes structured after-fix real behavior proof. and removed triage: mock-only-proof Candidate: PR proof only shows tests, mocks, snapshots, lint, typecheck, or CI. labels Jun 1, 2026
@alexzhu0
alexzhu0 force-pushed the fix/agent-web-search-provider-resolution branch from 3d604b7 to 1068c9e Compare June 2, 2026 03:08
@clawsweeper clawsweeper Bot added rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jun 2, 2026
@alexzhu0
alexzhu0 force-pushed the fix/agent-web-search-provider-resolution branch from 1068c9e to 50ef096 Compare June 2, 2026 17:36
@clawsweeper clawsweeper Bot added merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. and removed rating: 🦐 gold shrimp Decent PR readiness signal, but merge confidence is limited. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. labels Jun 19, 2026
@vincentkoc
vincentkoc force-pushed the fix/agent-web-search-provider-resolution branch from 50ef096 to b02543f Compare June 24, 2026 01:08
@vincentkoc

Copy link
Copy Markdown
Member

Fixes #87347

What Problem This Solves

Fixes an issue where agent-side web_search could report that no provider was
available even when the configured provider was loaded in the live runtime.

Why This Change Was Made

The agent tool was making a manifest-owner decision before runWebSearch could
use the active runtime provider registry. Search now stays runtime-first at the
agent boundary; runWebSearch remains responsible for downstream provider
scoping. web_fetch keeps its existing bundled-owner behavior.

User Impact

Configured manifest-owned search providers remain available to agent-side
web_search when their plugin is loaded in the current runtime.

Evidence

  • Current main: 4d034639adfdcfd58ac8d793fdea625c88897428
  • Focused Vitest: 4 files, 48 tests passed
  • Changed-file oxlint: passed
  • git diff --check: passed
  • Production resolver smoke: search preferRuntimeProviders=true; bundled fetch false
  • Autoreview: 0 findings
  • No live Brave request was run; credentials were not available

@vincentkoc
vincentkoc force-pushed the fix/agent-web-search-provider-resolution branch from b02543f to 20ea078 Compare June 24, 2026 01:18
@vincentkoc

Copy link
Copy Markdown
Member

rebased again because main advanced during merge preparation.

  • new base: 63874fa0d1194675fa6a96a7178ea187d971afa6
  • new head: 20ea0781092db9bc3291b672c8f49c6d363ddfc0
  • focused rerun: 4 files, 48 tests passed

The diff remains the same three-file owner-boundary fix.

@openclaw-barnacle openclaw-barnacle Bot added gateway Gateway runtime extensions: copilot-proxy Extension: copilot-proxy extensions: diagnostics-otel Extension: diagnostics-otel extensions: llm-task Extension: llm-task extensions: lobster Extension: lobster extensions: memory-core Extension: memory-core extensions: memory-lancedb Extension: memory-lancedb extensions: open-prose Extension: open-prose cli CLI command changes scripts Repository scripts commands Command implementations docker Docker and sandbox tooling channel: feishu Channel integration: feishu channel: twitch Channel integration: twitch channel: irc extensions: acpx extensions: anthropic extensions: openai extensions: minimax extensions: cloudflare-ai-gateway extensions: byteplus extensions: huggingface labels Jun 24, 2026
@vincentkoc

Copy link
Copy Markdown
Member

Maintainer update: the merge guard caught relevant mainline drift. I rebased the maintainer-editable branch onto the exact current main and force-updated it with a lease.

The PR remains the same three-file web-search owner-boundary fix. Fresh exact-head hosted checks are running before the guarded merge retry.

@vincentkoc

Copy link
Copy Markdown
Member

Maintainer update: main advanced to 2a484a3ff10 during the previous hosted run. The PR branch is now rebased onto that exact head and force-updated with a lease; the three-file diff is unchanged. Fresh checks are starting for this exact head.

@vincentkoc

Copy link
Copy Markdown
Member

Merged via squash.

Thanks @alexzhu0!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

agents Agent runtime and tooling merge-risk: 🚨 auth-provider 🚨 May break OAuth, tokens, provider routing, model choice, or credentials. merge-risk: 🚨 compatibility 🚨 May break existing users, config, migrations, defaults, or upgrade paths. P1 High-priority user-facing bug, regression, or broken workflow. proof: supplied External PR includes structured after-fix real behavior proof. rating: 🦪 silver shellfish Thin PR readiness signal; proof, validation, or implementation needs work. size: S status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: Agent-side web_search resolves to "no provider available" while CLI infer web search and plugins inspect confirm Brave is loaded

3 participants