[PR #35] [MERGED] Fix remote Ollama integration: cost tracking, URL masking, and max-findings parameter #48

Closed
opened 2026-03-02 04:08:01 +03:00 by kerem · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/gadievron/raptor/pull/35
Author: @sapran
Created: 12/12/2025
Status: Merged
Merged: 12/20/2025
Merged by: @danielcuthbert

Base: mainHead: fix/ollama-remote-host-issues


📝 Commits (1)

  • 91a0634 Fix remote Ollama integration: cost tracking, URL masking, and max-findings

📊 Changes

7 files changed (+38 additions, -23 deletions)

View changed files

📝 CLAUDE.md (+1 -0)
📝 packages/llm_analysis/agent.py (+5 -5)
📝 packages/llm_analysis/crash_agent.py (+7 -7)
📝 packages/llm_analysis/llm/config.py (+3 -1)
📝 packages/llm_analysis/llm/providers.py (+10 -4)
📝 packages/llm_analysis/orchestrator.py (+2 -2)
📝 raptor_agentic.py (+10 -4)

📄 Description

Summary

Fixes issues when using RAPTOR with remote Ollama servers, including cost tracking crashes, privacy concerns with URL logging, and a bug where --max-findings was ignored.

Issues Fixed

1. Cost Tracking Crashes

  • Problem: TypeError: unsupported operand type(s) for +=: 'float' and 'NoneType' when using remote Ollama
  • Root Cause: LiteLLM returns None for cost values from Ollama endpoints
  • Solution:
    • Add defensive None handling in track_usage() and cost calculations
    • Set explicit api_key="ollama" placeholder to prevent LiteLLM parameter issues
    • Files: packages/llm_analysis/llm/providers.py

2. Privacy: Remote Server URL Exposure 🔒

  • Problem: Remote Ollama server URLs logged in plaintext
  • Solution:
    • Mask remote URLs as [REMOTE-OLLAMA] in all log output
    • Keep localhost/127.0.0.1 URLs visible (not sensitive)
    • Files: raptor_agentic.py, packages/llm_analysis/llm/config.py, CLAUDE.md

3. Incorrect Local/Remote Detection 🏷️

  • Problem: Always displayed "Ollama (local)" even for remote servers
  • Solution:
    • Detect and display "Ollama (remote)" vs "Ollama (local)" based on hostname
    • Update terminology: "local model" → "self-hosted model" for accuracy
    • Files: raptor_agentic.py, packages/llm_analysis/agent.py, packages/llm_analysis/crash_agent.py

4. --max-findings Parameter Ignored 🐛

  • Problem: Orchestrator accepted --max-findings flag but always processed 10 findings
  • Root Cause: Parameter not passed from orchestrator to agent
  • Solution: Pass max_findings parameter to agent.process_findings()
  • Files: packages/llm_analysis/orchestrator.py

Testing

  • Verified with remote Ollama server (masked as [REMOTE-OLLAMA])
  • Confirmed cost tracking no longer crashes
  • Verified --max-findings 20 now processes 20 findings

Files Changed

  • packages/llm_analysis/llm/providers.py - Cost tracking fixes
  • packages/llm_analysis/llm/config.py - URL masking
  • packages/llm_analysis/agent.py - Terminology updates
  • packages/llm_analysis/crash_agent.py - Terminology updates
  • packages/llm_analysis/orchestrator.py - max-findings fix
  • raptor_agentic.py - Remote detection & URL masking
  • CLAUDE.md - Privacy policy addition

🤖 Generated with Claude Code


🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/gadievron/raptor/pull/35 **Author:** [@sapran](https://github.com/sapran) **Created:** 12/12/2025 **Status:** ✅ Merged **Merged:** 12/20/2025 **Merged by:** [@danielcuthbert](https://github.com/danielcuthbert) **Base:** `main` ← **Head:** `fix/ollama-remote-host-issues` --- ### 📝 Commits (1) - [`91a0634`](https://github.com/gadievron/raptor/commit/91a0634884e1fa9b0b0fab8a0dee0bd19cee1e83) Fix remote Ollama integration: cost tracking, URL masking, and max-findings ### 📊 Changes **7 files changed** (+38 additions, -23 deletions) <details> <summary>View changed files</summary> 📝 `CLAUDE.md` (+1 -0) 📝 `packages/llm_analysis/agent.py` (+5 -5) 📝 `packages/llm_analysis/crash_agent.py` (+7 -7) 📝 `packages/llm_analysis/llm/config.py` (+3 -1) 📝 `packages/llm_analysis/llm/providers.py` (+10 -4) 📝 `packages/llm_analysis/orchestrator.py` (+2 -2) 📝 `raptor_agentic.py` (+10 -4) </details> ### 📄 Description # Summary Fixes issues when using RAPTOR with remote Ollama servers, including cost tracking crashes, privacy concerns with URL logging, and a bug where --max-findings was ignored. # Issues Fixed ## 1. Cost Tracking Crashes ✅ - Problem: TypeError: unsupported operand type(s) for +=: 'float' and 'NoneType' when using remote Ollama - Root Cause: LiteLLM returns None for cost values from Ollama endpoints - Solution: - Add defensive None handling in track_usage() and cost calculations - Set explicit api_key="ollama" placeholder to prevent LiteLLM parameter issues - Files: packages/llm_analysis/llm/providers.py ## 2. Privacy: Remote Server URL Exposure 🔒 - Problem: Remote Ollama server URLs logged in plaintext - Solution: - Mask remote URLs as [REMOTE-OLLAMA] in all log output - Keep localhost/127.0.0.1 URLs visible (not sensitive) - Files: raptor_agentic.py, packages/llm_analysis/llm/config.py, CLAUDE.md ## 3. Incorrect Local/Remote Detection 🏷️ - Problem: Always displayed "Ollama (local)" even for remote servers - Solution: - Detect and display "Ollama (remote)" vs "Ollama (local)" based on hostname - Update terminology: "local model" → "self-hosted model" for accuracy - Files: raptor_agentic.py, packages/llm_analysis/agent.py, packages/llm_analysis/crash_agent.py ## 4. --max-findings Parameter Ignored 🐛 - Problem: Orchestrator accepted --max-findings flag but always processed 10 findings - Root Cause: Parameter not passed from orchestrator to agent - Solution: Pass max_findings parameter to agent.process_findings() - Files: packages/llm_analysis/orchestrator.py # Testing - ✅ Verified with remote Ollama server (masked as [REMOTE-OLLAMA]) - ✅ Confirmed cost tracking no longer crashes - ✅ Verified --max-findings 20 now processes 20 findings # Files Changed - packages/llm_analysis/llm/providers.py - Cost tracking fixes - packages/llm_analysis/llm/config.py - URL masking - packages/llm_analysis/agent.py - Terminology updates - packages/llm_analysis/crash_agent.py - Terminology updates - packages/llm_analysis/orchestrator.py - max-findings fix - raptor_agentic.py - Remote detection & URL masking - CLAUDE.md - Privacy policy addition 🤖 Generated with [Claude Code](https://claude.com/claude-code) --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
kerem 2026-03-02 04:08:01 +03:00
Sign in to join this conversation.
No milestone
No project
No assignees
1 participant
Notifications
Due date
The due date is invalid or out of range. Please use the format "yyyy-mm-dd".

No due date set.

Dependencies

No dependencies set.

Reference
starred/raptor#48
No description provided.