hermes-bsd/tests
Teknium 624ad582a5
fix: make gateway approval block agent thread like CLI does (#4557)
The gateway's dangerous command approval system was fundamentally broken:
the agent loop continued running after a command was flagged, and the
approval request only reached the user after the agent finished its
entire conversation loop. By then the context was lost.

This change makes the gateway approval mirror the CLI's synchronous
behavior. When a dangerous command is detected:

1. The agent thread blocks on a threading.Event
2. The approval request is sent to the user immediately
3. The user responds with /approve or /deny
4. The event is signaled and the agent resumes with the real result

The agent never sees 'approval_required' as a tool result. It either
gets the command output (approved) or a definitive BLOCKED message
(denied/timed out) — same as CLI mode.

Queue-based design supports multiple concurrent approvals (parallel
subagents via delegate_task, execute_code RPC handlers). Each approval
gets its own _ApprovalEntry with its own threading.Event. /approve
resolves the oldest (FIFO); /approve all resolves all at once.

Changes:
- tools/approval.py: Queue-based per-session blocking gateway approval
  (register/unregister callbacks, resolve with FIFO or all-at-once)
- gateway/run.py: Register approval callback in run_sync(), remove
  post-loop pop_pending hack, /approve and /deny support 'all' flag
- tests: 21 tests including parallel subagent E2E scenarios
2026-04-02 01:47:19 -07:00
..
acp fix(acp): complete session management surface for editor clients (salvage #3501) (#3675) 2026-03-28 23:45:53 -07:00
agent Merge branch 'main' into rewbs/tool-use-charge-to-subscription 2026-04-02 11:00:35 +11:00
cron fix(cron): resolve human-friendly delivery labels via channel directory (#3860) 2026-03-29 21:24:17 -07:00
e2e test(e2e): remove section separator comments 2026-04-01 15:23:52 -07:00
fakes
gateway fix: make gateway approval block agent thread like CLI does (#4557) 2026-04-02 01:47:19 -07:00
hermes_cli fix: invalidate update cache for all profiles, not just current 2026-04-02 00:49:17 -07:00
honcho_integration fix(honcho): write config to instance-local path for profile isolation (#4037) 2026-03-30 16:41:19 -07:00
integration refactor: remove mini-swe-agent dependency — inline Docker/Modal backends (#2804) 2026-03-24 07:30:25 -07:00
skills feat(skills): add memento-flashcards optional skill (#3827) 2026-03-29 16:52:52 -07:00
tools Merge branch 'main' into rewbs/tool-use-charge-to-subscription 2026-04-02 11:00:35 +11:00
__init__.py
conftest.py
run_interrupt_test.py
test_413_compression.py
test_860_dedup.py
test_1630_context_overflow_loop.py
test_agent_guardrails.py
test_agent_loop.py
test_agent_loop_tool_calling.py
test_agent_loop_vllm.py
test_anthropic_adapter.py fix(auth): use bearer auth for MiniMax Anthropic endpoints (#4028) 2026-03-30 13:19:44 -07:00
test_anthropic_error_handling.py fix(ci): pin acp <0.9 and update retry-exhaust test (#3320) 2026-03-26 19:21:34 -07:00
test_anthropic_oauth_flow.py
test_anthropic_provider_persistence.py
test_api_key_providers.py fix: remove hardcoded OpenRouter/opus defaults 2026-04-01 15:22:26 -07:00
test_async_httpx_del_neuter.py fix: eliminate 'Event loop is closed' / 'Press ENTER to continue' during idle (#3398) 2026-03-27 09:45:25 -07:00
test_atomic_json_write.py
test_atomic_yaml_write.py
test_auth_codex_provider.py
test_auth_commands.py feat(auth): same-provider credential pools with rotation, custom endpoint support, and interactive CLI (#2647) 2026-03-31 03:10:01 -07:00
test_auth_nous_provider.py
test_auxiliary_config_bridge.py
test_batch_runner_checkpoint.py
test_cli_approval_ui.py
test_cli_background_tui_refresh.py fix(cli): refresh TUI before background task output to prevent status bar overlap (#3048) 2026-03-25 15:00:33 -07:00
test_cli_context_warning.py fix: add missing provider attrs to cli_obj test fixture 2026-04-01 01:12:23 -07:00
test_cli_extension_hooks.py refactor(cli): add protected TUI extension hooks for wrapper CLIs 2026-03-21 09:42:07 -07:00
test_cli_file_drop.py refactor: extract _detect_file_drop() + add 28 tests 2026-04-02 00:40:27 -07:00
test_cli_init.py fix: root-level provider in config.yaml no longer overrides model.provider 2026-03-31 12:54:22 -07:00
test_cli_interrupt_subagent.py
test_cli_loading_indicator.py
test_cli_mcp_config_watch.py
test_cli_new_session.py
test_cli_plan_command.py
test_cli_prefix_matching.py
test_cli_preloaded_skills.py fix: move activated skills line below welcome text 2026-03-23 06:20:19 -07:00
test_cli_provider_resolution.py fix: resolve post-merge issues in auxiliary_client and model flow 2026-04-02 00:50:40 +00:00
test_cli_retry.py
test_cli_save_config_value.py fix(cli): use atomic write in save_config_value to prevent config loss on interrupt 2026-03-31 12:21:55 -07:00
test_cli_secret_capture.py
test_cli_skin_integration.py
test_cli_status_bar.py fix(cli): prevent status bar wrapping into duplicate rows (#3883) 2026-03-29 23:59:07 -07:00
test_cli_tools_command.py fix: resolve 7 failing CI tests (#3936) 2026-03-30 08:10:14 -07:00
test_codex_execution_paths.py fix(tests): provide model name in Codex 401 refresh tests for CI (#4166) 2026-03-30 21:17:09 -07:00
test_codex_models.py fix: remove hardcoded OpenRouter/opus defaults 2026-04-01 15:22:26 -07:00
test_compression_boundary.py
test_compression_persistence.py fix: persist compressed context to gateway session after mid-run compression 2026-03-30 18:49:14 -07:00
test_compressor_fallback_update.py feat(providers): add ordered fallback provider chain (salvage #1761) (#3813) 2026-03-29 16:04:53 -07:00
test_config_env_expansion.py feat(config): support ${ENV_VAR} substitution in config.yaml (#2684) 2026-03-23 16:02:06 -07:00
test_context_pressure.py fix: cap context pressure percentage at 100% in display (#3480) 2026-03-27 21:42:09 -07:00
test_context_references.py fix(context): restrict @ references to safe workspace paths (#2601) 2026-03-23 06:40:05 -07:00
test_context_token_tracking.py fix(tests): resolve all consistently failing tests 2026-03-22 05:58:26 -07:00
test_credential_pool.py feat(auth): same-provider credential pools with rotation, custom endpoint support, and interactive CLI (#2647) 2026-03-31 03:10:01 -07:00
test_credential_pool_routing.py fix: preserve credential_pool through smart routing and defer eager fallback on 429 (#4361) 2026-04-01 01:02:34 -07:00
test_crossloop_client_cache.py fix(agent): prevent AsyncOpenAI/httpx cross-loop deadlock in gateway mode (#2701) 2026-03-25 17:31:56 -07:00
test_dict_tool_call_args.py
test_display.py feat: add inline diff previews for write actions 2026-04-01 02:13:57 -07:00
test_evidence_store.py
test_exit_cleanup_interrupt.py fix: catch KeyboardInterrupt in exit cleanup handlers (#3257) 2026-03-26 14:34:31 -07:00
test_external_credential_detection.py
test_fallback_model.py
test_file_permissions.py
test_flush_memories_codex.py
test_hermes_state.py fix: merge dotted+hyphenated FTS5 quoting into single pass 2026-04-02 00:49:11 -07:00
test_honcho_client_config.py
test_insights.py
test_interactive_interrupt.py
test_interrupt_propagation.py
test_managed_server_tool_support.py
test_mcp_serve.py feat: add MCP server mode — hermes mcp serve (#3795) 2026-03-29 15:47:19 -07:00
test_minisweagent_path.py chore: remove all remaining mini-swe-agent references 2026-03-24 08:19:23 -07:00
test_model_metadata_local_ctx.py
test_model_provider_persistence.py
test_model_tools.py
test_model_tools_async_bridge.py
test_openai_client_lifecycle.py
test_packaging_metadata.py chore: prepare Hermes for Homebrew packaging (#4099) 2026-03-30 17:34:43 -07:00
test_percentage_clamp.py fix: cap percentage displays at 100% in stats, gateway, and memory tool (#3599) 2026-03-28 14:55:18 -07:00
test_personality_none.py
test_plugins.py feat: activate plugin lifecycle hooks (pre/post_llm_call, session start/end) (#3542) 2026-03-28 11:14:54 -07:00
test_plugins_cmd.py fix(tests): resolve 10 CI failures across hooks, tiktoken, plugins (#3848) 2026-03-29 20:05:59 -07:00
test_project_metadata.py fix(setup): auto-install matrix-nio during hermes setup (#3873) 2026-03-29 21:53:28 -07:00
test_provider_fallback.py feat(providers): add ordered fallback provider chain (salvage #1761) (#3813) 2026-03-29 16:04:53 -07:00
test_provider_parity.py feat: use 'developer' role for GPT-5 and Codex models (#4498) 2026-04-01 14:49:32 -07:00
test_quick_commands.py
test_real_interrupt_subagent.py
test_reasoning_command.py fix: prevent reasoning box from rendering 3x during tool-calling loops (#3405) 2026-03-27 09:57:50 -07:00
test_redirect_stdout_issue.py
test_resume_display.py
test_run_agent.py Merge branch 'main' into rewbs/tool-use-charge-to-subscription 2026-04-02 11:00:35 +11:00
test_run_agent_codex_responses.py
test_runtime_provider_resolution.py feat(auth): same-provider credential pools with rotation, custom endpoint support, and interactive CLI (#2647) 2026-03-31 03:10:01 -07:00
test_session_reset_fix.py fix(session): clear compressor summary and turn counter on /clear and /new (#3102) 2026-03-25 18:22:21 -07:00
test_setup_model_selection.py feat: add MiniMax M2.7 to hermes model picker and opencode-go (#4208) 2026-03-31 01:54:13 -07:00
test_sql_injection.py
test_streaming.py test: add codex transport drop regression 2026-03-31 12:05:06 -07:00
test_surrogate_sanitization.py fix: sanitize surrogate characters from clipboard paste to prevent UnicodeEncodeError (#3624) 2026-03-28 16:53:14 -07:00
test_timezone.py
test_tool_call_parsers.py fix(mistral-parser): handle nested JSON in fallback extraction 2026-03-21 09:41:17 -07:00
test_toolset_distributions.py
test_toolsets.py
test_trajectory_compressor.py fix: URL-based auth for third-party Anthropic endpoints + CI test fixes (#4148) 2026-03-30 20:36:56 -07:00
test_trajectory_compressor_async.py fix: create AsyncOpenAI lazily in trajectory_compressor to avoid closed event loop (#4013) 2026-03-30 13:16:16 -07:00
test_utils_truthy_values.py Gate tool-gateway behind an env var, so it's not in users' faces until we're ready. Even if users enable it, it'll be blocked server-side for now, until we unlock for non-admin users on tool-gateway. 2026-03-30 13:28:10 +09:00
test_worktree.py
test_worktree_security.py