Skip to content

fix: forward resolved context limit to Ollama#579

Open
zerone0x wants to merge 1 commit into
Nano-Collective:mainfrom
zerone0x:fix/485-ollama-num-ctx
Open

fix: forward resolved context limit to Ollama#579
zerone0x wants to merge 1 commit into
Nano-Collective:mainfrom
zerone0x:fix/485-ollama-num-ctx

Conversation

@zerone0x

Copy link
Copy Markdown
Contributor

Description

This PR fixes the missing runtime half of #485 for Ollama-backed models.

Nanocoder already let users configure context limits via:

  • /context-max / --context-max
  • provider-level contextWindow
  • per-model contextWindows
  • subagent contextWindow

But those limits were only used inside Nanocoder for context accounting and auto-compact decisions. They were not being forwarded to Ollama itself, so the actual model runtime could still use a different context size.

This change now forwards the resolved Nanocoder context limit to Ollama as options.num_ctx on each request, so the configured limit affects the real runtime behavior too.

It also updates the docs to make that behavior explicit.

Type of Change

  • New feature
  • Bug fix
  • Breaking change
  • Documentation update

Testing

Automated Tests

  • New features include passing tests in .spec.ts/tsx files
  • All existing tests pass (pnpm test:all completes successfully)
  • Tests cover both success and error scenarios

Ran:

  • npm exec --yes pnpm -- test:ava source/ai-sdk-client/chat/provider-options.spec.ts
  • npm exec --yes pnpm -- test:types
  • npm exec --yes pnpm -- exec biome check source/ai-sdk-client/chat/provider-options.ts source/ai-sdk-client/chat/provider-options.spec.ts source/ai-sdk-client/chat/chat-handler.ts docs/configuration/providers/ollama.md docs/features/subagents.md

Manual Testing

  • Tested with Ollama
  • Tested with OpenRouter
  • Tested with OpenAI-compatible API
  • Tested MCP integration (if applicable)

Manual testing was not run in this environment.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Documentation updated (if needed)
  • No breaking changes (or clearly documented)
  • Appropriate logging added using structured logging

Closes #485

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.

[Feature]

1 participant