Skip to content

fix(ollama): optimize cloud model requests to avoid proxy timeouts#1522

Merged
corvid-agent merged 3 commits intomainfrom
fix/ollama-cloud-timeout
Mar 27, 2026
Merged

fix(ollama): optimize cloud model requests to avoid proxy timeouts#1522
corvid-agent merged 3 commits intomainfrom
fix/ollama-cloud-timeout

Conversation

@corvid-agent
Copy link
Copy Markdown
Collaborator

@corvid-agent corvid-agent commented Mar 26, 2026

Summary

  • Add isCloudModel() static helper to detect non-localhost Ollama hosts
  • Skip local-only params (num_gpu, num_batch) and cap num_predict at 1024 for cloud models
  • Add compact prompt variants (~1/3 token count) for cloud-proxied models
  • Skip getCodebaseContextPrompt() for cloud models (inferred from file reads)
  • Fix nemotron missing from TEXT_BASED_FAMILIES in tool-prompt-templates
  • Update spec to document new public API and compact prompts

Test plan

  • All 9160 tests pass
  • TypeScript compiles clean (bun x tsc --noEmit --skipLibCheck)
  • Spec check passes (bun run spec:check)
  • Verify Condor (Nemotron via cloud proxy) completes requests within 90s timeout

🤖 Generated with Claude Code

Cloud-proxied Ollama models (like Nemotron) were timing out because
requests included local-only GPU params and oversized system prompts.

- Add isCloudModel() helper to detect non-localhost Ollama hosts
- Skip num_gpu/num_batch and cap num_predict at 1024 for cloud models
- Add compact prompt variants (~1/3 token count) for cloud models
- Skip codebase context prompt for cloud models (inferred from reads)
- Fix nemotron missing from TEXT_BASED_FAMILIES in tool-prompt-templates
- Update spec to document isCloudModel and compact prompts

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
github-actions[bot]
github-actions Bot previously approved these changes Mar 26, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

All CI checks passed (tsc, tests) on ubuntu. Cross-platform tests (macOS, Windows) run on release tags only.

@codecov
Copy link
Copy Markdown

codecov Bot commented Mar 26, 2026

Codecov Report

❌ Patch coverage is 82.60870% with 12 lines in your changes missing coverage. Please review.

Files with missing lines Patch % Lines
server/process/direct-process.ts 66.66% 7 Missing ⚠️
server/routes/agents.ts 50.00% 5 Missing ⚠️

📢 Thoughts on this report? Let us know!

Add getCompactToolInstructionPrompt, getCompactResponseRoutingPrompt, and
getCompactCodingToolPrompt to the spec's public API table. Add invariant #12
for cloud model compact prompts. Update Consumed By section. Remove duplicate
getCodebaseContextPrompt entry. Update TEXT_BASED_FAMILIES list in invariant #2.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
github-actions[bot]
github-actions Bot previously approved these changes Mar 26, 2026
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

All CI checks passed (tsc, tests) on ubuntu. Cross-platform tests (macOS, Windows) run on release tags only.

Add tests for getCompactToolInstructionPrompt, getCompactResponseRoutingPrompt,
getCompactCodingToolPrompt, and OllamaProvider.isCloudModel to satisfy
codecov/patch coverage requirements.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Copy link
Copy Markdown
Contributor

@github-actions github-actions Bot left a comment

Choose a reason for hiding this comment

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

All CI checks passed (tsc, tests) on ubuntu. Cross-platform tests (macOS, Windows) run on release tags only.

@corvid-agent corvid-agent merged commit 79f82d9 into main Mar 27, 2026
13 checks passed
@corvid-agent corvid-agent deleted the fix/ollama-cloud-timeout branch March 27, 2026 13:07
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