hermes-agent/tests/run_agent
kshitijk4poor d30ee2e545 refactor: unify transport dispatch + collapse normalize shims
Consolidate 4 per-transport lazy singleton helpers (_get_anthropic_transport,
_get_codex_transport, _get_chat_completions_transport, _get_bedrock_transport)
into one generic _get_transport(api_mode) with a shared dict cache.

Collapse the 65-line main normalize block (3 api_mode branches, each with
its own SimpleNamespace shim) into 7 lines: one _get_transport() call +
one _nr_to_assistant_message() shared shim. The shim extracts provider_data
fields (codex_reasoning_items, reasoning_details, call_id, response_item_id)
into the SimpleNamespace shape downstream code expects.

Wire chat_completions and bedrock_converse normalize through their transports
for the first time — these were previously falling into the raw
response.choices[0].message else branch.

Remove 8 dead codex adapter imports that have zero callers after PRs 1-6.

Transport lifecycle improvements:
- Eagerly warm transport cache at __init__ (surfaces import errors early)
- Invalidate transport cache on api_mode change (switch_model, fallback
  activation, fallback restore, transport recovery) — prevents stale
  transport after mid-session provider switch

run_agent.py: -32 net lines (11,988 -> 11,956).

PR 7 of the provider transport refactor.
2026-04-22 18:34:25 -07:00
..
__init__.py
conftest.py
test_413_compression.py
test_860_dedup.py
test_1630_context_overflow_loop.py
test_agent_guardrails.py
test_agent_loop_tool_calling.py
test_agent_loop_vllm.py
test_agent_loop.py
test_anthropic_error_handling.py
test_anthropic_prompt_cache_policy.py fix(cache): enable prompt caching for Qwen on OpenCode/OpenCode-Go/Alibaba (#13528) 2026-04-21 06:40:58 -07:00
test_anthropic_third_party_oauth_guard.py
test_anthropic_truncation_continuation.py
test_async_httpx_del_neuter.py
test_compression_boundary.py
test_compression_feasibility.py
test_compression_persistence.py
test_compression_trigger_excludes_reasoning.py fix(compression): exclude completion tokens from compression trigger (#12026) 2026-04-20 05:12:10 -07:00
test_compressor_fallback_update.py
test_concurrent_interrupt.py
test_context_token_tracking.py
test_create_openai_client_kwargs_isolation.py
test_create_openai_client_proxy_env.py fix(agent): normalize socks:// env proxies for httpx/anthropic 2026-04-21 05:52:46 -07:00
test_create_openai_client_reuse.py
test_dict_tool_call_args.py
test_exit_cleanup_interrupt.py
test_fallback_model.py
test_flush_memories_codex.py
test_interactive_interrupt.py
test_interrupt_propagation.py test: stop testing mutable data — convert change-detectors to invariants (#13363) 2026-04-20 23:20:33 -07:00
test_invalid_context_length_warning.py
test_long_context_tier_429.py
test_memory_provider_init.py
test_openai_client_lifecycle.py
test_percentage_clamp.py
test_plugin_context_engine_init.py
test_primary_runtime_restore.py
test_provider_attribution_headers.py feat: attribution default_headers for ai-gateway provider 2026-04-20 21:02:28 -07:00
test_provider_fallback.py fix(agent): resolve fallback provider key_env secrets 2026-04-22 14:42:48 -07:00
test_provider_parity.py feat: add ResponsesApiTransport + wire all Codex transport paths 2026-04-21 19:48:56 -07:00
test_real_interrupt_subagent.py
test_redirect_stdout_issue.py
test_repair_tool_call_arguments.py fix: extract _repair_tool_call_arguments helper, add tests, bound loop 2026-04-20 05:12:55 -07:00
test_run_agent_codex_responses.py feat: add ResponsesApiTransport + wire all Codex transport paths 2026-04-21 19:48:56 -07:00
test_run_agent_multimodal_prologue.py refactor: unify transport dispatch + collapse normalize shims 2026-04-22 18:34:25 -07:00
test_run_agent.py fix(display): strip standalone tool-call XML tags from visible text 2026-04-22 18:12:42 -07:00
test_sequential_chats_live.py
test_session_meta_filtering.py
test_session_reset_fix.py
test_steer.py refactor(steer): simplify injection marker to 'User guidance:' prefix (#13340) 2026-04-20 22:18:49 -07:00
test_streaming.py fix(streaming): silent retry when stream dies mid tool-call (#14151) 2026-04-22 13:47:33 -07:00
test_strict_api_validation.py
test_strip_reasoning_tags_cli.py fix(display): strip standalone tool-call XML tags from visible text 2026-04-22 18:12:42 -07:00
test_switch_model_context.py
test_switch_model_fallback_prune.py fix(model-switch): drop stale provider from fallback chain and env after /model 2026-04-21 14:31:47 -05:00
test_token_persistence_non_cli.py
test_tool_arg_coercion.py
test_unicode_ascii_codec.py