Bug Description
When configuring delegate_task to use an Ollama Cloud model (e.g., qwen3-coder-next:cloud), every delegation attempt fails immediately with:
Context length exceeded (1,584 tokens). Cannot compress further.
- Tokens consumed: input: 0, output: 0 — the model is never actually called
- Direct API call (curl to
https://ollama.com/v1/chat/completions) works perfectly with the same model
- Known models (gpt-5.5 via openai-codex) work fine for delegation
Root Cause (suspected: #17685)
The delegation subsystem resolves the model's context length via a fallback mechanism. For non-catalogued Ollama Cloud models, it cannot read context_length overrides and falls back to a minimal safety value (~2,048 tokens). The delegation system prompt (~1,584 tokens) immediately exceeds this, triggering a fatal compression error before any API call.
Failed Workarounds
All of the following were tested and none resolved the issue:
delegation.context_length: 64000 in config.yaml → ignored by delegate_task
custom_providers block with model-level context_length override → ignored
providers.ollama-cloud.models with context_length override → ignored
context_length_cache.yaml forced to 64000 for the model key → ignored (cache gets overwritten back)
- Gateway restart after all config changes → same error persists
Reproduction
delegation:
model: qwen3-coder-next:cloud
provider: ollama-cloud
base_url: https://ollama.com/v1
Then call delegate_task with any goal. Result: immediate failure.
Environment
- Hermes Agent: latest (v0.8+)
- Model: qwen3-coder-next:cloud (262,144 token context per Ollama)
- Provider: ollama-cloud
- OLLAMA_API_KEY: configured in .env
- Direct curl to the API endpoint: works correctly
Expected Behavior
delegate_task should respect context_length overrides from any of the documented config paths (custom_providers, providers, delegation block, or cache) and successfully delegate to Ollama Cloud models.
Bug Description
When configuring
delegate_taskto use an Ollama Cloud model (e.g.,qwen3-coder-next:cloud), every delegation attempt fails immediately with:https://ollama.com/v1/chat/completions) works perfectly with the same modelRoot Cause (suspected: #17685)
The delegation subsystem resolves the model's context length via a fallback mechanism. For non-catalogued Ollama Cloud models, it cannot read
context_lengthoverrides and falls back to a minimal safety value (~2,048 tokens). The delegation system prompt (~1,584 tokens) immediately exceeds this, triggering a fatal compression error before any API call.Failed Workarounds
All of the following were tested and none resolved the issue:
delegation.context_length: 64000in config.yaml → ignored by delegate_taskcustom_providersblock with model-levelcontext_lengthoverride → ignoredproviders.ollama-cloud.modelswithcontext_lengthoverride → ignoredcontext_length_cache.yamlforced to 64000 for the model key → ignored (cache gets overwritten back)Reproduction
Then call
delegate_taskwith any goal. Result: immediate failure.Environment
Expected Behavior
delegate_taskshould respectcontext_lengthoverrides from any of the documented config paths (custom_providers, providers, delegation block, or cache) and successfully delegate to Ollama Cloud models.