hermes-agent/tests/tools
Teknium e3f9894caf
fix: send_animation metadata, MarkdownV2 inline code splitting, tirith cosign-free install (#1626)
* fix: Anthropic OAuth compatibility — Claude Code identity fingerprinting

Anthropic routes OAuth/subscription requests based on Claude Code's
identity markers. Without them, requests get intermittent 500 errors
(~25% failure rate observed). This matches what pi-ai (clawdbot) and
OpenCode both implement for OAuth compatibility.

Changes (OAuth tokens only — API key users unaffected):

1. Headers: user-agent 'claude-cli/2.1.2 (external, cli)' + x-app 'cli'
2. System prompt: prepend 'You are Claude Code, Anthropic's official CLI'
3. System prompt sanitization: replace Hermes/Nous references
4. Tool names: prefix with 'mcp_' (Claude Code convention for non-native tools)
5. Tool name stripping: remove 'mcp_' prefix from response tool calls

Before: 9/12 OK, 1 hard fail, 4 needed retries (~25% error rate)
After: 16/16 OK, 0 failures, 0 retries (0% error rate)

* fix: three gateway issues from user error logs

1. send_animation missing metadata kwarg (base.py)
   - Base class send_animation lacked the metadata parameter that the
     call site in base.py line 917 passes. Telegram's override accepted
     it, but any platform without an override (Discord, Slack, etc.)
     hit TypeError. Added metadata to base class signature.

2. MarkdownV2 split-inside-inline-code (base.py truncate_message)
   - truncate_message could split at a space inside an inline code span
     (e.g. `function(arg1, arg2)`), leaving an unpaired backtick and
     unescaped parentheses in the chunk. Telegram rejects with
     'character ( is reserved'. Added inline code awareness to the
     split-point finder — detects odd backtick counts and moves the
     split before the code span.

3. tirith auto-install without cosign (tirith_security.py)
   - Previously required cosign on PATH for auto-install, blocking
     install entirely with a warning if missing. Now proceeds with
     SHA-256 checksum verification only when cosign is unavailable.
     Cosign is still used for full supply chain verification when
     present. If cosign IS present but verification explicitly fails,
     install is still aborted (tampered release).
2026-03-16 23:39:41 -07:00
..
__init__.py test: reorganize test structure and add missing unit tests 2026-02-26 03:20:08 +03:00
test_approval.py Merge pull request #1397 from NousResearch/hermes/hermes-629f8bde 2026-03-14 22:17:16 -07:00
test_browser_cleanup.py Fix browser cleanup consistency and screenshot recovery 2026-03-14 11:28:26 -07:00
test_browser_console.py fix: update all test mocks for call_llm migration 2026-03-11 21:06:54 -07:00
test_checkpoint_manager.py fix: reduce file tool log noise 2026-03-13 22:14:00 -07:00
test_clarify_tool.py test(tools): add unit tests for clarify_tool.py 2026-02-27 03:29:26 -05:00
test_clipboard.py fix(cli): respect HERMES_HOME in all remaining hardcoded ~/.hermes paths 2026-03-13 21:32:53 -07:00
test_code_execution.py test: cover repo-root imports in execute_code sandbox 2026-03-14 21:41:12 -07:00
test_command_guards.py fix: preserve current approval semantics for tirith guard 2026-03-14 00:17:04 -07:00
test_cron_prompt_injection.py fix: cron prompt injection scanner bypass for multi-word variants 2026-02-26 13:55:54 +03:00
test_cronjob_tools.py fix: preserve thread context for cronjob deliver=origin 2026-03-15 06:57:00 -07:00
test_daytona_environment.py fix(daytona): use shell timeout wrapper instead of broken SDK exec timeout 2026-03-05 13:12:41 -08:00
test_debug_helpers.py fix(tests): isolate HERMES_HOME in tests and adjust log directory for debug session 2026-03-02 04:34:21 -08:00
test_delegate.py feat: add direct endpoint overrides for auxiliary and delegation 2026-03-14 21:11:37 -07:00
test_docker_environment.py test: fake minisweagent for docker cwd mount regressions 2026-03-16 05:40:05 -07:00
test_docker_find.py fix: Docker backend fails when docker is not in PATH (macOS gateway) 2026-03-10 20:45:13 -07:00
test_file_operations.py fix: search_files now reports error for non-existent paths instead of silent empty results 2026-03-08 16:47:20 -07:00
test_file_tools.py fix: reduce file tool log noise 2026-03-13 22:14:00 -07:00
test_file_tools_live.py fix: skip hanging tests + add global test timeout 2026-03-12 01:23:28 -07:00
test_force_dangerous_override.py fix(skills): honor policy table for dangerous verdicts 2026-03-14 11:27:02 -07:00
test_fuzzy_match.py test: reorganize test structure and add missing unit tests 2026-02-26 03:20:08 +03:00
test_hidden_dir_filter.py fix: use Path.parts for hidden directory filter in skill listing 2026-03-04 18:34:16 +03:00
test_homeassistant_tool.py fix: add service domain blocklist and entity_id validation to HA tools 2026-03-01 11:53:50 +03:00
test_honcho_tools.py fix(honcho): isolate session routing for multi-user gateway (#1500) 2026-03-16 00:23:47 -07:00
test_interrupt.py feat: concurrent tool execution with ThreadPoolExecutor 2026-03-13 02:51:51 -07:00
test_local_env_blocklist.py feat: auto-detect provider when switching models via /model (#1506) 2026-03-16 04:34:45 -07:00
test_local_persistent.py simplify docstrings, fix some bugs 2026-03-15 01:20:42 +05:30
test_mcp_tool.py feat(mcp): make selective tool loading capability-aware 2026-03-14 06:22:02 -07:00
test_mcp_tool_issue_948.py fix(mcp): resolve npx stdio connection failures (#1291) 2026-03-14 05:44:00 -07:00
test_memory_tool.py fix: tighten memory and session recall guidance 2026-03-14 11:36:47 -07:00
test_mixture_of_agents_tool.py refactor: tighten MoA traceback logging scope (#1307) 2026-03-14 07:53:56 -07:00
test_modal_sandbox_fixes.py fix(docker): gate cwd workspace mount behind config 2026-03-16 05:20:56 -07:00
test_parse_env_var.py test(terminal): add tests for env var validation in _get_env_config 2026-03-11 02:59:12 -07:00
test_patch_parser.py test: cover pipe characters in v4a patch apply 2026-03-14 03:54:46 -07:00
test_process_registry.py fix(security): block gateway and tool env vars in subprocesses 2026-03-15 02:51:04 -07:00
test_read_loop_detection.py fix: improve read-loop detection — consecutive-only, correct thresholds, fix bugs 2026-03-10 16:25:41 -07:00
test_registry.py feat(tools): centralize tool emoji metadata in registry + skin integration 2026-03-15 20:21:21 -07:00
test_rl_training_tool.py fix: call _stop_training_run on early-return failure paths 2026-03-10 17:09:51 -07:00
test_send_message_tool.py fix: suppress duplicate cron sends to auto-delivery targets 2026-03-14 19:07:50 -07:00
test_session_search.py fix: tighten memory and session recall guidance 2026-03-14 11:36:47 -07:00
test_skill_manager_tool.py test: strengthen assertions in skill_manager + memory_tool (batch 3) 2026-03-05 18:51:43 -08:00
test_skill_view_path_check.py refactor: use Path.is_relative_to() for skill_view boundary check 2026-03-04 05:30:43 -08:00
test_skill_view_traversal.py fix(security): block path traversal in skill_view file_path (fixes #220) 2026-03-02 02:00:09 -08:00
test_skills_guard.py fix(skills): honor policy table for dangerous verdicts 2026-03-14 11:27:02 -07:00
test_skills_hub.py test(skills): isolate well-known cache in adapter tests 2026-03-14 08:24:59 -07:00
test_skills_hub_clawhub.py fix: improve clawhub skill search matching 2026-03-14 23:15:04 -07:00
test_skills_sync.py fix: prevent data loss in skills sync on copy/update failure 2026-03-07 03:58:32 +03:00
test_skills_tool.py fix: improve gateway secret capture guidance message 2026-03-13 04:10:22 -07:00
test_ssh_environment.py merge: resolve conflicts with origin/main (SSH preflight check) 2026-03-15 21:13:40 -07:00
test_symlink_prefix_confusion.py fix: use is_relative_to() for symlink boundary check in skills_guard 2026-03-04 17:23:23 +03:00
test_terminal_disk_usage.py fix: eliminate shell noise from terminal output with fence markers 2026-03-02 22:53:21 +03:00
test_terminal_requirements.py fix: clearer terminal backend requirement errors 2026-03-14 06:04:39 -07:00
test_terminal_tool_requirements.py fix: worktree-aware minisweagent path discovery + clean up requirements check (#1248) 2026-03-13 23:39:51 -07:00
test_tirith_security.py fix: send_animation metadata, MarkdownV2 inline code splitting, tirith cosign-free install (#1626) 2026-03-16 23:39:41 -07:00
test_todo_tool.py fix: update test_non_empty_has_markers to match todo filtering behavior 2026-03-08 23:07:38 +03:00
test_transcription.py fix: propagate STT disable through shared transcription config 2026-03-14 22:09:59 -07:00
test_transcription_tools.py fix: restore local STT fallback for gateway voice notes 2026-03-15 21:51:40 -07:00
test_vision_tools.py refactor: unify vision backend gating 2026-03-14 20:22:13 -07:00
test_voice_cli_integration.py fix: voice pipeline hardening — 7 bug fixes with tests 2026-03-14 14:27:21 +03:00
test_voice_mode.py fix: voice pipeline hardening — 7 bug fixes with tests 2026-03-14 14:27:21 +03:00
test_web_tools_config.py test: comprehensive tests for model metadata + firecrawl config 2026-03-05 18:22:39 -08:00
test_windows_compat.py fix: guard POSIX-only process functions for Windows compatibility 2026-03-01 01:54:27 +03:00
test_write_deny.py fix: resolve symlink bypass in write deny list on macOS 2026-02-26 13:30:55 +03:00
test_yolo_mode.py fix: preserve current approval semantics for tirith guard 2026-03-14 00:17:04 -07:00