hermes-agent/tests
teknium1 4068f20ce9 fix(anthropic): deep scan fixes — auth, retries, edge cases
Fixes from comprehensive code review and cross-referencing with
clawdbot/OpenCode implementations:

CRITICAL:
- Add one-shot guard (anthropic_auth_retry_attempted) to prevent
  infinite 401 retry loops when credentials keep changing
- Fix _is_oauth_token(): managed keys from ~/.claude.json are NOT
  regular API keys (don't start with sk-ant-api). Inverted the logic:
  only sk-ant-api* is treated as API key auth, everything else uses
  Bearer auth + oauth beta headers

HIGH:
- Wrap json.loads(args) in try/except in message conversion — malformed
  tool_call arguments no longer crash the entire conversation
- Raise AuthError in runtime_provider when no Anthropic token found
  (was silently passing empty string, causing confusing API errors)
- Remove broken _try_anthropic() from auxiliary vision chain — the
  centralized router creates an OpenAI client for api_key providers
  which doesn't work with Anthropic's Messages API

MEDIUM:
- Handle empty assistant message content — Anthropic rejects empty
  content blocks, now inserts '(empty)' placeholder
- Fix setup.py existing_key logic — set to 'KEEP' sentinel instead
  of None to prevent falling through to the auth choice prompt
- Add debug logging to _fetch_anthropic_models on failure

Tests: 43 adapter tests (2 new for token detection), 3197 total passed
2026-03-12 17:14:22 -07:00
..
agent merge: resolve conflicts with origin/main 2026-03-12 00:29:04 -07:00
cron test(cron): cover topic thread delivery metadata 2026-03-11 09:22:32 +01:00
fakes test: add HA integration tests with fake in-process server 2026-02-28 14:28:04 +03:00
gateway feat(gateway): thread-aware free-response routing for Discord 2026-03-11 09:15:31 -07:00
hermes_cli chore(skills): clean up PR #862 — simplify manifest guard, DRY up tests 2026-03-12 08:08:22 -07:00
honcho_integration Merge PR #193: add unit tests for 5 security/logic-critical modules (batch 4) 2026-03-04 19:35:01 -08:00
integration chore: remove nous-api provider (API key path) 2026-03-11 20:14:44 -07:00
skills feat: expand OpenClaw migration to cover all platform channels, provider keys, model/TTS config, shared skills, and daily memory 2026-03-10 00:35:14 -07:00
tools feat: add 'View full command' option to dangerous command approval (#887) 2026-03-12 06:27:21 -07:00
__init__.py A bit of restructuring for simplicity and organization 2025-10-01 23:29:25 +00:00
conftest.py fix: skip hanging tests + add global test timeout 2026-03-12 01:23:28 -07:00
test_413_compression.py fix: skip hanging tests + add global test timeout 2026-03-12 01:23:28 -07:00
test_860_dedup.py fix: eliminate 3x SQLite message duplication in gateway sessions (#860) 2026-03-10 15:22:44 -07:00
test_agent_loop.py fix: guard all atroposlib imports for CI without atropos installed 2026-03-11 06:52:55 -07:00
test_agent_loop_tool_calling.py fix: skip hanging tests + add global test timeout 2026-03-12 01:23:28 -07:00
test_agent_loop_vllm.py test: skip atropos-dependent tests when atroposlib not installed 2026-03-11 06:52:55 -07:00
test_anthropic_adapter.py fix(anthropic): deep scan fixes — auth, retries, edge cases 2026-03-12 17:14:22 -07:00
test_api_key_providers.py fix: add Kimi Code API support (api.kimi.com/coding/v1) 2026-03-07 21:00:12 -05:00
test_atomic_json_write.py refactor: extract atomic_json_write helper, add 24 checkpoint tests 2026-03-06 05:50:12 -08:00
test_auth_codex_provider.py refactor(auth): transition Codex OAuth tokens to Hermes auth store 2026-03-01 19:59:24 -08:00
test_auth_nous_provider.py Fix nous refresh token rotation failure in case where api key mint/retrieval fails 2026-03-02 17:18:15 +11:00
test_auxiliary_config_bridge.py fix: update all test mocks for call_llm migration 2026-03-11 21:06:54 -07:00
test_batch_runner_checkpoint.py refactor: extract atomic_json_write helper, add 24 checkpoint tests 2026-03-06 05:50:12 -08:00
test_cli_init.py fix: normalize max turns config path 2026-03-10 06:05:02 -07:00
test_cli_loading_indicator.py fix(cli): add loading indicators for slow slash commands 2026-03-10 17:31:00 -07:00
test_cli_model_command.py feat: unified /model and /provider into single view 2026-03-11 23:06:06 -07:00
test_cli_provider_resolution.py refactor: remove LLM_MODEL env var dependency — config.yaml is sole source of truth 2026-03-11 22:04:42 -07:00
test_codex_execution_paths.py feat: simple fallback model for provider resilience 2026-03-08 20:22:33 -07:00
test_codex_models.py Merge pull request #735 from NousResearch/hermes/hermes-f8d56335 2026-03-08 18:30:27 -07:00
test_display.py fix: add upstream guard for non-dict function_args + tests for build_tool_preview 2026-03-09 21:01:40 -07:00
test_external_credential_detection.py refactor(auth): transition Codex OAuth tokens to Hermes auth store 2026-03-01 19:59:24 -08:00
test_fallback_model.py refactor: route main agent client + fallback through centralized router 2026-03-11 21:38:29 -07:00
test_file_permissions.py security: enforce 0600/0700 file permissions on sensitive files (inspired by openclaw) 2026-03-09 02:19:32 -07:00
test_flush_memories_codex.py fix: update all test mocks for call_llm migration 2026-03-11 21:06:54 -07:00
test_hermes_state.py Merge PR #565: fix: sanitize FTS5 queries and close mirror DB connections 2026-03-09 23:59:26 -07:00
test_honcho_client_config.py fix(honcho): auto-enable when API key is present 2026-03-01 03:12:37 -05:00
test_insights.py fix: deep review — prefix matching, tool_calls extraction, query perf, serialization 2026-03-06 14:50:57 -08:00
test_managed_server_tool_support.py fix: guard all atroposlib imports for CI without atropos installed 2026-03-11 06:52:55 -07:00
test_model_provider_persistence.py fix: provider selection not persisting when switching via hermes model 2026-03-10 17:12:34 -07:00
test_model_tools.py test: strengthen assertions across 3 more test files (batch 2) 2026-03-05 18:46:30 -08:00
test_personality_none.py feat(cli,gateway): add /personality none and custom personality support 2026-03-09 17:31:54 +03:00
test_provider_parity.py feat: default reasoning effort from xhigh to medium 2026-03-07 10:14:19 -08:00
test_quick_commands.py feat(cli,gateway): add user-defined quick commands that bypass agent loop 2026-03-09 07:38:06 +03:00
test_reasoning_command.py fix: /reasoning command — add gateway support, fix display, persist settings (#1031) 2026-03-12 05:38:19 -07:00
test_resume_display.py feat: display previous messages when resuming a session in CLI 2026-03-08 17:45:45 -07:00
test_run_agent.py feat: native Anthropic provider with Claude Code credential auto-discovery 2026-03-12 15:47:45 -07:00
test_run_agent_codex_responses.py fix: add missing Responses API parameters for Codex provider 2026-03-11 04:28:31 -07:00
test_runtime_provider_resolution.py chore: remove nous-api provider (API key path) 2026-03-11 20:14:44 -07:00
test_timezone.py test(cron): add regression tests for _ensure_aware timezone conversion 2026-03-11 08:42:04 -07:00
test_tool_call_parsers.py fix: guard all atroposlib imports for CI without atropos installed 2026-03-11 06:52:55 -07:00
test_toolset_distributions.py test: add unit tests for 8 modules (batch 2) 2026-02-26 13:54:20 +03:00
test_toolsets.py fix: add missing Platform.SIGNAL to toolset mappings, update test + config docs 2026-03-09 23:27:19 -07:00
test_trajectory_compressor.py test: add 25 unit tests for trajectory_compressor 2026-02-28 21:28:28 +03:00
test_worktree.py fix: wire worktree flag into hermes CLI entry point + docs + tests 2026-03-07 21:05:40 -08:00