Skip to content

fix(transport): system-message guard for ollama-cloud (#29871) - #30236

Closed
zombi3butt wants to merge 7 commits into
NousResearch:mainfrom
zombi3butt:fix/ollama-cloud-system-message-guard
Closed

fix(transport): system-message guard for ollama-cloud (#29871)#30236
zombi3butt wants to merge 7 commits into
NousResearch:mainfrom
zombi3butt:fix/ollama-cloud-system-message-guard

Conversation

@zombi3butt

Copy link
Copy Markdown

When provider hooks silently strip the role=system message from outgoing API payloads, _build_kwargs_from_profile detects this and re-injects from original input so SOUL.md persona content is never lost.

Fix: defensive cross-check in _build_kwargs_from_profile that compares input params vs output messages, re-injecting system role when stripped.

Changes:

  • agent/transports/chat_completions.py: logger import + guard (29 lines)
  • tests/agent/transports/test_system_message_guard.py: 6 regression tests (148 lines)

Testing: 73 tests pass, no regressions. Fixes #29871

3ighty2O and others added 7 commits May 21, 2026 21:17
…me dict (issue NousResearch#29872)

When resolving named custom providers (custom:<name>), the returned
runtime dict previously collapsed provider to bare 'custom', losing
the specific sub-provider identity. This caused TUI display and
credential pool lookups to show only 'custom' instead of
'custom:bobapi-deepseek' etc.

Changes:
- _try_resolve_from_custom_pool: preserve sub-provider name in
  returned provider field as 'custom:<name>'
- _resolve_named_custom_runtime: non-pool return path uses
  'custom:<name>' for the provider field
- Bare 'custom' with explicit base_url remains unchanged

Updated tests to reflect new expected provider values.
fix: route cron job scripts through remote terminal backend (issue NousResearch#29849)
…9871)

When a provider's prepare_messages() hooks silently strip the role=
"system" message (known with some Ollama Cloud variants),
_build_kwargs_from_profile detects this via a cross-check between
input params and sanitized output, and re-injects from original
input so SOUL.md persona content is never lost mid-flight.

Fixes NousResearch#29871
@alt-glitch alt-glitch added type/bug Something isn't working P3 Low — cosmetic, nice to have comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/ollama Ollama / local models comp/cron Cron scheduler and job management comp/cli CLI entry point, hermes_cli/, setup wizard tool/mcp MCP client and OAuth tool/skills Skills system (list, view, manage) labels May 22, 2026
@alt-glitch

Copy link
Copy Markdown
Collaborator

Resubmission of closed #29935, both fixing #29871. Note: this PR bundles several unrelated changes beyond the ollama-cloud system-message guard — cron/scheduler.py adds ~200 lines of SSH remote execution (refs #29849), plus modifications to hermes_cli/main.py, hermes_cli/runtime_provider.py, tools/mcp_tool.py, tools/skills_sync.py, and agent/model_metadata.py. These should be split into separate PRs.

@teknium1

Copy link
Copy Markdown
Contributor

Thanks for the defensive investigation. This is an automated hermes-sweeper review; current main already preserves this behavior through the provider-profile transport path.

  • agent/conversation_loop.py:852-856 constructs the outgoing first role="system" message from the stable prompt, which includes SOUL.md via agent/system_prompt.py:185-190.
  • agent/transports/chat_completions.py:519-535 passes profile.prepare_messages() directly into api_kwargs["messages"]; the inherited implementation in providers/base.py:111-117 is pass-through.
  • plugins/model-providers/ollama-cloud/__init__.py:26-73 and plugins/model-providers/custom/__init__.py:19-94 do not override that hook, covering both the Ollama Cloud request and the local/custom endpoint mentioned on [Bug]: ollama-cloud provider does not inject SOUL.md into outgoing request (loader fires correctly; content drops downstream) #29871.
  • The current provider-profile implementation was introduced on main by d682f320b35a13084371a541a835e1d988c982b8; the reported downstream system-message drop is no longer present.

The member note about the unrelated cron, MCP, runtime-provider, skills, and metadata changes was also considered. No cherry-pick is needed for the stated transport fix.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint comp/cli CLI entry point, hermes_cli/, setup wizard comp/cron Cron scheduler and job management P3 Low — cosmetic, nice to have provider/ollama Ollama / local models sweeper:implemented-on-main Sweeper: behavior already present on current main tool/mcp MCP client and OAuth tool/skills Skills system (list, view, manage) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: ollama-cloud provider does not inject SOUL.md into outgoing request (loader fires correctly; content drops downstream)

4 participants