Skip to content

Web search - #2

Open
b4prog wants to merge 2 commits into
mainfrom
web-search
Open

Web search#2
b4prog wants to merge 2 commits into
mainfrom
web-search

Conversation

@b4prog

@b4prog b4prog commented Jul 20, 2026

Copy link
Copy Markdown
Owner

Summary by CodeRabbit

  • New Features
    • Added optional agentic web research with web search and page-fetching capabilities.
    • Added visible workflow steps showing research progress, status, and details during chat responses.
    • Added support for tool-enabled chat interactions and streaming responses.
  • Documentation
    • Expanded setup, usage, troubleshooting, and security guidance for web research and tool-enabled models.
  • Bug Fixes
    • Improved handling of streaming responses, tool messages, provider errors, and empty or incomplete output.

@coderabbitai

coderabbitai Bot commented Jul 20, 2026

Copy link
Copy Markdown

Review Change Stack

📝 Walkthrough

Walkthrough

The PR adds Ollama tool calling, bounded web-research orchestration, public-network protections, streamed agent-step events, and expandable workflow steps in the Angular chat interface. Documentation and build-budget configuration are updated accordingly.

Changes

Agentic web research

Layer / File(s) Summary
Provider and tool-call contracts
src-tauri/Cargo.toml, src-tauri/src/providers/*, src-tauri/src/tools/mod.rs, src-tauri/src/error.rs
Chat models and Ollama requests support tool calls, while provider and tool-executor interfaces expose the new execution contract.
Public web tool implementation
src-tauri/src/tools/web.rs
Search and page-fetch tools parse evidence, discover links, and restrict redirects, private destinations, content types, and response sizes.
Bounded research and answer orchestration
src-tauri/src/agent.rs
The agent plans research, executes bounded tool calls, reports lifecycle steps, builds evidence-limited prompts, and streams validated answers.
IPC wiring and workflow presentation
src-tauri/src/app_state.rs, src-tauri/src/commands/chat.rs, src-tauri/src/lib.rs, src/app/core/chat/*, src/app/features/chat/*
Tauri forwards agent steps and chunks to Angular, which stores, renders, expands, and tests workflow steps.
Documentation and build alignment
README.md, angular.json
README guidance covers web research and safety behavior, and the component-style warning budget increases to 6kB.

Estimated code review effort: 4 (Complex) | ~60 minutes

Sequence Diagram(s)

sequenceDiagram
  participant User
  participant ChatShellComponent
  participant ChatCommand
  participant run_agent_stream
  participant WebTools
  participant Ollama
  User->>ChatShellComponent: Submit research prompt
  ChatShellComponent->>ChatCommand: Send request with chunk and step channels
  ChatCommand->>run_agent_stream: Start bounded research
  run_agent_stream->>Ollama: Request planning with tool definitions
  Ollama-->>run_agent_stream: Tool calls
  run_agent_stream->>WebTools: Search or fetch public pages
  WebTools-->>run_agent_stream: Evidence and follow-up calls
  run_agent_stream-->>ChatCommand: Agent step events
  run_agent_stream->>Ollama: Request final answer with evidence
  Ollama-->>ChatCommand: Stream answer chunks
  ChatCommand-->>ChatShellComponent: Steps and chunks
Loading

Possibly related PRs

  • b4prog/Taurus#1: Introduces the earlier streaming chat IPC and provider/chat model that this PR extends.
🚥 Pre-merge checks | ✅ 3 | ❌ 2

❌ Failed checks (1 warning, 1 inconclusive)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 21.05% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
Title check ❓ Inconclusive The title is related to the change set, but it is too generic to describe the main update clearly. Use a more specific title such as "Add agentic web search and web research tools".
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
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.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch web-search

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 ESLint

If the error stems from missing dependencies, add them to the package.json file. For unrecoverable errors (e.g., due to private dependencies), disable the tool in the CodeRabbit configuration.

ESLint install timed out. The project may have too many dependencies for the sandbox.


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

Choose a reason for hiding this comment

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

Actionable comments posted: 2

🧹 Nitpick comments (2)
src-tauri/Cargo.toml (1)

18-25: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Consider updating quick-xml and scraper to their latest stable versions.

The specified versions are valid and exist on crates.io: quick-xml = 0.39 (released January 2026), scraper = 0.24 (released August 2025), and tokio = 1.x. No security advisories found for either crate. However, both are outdated:

  • quick-xml has advanced to 0.41.0 (June 29, 2026)
  • scraper has advanced to 0.27.0

Updating to the latest stable versions is straightforward and recommended for access to bug fixes and improvements. The tokio net feature is correctly enabled for tools/web.rs usage.

🤖 Prompt for 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.

In `@src-tauri/Cargo.toml` around lines 18 - 25, Update the dependency versions in
Cargo.toml from quick-xml 0.39 to 0.41.0 and scraper 0.24 to 0.27.0, preserving
their existing feature configuration and leaving tokio unchanged.
src/app/features/chat/chat-shell.component.html (1)

93-99: 📐 Maintainability & Code Quality | 🔵 Trivial | ⚡ Quick win

Add a trackBy to the step *ngFor to preserve DOM identity.

applyAgentStep and toggleStepDetail build new AgentStep objects and a new array on every event, so with default identity tracking Angular destroys and recreates each step's <button> on every status transition and on toggle — dropping keyboard focus and restarting the running spinner. Track by step.id.

♻️ Proposed change
           <div
             class="agent-step"
-            *ngFor="let step of workflowSteps(messageIndex)"
+            *ngFor="let step of workflowSteps(messageIndex); trackBy: trackByStepId"

Add the helper in chat-shell.component.ts:

protected trackByStepId(_: number, step: AgentStep): string {
  return step.id;
}
🤖 Prompt for 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.

In `@src/app/features/chat/chat-shell.component.html` around lines 93 - 99,
Preserve step DOM identity in the workflowSteps loop by adding a trackBy binding
that uses each step’s id. Implement the corresponding trackByStepId method in
the chat shell component, accepting the index and AgentStep and returning
step.id, then reference it from the step *ngFor.
🤖 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 `@README.md`:
- Around line 384-389: Update the later Roadmap heading in README.md from
section 22 to section 23, preserving the existing Roadmap content.

In `@src-tauri/src/providers/ollama.rs`:
- Line 16: Split the timeout constants in the Ollama provider: retain
OLLAMA_REQUEST_TIMEOUT at the shorter health/listing duration for health_check
and list_models, add a dedicated longer OLLAMA_CHAT_TIMEOUT, and update
chat_with_tool_definitions to use it.

---

Nitpick comments:
In `@src-tauri/Cargo.toml`:
- Around line 18-25: Update the dependency versions in Cargo.toml from quick-xml
0.39 to 0.41.0 and scraper 0.24 to 0.27.0, preserving their existing feature
configuration and leaving tokio unchanged.

In `@src/app/features/chat/chat-shell.component.html`:
- Around line 93-99: Preserve step DOM identity in the workflowSteps loop by
adding a trackBy binding that uses each step’s id. Implement the corresponding
trackByStepId method in the chat shell component, accepting the index and
AgentStep and returning step.id, then reference it from the step *ngFor.
🪄 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: CHILL

Plan: Pro

Run ID: 4eed1642-bd3a-4ddf-8758-1f47d7f287a7

📥 Commits

Reviewing files that changed from the base of the PR and between 10fe2a8 and 62259af.

⛔ Files ignored due to path filters (1)
  • src-tauri/Cargo.lock is excluded by !**/*.lock
📒 Files selected for processing (18)
  • README.md
  • angular.json
  • src-tauri/Cargo.toml
  • src-tauri/src/agent.rs
  • src-tauri/src/app_state.rs
  • src-tauri/src/commands/chat.rs
  • src-tauri/src/error.rs
  • src-tauri/src/lib.rs
  • src-tauri/src/providers/mod.rs
  • src-tauri/src/providers/ollama.rs
  • src-tauri/src/tools/mod.rs
  • src-tauri/src/tools/web.rs
  • src/app/core/chat/chat.models.ts
  • src/app/core/chat/chat.service.ts
  • src/app/features/chat/chat-shell.component.css
  • src/app/features/chat/chat-shell.component.html
  • src/app/features/chat/chat-shell.component.spec.ts
  • src/app/features/chat/chat-shell.component.ts

Comment thread README.md
Comment on lines +384 to +389
## 22. Security Notes

- Taurus is local-first and does not include telemetry by default.
- Web research sends the model's search query to Bing and automatically fetches up to two highest-ranked public result pages per search. The planner may selectively request additional public pages linked by fetched results, subject to the global planning-round and tool-call limits.
- The fetch tool blocks loopback, private, link-local, and other special-use IP ranges, including across redirects.
- Web responses are size-limited and page text is treated as untrusted reference material in the agent prompt. The expandable workflow retains the fetched text, while the model receives a bounded excerpt to leave enough context for its answer.

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

📐 Maintainability & Code Quality | 🟡 Minor | ⚡ Quick win

Renumber the Roadmap section.

These changes make Security Notes section 22, but the later Roadmap heading remains section 22 at Line 396. Rename the Roadmap heading to ## 23. Roadmap.

🤖 Prompt for 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.

In `@README.md` around lines 384 - 389, Update the later Roadmap heading in
README.md from section 22 to section 23, preserving the existing Roadmap
content.

pub const DEFAULT_OLLAMA_BASE_URL: &str = "http://localhost:11434";
const OLLAMA_CONNECT_TIMEOUT: Duration = Duration::from_secs(5);
const OLLAMA_REQUEST_TIMEOUT: Duration = Duration::from_secs(30);
const OLLAMA_REQUEST_TIMEOUT: Duration = Duration::from_secs(120);

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

🩺 Stability & Availability | 🟡 Minor | ⚡ Quick win

Shared timeout bump to 120s also stretches health checks and model listing. OLLAMA_REQUEST_TIMEOUT is reused by health_check (Line 107) and list_models (Line 138), so raising it from 30s to 120s means a connected-but-slow Ollama can stall those UX-facing calls for up to two minutes. The long budget is only needed for tool-calling chat. Consider a dedicated chat timeout and a shorter one for health/list.

Suggested split
-const OLLAMA_REQUEST_TIMEOUT: Duration = Duration::from_secs(120);
+const OLLAMA_CHAT_TIMEOUT: Duration = Duration::from_secs(120);
+const OLLAMA_REQUEST_TIMEOUT: Duration = Duration::from_secs(30);

Use OLLAMA_CHAT_TIMEOUT in chat_with_tool_definitions and keep OLLAMA_REQUEST_TIMEOUT for health_check/list_models.

🤖 Prompt for 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.

In `@src-tauri/src/providers/ollama.rs` at line 16, Split the timeout constants in
the Ollama provider: retain OLLAMA_REQUEST_TIMEOUT at the shorter health/listing
duration for health_check and list_models, add a dedicated longer
OLLAMA_CHAT_TIMEOUT, and update chat_with_tool_definitions to use it.

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.

1 participant