hermes-agent/tests/acp
georgex8001 62b9fb6623 fix(acp): thread-safe interactive approval via contextvars
Concurrent ACP sessions run on a shared ThreadPoolExecutor (max_workers=4).
Each _run_agent mutated the process-global os.environ["HERMES_INTERACTIVE"]
and restored it in finally, so one session's restore could clobber another's
set mid-run — dropping the second session onto the non-interactive
auto-approve path, executing a dangerous command without the approval
callback firing (GHSA-96vc-wcxf-jjff).

Replace the env-var flag with a thread/task-local contextvar in
tools.approval. The two HERMES_INTERACTIVE read sites in approval.py now go
through _is_interactive_cli() (contextvar-first, env fallback for legacy
single-threaded CLI callers). The ACP executor sets the contextvar instead
of os.environ; the existing contextvars.copy_context() wrapper isolates each
session's write.

Co-authored-by: Hermes Agent <127238744+teknium1@users.noreply.github.com>
2026-06-30 03:24:58 -07:00
..
__init__.py feat: restore ACP server implementation from PR #949 (#1254) 2026-03-14 00:09:05 -07:00
test_approval_isolation.py fix(acp): thread-safe interactive approval via contextvars 2026-06-30 03:24:58 -07:00
test_auth.py feat: add ACP registry metadata for Zed 2026-05-14 20:26:02 -07:00
test_edit_approval.py fix(acp): use tempfile.gettempdir() in workspace auto-approve 2026-05-19 03:05:10 -07:00
test_entry.py refactor(bootstrap): consolidate ACP browser bootstrap into install.{sh,ps1} (#27851) 2026-05-18 16:36:26 +05:30
test_events.py fix(ci): rip out some xdist legacy stuff... how did these ever work?? 2026-06-26 19:15:18 -07:00
test_mcp_e2e.py chore: prune unused imports and duplicate import redefinitions 2026-05-28 22:26:25 -07:00
test_permissions.py feat(acp): enrich permission request cards 2026-05-18 11:47:27 -07:00
test_ping_suppression.py fix(acp): silence 'Background task failed' noise on liveness-probe requests (#12855) 2026-04-20 00:10:27 -07:00
test_registry_manifest.py feat(acp-registry): switch to uvx distribution, drop npm launcher 2026-05-14 22:27:09 -07:00
test_server.py fix(acp): preserve memory provider tools 2026-06-13 04:51:44 -07:00
test_session.py fix(codex): seed app-server sessions with configured cwd 2026-06-21 16:39:02 -07:00
test_session_db_private_access.py fix(acp): replace direct db._lock/_conn access with public update_session_meta() 2026-06-04 17:54:59 -07:00
test_session_provenance.py feat(acp): emit session provenance metadata for compression rotation (#41724) 2026-06-07 22:22:21 -07:00
test_tools.py chore: prune unused imports and duplicate import redefinitions 2026-05-28 22:26:25 -07:00