hermes-agent/tests/agent
Savanne Kham 258965663c fix(chat_completions): strip tool_name from messages for strict providers
The 'tool_name' key on role=tool messages is an internal Hermes field
(stored in the messages.tool_name SQLite column for FTS indexing) that
is not part of the OpenAI Chat Completions schema. Strict OpenAI-compatible
providers — notably Moonshot AI (Kimi) — reject it with HTTP 400:

  Error from provider: Extra inputs are not permitted,
  field: 'messages[N].tool_name', value: 'execute_code'

Add 'tool_name' to the sanitize block in ChatCompletionsTransport.convert_messages
alongside the existing Codex Responses API fields (codex_reasoning_items,
codex_message_items) so it is popped before the request is sent.

Reproducer:
  hermes chat --model kimi-k2.6
  > list the top 5 Hacker News stories
  -> assistant emits tool_call(execute_code)
  -> tool result message gets tool_name='execute_code'
  -> next turn's payload includes messages[N].tool_name -> 400

Permissive backends (MiniMax, OpenRouter on most routes) ignore the extra
field and were masking the bug.
2026-05-20 02:44:08 -07:00
..
lsp fix(lint): skip per-file shell linter when LSP will handle the file (#29054) 2026-05-20 01:46:40 -05:00
transports fix(chat_completions): strip tool_name from messages for strict providers 2026-05-20 02:44:08 -07:00
__init__.py
…
test_anthropic_adapter.py feat(azure-foundry): add Microsoft Entra ID auth 2026-05-18 10:14:38 -07:00
test_anthropic_keychain.py
…
test_anthropic_oauth_pkce.py
…
test_arcee_trinity_overrides.py
…
test_async_utils.py
…
test_auxiliary_client.py test(auxiliary): cover layered fallback (chain → main agent → warn) 2026-05-17 17:15:31 -07:00
test_auxiliary_client_anthropic_custom.py
…
test_auxiliary_client_azure_foundry.py feat(azure-foundry): add Microsoft Entra ID auth 2026-05-18 10:14:38 -07:00
test_auxiliary_config_bridge.py
…
test_auxiliary_main_first.py chore: ruff auto-fix PLR6201 resweep — tuple → set in membership tests (#27355) 2026-05-17 02:29:41 -07:00
test_auxiliary_named_custom_providers.py
…
test_auxiliary_transport_autodetect.py
…
test_azure_identity_adapter.py feat(azure-foundry): add Microsoft Entra ID auth 2026-05-18 10:14:38 -07:00
test_bedrock_1m_context.py feat(azure-foundry): add Microsoft Entra ID auth 2026-05-18 10:14:38 -07:00
test_bedrock_adapter.py
…
test_bedrock_integration.py
…
test_codex_cloudflare_headers.py
…
test_compress_focus.py
…
test_compressor_historical_media.py
…
test_compressor_image_tokens.py
…
test_context_compressor.py fix(compress): make abort-on-summary-failure opt-in via config flag (#28117) 2026-05-18 10:28:20 -07:00
test_context_compressor_summary_continuity.py
…
test_context_engine.py
…
test_context_references.py
…
test_copilot_acp_client.py
…
test_copilot_acp_deprecation.py
…
test_credential_pool.py fix(codex-oauth): quarantine terminal refresh errors so dead tokens are not replayed across sessions 2026-05-18 10:31:40 -07:00
test_credential_pool_routing.py
…
test_crossloop_client_cache.py
…
test_curator.py
…
test_curator_activity.py
…
test_curator_backup.py
…
test_curator_classification.py
…
test_curator_reports.py
…
test_deepseek_anthropic_thinking.py chore: ruff auto-fix PLR6201 resweep — tuple → set in membership tests (#27355) 2026-05-17 02:29:41 -07:00
test_direct_provider_url_detection.py
…
test_display.py
…
test_display_emoji.py
…
test_error_classifier.py
…
test_external_skills.py
…
test_external_skills_dirs_cache.py
…
test_gemini_cloudcode.py
…
test_gemini_fast_fallback.py fix: wrap _pool_may_recover_from_rate_limit call through run_agent namespace 2026-05-18 20:04:57 -07:00
test_gemini_free_tier_gate.py
…
test_gemini_native_adapter.py
…
test_gemini_schema.py
…
test_i18n.py
…
test_image_gen_registry.py
…
test_image_routing.py
…
test_insights.py
…
test_kimi_coding_anthropic_thinking.py
…
test_local_stream_timeout.py
…
test_markdown_tables.py
…
test_memory_provider.py
…
test_memory_session_switch.py
…
test_memory_user_id.py
…
test_minimax_auxiliary_url.py
…
test_minimax_provider.py
…
test_model_metadata.py fix(metadata): qwen3.6-plus has a 1M context window (#27008) 2026-05-17 02:31:18 -07:00
test_model_metadata_local_ctx.py
…
test_model_metadata_ssl.py
…
test_models_dev.py
…
test_moonshot_schema.py
…
test_nous_rate_guard.py
…
test_onboarding.py
…
test_openrouter_response_cache.py
…
test_plugin_llm.py
…
test_portal_tags.py
…
test_prompt_builder.py fix(agent): add qwen and deepseek to TOOL_USE_ENFORCEMENT_MODELS 2026-05-18 20:06:49 -07:00
test_prompt_caching.py
…
test_proxy_and_url_validation.py
…
test_rate_limit_tracker.py
…
test_redact.py fix(security): redact xAI (Grok) API keys in logs 2026-05-18 10:21:22 -07:00
test_shell_hooks.py fix(security): restore type safety and extract constant in shell hook block handler 2026-05-17 02:31:18 -07:00
test_shell_hooks_consent.py
…
test_skill_bundles.py feat(skills): add skill bundles — alias /<name> loads multiple skills (#28373) 2026-05-18 21:38:05 -07:00
test_skill_commands.py fix(skills): load symlinked skill slash commands 2026-05-18 00:34:29 -07:00
test_skill_commands_reload.py
…
test_skill_utils.py
…
test_streaming_context_scrubber.py 🐛 fix(memory): require newline after context tag 2026-05-18 10:53:08 -07:00
test_subagent_progress.py
…
test_subagent_stop_hook.py
…
test_subdirectory_hints.py
…
test_system_prompt_restore.py perf(prompt-cache): date-only timestamp + loud gateway-DB roundtrip logging 2026-05-17 23:20:37 -07:00
test_think_scrubber.py
…
test_title_generator.py
…
test_tool_guardrails.py fix: add recovery hints to loop guard warnings 2026-05-19 00:12:12 -07:00
test_tool_result_classification.py
…
test_unsupported_parameter_retry.py
…
test_unsupported_temperature_retry.py
…
test_usage_pricing.py
…
test_video_gen_registry.py
…
test_vision_resolved_args.py
…