hermes-agent/tests
Teknium e2dfa843ef feat: prompt-cache prewarm for TUI/desktop sessions (agent.prewarm_prompt_cache)
The first API call of a fresh desktop/TUI session pays provider-side
ingestion of the entire uncached prefix (system prompt + tool schemas,
commonly 50-70k tokens) — observed as ~20s first-message latency on
Anthropic-cached routes, vs 4-7s on every later 100%-cache-hit turn.

When agent.prewarm_prompt_cache is enabled (config.yaml, default off),
the gateway issues one minimal non-streaming max_tokens=1 request right
after the session agent is built — same tool schemas, same system prompt
with the same [static, volatile] cache_control layout — so the provider
writes the prompt-prefix cache BEFORE the first user message. The first
real turn then reads a warm prefix instead of writing it cold.

Measured on a live desktop-shaped session (nous / claude-fable-5, 67k
prefix): prewarm 2.7s off the response path, first real turn 3.8s with
cache=67045/67131 (100%) — down from 20.4s cold.

Details:
- agent/prompt_prewarm.py: pure helper; supported only where the request
  shape is reproducible (chat_completions / anthropic_messages, not MoA/
  Codex/Bedrock/ACP) and _use_prompt_caching is on. Thinking/reasoning
  knobs are stripped (max_tokens=1 violates budget_tokens; thinking
  changes don't invalidate system/tools cache blocks). Fail-open: any
  failure returns False and the first real turn pays the write itself.
- The exact sent prompt is handed to the first real turn via
  _prewarmed_system_prompt; _restore_or_build_system_prompt adopts it
  (gated on runtime-identity match, no history, no custom system message)
  so the volatile tail can't drift and split the just-warmed prefix.
  One-shot — cleared after every first-turn resolution.
- tui_gateway/server.py: _schedule_prompt_prewarm fires from both agent
  build sites, waits for late MCP discovery first (tools are part of the
  cached prefix), and skips if the user already started the conversation.

Cost note: the cache write (1.25x input, 5m TTL) is paid by the first
real call today anyway; prewarming moves it earlier. Extra spend is one
0.1x cache read per session plus wasted writes for sessions opened but
never used — which is why it ships default-off.
2026-07-27 18:04:16 -07:00
..
acp fix(acp): pin the session cwd for slash-command handlers too 2026-07-25 18:06:32 -07:00
acp_adapter feat(surfaces): route busy-input corrections through active-turn redirect 2026-07-22 12:10:58 -05:00
agent feat: prompt-cache prewarm for TUI/desktop sessions (agent.prewarm_prompt_cache) 2026-07-27 18:04:16 -07:00
ci fix(ci): report E2E evidence upload failures (#69901) 2026-07-23 05:45:17 +00:00
cli feat(cli): /focus — reduced-output view with hidden-line recovery and status indicator 2026-07-26 18:10:34 -07:00
computer_use fix(computer_use): stop the cua-driver child on exit 2026-07-26 03:38:23 -05:00
conformance feat(conformance): vector generator — native renderers as executable spec (#71666) 2026-07-26 16:52:25 +10:00
cron fix(delegation): route delegated-child API calls inline to avoid nested-pool wedge (#60203) 2026-07-26 20:37:51 -07:00
dashboard
docker fix(hermes_cli): heal root-owned logs/gateways on every stage2 boot 2026-07-27 19:19:01 +05:30
e2e fix(slack): handle leading-space text commands 2026-07-22 20:55:51 -07:00
fakes
fixtures/plugins/example-dashboard/dashboard
gateway fix(gateway): let @ completion find folders by name 2026-07-27 15:24:35 -05:00
hermes_cli revert: PR #72817 — session activity watchdog, stall notify, compress timeout 2026-07-28 00:15:00 +05:00
hermes_state
honcho_plugin fix(honcho): default device-code poll interval to 5s when AS omits it 2026-07-24 07:53:12 -07:00
integration
manual
openviking_plugin fix(openviking): cool down failed refreshes and publish conn identity atomically 2026-07-24 13:00:53 +05:30
plugins fix(deepseek): drop retired models from picker and provider defaults 2026-07-26 16:28:41 -07:00
providers fix(openrouter): give auxiliary calls the sticky routing key 2026-07-25 22:46:35 -07:00
run_agent fix(xai): send Hermes-Agent User-Agent on chat/completions 2026-07-27 17:47:28 -07:00
scripts fix(scripts): accept legacy consecutive-hyphen GitHub logins in add_contributor 2026-07-24 22:40:15 -07:00
secret_sources feat(secrets): orchestrator-level preserve_existing + profile aliasing (#69058) 2026-07-22 03:20:45 -07:00
skills fix(skills): parse stored GitHub credentials without scanner false positives 2026-07-26 20:59:26 -07:00
state fix(compression): recover rotated session lineage 2026-07-24 16:00:34 -07:00
stress
tools fix(browser): stop stale cdp_url from stalling every startup by 10+ seconds 2026-07-27 14:32:05 -07:00
tui_gateway feat(gateway): group unplaced sessions into a Home bucket in the project tree 2026-07-27 16:04:57 -05:00
website
__init__.py
conftest.py fix(kanban): preserve telegram dm topic metadata 2026-07-26 16:01:32 -07:00
run_interrupt_test.py
test_account_usage.py
test_atomic_replace_symlinks.py
test_background_review_list_shapes.py
test_background_review_session_isolation.py
test_base_url_hostname.py
test_batch_runner_checkpoint.py
test_bitwarden_secrets.py fix(secrets): unify encrypted-cache fallback with the merged stale-cache path 2026-07-22 04:40:07 -07:00
test_cli_file_drop.py
test_cli_manual_compress.py test(cli): prove /compress type-ahead queue-drain; map contributor email 2026-07-23 07:24:46 -07:00
test_cli_skin_integration.py
test_code_skew.py
test_command_secret_source.py feat(secrets): rework command source as a registered SecretSource — no provider selector 2026-07-22 04:39:28 -07:00
test_conftest_wal_gate.py fix(tests): gate WAL-dependent tests on the linked SQLite's real capability 2026-07-25 07:17:52 -07:00
test_copilot_initiator.py
test_credential_file_permissions.py harden(slack): CDN-allowlist inbound file URLs, DNS-pin token downloads, widen token-file perms warning 2026-07-23 11:44:43 -07:00
test_ctx_halving_fix.py
test_delegate_cascade_49148.py
test_dispatch_session_id.py
test_empty_model_fallback.py
test_empty_session_hygiene.py
test_env_loader_applied_homes.py fix(secrets): mark _APPLIED_HOMES only after a real fetch attempt (#40597) (#69056) 2026-07-22 03:20:25 -07:00
test_env_loader_op_bootstrap.py
test_env_loader_secret_sources.py test(secrets): match real ApplyReport shape in isolation test 2026-07-22 04:39:17 -07:00
test_evidence_store.py
test_fast_safe_load.py
test_fts_cjk_bigram.py test(state): cover pure-Latin embedded-in-CJK recovery via the cjk index 2026-07-22 10:35:04 -07:00
test_gateway_streaming_nested_config.py fix(gateway): normalize YAML boolean streaming mode and keep enabled a mode-only alias 2026-07-20 05:39:09 -07:00
test_get_tool_definitions_cache_isolation.py
test_hermes_bootstrap.py test(install): add UTF-8 regression guard for skills_sync child path 2026-07-24 17:10:39 -07:00
test_hermes_constants.py fix(dashboard): keep custom themes visible after embedded chat starts (#60601) 2026-07-18 00:34:54 -04:00
test_hermes_home_profile_warning.py
test_hermes_logging.py
test_hermes_state.py revert: PR #72817 — session activity watchdog, stall notify, compress timeout 2026-07-28 00:15:00 +05:00
test_hermes_state_compression_locks.py fix(compression-lock): reclaim crashed holders instead of stranding the lease 2026-07-25 22:47:07 -07:00
test_hermes_state_readonly_preflight.py fix(state): recover from read-only database files at startup 2026-07-27 17:27:38 -07:00
test_hermes_state_wal_fallback.py fix(state): make the byte-probe guard atomic, path-correct, and fail-closed 2026-07-25 21:44:43 -07:00
test_honcho_client_concurrency.py
test_honcho_client_config.py
test_honcho_session_context.py
test_honcho_startup_fail_open.py fix(ci): make tests, workflows, and attribution reliable under load (#66373) 2026-07-17 20:55:24 +00:00
test_install_autostash_conflict_recovery.py test: add happy-path + no-markers coverage for autostash recovery 2026-07-18 19:18:03 +05:30
test_install_diverged_update.py
test_install_lockfile_churn.py
test_install_macos_launcher.py fix(install): avoid realpath-dependent uv launcher on macOS 2026-07-26 19:30:32 -07:00
test_install_no_initial_commit.py
test_install_ps1_ascii_only.py fix(install): keep install.ps1 pure ASCII so Windows PowerShell 5.1 doesn't misparse it 2026-07-18 18:40:59 -04:00
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_bootstrap_marker.py fix(install): stamp the bootstrap-complete marker from install.sh too 2026-07-26 16:06:50 -05:00
test_install_sh_browser_install.py
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_iron_proxy.py Reapply "Merge pull request #30179 from NousResearch/feat/iron-proxy" 2026-07-24 09:49:00 -07:00
test_iron_proxy_cli.py Reapply "Merge pull request #30179 from NousResearch/feat/iron-proxy" 2026-07-24 09:49:00 -07:00
test_iron_proxy_e2e.py Reapply "Merge pull request #30179 from NousResearch/feat/iron-proxy" 2026-07-24 09:49:00 -07:00
test_lazy_session_regressions.py fix(desktop): persist @image: refs instead of the vision-enrichment text 2026-07-24 21:20:52 -05:00
test_lint_config.py
test_live_system_guard_self_test.py fix(tests): make the live-system-guard canary fail closed 2026-07-21 12:15:46 +05:30
test_mcp_serve.py
test_mini_swe_runner.py
test_minimax_model_validation.py
test_minimax_oauth.py
test_minisweagent_path.py
test_model_forces_max_completion_tokens.py
test_model_picker_scroll.py
test_model_tools.py
test_model_tools_async_bridge.py
test_ollama_num_ctx.py
test_onepassword_secrets.py fix(secrets): pass OP_LOAD_DESKTOP_APP_SETTINGS through to the op child env 2026-07-22 03:19:32 -07:00
test_output_cap_parsing.py
test_packaging_build_guard.py rip out brew + pip/PyPI wheel support (#68217) 2026-07-22 16:51:01 -04:00
test_packaging_metadata.py fix(deps): move CVE pins to current fixed versions so update stops downgrading patched envs 2026-07-26 19:29:07 -07:00
test_plugin_skills.py
test_plugin_utils.py
test_process_loop_event_loop_warning.py
test_profile_isolation_runtime.py
test_project_metadata.py test(deps): class invariant — every shared LAZY_DEPS exact pin must match uv.lock 2026-07-26 19:28:55 -07:00
test_pty_keepalive_ws.py
test_pty_session.py
test_retry_utils.py
test_run_tests_parallel.py fix(tests): a run that collects nothing can no longer look green 2026-07-25 07:09:22 -07:00
test_sanitize_tool_error.py
test_search_slow_query_log.py feat(state): messages_fts_cjk — CJK-bigram index on the v23 external-content layout 2026-07-22 07:56:47 -07:00
test_session_skill_previews.py fix(sessions): keep the skill body out of session previews 2026-07-26 02:58:20 -05:00
test_session_workspace_binding.py
test_slack_thread_require_mention.py Add Slack thread mention gating 2026-07-22 21:14:44 -07:00
test_slash_worker_watchdog.py test(tui): keep watchdog checks behavior-focused 2026-07-18 04:15:13 -07:00
test_sql_injection.py
test_sqlite_lock_safe_inspection.py fix(state): make the byte-probe guard atomic, path-correct, and fail-closed 2026-07-25 21:44:43 -07:00
test_sqlite_wal_reset_gate.py fix(state): make the byte-probe guard atomic, path-correct, and fail-closed 2026-07-25 21:44:43 -07:00
test_stale_utils_module_import.py
test_state_db_malformed_repair.py perf(state): external-content FTS + tool-row-free trigram index (schema v23) (#65798) 2026-07-22 04:42:50 -07:00
test_subprocess_home_isolation.py
test_telegram_polling_progress_ptb.py
test_termux_all_extra_compat.py
test_timezone.py
test_tini_shim.py test(docker): cover tini -g legacy entrypoint boot path 2026-07-18 01:11:03 -07:00
test_toolset_distributions.py
test_toolsets.py docs(xai): clarify x_search vs xurl routing without schema cross-refs 2026-07-23 21:06:47 -07:00
test_trajectory_compressor.py fix(compaction): skip compression when it can't reduce tokens 2026-07-23 16:21:03 -07:00
test_trajectory_compressor_async.py
test_transform_llm_output_hook.py
test_transform_tool_result_hook.py
test_tui_entry_mcp_owner.py fix(tui): gate the shared-owner MCP discovery wait on the stdio TUI flag 2026-07-21 12:43:27 -07:00
test_tui_gateway_loop_noise.py
test_tui_gateway_queue_on_busy.py fix(tui_gateway): keep the original prompt when a redirect corrects a turn 2026-07-26 19:43:23 -05:00
test_tui_gateway_server.py feat(approvals): add cross-surface mode command 2026-07-26 21:13:03 -07:00
test_tui_gateway_ws.py fix(mcp): propagate profile HERMES_HOME override into shared discovery owner; restore stdio startup + WSTransport tests 2026-07-26 14:14:03 -07:00
test_tui_mcp_late_refresh.py
test_utils_truthy_values.py
test_wal_checkpoint_strategy.py
test_web_server.py
test_web_server_sessiondb_eventloop.py
test_windows_subprocess_no_window_flags.py fix(cron): respect the platform-conditional decode design in _run_job_script + taskkill kwarg snapshot 2026-07-24 11:45:57 -07:00
test_yaml_indent_consistency_31999.py
test_yuanbao_integration.py
test_yuanbao_markdown.py
test_yuanbao_pipeline.py
test_yuanbao_proto.py
test_yuanbao_reconnect_set_active.py
test_yuanbao_shutdown.py
test_zeroed_state_db.py fix(state): quarantine lock fails closed when unacquireable (#68805) 2026-07-24 23:06:05 -07:00