fix(cron): warn when web_search is in toolsAllow but no provider is enabled#97719
fix(cron): warn when web_search is in toolsAllow but no provider is enabled#97719LeonidasLux wants to merge 2 commits into
Conversation
|
Thanks for the context here. I swept through the related work, and this is now duplicate or superseded. Close: this PR is superseded by #97677, which covers the same linked cron web_search/toolsAllow issue with native-search-aware provider selection, provider-neutral persisted diagnostics, focused tests, and positive proof; this branch still has merge-blocking diagnostic correctness gaps. Root-cause cluster Members:
Proposal only: this assessment does not dispatch repair, suppress jobs, mutate sibling items, close, or merge anything. Canonical path: Close this duplicate branch and let maintainers review or land the native-aware replacement PR for the shared issue. So I’m closing this here because the remaining work is already tracked in the canonical issue. Review detailsBest possible solution: Close this duplicate branch and let maintainers review or land the native-aware replacement PR for the shared issue. Do we have a high-confidence way to reproduce the issue? Yes. Source inspection shows current main can expose or satisfy web_search through different provider paths while 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? No. A cron preflight diagnostic is the right boundary, but this branch is not the best fix because it ignores native hosted search and leaves stale persisted diagnostic text; the replacement PR is the safer path. Security review: Security review cleared: The diff only changes cron TypeScript diagnostics and tests; it does not add dependency, workflow, credential, permission, or external code-execution surface. AGENTS.md: found and applied where relevant. What I checked:
Likely related people:
Codex review notes: model internal, reasoning high; reviewed against ff1e7e1305cc. |
…nabled - Add preflight check in prepareCronRunContext that logs a warning when web_search is requested but listWebSearchProviders() is empty - Merge a cron-preflight diagnostic entry with warn severity into the run result in finalizeCronRun so diagnostics_summary surfaces it Fixes openclaw#97654
… test - Replace hard-coded duckduckgo with provider-neutral guidance - Add focused regression test verifying logWarn is called when web_search is in toolsAllow but listWebSearchProviders is empty Fixes openclaw#97654
e7f5d29 to
8a33d39
Compare
|
Addressed review findings:
@clawsweeper re-review |
|
🦞🧹 I asked ClawSweeper to review this item again. |
|
ClawSweeper applied the proposed close for this PR.
|
Summary
Problem: When a cron job has
web_searchintoolsAllowbut no web search provider plugin is enabled (duckduckgo, exa, firecrawl, tavily, searxng all disabled), the run completes silently withstatus: okwhile the model cannot search the web. The operator sees no warning in logs or diagnostics.Solution: Add a cron preflight check in
prepareCronRunContextthat detects the mismatch and emits alogWarn, and merge acron-preflightdiagnostic entry withseverity: warninto the run result infinalizeCronRun.What changed: Two files —
src/cron/isolated-agent/run.ts(preflight check) andsrc/cron/isolated-agent/run.tools-allow.test.ts(regression test). The preflight path now callsexpandToolGroupsandnormalizeToolNameon theagentPayload.toolsAllowlist; whenweb_searchis found andlistWebSearchProviders()returns an empty array, a warning is emitted via bothlogWarnand the diagnostics system. The warning message uses provider-neutral language (no hard-codedduckduckgo).What did NOT change: All existing behavior is preserved. The check is additive — it only emits warnings, never changes execution flow, never blocks runs, and never rejects configurations. No config schema, CLI interface, public API, or plugin SDK surface is touched.
Fixes #97654
What Problem This Solves
Problem:
Operators who configure a cron job with
toolsAllow: ["web_search"]while all search provider plugins are disabled get a silent failure. The cron run showsstatus: okandlastDeliveryStatus: delivered, but the delivered content is the model apologising that it cannot search. No warning appears incron_run_logs.diagnostics_summaryandopenclaw logsshows nothing actionable.Why This Change Was Made:
toolsAllowonly gates whether a registered tool is permitted — it does not validate whether the tool is actually registered. The web_search tool is built fromlistWebSearchProviders(), which returns an empty array when no search plugin is enabled. The preflight now cross-references the two.The same class of issue exists for
web_fetchandbrowsertools and can be addressed in follow-up PRs.User Impact:
Operators now see a
warn-severity diagnostic in the cron run result whenweb_searchis requested but unavailable, and alogWarnline in server logs at preflight time.Root Cause
Trigger condition:
A cron job with
toolsAllowcontainingweb_searchruns while all web search provider plugins are disabled (or none are installed).Root cause analysis:
webSearchProvidersis emptyAffected scope:
toolsAllow: ["web_search"]when no search provider is enabledweb_searchin toolsAllow, or with at least one search provider enabledLinked context
web_searchis requested but no search provider is availableweb_fetchandbrowsertools (same class of issue, follow-up PRs); non-cron agent turn paths (channels, CLI)docs/.local/issue-97654/(01-analysis.mdthrough06-verification.md)Real behavior proof
Behavior addressed: Cron preflight now warns when
web_searchis intoolsAllowbutlistWebSearchProviders()returns an empty arrayReal environment tested: Linux x86_64 / Debian 12 / OpenClaw source at upstream/main (
96c8338d5b)Exact steps or command run after this patch:
After-fix evidence:
Observed result after the fix: TypeScript compilation succeeds with zero errors, no new import cycles are introduced, and all 10 existing cron diagnostics tests pass. The broader cron test suite (108 test files, 1164 tests) also passes.
What was not tested: Live end-to-end cron execution (requires a running OpenClaw Gateway with disabled search plugins — this is a
source-reproissue). The fix is validated through type safety, import cycle analysis, and existing test coverage of the modifiedfinalizeCronRunandagentDiagnosticsmerge path.Tests and validation
Local checks
Unit tests — tools-allow regression test
The new test
warns when web_search is in toolsAllow but no search provider is enabledverifies thatlogWarnis called with the expected preflight warning.Unit tests — cron diagnostics
Unit tests — full cron module
The 32 failing tests are all pre-existing
Cannot find moduleerrors from unbuilt extension artifacts (anthropic/cli-shared.js, openai/thinking-policy.js, etc.) — entirely unrelated to this change. 108 test files and 1164 individual tests pass.Risk checklist
This change is backwards compatible
This change has been tested with existing configurations
I have updated relevant documentation
Breaking changes (if any) are documented in Summary
Auth-provider risk: None. The check only looks at
toolsAllowandlistWebSearchProviders()— no credential/auth flow is touched.Compatibility risk: None. Additive warning only — emits a
logWarnand acron-preflightdiagnostic entry. Never blocks execution, never changes existing behavior.Merge-risk explanation: Low. Single-file change (37 lines added in
src/cron/isolated-agent/run.ts). All new code is gated behind the conditionweb_search in toolsAllow AND no provider available. Normal configurations (with a search provider enabled) see zero overhead from this check.Current review state