Skip to content

fix(cron): warn when allowed web_search has no provider#97677

Merged
vincentkoc merged 1 commit into
openclaw:mainfrom
LiLan0125:fix/97654-web-search-tools-allow-diagnostic
Jun 29, 2026
Merged

fix(cron): warn when allowed web_search has no provider#97677
vincentkoc merged 1 commit into
openclaw:mainfrom
LiLan0125:fix/97654-web-search-tools-allow-diagnostic

Conversation

@LiLan0125

Copy link
Copy Markdown
Contributor

What Problem This Solves

  • Cron jobs can explicitly allow web_search through toolsAllow even when no managed web search provider is actually selected.
  • In that state, the run can appear successful while the exposed web_search tool cannot produce useful results.

Why This Change Was Made

  • Add a non-fatal cron preflight diagnostic when explicit toolsAllow requests web_search but provider selection resolves to empty.
  • Use the existing tool policy matcher, so exact names, groups, and glob-style allowlist entries are handled consistently.
  • Use the runtime provider selection path instead of checking only whether provider plugins exist.
  • Skip default-derived allowlists and provider-owned native search cases where managed web_search is intentionally suppressed.

User Impact

  • Affected cron runs now record an actionable warning in run diagnostics instead of silently proceeding with an unusable managed web_search tool.
  • Existing successful runs remain successful; this only adds diagnostic context.

Evidence

node scripts/run-vitest.mjs run src/cron/isolated-agent/run.tools-allow.test.ts src/cron/run-diagnostics.test.ts --maxWorkers=1
[test] starting test/vitest/vitest.cron.config.ts
[test] passed 1 Vitest shard in 18.20s
node scripts/run-vitest.mjs run src/agents/tools/web-tools.enabled-defaults.test.ts src/agents/tool-allowlist-guard.test.ts --maxWorkers=1
[test] starting test/vitest/vitest.unit-fast.config.ts
[test] starting test/vitest/vitest.agents.config.ts
[test] passed 2 Vitest shards in 19.10s
git diff --check

Real behavior proof

Behavior addressed: Explicit cron toolsAllow requests for web_search now produce diagnostics when runtime provider selection has no selected managed provider.
Environment tested: Linux, Node with tsx, local OpenClaw source checkout on branch fix/97654-web-search-tools-allow-diagnostic.
Steps run after the patch: Called the actual runtime provider selection function and the actual cron diagnostic helper from source.
Evidence after fix:

node --import tsx --no-warnings -e "import { resolveWebSearchProviderId } from './src/web-search/runtime.ts'; import { createCronRunDiagnosticsFromMissingWebSearchProvider } from './src/cron/run-diagnostics.ts'; const providers = [{ id: 'duckduckgo', pluginId: 'duckduckgo', requiresCredential: false }]; const selectedProvider = resolveWebSearchProviderId({ config: {}, providers }); const diagnostics = createCronRunDiagnosticsFromMissingWebSearchProvider({ toolsAllow: ['web_search'], hasWebSearchProvider: Boolean(selectedProvider), nowMs: () => 123456 }); console.log(JSON.stringify({ selectedProvider: selectedProvider || null, diagnostics }, null, 2));"

Output:

{
  "selectedProvider": null,
  "diagnostics": {
    "summary": "web_search tool requested in toolsAllow but no web search provider is selected. Configure one with: openclaw configure --section web, or set tools.web.search.provider.",
    "entries": [
      {
        "ts": 123456,
        "source": "cron-preflight",
        "severity": "warn",
        "message": "web_search tool requested in toolsAllow but no web search provider is selected. Configure one with: openclaw configure --section web, or set tools.web.search.provider.",
        "toolName": "web_search"
      }
    ]
  }
}

Observed result: Provider selection was empty and the cron diagnostic contained the warning that tells operators to configure or select a provider.
Not tested: A live gateway cron execution with real external search credentials was not run.

Impact Assessment

  • Scope: cron isolated-agent preflight diagnostics and cron diagnostic formatting.
  • Downstream: the changed helper is consumed by cron isolated runs and persisted through the existing diagnostics path.
  • Edge cases: wildcard-only allowlists, default-derived allowlists, selected providers, and native-search suppression are covered by tests.
  • Hard-coded values: no provider availability is assumed; the check uses runtime provider selection.
  • Existing fixes: no existing open PR was found for this issue before implementation.

Closes #97654

@clawsweeper

clawsweeper Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Codex review: needs maintainer review before merge. Reviewed June 29, 2026, 4:39 AM ET / 08:39 UTC.

Summary
The PR adds a non-fatal cron preflight diagnostic when an explicit toolsAllow requests web_search but no managed provider is selected, while skipping default allowlists and native hosted-search ownership.

PR surface: Source +149, Tests +170. Total +319 across 5 files.

Reproducibility: yes. source-level reproduction is high confidence: current main can expose web_search while provider availability is only discovered if the tool executes, and cron diagnostics do not warn for a successful model apology response. I did not run a live cron job in this read-only review.

Review metrics: none identified.

Root-cause cluster
Relationship: fixed_by_candidate
Canonical: #97654
Summary: This PR is a candidate fix for the open cron web_search toolsAllow diagnostics issue; several sibling PRs are competing candidate fixes for the same issue.

Members:

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

Merge readiness
Overall: 🐚 platinum hermit
Proof: 🐚 platinum hermit
Patch quality: 🐚 platinum hermit
Result: ready for maintainer review.

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

Rank-up moves:

  • none.

Risk before merge

  • [P1] Several open sibling PRs target the same linked issue, so maintainers should choose one canonical fix before landing and closing the other candidates.

Maintainer options:

  1. Decide the mitigation before merge
    Land one native-aware, provider-selection-based cron diagnostic fix with regression coverage, then close the linked issue and supersede the remaining duplicate PRs.
  2. Pause or close
    Do not merge this PR until maintainers decide whether the risk is worth taking.

Next step before merge

  • No automated repair is needed; maintainers should choose whether this is the canonical branch among the open sibling fixes for the same issue.

Security
Cleared: The diff only changes cron diagnostic TypeScript and tests; it does not change secrets, dependencies, workflows, package metadata, permissions, or downloaded code execution paths.

Review details

Best possible solution:

Land one native-aware, provider-selection-based cron diagnostic fix with regression coverage, then close the linked issue and supersede the remaining duplicate PRs.

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

Yes, source-level reproduction is high confidence: current main can expose web_search while provider availability is only discovered if the tool executes, and cron diagnostics do not warn for a successful model apology response. I did not run a live cron job in this read-only review.

Is this the best way to solve the issue?

Yes, this is the right fix shape: a non-fatal cron preflight diagnostic using the existing tool-policy matcher, native-search suppression check, and runtime provider-selection path. Failing the run hard or only warning at job creation would be less compatible and less reliable.

AGENTS.md: found and applied where relevant.

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

Label changes

Label changes:

  • add proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal output from real source functions showing empty provider selection yields the new warning diagnostic, with focused tests covering cron integration branches.
  • add rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • add status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes after-fix terminal output from real source functions showing empty provider selection yields the new warning diagnostic, with focused tests covering cron integration branches.

Label justifications:

  • P2: The PR targets a concrete cron/runtime diagnostics bug with limited blast radius and no outage, data-loss, or security-bypass evidence.
  • rating: 🐚 platinum hermit: Overall readiness is 🐚 platinum hermit; proof is 🐚 platinum hermit and patch quality is 🐚 platinum hermit.
  • status: 👀 ready for maintainer look: ClawSweeper has no concrete contributor-facing blocker left for this PR. Sufficient (terminal): The PR body includes after-fix terminal output from real source functions showing empty provider selection yields the new warning diagnostic, with focused tests covering cron integration branches.
  • proof: sufficient: Contributor real behavior proof is sufficient. The PR body includes after-fix terminal output from real source functions showing empty provider selection yields the new warning diagnostic, with focused tests covering cron integration branches.
Evidence reviewed

PR surface:

Source +149, Tests +170. Total +319 across 5 files.

View PR surface stats
Area Files Added Removed Net
Source 3 155 6 +149
Tests 2 170 0 +170
Docs 0 0 0 0
Config 0 0 0 0
Generated 0 0 0 0
Other 0 0 0 0
Total 5 325 6 +319

What I checked:

  • Current main diagnostic gap: Current main proceeds from the cron agent payload into delivery-context resolution without checking explicit web_search allowlists against effective provider availability. (src/cron/isolated-agent/run.ts:756, ff1e7e1305cc)
  • Current web_search availability is execution-time: Current main creates the managed web_search tool unless config disables search, while runWebSearch throws only after provider candidates resolve empty; that supports the linked source-level reproduction. (src/web-search/runtime.ts:462, ff1e7e1305cc)
  • PR preflight predicate: The PR adds createCronToolsAllowPreflightDiagnostics, skips default-derived allowlists, checks native hosted-search suppression, then resolves the managed web_search provider id before creating the warning. (src/cron/isolated-agent/run.ts:345, 1ceb3f7a81aa)
  • PR diagnostic helper: The PR centralizes the warning text and uses the existing policy matcher so exact tool names, groups, and glob-style entries are handled consistently while wildcard-only allowlists are skipped. (src/cron/run-diagnostics.ts:23, 1ceb3f7a81aa)
  • PR regression coverage: The PR adds tests for the warning path, default-derived allowlists, native hosted-search suppression, and aborted-run diagnostic merging. (src/cron/isolated-agent/run.tools-allow.test.ts:153, 1ceb3f7a81aa)
  • Codex native web_search contract checked: Sibling Codex source shows hosted web_search is represented as a web_search ToolSpec when web_search_mode is cached/indexed/live and omitted when disabled or unset, supporting the PR's native-search skip path. (../codex/codex-rs/core/src/tools/hosted_spec.rs:20, ccdfb4f342a2)

Likely related people:

  • vincentkoc: Recent main history on src/web-search/runtime.ts includes runtime-provider refactors and explicit/global provider selection work that this PR calls. (role: recent web_search runtime contributor; confidence: high; commits: e122cd09ab0f, b962c53e785c, 0668f1e003ed; files: src/web-search/runtime.ts, src/agents/tools/web-tool-runtime-context.ts)
  • fuller-stack-dev: Authored the merged Codex hosted web_search work that owns the native path this PR explicitly avoids misdiagnosing. (role: native hosted web_search feature contributor; confidence: high; commits: 1e0062b44a51; files: src/agents/codex-native-web-search-core.ts)
  • eleqtrizit: Authored the merged native web_search policy enforcement work used by shouldSuppressManagedWebSearchTool. (role: native web_search policy contributor; confidence: high; commits: f0d8048aa3b4; files: src/agents/codex-native-web-search-core.ts)
  • Jerry-Xin: Recent main history on src/cron/isolated-agent/run.ts includes a guard in the same prepare/finalize cron runner area touched by this PR. (role: recent cron isolated-run contributor; confidence: medium; commits: 30b39c6eab43; files: src/cron/isolated-agent/run.ts)
  • mmaps: Authored the merged scheduled-turn tool policy PR that preserved cron toolsAllow behavior adjacent to this diagnostic gap. (role: scheduled-turn toolsAllow contributor; confidence: medium; commits: 49b18ddfba2b, b02ab0c49ed7, 07741ef6a683; files: src/agents/agent-tools.ts, src/agents/embedded-agent-runner/run/attempt.ts, src/agents/tools/cron-tool.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 proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. P2 Normal backlog priority with limited blast radius. and removed proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 29, 2026
@clawsweeper clawsweeper Bot added proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR. labels Jun 29, 2026
@vincentkoc
vincentkoc merged commit 685b95b into openclaw:main Jun 29, 2026
158 of 170 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

P2 Normal backlog priority with limited blast radius. proof: sufficient ClawSweeper judged the real behavior proof convincing. rating: 🐚 platinum hermit Good normal PR readiness with ordinary maintainer review expected. size: M status: 👀 ready for maintainer look ClawSweeper has no concrete contributor-facing blocker left for this PR.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Silent failure when web_search is in toolsAllow but no search provider plugin is enabled

2 participants