hermes-agent/tests
Michael Jordan 186cad02f9 feat(agent): per-turn micro-compaction to amortize context compression
Batch compaction pauses a session for one large summarization once the
window fills. Micro-compaction spreads that cost out: after each completed
turn, `finalize_turn` folds the single oldest un-absorbed exchange
(assistant message plus its tool results) into a rolling summary, so the
work happens in small increments during post-turn idle time instead of one
long stall.

Mechanics:
  - a cursor tracks the first message not yet absorbed, recovered from the
    transcript's last summary marker when in-memory state is unavailable;
  - protected head and tail windows are never touched, so the system prompt
    and recent turns stay verbatim;
  - the absorbed span is replaced by a marker carrying the usual
    `_compressed_summary` metadata, so resume, handoff and `/compress`
    treat it exactly like a batch summary;
  - `archive_and_compact` keeps the session DB in step, otherwise the
    append-only flush would leave the original rows active and a resume
    would double-load both summary and originals;
  - when the rolling summary itself passes a token threshold it is
    defragged: re-summarized in one shot and the cursor jumps to the tail;
  - an exchange the summarizer can't handle is retried a bounded number of
    times, then skipped, so one poison exchange can't stall every turn.

Keep only the newest summary marker. The rolling summary is cumulative, so
each marker already contains everything the previous ones held; leaving them
stacked near-duplicate copies of the same text, each with its own heading and
end-marker scaffolding, and the transcript grew on every turn instead of
shrinking. Measured over six turns on a 12-exchange conversation with tool
output: 4104 -> 4797 tokens before, 4104 -> 2572 after.

Off switch: `compression.micro_compact: false` (default on).

Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
2026-07-31 17:44:19 +05:30
..
acp test: prune wave 2 + speed fixes — 28,106 → 19,757 test functions, suite wall 315s → 294s 2026-07-29 13:39:40 -07:00
acp_adapter test: prune wave 2 + speed fixes — 28,106 → 19,757 test functions, suite wall 315s → 294s 2026-07-29 13:39:40 -07:00
agent feat(agent): per-turn micro-compaction to amortize context compression 2026-07-31 17:44:19 +05:30
ci test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
cli fix(cli): route Cmd+Backspace and Cmd+ForwardDelete to the kill bindings 2026-07-30 03:39:26 -05:00
computer_use Merge remote-tracking branch 'origin/main' into tests/prune-low-value 2026-07-29 14:12:25 -07:00
conformance test: prune wave 2 + speed fixes — 28,106 → 19,757 test functions, suite wall 315s → 294s 2026-07-29 13:39:40 -07:00
cron test(tests): assert SessionDB timeout without wall-clock 2026-07-29 18:55:10 -07:00
dashboard test: prune wave 2 + speed fixes — 28,106 → 19,757 test functions, suite wall 315s → 294s 2026-07-29 13:39:40 -07:00
docker test: prune wave 2 + speed fixes — 28,106 → 19,757 test functions, suite wall 315s → 294s 2026-07-29 13:39:40 -07:00
e2e
fakes
fixtures feat(computer_use): align cua-driver 0.9 contracts 2026-07-29 12:19:37 -07:00
gateway fix(gateway): preserve voice_only semantics for text input 2026-07-30 00:11:33 -07:00
hermes_cli fix(cli): stabilize custom provider identities 2026-07-31 17:26:42 +05:30
hermes_state test: prune wave 2 + speed fixes — 28,106 → 19,757 test functions, suite wall 315s → 294s 2026-07-29 13:39:40 -07:00
honcho_plugin fix(honcho): network-hermetic unit tests + lazy async writer start 2026-07-29 18:55:10 -07:00
integration
manual
monitoring test: prune wave 2 + speed fixes — 28,106 → 19,757 test functions, suite wall 315s → 294s 2026-07-29 13:39:40 -07:00
openviking_plugin test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
plugins test: prove concurrency with barriers/witnesses instead of wall-clock bounds 2026-07-29 21:30:53 -07:00
providers modernize re-added Vercel integrations: SDK 0.7.2, telemetry off, sibling-site wiring 2026-07-29 19:48:37 -07:00
run_agent Revert "remove Vercel AI Gateway and Vercel Sandbox (#33067)" 2026-07-29 19:48:37 -07:00
scripts test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
secret_sources test: prune wave 2 + speed fixes — 28,106 → 19,757 test functions, suite wall 315s → 294s 2026-07-29 13:39:40 -07:00
skills test: prune wave 2 + speed fixes — 28,106 → 19,757 test functions, suite wall 315s → 294s 2026-07-29 13:39:40 -07:00
state fix(state): time-based write-lock patience so busy sibling processes can't destroy turns 2026-07-29 17:59:02 -07:00
stress
tools fix(file_ops): harden new-file umask chmod for portability 2026-07-31 14:22:38 +05:30
tui_gateway test(tui_gateway): pin goal-command config home against collection-time _hermes_home freeze 2026-07-29 21:30:53 -07:00
website
__init__.py
conftest.py test(tui_gateway): make the tui gateway suite order-independent 2026-07-29 21:30:53 -07:00
run_interrupt_test.py
test_account_usage.py
test_atomic_replace_symlinks.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_audio_playback_guard.py fix(tests): stop the test suite speaking aloud and launching a browser 2026-07-28 14:07:21 -07:00
test_background_review_list_shapes.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_background_review_session_isolation.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_base_url_hostname.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_batch_runner_checkpoint.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_bitwarden_secrets.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_cli_manual_compress.py
test_cli_skin_integration.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_code_skew.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_command_secret_source.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_conftest_wal_gate.py
test_copilot_initiator.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_credential_file_permissions.py
test_ctx_halving_fix.py fix(tests): eliminate flaky/broken tests — shadow sys.path inserts, unmocked network in compressor tests, stale-SDK feishu pin guard, quadratic redact regexes 2026-07-29 15:12:28 -07:00
test_delegate_cascade_49148.py
test_dispatch_session_id.py
test_empty_model_fallback.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_empty_session_hygiene.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_env_loader_applied_homes.py
test_env_loader_op_bootstrap.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_env_loader_secret_sources.py
test_evidence_store.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_fast_safe_load.py
test_fts_cjk_bigram.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_gateway_streaming_nested_config.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_get_tool_definitions_cache_isolation.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_hermes_bootstrap.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_hermes_constants.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_hermes_home_profile_warning.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_hermes_logging.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_hermes_state.py fix(config): respect database.journal_mode from config.yaml 2026-07-29 18:13:09 -07:00
test_hermes_state_compression_locks.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_hermes_state_readonly_preflight.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_hermes_state_wal_fallback.py fix(state): reconcile salvaged WAL fixes with current main 2026-07-29 18:13:09 -07:00
test_hermetic_side_effect_guards.py test: guard browser and Keychain side effects suite-wide (#35404) 2026-07-29 18:55:10 -07:00
test_honcho_client_concurrency.py
test_honcho_client_config.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_honcho_session_context.py
test_honcho_startup_fail_open.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_install_autostash_conflict_recovery.py
test_install_commit_pin_rollback.py fix(installer): never let a stale --commit pin roll an install backwards 2026-07-29 17:35:16 -05:00
test_install_diverged_update.py
test_install_lockfile_churn.py
test_install_macos_launcher.py
test_install_no_initial_commit.py
test_install_ps1_ascii_only.py
test_install_ps1_native_stderr_eap.py
test_install_ps1_node_path_for_npm.py
test_install_ps1_python_fallback_venv.py
test_install_ps1_uv_powershell_host.py
test_install_ps1_web_server_syntax_probe.py
test_install_sh_acp_launcher.py
test_install_sh_bootstrap_marker.py
test_install_sh_browser_install.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_install_sh_install_method_stamp.py
test_install_sh_node_global_prefix.py
test_install_sh_pythonpath_sanitization.py
test_install_sh_root_fhs_uv_python_path.py
test_install_sh_setup_wizard_tty_probe.py
test_install_sh_symlink_stomp.py
test_install_sh_termux_network_prereqs.py
test_install_unmerged_index.py
test_ipv4_preference.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_iron_proxy.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_iron_proxy_cli.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_iron_proxy_e2e.py
test_journal_mode_config.py fix(state): make journal mode canonical and behaviorally verified 2026-07-29 18:13:09 -07:00
test_lazy_session_regressions.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_live_system_guard.py test(tui_gateway): make the tui gateway suite order-independent 2026-07-29 21:30:53 -07:00
test_live_system_guard_self_test.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_log_isolation.py fix(tests): stop the suite writing into the operator's real Hermes logs 2026-07-29 19:53:17 -07:00
test_mcp_serve.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_message_reactions.py fix(state): make _row_id opt-in per consumer instead of universal 2026-07-30 00:08:28 -05:00
test_mini_swe_runner.py
test_minimax_model_validation.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_minimax_oauth.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_minisweagent_path.py
test_model_forces_max_completion_tokens.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_model_picker_scroll.py fix(tests): eliminate flaky/broken tests — shadow sys.path inserts, unmocked network in compressor tests, stale-SDK feishu pin guard, quadratic redact regexes 2026-07-29 15:12:28 -07:00
test_model_tools.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_model_tools_async_bridge.py
test_ollama_num_ctx.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_onepassword_secrets.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_output_cap_parsing.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_packaging_build_guard.py
test_packaging_metadata.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_plugin_skills.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_plugin_utils.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_process_loop_event_loop_warning.py
test_profile_isolation_runtime.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_project_metadata.py Revert "remove Vercel AI Gateway and Vercel Sandbox (#33067)" 2026-07-29 19:48:37 -07:00
test_pty_keepalive_ws.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_pty_session.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_retry_utils.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_run_tests_parallel.py fix(test-runner): native Windows venv probe + glyph-safe stdio 2026-07-29 21:30:53 -07:00
test_run_tests_parallel_stdio.py fix(test-runner): native Windows venv probe + glyph-safe stdio 2026-07-29 21:30:53 -07:00
test_sanitize_tool_error.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_search_slow_query_log.py
test_session_db_read_path_split.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_session_skill_previews.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_session_workspace_binding.py
test_slack_thread_require_mention.py
test_slash_worker_watchdog.py
test_sql_injection.py
test_sqlite_lock_safe_inspection.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_sqlite_wal_reset_gate.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_stale_utils_module_import.py
test_state_db_malformed_repair.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_subprocess_home_isolation.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_telegram_polling_progress_ptb.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_termux_all_extra_compat.py
test_timezone.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_tini_shim.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_toolset_distributions.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_toolsets.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_trajectory_compressor.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_trajectory_compressor_async.py
test_transform_llm_output_hook.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_transform_tool_result_hook.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_tui_entry_mcp_owner.py
test_tui_gateway_loop_noise.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_tui_gateway_queue_on_busy.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_tui_gateway_server.py test(tui): make _load_enabled_toolsets assertions tolerant of first-release back-filled toolsets 2026-07-30 16:34:08 -07:00
test_tui_gateway_ws.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_tui_mcp_late_refresh.py
test_utils_truthy_values.py
test_voice_max_recording_seconds.py fix(voice): enforce voice.max_recording_seconds (was dead config) 2026-07-28 11:57:37 -07:00
test_wal_checkpoint_strategy.py
test_web_server.py fix(web): raise uvicorn WS frame cap for Desktop file.attach 2026-07-28 19:20:14 -05:00
test_web_server_sessiondb_eventloop.py refactor(web): extract sessions/mcp/skills/tools routes to APIRouter modules (wave 2; route-table equality verified) 2026-07-29 16:21:54 -07:00
test_windows_subprocess_no_window_flags.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_yaml_indent_consistency_31999.py
test_yuanbao_integration.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_yuanbao_markdown.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_yuanbao_pipeline.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_yuanbao_proto.py test: prune low-value tests suite-wide (wave 1) — 46,820 → 28,106 test functions 2026-07-29 13:10:23 -07:00
test_yuanbao_reconnect_set_active.py
test_yuanbao_shutdown.py
test_zeroed_state_db.py