Skip to content

fix(cron): warn when web_search is in toolsAllow but no search provider is enabled#97658

Closed
krissding wants to merge 1 commit into
openclaw:mainfrom
krissding:issue-97654
Closed

fix(cron): warn when web_search is in toolsAllow but no search provider is enabled#97658
krissding wants to merge 1 commit into
openclaw:mainfrom
krissding:issue-97654

Conversation

@krissding

@krissding krissding commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Closes #97654

What Problem This Solves

When a cron agent turn specifies web_search in toolsAllow but no search provider plugin is enabled, the cron completes with "ok" while the model delivers an apology — because the tool has no registered handler. The cron succeeds at the infrastructure level but fails at the task level, wasting a scheduled cycle.

Why This Change Was Made

A preflight check in prepareCronRunContext detects the mismatch early and logs a warning with actionable guidance. This avoids silent failures and helps operators fix configuration before the cron executes.

The check runs after tool expansion/normalization so aliases map to the canonical web_search name. listWebSearchProviders already exists and is the authoritative API for determining whether a search provider is available.

Evidence

Source-level proof

  • expandToolGroups + normalizeToolName provide canonical tool name matching (same path used by the actual tool executor)
  • listWebSearchProviders({ config }) is the authoritative API — returns empty array when no search provider plugin is enabled
  • The warning message includes [cron:${job.id}] prefix for traceability and actionable remediation text

Existing code paths

  • The check runs after agentTurn payload validation but before the delivery plan is resolved, so no side effects occur
  • Control flow continues normally after the warning — the cron still runs, but the operator is informed

Not tested

  • Live cron cycle with search provider configuration changes (requires running gateway + cron scheduling)

Merge Risk

Low. The change:

  • Adds a read-only preflight check (no side effects)
  • Uses existing, well-tested APIs (expandToolGroups, normalizeToolName, listWebSearchProviders)
  • Only emits a logWarn — does not block execution
  • +17 lines, one file, zero imports added

🤖 Generated with Claude Code

…er is enabled

When a cron job has web_search in its toolsAllow but every search provider
plugin is disabled, the model delivers an apology and the run completes with
status "ok" — no warning, no diagnostic.  The operator has no signal that
anything is wrong.

Add a preflight check in prepareCronRunContext that logs a warning when
web_search is requested but listWebSearchProviders() returns empty, directing
the operator to enable a search plugin.

Co-Authored-By: Claude Sonnet 4.6 <[email protected]>
@clawsweeper

clawsweeper Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

Thanks for the context here. I swept through the related work, and this is now duplicate or superseded.

Close as superseded: this branch is a narrower warning-only fix with known gaps, while the open sibling PR now provides the same issue’s viable native-aware, persisted-diagnostics implementation with proof and tests.

Root-cause cluster
Relationship: superseded
Canonical: #97677
Summary: This PR and the open sibling PR both target #97654; the sibling has the viable native-aware, diagnostics-persisting fix path.

Members:

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

Canonical path: Land the native-aware, provider-selection-based diagnostic path in #97677 and close this narrower branch as superseded.

So I’m closing this here and keeping the remaining discussion on #97677.

Review details

Best possible solution:

Land the native-aware, provider-selection-based diagnostic path in #97677 and close this narrower branch as superseded.

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

Yes. Source inspection shows web_search is still constructed when search is enabled, while missing-provider failures only become diagnostics when the tool actually reports an error, not when the model simply apologizes.

Is this the best way to solve the issue?

No. The branch is a plausible warning-only mitigation, but it does not persist the warning into cron run diagnostics and it is superseded by a native-aware sibling PR with tests and real terminal proof.

Security review:

Security review cleared: The diff only adds a cron runtime warning path and does not change secrets, dependencies, workflows, package metadata, permissions, or downloaded code execution.

AGENTS.md: found and applied where relevant.

What I checked:

Likely related people:

  • Alex Knight: git blame attributes the current cron context handoff and run-diagnostics extraction lines to commit 1f0c6a6 in the same files this PR depends on. (role: recent area contributor; confidence: medium; commits: 1f0c6a66a6bc; files: src/cron/isolated-agent/run.ts, src/cron/run-diagnostics.ts)
  • vincentkoc: git log --all -- src/web-search/runtime.ts shows recent web_search runtime and provider-resolution work by Vincent Koc that this PR calls through listWebSearchProviders. (role: recent web_search runtime contributor; confidence: high; commits: e56dde815e3a, c6ca11e5a5d0, aa69b12d0086; files: src/web-search/runtime.ts)
  • steipete: File history and shortlog show substantial adjacent edits across web provider config/runtime helpers and cron diagnostics surfaces. (role: adjacent runtime contributor; confidence: medium; commits: ce58f55fe017, 8838fdc91625, df525b90f29f; files: src/web-search/runtime.ts, src/cron/run-diagnostics.ts)

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

@clawsweeper clawsweeper Bot added rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. status: 📣 needs proof The PR needs real behavior proof before ClawSweeper can clear the contributor ask. P2 Normal backlog priority with limited blast radius. labels Jun 29, 2026

@harjothkhara harjothkhara left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think this still misses the operator-facing surface from #97654. The new preflight only calls logWarn in prepareCronRunContext, then returns the normal prepared context. For the successful “model apologized” path, finalizeCronRun still persists diagnostics from createCronRunDiagnosticsFromAgentResult(...) only, and that helper only extracts failed tool payloads, meta.error, and meta.failureSignal.

That means cron_run_logs.diagnostics_summary / job.state.lastDiagnostics can remain empty while the run still records status: ok, which is the symptom the issue is asking to make visible. Can you carry the warning into the final RunCronAgentTurnResult.diagnostics as a cron-preflight warning, and add a focused toolsAllow: ["web_search"] regression that asserts the persisted diagnostics are present?

@clawsweeper

clawsweeper Bot commented Jun 29, 2026

Copy link
Copy Markdown
Contributor

ClawSweeper applied the proposed close for this PR.

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. rating: 🧂 unranked krab Not merge-ready due to missing proof or serious correctness/safety concerns. size: XS 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.

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

2 participants