hermes-agent/tests
teknium1 8311e8984b fix: preflight context compression + error handler ordering for model switches
Two fixes for the case where a user switches to a model with a smaller
context window while having a large existing session:

1. Preflight compression in run_conversation(): Before the main loop,
   estimate tokens of loaded history + system prompt. If it exceeds the
   model's compression threshold (85% of context), compress proactively
   with up to 3 passes. This naturally handles model switches because
   the gateway creates a fresh AIAgent per message with the current
   model's context length.

2. Error handler reordering: Context-length errors (400 with 'maximum
   context length' etc.) are now checked BEFORE the generic 4xx handler.
   Previously, OpenRouter's 400-status context-length errors were caught
   as non-retryable client errors and aborted immediately, never reaching
   the compression+retry logic.

Reported by Sonicrida on Discord: 840-message session (2MB+) crashed
after switching from a large-context model to minimax via OpenRouter.
2026-03-04 14:42:41 -08:00
..
agent fix(agent): handle None content in context compressor (fixes #211) 2026-03-02 01:35:52 -08:00
cron Merge pull request #62 from 0xbyt4/test/expand-coverage-2 2026-02-27 01:47:30 -08:00
fakes test: add HA integration tests with fake in-process server 2026-02-28 14:28:04 +03:00
gateway Merge PR #370: fix(session): use database session count for has_any_sessions 2026-03-04 05:37:15 -08:00
hermes_cli test: enhance session source tests and add validation for chat types 2026-02-26 00:53:57 -08:00
honcho_integration test: add unit tests for 8 untested modules (batch 3) (#191) 2026-03-01 05:28:12 -08:00
integration test: add HA integration tests with fake in-process server 2026-02-28 14:28:04 +03:00
tools fix: catch exceptions from check_fn in is_toolset_available() 2026-03-04 14:22:30 -08:00
__init__.py A bit of restructuring for simplicity and organization 2025-10-01 23:29:25 +00:00
conftest.py fix(tests): isolate HERMES_HOME in tests and adjust log directory for debug session 2026-03-02 04:34:21 -08:00
test_413_compression.py fix: preflight context compression + error handler ordering for model switches 2026-03-04 14:42:41 -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_cli_init.py fix(cli): fix max_turns comment and test for correct priority order 2026-03-02 01:18:52 -08:00
test_cli_provider_resolution.py Add OpenAI Codex provider runtime and responses integration (without .agent/PLANS.md) 2026-02-25 18:20:38 -08:00
test_codex_execution_paths.py feat(provider-routing): add OpenRouter provider routing configuration 2026-03-01 18:24:27 -08:00
test_codex_models.py Harden Codex auth refresh and responses compatibility 2026-02-25 19:27:54 -08: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_flush_memories_codex.py refactor(cli): Finalize OpenAI Codex Integration with OAuth 2026-02-28 21:47:51 -08:00
test_hermes_state.py test: add unit tests for 8 untested modules 2026-02-26 13:27:58 +03:00
test_honcho_client_config.py fix(honcho): auto-enable when API key is present 2026-03-01 03:12:37 -05:00
test_model_tools.py test: add unit tests for 8 modules (batch 2) 2026-02-26 13:54:20 +03:00
test_provider_parity.py feat(agent): add summary handling for reasoning items 2026-03-01 20:03:03 -08:00
test_run_agent.py merge: resolve conflict with main (add mcp + homeassistant extras) 2026-03-03 14:52:22 +03:00
test_run_agent_codex_responses.py refactor(cli): Finalize OpenAI Codex Integration with OAuth 2026-02-28 21:47:51 -08:00
test_runtime_provider_resolution.py fix: prioritize OPENROUTER_API_KEY over OPENAI_API_KEY 2026-03-03 00:28:26 +03: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 test: add unit tests for 8 untested modules 2026-02-26 13:27:58 +03:00