Bug Description
When running Hermes Agent with OpenAI-compatible third-party endpoints (e.g., OpenRouter and SiliconFlow Custom providers), the conversation loop intermittently crashes with a non-retryable client error. The runtime executes Completions.create() (the legacy text completions method or an improperly bound endpoint mapping) while explicitly forwarding a top-level system prompt keyword parameter. This causes a TypeError in the underlying OpenAI Python SDK wrapper. Because the error is caught as a non-retryable client validation exception, it propagates entirely through the fallback chain and triggers an unrecoverable infinite loop during agent state recovery.
Steps to Reproduce
- Configure a custom OpenAI/OpenRouter provider profile (/opt/data/profiles/robin/profile.yaml).
- Set up models using chat interfaces that utilize custom endpoint definitions (e.g., tencent/Hy3 via SiliconFlow or nvidia/nemotron-3-super-120b-a12b:free via OpenRouter).
- Interact with the agent over an extended multi-turn session until the active context length escalates (e.g., ~31 messages, ~43,996 tokens).
- Watch the agent crash on payload construction immediately during a fallback rotation or session continuation query.
Expected Behavior
The agent should construct a valid modern payload targetting the chat interface (ChatCompletions.create()) or map system variables safely inside standard messages arrays rather than appending system as a top-level kwarg payload parameter to the legacy Completions interface.
Actual Behavior
WARNING agent.conversation_loop: API call failed (attempt 1/3) error_type=TypeError thread=hermes-gateway_0:130297385428672 provider=custom base_url=https://siliconflow.com model=tencent/Hy3 summary=Completions.create() got an unexpected keyword argument 'system'
WARNING agent.conversation_loop: API call failed (attempt 1/3) error_type=TypeError thread=hermes-gateway_0:130297385428672 provider=openrouter base_url=https://openrouter.ai model=nvidia/nemotron-3-super-120b-a12b:free summary=Completions.create() got an unexpected keyword argument 'system'
ERROR agent.conversation_loop: Non-retryable client error: Completions.create() got an unexpected keyword argument 'system'
Affected Component
Agent Core (conversation loop, context compression, memory)
Messaging Platform (if gateway-related)
No response
Debug Report
"description": "Deep structured memory with algebraic reasoning. Use alongside the memory tool — memory for always-on context, fact_store for deep recall and compositional queries.\n\nACTIONS (simple → powerful):\n• add — Store a fact the user would expect you to remember.\n• search — Keyword lookup ('editor config', 'deploy process').\n• probe — Entity recall: ALL facts about a person/thing.\n• related — What connects to an entity? Structural adjacency.\n• reason — Compositional: facts connected to MULTIPLE entities simultaneously.\n• contradict — Memory hygiene: find facts making conflicting claims.\n• update/remove/list — CRUD operations.\n\nIMPORTANT: Before answering questions about the user, ALWAYS probe or reason first.",
"parameters": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"add",
"search",
"probe",
"related",
"reason",
"contradict",
"update",
"remove",
"list"
]
},
"content": {
"type": "string",
"description": "Fact content (required for 'add')."
},
"query": {
"type": "string",
"description": "Search query (required for 'search')."
},
"entity": {
"type": "string",
"description": "Entity name for 'probe'/'related'."
},
"entities": {
"type": "array",
"items": {
"type": "string"
},
"description": "Entity names for 'reason'."
},
"fact_id": {
"type": "integer",
"description": "Fact ID for 'update'/'remove'."
},
"category": {
"type": "string",
"enum": [
"user_pref",
"project",
"tool",
"general"
]
},
"tags": {
"type": "string",
"description": "Comma-separated tags."
},
"trust_delta": {
"type": "number",
"description": "Trust adjustment for 'update'."
},
"min_trust": {
"type": "number",
"description": "Minimum trust filter (default: 0.3)."
},
"limit": {
"type": "integer",
"description": "Max results (default: 10)."
}
},
"required": [
"action"
]
}
}
},
{
"type": "function",
"function": {
"name": "fact_feedback",
"description": "Rate a fact after using it. Mark 'helpful' if accurate, 'unhelpful' if outdated. This trains the memory — good facts rise, bad facts sink.",
"parameters": {
"type": "object",
"properties": {
"action": {
"type": "string",
"enum": [
"helpful",
"unhelpful"
]
},
"fact_id": {
"type": "integer",
"description": "The fact ID to rate."
}
},
"required": [
"action",
"fact_id"
]
}
}
}
],
"extra_body": {
"session_id": "20260708_090850_04622636"
},
"system": "\n\n⚡ SKILL LOADING REMINDER: No domain-specific skills have been loaded recently (turn 17, freshness window: 15 turns). Before fixing, debugging, or modifying any system, you MUST load the relevant skill(s) using skill_view(). This is NON-NEGOTIABLE.\n\nDomain skill chains:\n[backtest] position-sizing → purged-cross-validation → overfitting-defense | [cron] cron-triage-protocol → kaggle-pipeline | [debug] systematic-debugging → skill-driven-debugging → pipeline-mastery | [feature] nse-market-microstructure → microstructure-features → fractional-differentiation | [hermes] hermes-agent | [kaggle] kaggle-env-compat → kaggle-api-behavior → pipeline-mastery → kaggle-pipeline"
}
},
"error": {
"type": "TypeError",
"message": "Completions.create() got an unexpected keyword argument 'system'"
}
}
Operating System
Linux 6.6.114.1-microsoft-standard-WSL2 x86_64
Python Version
No response
Hermes Version
No response
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
The error stems from agent/transports/chat_completions.py within _build_kwargs_from_profile():Around lines 570–600, dictionary iteration logic mapping user environment configurations assigns raw parameters dynamically: api_kwargs[k] = v.When it captures a root-level profile rule mapping (such as a system template variable or explicit model option named system), it appends it directly as an argument to the request block, exploding during unpacked instantiation: Completions.create(**api_kwargs)
Proposed Fix (optional)
No response
Are you willing to submit a PR for this?
Bug Description
When running Hermes Agent with OpenAI-compatible third-party endpoints (e.g., OpenRouter and SiliconFlow Custom providers), the conversation loop intermittently crashes with a non-retryable client error. The runtime executes Completions.create() (the legacy text completions method or an improperly bound endpoint mapping) while explicitly forwarding a top-level system prompt keyword parameter. This causes a TypeError in the underlying OpenAI Python SDK wrapper. Because the error is caught as a non-retryable client validation exception, it propagates entirely through the fallback chain and triggers an unrecoverable infinite loop during agent state recovery.
Steps to Reproduce
Expected Behavior
The agent should construct a valid modern payload targetting the chat interface (ChatCompletions.create()) or map system variables safely inside standard messages arrays rather than appending system as a top-level kwarg payload parameter to the legacy Completions interface.
Actual Behavior
WARNING agent.conversation_loop: API call failed (attempt 1/3) error_type=TypeError thread=hermes-gateway_0:130297385428672 provider=custom base_url=https://siliconflow.com model=tencent/Hy3 summary=Completions.create() got an unexpected keyword argument 'system'
WARNING agent.conversation_loop: API call failed (attempt 1/3) error_type=TypeError thread=hermes-gateway_0:130297385428672 provider=openrouter base_url=https://openrouter.ai model=nvidia/nemotron-3-super-120b-a12b:free summary=Completions.create() got an unexpected keyword argument 'system'
ERROR agent.conversation_loop: Non-retryable client error: Completions.create() got an unexpected keyword argument 'system'
Affected Component
Agent Core (conversation loop, context compression, memory)
Messaging Platform (if gateway-related)
No response
Debug Report
Operating System
Linux 6.6.114.1-microsoft-standard-WSL2 x86_64
Python Version
No response
Hermes Version
No response
Additional Logs / Traceback (optional)
Root Cause Analysis (optional)
The error stems from agent/transports/chat_completions.py within _build_kwargs_from_profile():Around lines 570–600, dictionary iteration logic mapping user environment configurations assigns raw parameters dynamically: api_kwargs[k] = v.When it captures a root-level profile rule mapping (such as a system template variable or explicit model option named system), it appends it directly as an argument to the request block, exploding during unpacked instantiation: Completions.create(**api_kwargs)
Proposed Fix (optional)
No response
Are you willing to submit a PR for this?