-
Notifications
You must be signed in to change notification settings - Fork 2.8k
feat(ollama): add diagnostic logging for debugging request hangs #11057
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
Adds comprehensive logging to help diagnose cases where Ollama requests hang indefinitely, as reported in #11049. The logging includes: - Client creation with base URL - Request start timestamps - Model fetch timing and cache status - Warning when model is not in tool-capable list - Chat request details (URL, model, message count, tool count) - Stream start timing Also adds DEFAULT_OLLAMA_TIMEOUT_MS constant (5 minutes) to accommodate slow model loading times (Ollama models can take 30-60+ seconds to load into memory on first use). This logging will help users identify: 1. If the request is reaching Ollama at all 2. Where in the request lifecycle things are hanging 3. If the model is being filtered due to missing tool capabilities Fixes #11049
Review completed with 2 minor issues found.
Mention @roomote in a comment to request specific changes to this pull request or fix all unresolved issues. |
| // Default timeout for Ollama requests (5 minutes to accommodate slow model loading) | ||
| // Ollama models can take 30-60+ seconds to load into memory on first use | ||
| const DEFAULT_OLLAMA_TIMEOUT_MS = 300_000 // 5 minutes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
DEFAULT_OLLAMA_TIMEOUT_MS is defined but never used. The constant and its comments suggest timeout handling exists for slow model loading, but it's not passed to the Ollama client anywhere. Either remove this dead code or apply the timeout to the client configuration if that was the intent.
Fix it with Roo Code or mention @roomote and request a fix.
| const { id: modelId } = await this.fetchModel() | ||
|
|
||
| console.log(`[Ollama] createMessage: Fetching model info...`) | ||
| const { id: modelId, info: modelInfo } = await this.fetchModel() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
modelInfo is destructured here but never used in the method. Consider removing it to avoid the unused variable.
| const { id: modelId, info: modelInfo } = await this.fetchModel() | |
| const { id: modelId } = await this.fetchModel() |
Fix it with Roo Code or mention @roomote and request a fix.
Related GitHub Issue
Closes: #11049
Description
This PR adds comprehensive diagnostic logging to
NativeOllamaHandlerto help debug cases where Ollama requests hang indefinitely.Key changes:
ensureClient()showing the base URL being usedcreateMessage():DEFAULT_OLLAMA_TIMEOUT_MSconstant (5 minutes) to document expected slow model loading timesDesign choices:
console.logfor info-level logging andconsole.warnfor potential issuesDate.now()for millisecond precisionollama show <model>)Test Procedure
native-ollama.spec.ts)To verify the logging:
[Ollama]prefixed log messages showing request timingPre-Submission Checklist
Documentation Updates
Additional Notes
This PR complements PR #11055 which added diagnostic logging for model filtering. Together, these changes will help users identify:
The root cause of issue #11049 may be related to Ollama models taking 30-60+ seconds to load into memory on first use. The added logging will help confirm this hypothesis.
Important
Add diagnostic logging to
NativeOllamaHandlerfor debugging request hangs, including request timing and tool capability warnings.ensureClient()for base URL.createMessage()for request start, model fetch, chat request details, and stream start.createMessage()for models not found in tool-capable list.DEFAULT_OLLAMA_TIMEOUT_MS(5 minutes) for slow model loading.console.logfor info andconsole.warnfor warnings.Date.now()for precision.This description was created by
for 330c3d4. You can customize this summary. It will automatically update as commits are pushed.