hermes-agent/tests/agent
kshitijk4poor 130e2337c2 fix(usage): scope Codex usage pool fallback to AuthError, keep singleton token on account_id read failure
Follow-up hardening on the cherry-picked pool-fallback fix. The original
_resolve_codex_usage_credentials wrapped BOTH resolve_codex_runtime_credentials()
and the separate _read_codex_tokens() account_id read in one broad
'except Exception: pass', which had three problems:

1. A transient refresh/network failure (non-AuthError) from the resolver was
   silently swallowed and downgraded to pool.select(), which could report
   /usage limits for a DIFFERENT pool account than the one actually running.
   On main that error surfaced. This is a real behavior regression for the
   multi-account/pool case.
2. If the resolver succeeded but only the account_id read raised, the whole
   singleton tier was abandoned in favor of a pool token that carries no
   ChatGPT-Account-Id header (PooledCredential has no account_id concept),
   risking a wrong-account read or 401.
3. 'except Exception' masked genuine programming errors.

Fix: narrow the outer catch to AuthError (the documented 'no creds' failure
mode of both functions), and read account_id in a best-effort inner try so a
partial/missing singleton store can't sink an otherwise-usable credential.
Transient errors now propagate and fail open via the outer fetch_account_usage
guard rather than mis-routing to the wrong account. Adds debug breadcrumbs and
a comment characterizing when the tier-3 pool path actually fires.

Guard tests: a non-AuthError resolver failure must NOT swap to the pool
(fail-open, no snapshot); an account_id read failure keeps the singleton token.
Updated the existing pool-fallback test to use AuthError (the real failure
mode) instead of a generic RuntimeError.
2026-07-07 12:01:33 +05:30
..
lsp feat(lsp): add PowerShellEditorServices language server (#55930) 2026-06-30 16:22:18 -07:00
transports fix(codex): recover final app-server text without completion 2026-07-04 15:44:50 -07:00
__init__.py
…
test_account_usage.py fix(usage): scope Codex usage pool fallback to AuthError, keep singleton token on account_id read failure 2026-07-07 12:01:33 +05:30
test_anthropic_adapter.py fix: complete OAuth-UA salvage follow-up (stale comment + test keychain isolation) 2026-07-04 15:16:13 +05:30
test_anthropic_billing_guidance.py feat(classifier): Anthropic-specific guidance for subscription exhaustion 2026-07-01 01:36:34 -07:00
test_anthropic_keychain.py
…
test_anthropic_kwargs_sanitize.py
…
test_anthropic_mcp_prefix_strip.py
…
test_anthropic_oauth_pkce.py
…
test_anthropic_oauth_ua_prefix.py fix(anthropic): OAuth token endpoint UA must not be claude-code/ (login 429, #48534) 2026-07-04 15:16:13 +05:30
test_anthropic_output_field_leak.py
…
test_anthropic_thinking_block_order.py
…
test_arcee_trinity_overrides.py fix(compression): keep Codex gpt-5.5 autoraise from lowering a higher threshold 2026-07-06 12:46:20 -07:00
test_async_utils.py
…
test_auxiliary_anthropic_pool_fallback_regression.py fix(auxiliary): fall back to token resolver when anthropic pool has no usable entry 2026-07-04 15:44:50 -07:00
test_auxiliary_client.py fix(auxiliary): recover from stale fallback-candidate credentials instead of aborting 2026-07-06 18:12:24 -07:00
test_auxiliary_client_anthropic_custom.py
…
test_auxiliary_client_azure_foundry.py
…
test_auxiliary_client_base_url_host_validation_52608.py
…
test_auxiliary_client_proxy_env.py
…
test_auxiliary_client_resolve_dedup.py fix(auxiliary_client): demote the 2 sibling routing fall-throughs too (review) 2026-07-01 17:00:30 +05:30
test_auxiliary_client_ssl_verify.py fix(agent): honor custom CA certs on aux client + harden TLS resolution 2026-07-02 04:51:56 +05:30
test_auxiliary_client_xai_oauth_recovery.py
…
test_auxiliary_compression_timeout_floor.py fix(auxiliary): floor compression timeout so reasoning models don't fall back to marker (#54915) 2026-07-06 12:44:10 -07:00
test_auxiliary_config_bridge.py
…
test_auxiliary_main_first.py feat(compression): extend Codex 272K compaction autoraise to gpt-5.4 2026-07-06 12:46:20 -07:00
test_auxiliary_named_custom_providers.py fix(auxiliary): reuse main_runtime credentials for named custom providers 2026-07-05 19:23:26 -07:00
test_auxiliary_transient_retry.py fix(auxiliary): retry transient blips harder + isolate client cache per model (#56889) 2026-07-02 01:09:37 -07:00
test_auxiliary_transport_autodetect.py
…
test_auxiliary_user_default_headers.py
…
test_azure_identity_adapter.py
…
test_bedrock_1m_context.py
…
test_bedrock_adapter.py
…
test_bedrock_integration.py
…
test_billing_view.py
…
test_bounded_response.py fix(agents): bound streaming error-response body reads 2026-07-05 14:00:20 -07:00
test_cascading_interrupt_6600.py
…
test_chat_completion_helpers_provider_sort.py
…
test_close_interrupted_tool_sequence.py
…
test_codex_app_server_persist.py fix+test(codex): self-persist projected turns; keep agent_persisted=True 2026-07-01 17:08:59 +05:30
test_codex_cloudflare_headers.py
…
test_codex_gpt55_autoraise_notice.py fix(agent): dedupe Codex gpt-5.5 autoraise notice across agent inits 2026-07-06 12:46:20 -07:00
test_codex_responses_adapter.py
…
test_codex_ttfb_watchdog.py test(codex): cover gateway-scale stale timeout floor and TTFB gate 2026-07-02 17:05:05 +05:30
test_coding_context.py
…
test_compress_focus.py
…
test_compressed_summary_metadata.py
…
test_compression_concurrent_fork.py fix(compression): preserve user turn after compaction 2026-07-04 21:04:27 +05:30
test_compression_count_warning_36908.py
…
test_compression_interrupt_protection.py
…
test_compression_logging_session_context.py
…
test_compression_progress.py
…
test_compression_rotation_state.py
…
test_compressor_assistant_tail_anchor.py fix(compaction): detect and strip merge-into-tail summaries past the delimiter 2026-07-01 18:23:01 +05:30
test_compressor_historical_media.py
…
test_compressor_image_tokens.py
…
test_compressor_media_stripping.py
…
test_compressor_tool_call_budget.py
…
test_compressor_zero_user_guard.py test(compressor): drop source-string guardrail tests 2026-07-05 21:42:19 +05:30
test_context_breakdown.py
…
test_context_compressor.py [verified] fix: account for codex replay in compression tail budget 2026-07-06 12:43:59 -07:00
test_context_compressor_cross_session_guard.py
…
test_context_compressor_session_end_clears_state.py fix(compression): clear all per-session state in on_session_end, not just _previous_summary 2026-07-01 02:48:32 -07:00
test_context_compressor_summary_continuity.py
…
test_context_compressor_temporal_anchoring.py
…
test_context_engine.py fix(context): clamp -1 post-compression sentinel in sibling status paths 2026-07-01 13:36:50 +05:30
test_context_engine_host_contract.py
…
test_context_references.py fix(security): anchor @file context refs to canonical read deny-list 2026-07-01 02:43:49 -07:00
test_context_refs_concurrent.py
…
test_copilot_acp_client.py
…
test_copilot_acp_deprecation.py
…
test_credential_pool.py feat(auth): make xAI Grok OAuth device-code-only, drop loopback login 2026-07-02 13:17:41 -07:00
test_credential_pool_oauth_writethrough.py fix(auth): serialize Codex OAuth pool refresh under the auth-store lock (#56233) 2026-07-01 02:45:07 -07:00
test_credential_pool_routing.py
…
test_credits_cold_start.py
…
test_credits_fixture_snapshot.py
…
test_credits_policy.py
…
test_credits_tracker.py
…
test_credits_view.py
…
test_crossloop_client_cache.py
…
test_curator.py
…
test_curator_activity.py
…
test_curator_backup.py
…
test_curator_classification.py fix: remove dead f-string prefixes via ruff F541 (216 sites) (#52336) 2026-07-05 13:42:46 -07:00
test_curator_reports.py
…
test_custom_pool_mismatch_guard.py
…
test_custom_provider_extra_body.py
…
test_custom_providers_vision.py
…
test_deepseek_anthropic_thinking.py
…
test_direct_provider_url_detection.py
…
test_display.py
…
test_display_emoji.py
…
test_display_todo_progress.py
…
test_display_tool_failure.py
…
test_empty_tool_name_loop_dampening.py
…
test_error_classifier.py test(error-classifier): 408 boundary coverage — Copilot user_request_timeout shape, never auto-compress, falsification guard 2026-07-06 01:56:09 -07:00
test_external_skills.py
…
test_external_skills_dirs_cache.py
…
test_failover_identity.py
…
test_file_safety.py fix(file): block credential paths from search results 2026-07-01 01:02:35 -07:00
test_file_safety_container_mirror.py
…
test_file_safety_credentials.py fix(file): block credential paths from search results 2026-07-01 01:02:35 -07:00
test_file_safety_cross_profile.py
…
test_file_safety_sandbox_mirror.py
…
test_gemini_fast_fallback.py chore(providers): remove dead cloudcode-pa quota-fallback branches (#51489) 2026-07-05 13:44:33 -07:00
test_gemini_free_tier_gate.py
…
test_gemini_native_adapter.py Merge consecutive same-role contents for native Gemini 2026-06-30 11:51:22 -07:00
test_gemini_schema.py
…
test_i18n.py
…
test_image_gen_registry.py
…
test_image_routing.py Guard native image routing with file safety 2026-07-05 03:15:03 -07:00
test_insights.py
…
test_intent_ack_continuation.py
…
test_jiter_preload.py
…
test_kimi_coding_anthropic_thinking.py
…
test_last_total_tokens.py
…
test_learn_prompt.py fix(learn): honor requirements mixed with sources in /learn requests (#55956) 2026-06-30 16:56:01 -07:00
test_learning_graph.py fix(learning_graph): guard non-dict metadata so /journey can't crash 2026-07-01 16:25:48 -05:00
test_learning_graph_render.py fix(journey): swap skill/memory inks so drillable rows read as clickable 2026-06-30 11:54:16 -05:00
test_learning_mutations.py test(journey): lock memory write format-parity with the memory tool 2026-06-30 15:16:25 -05:00
test_local_stream_timeout.py
…
test_markdown_tables.py fix: remove dead f-string prefixes via ruff F541 (216 sites) (#52336) 2026-07-05 13:42:46 -07:00
test_memory_async_sync.py
…
test_memory_provider.py
…
test_memory_session_switch.py
…
test_memory_skill_scaffolding.py
…
test_memory_user_id.py
…
test_memory_write_bridge.py
…
test_message_content.py
…
test_minimax_auxiliary_url.py
…
test_minimax_provider.py
…
test_moa_aggregator_cache_control.py fix(moa): apply prompt-caching decoration to the aggregator's one-shot synthesis call 2026-07-04 20:59:02 +05:30
test_moa_aggregator_cost_slot.py fix(moa): price aggregator turn at its real model so session cost isn't advisor-only (#56394) 2026-07-01 06:02:33 -07:00
test_moa_slot_api_mode.py fix(moa): propagate api_mode from slot runtime to call_llm 2026-06-30 03:39:50 -07:00
test_moa_switch_api_mode.py fix(moa): pin chat_completions on live switch to a MoA preset 2026-06-30 03:39:50 -07:00
test_moa_trace_streamed_capture.py fix(moa): capture streamed aggregator output into full-turn traces (#56312) 2026-07-01 04:07:46 -07:00
test_model_extra_type_guard.py test+chore: real-path regression test for #15157 model_extra guard + AUTHOR_MAP 2026-06-30 03:27:12 -07:00
test_model_metadata.py fix(agent): resolve review findings on vLLM local-context salvage 2026-07-03 03:27:13 +05:30
test_model_metadata_local_ctx.py fix(agent): self-review follow-ups on vLLM local-context salvage 2026-07-03 03:36:22 +05:30
test_model_metadata_ssl.py
…
test_models_dev.py
…
test_moonshot_schema.py
…
test_non_stream_stale_timeout.py test(codex): cover gateway-scale stale timeout floor and TTFB gate 2026-07-02 17:05:05 +05:30
test_nous_credits_gauge.py
…
test_nous_credits_snapshot.py
…
test_nous_oauth_401_guidance.py
…
test_nous_rate_guard.py
…
test_onboarding.py
…
test_oneshot.py
…
test_openrouter_response_cache.py
…
test_pet_engine.py fix(pet): snap kitty frames to whole cells 2026-06-30 15:41:44 -05:00
test_pet_generate.py
…
test_platform_hint_overrides.py
…
test_plugin_llm.py
…
test_portal_tags.py
…
test_preflight_compression_gate.py
…
test_prompt_builder.py
…
test_prompt_caching.py fix(prompt-caching): align _can_carry_marker with last-part-dict marking 2026-07-04 13:54:27 +05:30
test_proxy_and_url_validation.py
…
test_rate_limit_tracker.py
…
test_reasoning_stale_timeout_floor.py
…
test_redact.py fix(redact): skip env-lookup exception for JSON/YAML config field redaction 2026-07-05 13:58:19 -07:00
test_replay_cleanup.py
…
test_restore_primary_pool_reselect.py
…
test_resume_stale_active_task.py
…
test_runtime_cwd.py
…
test_save_url_image.py
…
test_secret_scope.py
…
test_set_runtime_main_custom_provider.py
…
test_shell_hooks.py
…
test_shell_hooks_consent.py
…
test_skill_bundles.py fix(gateway): apply platform-disabled skill gate to bundle invocations (#59156) 2026-07-05 14:48:11 -07:00
test_skill_commands.py fix(skills): apply disabled-skill gate to CLI/TUI preloaded skills 2026-07-06 02:43:37 -07:00
test_skill_commands_reload.py
…
test_skill_utils.py
…
test_ssl_ca_guard.py
…
test_ssl_verify.py feat(agent): add resolve_httpx_verify for custom CA bundle TLS 2026-07-02 04:51:56 +05:30
test_stream_read_timeout_floor.py
…
test_streaming_context_scrubber.py
…
test_subagent_progress.py
…
test_subagent_stop_hook.py
…
test_subdirectory_hints.py
…
test_subdirectory_hints_tilde.py fix(subdirectory_hints): catch RuntimeError from Path.expanduser() 2026-07-01 04:55:15 -07:00
test_summary_prefix_semantics.py
…
test_system_prompt.py
…
test_system_prompt_restore.py
…
test_think_scrubber.py
…
test_thinking_timeout_guidance.py
…
test_thread_scoped_output.py fix(bg-review): scope stdout/stderr silencing to the worker thread (#55966) 2026-06-30 17:28:33 -07:00
test_title_generator.py fix(title_generator): strip think blocks from LLM output before extracting title 2026-07-01 04:18:48 -07:00
test_tool_call_arg_no_redaction.py
…
test_tool_dispatch_helpers.py fix(agent): wrap list-type untrusted content in untrusted_tool_result 2026-07-01 02:44:09 -07:00
test_tool_guardrails.py
…
test_tool_result_classification.py
…
test_transcription_registry.py
…
test_tts_registry.py
…
test_turn_context.py
…
test_turn_finalizer_cleanup_guard.py
…
test_turn_finalizer_final_response_persistence.py fix(agent): persist recovered final responses 2026-07-01 03:34:49 -07:00
test_turn_finalizer_interrupt_alternation.py
…
test_turn_retry_state.py feat(vertex): add Google Vertex AI provider for Gemini (OAuth2) 2026-07-01 05:25:33 -07:00
test_unsupported_parameter_retry.py
…
test_unsupported_temperature_retry.py
…
test_usage_pricing.py
…
test_verification_evidence.py
…
test_verification_stop.py
…
test_verification_stop_caching.py fix(cache): stop verification-loop synthetic nudges from persisting (#56194) 2026-07-01 02:26:06 -07:00
test_verify_hooks.py
…
test_vertex_adapter.py security(vertex): route credential/project/region resolution through the profile secret scope 2026-07-02 06:07:56 +05:30
test_video_gen_registry.py
…
test_vision_resolved_args.py
…
test_vision_routing_31179.py
…