Skip to content

feat(doctor): add WebSearch backend diagnostics - #1884

Merged
kevincodex1 merged 7 commits into
Gitlawb:mainfrom
chioarub:fix/websearch-runtime-diagnostics
Jul 8, 2026
Merged

feat(doctor): add WebSearch backend diagnostics#1884
kevincodex1 merged 7 commits into
Gitlawb:mainfrom
chioarub:fix/websearch-runtime-diagnostics

Conversation

@chioarub

@chioarub chioarub commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Summary

  • Add a doctor:runtime WebSearch backend diagnostic that reports the resolved provider mode and configured API-backed providers.
  • Surface DDG-only fallback guidance, explicit missing credential failures, Firecrawl cloud missing-key failures, and native provider support details.
  • Include the built-in adapter provider timeout detail where WEB_SEARCH_TIMEOUT_SEC applies.

Implementation

  • Reuses the existing WebSearch provider registry and runtime provider/model resolution for auto, native, adapter, and custom modes.
  • Keeps DDG-only auto mode usable while making the diagnostic guidance explicit and actionable.
  • Expands system-check test isolation so provider-related environment variables from a developer shell cannot change expected diagnostics.

Tests

  • bun test scripts/system-check.test.ts
  • env CLAUDE_CODE_USE_BEDROCK=1 bun test scripts/system-check.test.ts
  • env XAI_API_KEY=xai-test-key bun test scripts/system-check.test.ts
  • bun test src/tools/WebSearchTool/providers/timeout.test.ts
  • bun run typecheck
  • bun run build
  • bun run doctor:runtime
  • bun run doctor:runtime:json
  • git diff --check

Risk

  • This is configuration diagnostics only and does not make live WebSearch backend calls.
  • Existing provider selection behavior is unchanged.

Summary by CodeRabbit

  • New Features
    • Upgraded the system-check “doctor report” with detailed Web Search environment diagnostics across provider modes, including compatibility gating, preset-specific requirements, cloud vs self-hosted handling, and per-mode timeout details.
  • Bug Fixes
    • Improved Firecrawl cloud endpoint detection so API key requirements apply only to the cloud API; ensured Web Search secrets are redacted from diagnostics.
  • Tests
    • Expanded Web Search system-check coverage and added better test isolation via temporary config/environment cleanup.
    • Added Firecrawl client tests for proxy-style cloud URLs and case-insensitive cloud URL behavior.
    • Strengthened Brave timeout test to confirm abort signaling is observed.

@coderabbitai

coderabbitai Bot commented Jul 7, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f99fd712-a27b-4699-807d-3ea3104ddef6

📥 Commits

Reviewing files that changed from the base of the PR and between b26b3e0 and d1e74e3.

📒 Files selected for processing (2)
  • scripts/system-check.test.ts
  • scripts/system-check.ts
📜 Recent review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: smoke-and-tests (22)
  • GitHub Check: smoke-and-tests (24.11.x)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strict mode and ESM imports in source and test files.

Files:

  • scripts/system-check.test.ts
  • scripts/system-check.ts
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

In the files you touch, preserve the existing code style.

Files:

  • scripts/system-check.test.ts
  • scripts/system-check.ts

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • scripts/system-check.test.ts
  • scripts/system-check.ts
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md - AI Agent Coding Guide

This guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.

Project Snapshot

OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.

The installed CLI runs on Node.js >=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.

Work Style

  • Keep changes focused on one problem.
  • Prefer existing patterns in the file or nearby module.
  • Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
  • Add or update tests when behavior changes.
  • Update docs when setup, commands, provider behavior, or user-facing behavior changes.
  • For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.

Stack And Conventions

  • TypeScript with strict mode and ESM imports.
  • React + Ink for terminal UI.
  • Bun lockfile and Bun scripts for development workflows.
  • Node runtime for the built CLI.

Common libraries and patterns:

  • chalk for terminal color.
  • commander for CLI argument parsing.
  • execa for child processes.
  • Existing service, provider, settings, permission, and UI patterns over new abstractions.

Repository Map

  • src/commands/ - slash and CLI command implementations.
  • src/components/ - React/Ink UI components.
  • src/services/ - API, MCP, OAuth, wiki, voice, and other service integrations.
  • src/tools/ - tool implementations.
  • src/utils/ - shared utilities.
  • src/integrations/ - provider and model integration metadata.
  • src/entrypoints/ - CLI, MCP, SDK, and generated public types.
  • src/tasks/ - local, remote, workflow, and monitor tas...

Files:

  • scripts/system-check.test.ts
  • scripts/system-check.ts
{bin/**,scripts/**,package.json,src/setup.ts,src/main.tsx,src/entrypoints/**}

⚙️ CodeRabbit configuration file

{bin/**,scripts/**,package.json,src/setup.ts,src/main.tsx,src/entrypoints/**}: Review install, launcher, build, packaging, startup, and entrypoint changes for cross-platform compatibility, tracked-source rewrites, env/config precedence, and release safety. Block on changes that can break Windows/macOS/Linux startup or publish unexpected artifacts.

Files:

  • scripts/system-check.test.ts
  • scripts/system-check.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • scripts/system-check.test.ts
🔇 Additional comments (3)
scripts/system-check.ts (2)

389-390: LGTM!


414-423: 🎯 Functional Correctness

No change needed here — the custom web-search preset uses the raw WEB_PROVIDER value, so a trailing-space value should fail this check.

			> Likely an incorrect or invalid review comment.
scripts/system-check.test.ts (1)

623-645: LGTM!


📝 Walkthrough

Walkthrough

Adds web-search diagnostics to scripts/system-check.ts, wires them into the doctor report, expands test isolation and coverage, updates Firecrawl URL handling, and tightens a Brave timeout test.

Changes

WebSearch Diagnostics

Layer / File(s) Summary
WebSearch diagnostics logic
scripts/system-check.ts
Adds web-search diagnostic imports, constants, helpers, mode checks, timeout details, orchestration, and exports for doctor output.

WebSearch Test Coverage

Layer / File(s) Summary
WebSearch test isolation and coverage
scripts/system-check.test.ts
Adds temporary config-dir isolation, expanded environment cleanup, settings cache resets, and WebSearch diagnostics tests covering modes, credentials, timeout text, and redaction.

Firecrawl URL Handling

Layer / File(s) Summary
Firecrawl cloud URL detection
src/tools/firecrawl/client.ts, src/tools/firecrawl/client.test.ts
Adds a Firecrawl URL classifier, updates cloud API key gating to use it, and adds proxy and cloud-key tests for Firecrawl requests.

Brave timeout test

Layer / File(s) Summary
Brave timeout abort test
src/tools/WebSearchTool/providers/brave.test.ts
Updates the Brave provider timeout test to observe the abort signal through an event listener and assert the request was aborted.

Estimated code review effort: 3 (Moderate) | ~30 minutes

Possibly related PRs

Suggested reviewers: jatmn, kevincodex1

🚥 Pre-merge checks | ✅ 7
✅ Passed checks (7 passed)
Check name Status Explanation
Title check ✅ Passed The title is concise, scoped, and accurately reflects the WebSearch backend diagnostics changes.
Description check ✅ Passed The description covers summary, implementation, tests, and risk, but omits the template's Impact and Notes sections.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
Risk Surface Disclosed ✅ Passed PR Risk section explicitly says the change is config-only, makes no live WebSearch calls, and does not change provider selection; no blocker is identified.
No Hidden Policy Change ✅ Passed PASS: The diff only adds doctor/test diagnostics; no runtime routing, permissions, telemetry, or network-policy code changed.
✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 2

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@scripts/system-check.ts`:
- Around line 240-247: The native web search check in buildNativeWebSearchCheck
is only treating openai as supported, so codex resolves fall through to the
unsupported-provider failure. Update the provider guard to include codex
alongside openai, and make the same change in the other Codex responses native
check path referenced by this review so both pass branches recognize Codex
models returned by getAPIProvider(). Preserve the existing
isCodexResponsesWebSearchEnabledForDoctor gating and the current pass message
behavior.
- Around line 329-331: The host check in isFirecrawlCloudApiUrl is too broad
because it uses includes and can match non-cloud/proxy URLs accidentally. Update
the logic to parse the apiUrl hostname and compare it exactly against the
Firecrawl cloud host (with the default fallback still treated as cloud), so only
the intended cloud endpoint is classified as such.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: 3d9f1209-4a82-48cf-a1a6-2d1a1d5cf1cf

📥 Commits

Reviewing files that changed from the base of the PR and between aac2d8c and 9b3a35d.

📒 Files selected for processing (2)
  • scripts/system-check.test.ts
  • scripts/system-check.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (2)
  • GitHub Check: smoke-and-tests (24.11.x)
  • GitHub Check: smoke-and-tests (22)
🧰 Additional context used
📓 Path-based instructions (5)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strict mode and ESM imports in source and test files.

Files:

  • scripts/system-check.test.ts
  • scripts/system-check.ts
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

In the files you touch, preserve the existing code style.

Files:

  • scripts/system-check.test.ts
  • scripts/system-check.ts

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • scripts/system-check.test.ts
  • scripts/system-check.ts
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md - AI Agent Coding Guide

This guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.

Project Snapshot

OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.

The installed CLI runs on Node.js >=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.

Work Style

  • Keep changes focused on one problem.
  • Prefer existing patterns in the file or nearby module.
  • Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
  • Add or update tests when behavior changes.
  • Update docs when setup, commands, provider behavior, or user-facing behavior changes.
  • For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.

Stack And Conventions

  • TypeScript with strict mode and ESM imports.
  • React + Ink for terminal UI.
  • Bun lockfile and Bun scripts for development workflows.
  • Node runtime for the built CLI.

Common libraries and patterns:

  • chalk for terminal color.
  • commander for CLI argument parsing.
  • execa for child processes.
  • Existing service, provider, settings, permission, and UI patterns over new abstractions.

Repository Map

  • src/commands/ - slash and CLI command implementations.
  • src/components/ - React/Ink UI components.
  • src/services/ - API, MCP, OAuth, wiki, voice, and other service integrations.
  • src/tools/ - tool implementations.
  • src/utils/ - shared utilities.
  • src/integrations/ - provider and model integration metadata.
  • src/entrypoints/ - CLI, MCP, SDK, and generated public types.
  • src/tasks/ - local, remote, workflow, and monitor tas...

Files:

  • scripts/system-check.test.ts
  • scripts/system-check.ts
{bin/**,scripts/**,package.json,src/setup.ts,src/main.tsx,src/entrypoints/**}

⚙️ CodeRabbit configuration file

{bin/**,scripts/**,package.json,src/setup.ts,src/main.tsx,src/entrypoints/**}: Review install, launcher, build, packaging, startup, and entrypoint changes for cross-platform compatibility, tracked-source rewrites, env/config precedence, and release safety. Block on changes that can break Windows/macOS/Linux startup or publish unexpected artifacts.

Files:

  • scripts/system-check.test.ts
  • scripts/system-check.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • scripts/system-check.test.ts
🪛 ast-grep (0.44.1)
scripts/system-check.test.ts

[error] 117-120: Recursive/iterative merge copies attacker-controllable keys from a source object into a target via a computed property assignment without rejecting dangerous keys, allowing prototype pollution. Skip or block "proto", "constructor", and "prototype" keys (e.g. if (key === "__proto__" || key === "constructor" || key === "prototype") continue;), use a null-prototype object (Object.create(null)), or use a safe merge utility instead.
Context: for (const key of ENV_KEYS) {
originalEnv[key] = process.env[key]
delete process.env[key]
}
Note: [CWE-1321] Improperly Controlled Modification of Object Prototype Attributes ('Prototype Pollution').

(prototype-pollution-recursive-merge-typescript)

🔇 Additional comments (2)
scripts/system-check.test.ts (1)

2-9: LGTM!

Also applies to: 18-124, 135-139, 349-613

scripts/system-check.ts (1)

39-238: LGTM!

Also applies to: 250-275, 287-328, 334-537, 1384-1384

Comment thread scripts/system-check.ts
Comment thread scripts/system-check.ts Outdated
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 7, 2026

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I found an issue that needs to be addressed before this is ready.

Findings

  • [P2] Keep the Firecrawl cloud URL check aligned with runtime
    scripts/system-check.ts:329
    The new diagnostic now treats only the exact api.firecrawl.dev hostname as Firecrawl cloud, and the added test says FIRECRAWL_API_URL=https://proxy.example.com/api.firecrawl.dev is configured without an API key. However the runtime Firecrawl client still checks apiUrl.includes('api.firecrawl.dev'), so that same URL still throws Firecrawl API key is required for the cloud API before it can search. Please complete CodeRabbit's Firecrawl host-matching request in the runtime Firecrawl config path as well, or keep the doctor diagnostic using the same classification as runtime, so doctor:runtime does not report a backend as healthy when WebSearch will reject it.

@coderabbitai coderabbitai Bot 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.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@src/tools/firecrawl/client.ts`:
- Around line 45-56: The fallback path in isFirecrawlCloudApiUrl is too narrow
and case-sensitive for schemeless inputs, so normalize the hostname comparison
in the catch branch. Update the logic in isFirecrawlCloudApiUrl to treat the
bare host equivalently regardless of case (and after trimming trailing slashes),
and keep the DEFAULT_FIRECRAWL_API_URL check only if you still need it for
non-URL inputs. Ensure the URL parsing path and fallback branch both classify
api.firecrawl.dev consistently.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: ASSERTIVE

Plan: Pro

Run ID: f2758763-ed3f-4869-9727-f838d20cf17d

📥 Commits

Reviewing files that changed from the base of the PR and between 1417507 and 55fe341.

📒 Files selected for processing (3)
  • scripts/system-check.ts
  • src/tools/firecrawl/client.test.ts
  • src/tools/firecrawl/client.ts
📜 Review details
⏰ Context from checks skipped due to timeout. (3)
  • GitHub Check: smoke-and-tests (24.11.x)
  • GitHub Check: smoke-and-tests (22)
  • GitHub Check: typecheck
🧰 Additional context used
📓 Path-based instructions (7)
**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Use TypeScript with strict mode and ESM imports in source and test files.

Files:

  • src/tools/firecrawl/client.test.ts
  • src/tools/firecrawl/client.ts
  • scripts/system-check.ts
src/{commands,components,services,tools,utils,integrations,entrypoints,tasks}/**/*.{ts,tsx}

📄 CodeRabbit inference engine (AGENTS.md)

Prefer the existing service, provider, settings, permission, and UI patterns over introducing new abstractions.

Files:

  • src/tools/firecrawl/client.test.ts
  • src/tools/firecrawl/client.ts
**/*

📄 CodeRabbit inference engine (CONTRIBUTING.md)

In the files you touch, preserve the existing code style.

Files:

  • src/tools/firecrawl/client.test.ts
  • src/tools/firecrawl/client.ts
  • scripts/system-check.ts

⚙️ CodeRabbit configuration file

**/*: Apply the OpenClaude maintainer review rubric from AGENTS.md. Review the current diff, not stale discussion context. Separate real blockers from suggestions. Do not request changes for vague style churn. Treat approval as merge-ready from CodeRabbit's side, pending required human review and GitHub Checks. If checks are failing or unavailable, say so clearly instead of implying the PR is fully ready.

Files:

  • src/tools/firecrawl/client.test.ts
  • src/tools/firecrawl/client.ts
  • scripts/system-check.ts
**

⚙️ CodeRabbit configuration file

**: # AGENTS.md - AI Agent Coding Guide

This guide is for AI coding agents working in the OpenClaude repository. Read it before changing code, and also follow CONTRIBUTING.md for contributor policy, PR expectations, review follow-up, and project scope.

Project Snapshot

OpenClaude is a coding-agent CLI for cloud and local model providers. It supports OpenAI-compatible APIs, Anthropic, Gemini, DeepSeek, Ollama, MCP, local backends, slash commands, tools, agents, and a React/Ink terminal UI.

The installed CLI runs on Node.js >=22.0.0. Bun is used for source builds, scripts, dependency management, and tests.

Work Style

  • Keep changes focused on one problem.
  • Prefer existing patterns in the file or nearby module.
  • Avoid unrelated formatting, renames, dependency changes, or broad rewrites.
  • Add or update tests when behavior changes.
  • Update docs when setup, commands, provider behavior, or user-facing behavior changes.
  • For new features, larger refactors, dependencies, or runtime changes, follow the issue-first guidance in CONTRIBUTING.md.

Stack And Conventions

  • TypeScript with strict mode and ESM imports.
  • React + Ink for terminal UI.
  • Bun lockfile and Bun scripts for development workflows.
  • Node runtime for the built CLI.

Common libraries and patterns:

  • chalk for terminal color.
  • commander for CLI argument parsing.
  • execa for child processes.
  • Existing service, provider, settings, permission, and UI patterns over new abstractions.

Repository Map

  • src/commands/ - slash and CLI command implementations.
  • src/components/ - React/Ink UI components.
  • src/services/ - API, MCP, OAuth, wiki, voice, and other service integrations.
  • src/tools/ - tool implementations.
  • src/utils/ - shared utilities.
  • src/integrations/ - provider and model integration metadata.
  • src/entrypoints/ - CLI, MCP, SDK, and generated public types.
  • src/tasks/ - local, remote, workflow, and monitor tas...

Files:

  • src/tools/firecrawl/client.test.ts
  • src/tools/firecrawl/client.ts
  • scripts/system-check.ts
src/{components/permissions,utils/permissions,hooks/toolPermission,tools,entrypoints/sdk}/**

⚙️ CodeRabbit configuration file

src/{components/permissions,utils/permissions,hooks/toolPermission,tools,entrypoints/sdk}/**: Review permission prompts, auto-allow logic, sandbox behavior, SDK permission schemas, shell/PowerShell execution, and background execution paths as security-sensitive. Block on bypasses, unclear trust boundaries, unsafe path handling, missing user visibility, or changes that broaden allowed behavior without an explicit maintainer decision.

Files:

  • src/tools/firecrawl/client.test.ts
  • src/tools/firecrawl/client.ts
{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}

⚙️ CodeRabbit configuration file

{src/**/*.test.ts,src/**/*.test.tsx,tests/**,scripts/**/*.test.ts,vscode-extension/**/*.test.js}: Review tests for meaningful coverage of the changed behavior, isolation of global/env/config state, async cleanup, fake timers, provider profile leaks, and Windows-compatible assumptions. Block when risky runtime changes lack focused regression coverage or tests assert implementation details while missing the user-visible behavior.

Files:

  • src/tools/firecrawl/client.test.ts
{bin/**,scripts/**,package.json,src/setup.ts,src/main.tsx,src/entrypoints/**}

⚙️ CodeRabbit configuration file

{bin/**,scripts/**,package.json,src/setup.ts,src/main.tsx,src/entrypoints/**}: Review install, launcher, build, packaging, startup, and entrypoint changes for cross-platform compatibility, tracked-source rewrites, env/config precedence, and release safety. Block on changes that can break Windows/macOS/Linux startup or publish unexpected artifacts.

Files:

  • scripts/system-check.ts
🔇 Additional comments (3)
scripts/system-check.ts (1)

46-46: LGTM!

src/tools/firecrawl/client.ts (1)

58-62: Cloud-detection gating logic looks correct.

Switching from a substring check to hostname-based classification correctly prevents proxy URLs like https://proxy.example.com/api.firecrawl.dev from being misclassified as cloud (previously .includes('api.firecrawl.dev') would have falsely required an API key here). This aligns with the downstream system-check.ts usage shown in the context snippets.

src/tools/firecrawl/client.test.ts (1)

90-113: 🩺 Stability & Availability

Env cleanup is already isolated in this test file. The file restores both FIRECRAWL_API_KEY and FIRECRAWL_API_URL in afterEach, so this mutation does not leak into other tests.

			> Likely an incorrect or invalid review comment.

Comment thread src/tools/firecrawl/client.ts
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 7, 2026

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I found an issue that needs to be addressed before this is ready.

Findings

  • [P2] Keep auto-mode diagnostics aligned with fallback providers
    scripts/system-check.ts:467
    In WEB_SEARCH_PROVIDER=auto, this returns the Firecrawl missing-key failure before considering the rest of the configured provider chain. That makes doctor:runtime fail for a usable setup such as FIRECRAWL_API_URL=https://api.firecrawl.dev without FIRECRAWL_API_KEY but with BRAVE_API_KEY configured: runtime runSearch() catches the Firecrawl error and falls through to Brave, while the new diagnostic reports the whole Web search backend as failed. Please only fail this Firecrawl cloud-key case when there is no later runnable provider, or include the fallback provider in the pass/warning so the diagnostic matches what WebSearch will actually do in auto mode.

@chioarub chioarub changed the title Add WebSearch backend runtime diagnostics feat(doctor): add WebSearch backend diagnostics Jul 7, 2026
@chioarub
chioarub force-pushed the fix/websearch-runtime-diagnostics branch from f8645b7 to b26b3e0 Compare July 7, 2026 19:05
coderabbitai[bot]
coderabbitai Bot previously approved these changes Jul 7, 2026
@chioarub
chioarub requested a review from jatmn July 7, 2026 19:24

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the update. I rechecked the changed paths and found one issue that still needs to be addressed.

Findings

  • [P2] Keep custom preset diagnostics aligned with runtime parsing
    scripts/system-check.ts:389
    The new custom-mode diagnostic trims WEB_PROVIDER before matching built-in presets, but the runtime custom provider still reads the raw WEB_PROVIDER value. With WEB_SEARCH_PROVIDER=custom and WEB_PROVIDER='brave ' or WEB_PROVIDER='serpapi ', plus WEB_KEY, doctor:runtime reports the preset credentials as configured, while customProvider.search() does not find that preset and fails before the request with "" cannot be parsed as a URL. The same mismatch affects WEB_PROVIDER='google ' when WEB_KEY and GOOGLE_CSE_ID are set. Please either normalize WEB_PROVIDER the same way in the runtime custom provider or have the diagnostic fail for the unrecognized raw preset value, so the doctor report does not mark a backend healthy when WebSearch cannot use it.

@jatmn jatmn left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks for the update. I rechecked the previously discussed paths and do not see any remaining actionable issues from my side.

@kevincodex1 LGTM

@kevincodex1 kevincodex1 left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM

@kevincodex1
kevincodex1 merged commit e204d5a into Gitlawb:main Jul 8, 2026
5 checks passed
@chioarub
chioarub deleted the fix/websearch-runtime-diagnostics branch July 8, 2026 05:11
hotmanxp added a commit to hotmanxp/openclaude that referenced this pull request Jul 9, 2026
hotmanxp pushed a commit to hotmanxp/openclaude that referenced this pull request Jul 9, 2026
* feat(doctor): add WebSearch backend diagnostics

* fix(doctor): tighten Firecrawl cloud URL diagnostics

* fix(firecrawl): align cloud URL detection

* test(websearch): stabilize Brave timeout assertion

* fix(firecrawl): handle bare cloud host casing

* fix(doctor): align WebSearch auto diagnostics with fallback

* fix(doctor): align custom preset diagnostics
hotmanxp added a commit to hotmanxp/openclaude that referenced this pull request Jul 9, 2026
OpenCC cherry-pick of Gitlawb#1884 (WebSearch backend diagnostics, 4ad0f0e)
ported scripts/system-check.ts but missed the required firecrawl/client.ts
implementation, leaving 2 broken imports:

  - scripts/system-check.ts:30 → ../src/tools/firecrawl/client.js (doctor crash)
  - src/tools/WebSearchTool/providers/firecrawl.ts:5 → ../firecrawl/client.js
    (only triggered when firecrawl is active web search backend)

Fix:
  - Port src/tools/firecrawl/client.ts from upstream main (183 lines)
  - Update WebSearchTool/providers/firecrawl.ts import to canonical
    ../../firecrawl/client.js path

Verification:
  - bun run typecheck: 0 errors
  - bun run doctor:runtime: 12/12 PASS (was 0/0 before fix)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants