hermes-agent/tests/agent
Avi Fenesh 77ba81f75f fix(bedrock): add Fable + Claude 4.6/4.7/4.8 1M entries to context table, drop stale cached values
BEDROCK_CONTEXT_LENGTHS was missing entries for current 1M-context Claude
models, and the resolution path in get_model_context_length() short-circuits
to that table (step 1b) before DEFAULT_CONTEXT_LENGTHS is ever consulted, so
the catalog's correct values could never apply on Bedrock:

- claude-fable-5 (no entry at all) fell through to
  BEDROCK_DEFAULT_CONTEXT_LENGTH and reported 128K for a 1M model.
- opus-4-7 / opus-4-8 substring-matched the generic 'anthropic.claude-opus-4'
  key and reported 200K.
- opus-4-6 / sonnet-4-6 had explicit 200K entries predating their 1M windows.

The practical symptom: the agent compresses context prematurely (at ~128K or
~200K of a 1M window) on every Bedrock-hosted current Claude model.

Fixing the table alone is not enough for existing installs: a previously
persisted 128K/200K value in the context-length cache wins at step 1 and
masks the corrected table forever. Step 1 now reconciles Bedrock-context
cache hits against the static table (the table is authoritative for Bedrock
— there is no live probe to reconcile against), invalidating stale entries
so existing users converge to the right window without manual cache surgery.

Tests cover the new table entries (incl. inference-profile and versioned ID
forms), the 128K-default regression for Fable, the stale-cache invalidation
path, and that pre-4.6 models keep their 200K entries.
2026-07-20 05:38:55 -07:00
..
lsp
…
transports fix(codex): harden final cache-key boundaries 2026-07-17 13:48:41 -07:00
__init__.py
…
test_account_usage.py feat(codex): redeem banked usage-limit resets via /usage reset (#64280) 2026-07-14 03:23:19 -07:00
test_anthropic_adapter.py feat(agent): adaptive thinking for Kimi-family Anthropic endpoints 2026-07-19 12:21:59 -07:00
test_anthropic_billing_guidance.py
…
test_anthropic_keychain.py
…
test_anthropic_kimi_signed_thinking_replay.py fix(anthropic): preserve thinking blocks on Kimi-family endpoints on replay 2026-07-19 01:53:01 -07:00
test_anthropic_kwargs_sanitize.py
…
test_anthropic_mcp_prefix_strip.py
…
test_anthropic_oauth_pkce.py
…
test_anthropic_oauth_ua_prefix.py
…
test_anthropic_output_field_leak.py
…
test_anthropic_thinking_block_order.py
…
test_api_content_sidecar.py feat(cache): persist the exact bytes sent to the API in an api_content sidecar 2026-07-19 08:25:35 +05:30
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
…
test_auxiliary_client.py feat(analytics): record auxiliary model usage per task in session accounting (#65537) 2026-07-16 04:23:12 -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_bootstrap_skew.py fix(auxiliary_client): warn once + regression tests for bootstrap version skew 2026-07-15 07:47:18 -07:00
test_auxiliary_client_proxy_env.py
…
test_auxiliary_client_resolve_dedup.py
…
test_auxiliary_client_ssl_verify.py
…
test_auxiliary_client_xai_oauth_recovery.py
…
test_auxiliary_compression_timeout_floor.py feat(analytics): record auxiliary model usage per task in session accounting (#65537) 2026-07-16 04:23:12 -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_runtime_cache_key.py fix(auxiliary): scope runtime state to each turn 2026-07-17 09:08:30 -07:00
test_auxiliary_transient_retry.py
…
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 fix(bedrock): add Fable + Claude 4.6/4.7/4.8 1M entries to context table, drop stale cached values 2026-07-20 05:38:55 -07:00
test_bedrock_empty_text_blocks.py fix(bedrock): use non-whitespace placeholder for empty text blocks 2026-07-20 03:27:38 -07:00
test_bedrock_integration.py fix: normalize string stop + surface dropped stream/tool_choice in Converse shim 2026-07-08 01:51:05 +05:30
test_bedrock_interrupt_post_worker.py fix(streaming): Bedrock liveness watchdog (into #58962 breaker) + finite local timeout 2026-07-18 19:38:21 +05:30
test_billing_usage.py feat(tui+cli): change your Nous plan from the terminal (/subscription, /topup, terminal-billing UX) (#51639) 2026-07-18 14:30:24 +05:30
test_billing_view.py feat(tui+cli): change your Nous plan from the terminal (/subscription, /topup, terminal-billing UX) (#51639) 2026-07-18 14:30:24 +05:30
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 fix(agent): request-local Anthropic clients so the stale/interrupt watchdog never corrupts SQLite (#67142) 2026-07-18 21:20:48 -04:00
test_chat_completion_helpers_provider_sort.py
…
test_close_interrupted_tool_sequence.py
…
test_codex_app_server_event_bridge.py feat(codex): webSearch bubbles + bare hermes-tools names in app-server bridge 2026-07-17 06:49:47 -07:00
test_codex_app_server_persist.py
…
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 fix(agent): treat Codex incomplete content filter as refusal 2026-07-15 09:47:37 -07:00
test_codex_runtime_live_events.py feat(codex): stream live app-server events to TUI/desktop tool cards 2026-07-17 13:44:12 -07:00
test_codex_ttfb_watchdog.py fix(agent): harden non-finite wait recovery 2026-07-17 04:46:59 -07:00
test_coding_context.py
…
test_compaction_anti_thrash.py fix(context): persist fallback compaction breaker 2026-07-14 02:19:40 +05:30
test_compress_focus.py test(compaction): initialize anti-thrash fixture state 2026-07-11 22:59:49 +05:30
test_compressed_summary_metadata.py
…
test_compression_concurrent_fork.py fix(compression): detect semantic no-op results 2026-07-20 02:25:57 -07:00
test_compression_count_warning_36908.py
…
test_compression_fallback_budget.py fix(compression): give fallback candidates their own timeout budget + escalate repeat-timeout cooldowns (#65143) 2026-07-15 12:28:09 -07:00
test_compression_interrupt_protection.py
…
test_compression_logging_session_context.py
…
test_compression_progress.py
…
test_compression_rotation_state.py perf(compression): skip durable refresh for in-memory-only blocks 2026-07-19 13:16:52 +05:30
test_compression_small_ctx_threshold_floor.py fix(compression): stop compaction thrash — 75% trigger floor under 512K, no summary output cap, reasoning-trace exclusion (#60989) 2026-07-08 11:56:17 -07:00
test_compressor_assistant_tail_anchor.py
…
test_compressor_historical_media.py
…
test_compressor_image_tokens.py
…
test_compressor_media_stripping.py feat(compressor): keep image URLs and unknown-part markers in summarizer serialization 2026-07-15 09:47:04 -07:00
test_compressor_tail_cut_tool_pair_floor.py fix(compression): stop the progress floor from splitting a tool group 2026-07-20 11:58:50 +05:30
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 fix(compression): keep anchor restoration alternation-safe and grounding scaffolding-proof 2026-07-19 08:55:08 +05:30
test_context_compressor_cross_session_guard.py
…
test_context_compressor_session_end_clears_state.py
…
test_context_compressor_summary_continuity.py fix(agent): harden pre-compress context handoff 2026-07-20 02:25:57 -07:00
test_context_compressor_temporal_anchoring.py
…
test_context_engine.py
…
test_context_engine_host_contract.py fix(context): persist fallback compaction breaker 2026-07-14 02:19:40 +05:30
test_context_references.py
…
test_context_refs_concurrent.py
…
test_copilot_acp_client.py fix(file-safety): distinguish safe-root write denial from credential blocks 2026-07-14 17:09:40 +05:30
test_copilot_acp_deprecation.py
…
test_credential_pool.py fix(auth): make xAI OAuth pools multi-account resilient 2026-07-17 11:37:25 +05:30
test_credential_pool_no_entries_log_throttle.py fix(credential-pool): throttle "no available entries" log to stop Windows log-lock storm (contributes to #62698) (#66338) 2026-07-17 13:08:46 -04:00
test_credential_pool_oat_authtype.py fix(auth): centralize pool auth normalization 2026-07-13 23:20:48 +05:30
test_credential_pool_oauth_writethrough.py fix(auth): enforce complete fallback routes 2026-07-16 06:14:56 -07:00
test_credential_pool_provider_boundary.py fix(auth): enforce credential pool provider boundaries (#63048) 2026-07-12 03:00:53 -07:00
test_credential_pool_routing.py fix(auth): make xAI OAuth pools multi-account resilient 2026-07-17 11:37:25 +05:30
test_credits_cold_start.py
…
test_credits_fixture_snapshot.py
…
test_credits_policy.py feat(tui+cli): change your Nous plan from the terminal (/subscription, /topup, terminal-billing UX) (#51639) 2026-07-18 14:30:24 +05:30
test_credits_tracker.py
…
test_credits_view.py feat(tui+cli): change your Nous plan from the terminal (/subscription, /topup, terminal-billing UX) (#51639) 2026-07-18 14:30:24 +05:30
test_cron_inline_api_call_62151.py fix(cron): scope inline calls to reported transport 2026-07-11 11:07:34 +05:30
test_crossloop_client_cache.py
…
test_curator.py fix(runtime): preserve resolved fork metadata 2026-07-10 18:32:32 +05:30
test_curator_activity.py
…
test_curator_backup.py fix(cron): widen UTF-8 BOM tolerance to backup/curator jobs.json readers 2026-07-18 02:31:20 -07:00
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_provider_extra_body_matching.py fix(agent): honor custom-provider extra_body for multi-model catalogs 2026-07-12 23:30:52 -07:00
test_custom_providers_vision.py
…
test_deepseek_anthropic_thinking.py
…
test_direct_provider_url_detection.py
…
test_display.py feat(gateway): live per-tool status line on Slack 2026-07-18 12:28:59 -07:00
test_display_emoji.py
…
test_display_todo_progress.py fix(web): harden extract input and display boundaries 2026-07-10 19:14:06 +05:30
test_display_tool_failure.py
…
test_empty_tool_name_loop_dampening.py fix(agent): execute valid tool calls in mixed batches with invalid names (#66317) 2026-07-17 06:48:42 -07:00
test_error_classifier.py test(error_classifier): cover empty-response max_tokens misclassification 2026-07-18 12:54:58 -07:00
test_external_skills.py
…
test_external_skills_dirs_cache.py
…
test_failover_identity.py
…
test_file_safety.py
…
test_file_safety_container_mirror.py
…
test_file_safety_credentials.py refactor(terminal,file-tools): delete legacy env-side cwd tracking (step 4) 2026-07-16 00:18:38 -07:00
test_file_safety_cross_profile.py
…
test_file_safety_sandbox_mirror.py
…
test_file_safety_session_state.py test(file-safety): unbreak session-snapshot suite; de-flake fixture to env-var resolution (#66293) 2026-07-17 05:45:12 -07:00
test_gateway_turn_sidecar.py perf(gateway): byte-stable session context prompts 2026-07-19 14:58:59 +05:30
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 feat(gemini): improve request context for support and compatibility 2026-07-13 22:26:19 -07:00
test_gemini_schema.py fix(gemini): prune required entries missing from properties in tool schemas 2026-07-17 04:54:06 -07:00
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 fix(insights): harden per-route usage attribution 2026-07-11 05:59:42 -07:00
test_intent_ack_continuation.py
…
test_jiter_preload.py
…
test_kanban_stop.py follow-up: integrate agent nudge + dispatcher retry docs and tests 2026-07-14 16:47:33 +05:30
test_kimi_coding_anthropic_thinking.py feat(agent): adaptive thinking for Kimi-family Anthropic endpoints 2026-07-19 12:21:59 -07:00
test_last_total_tokens.py
…
test_learn_prompt.py
…
test_learning_graph.py
…
test_learning_graph_render.py
…
test_learning_mutations.py
…
test_lmstudio_reasoning.py fix(lmstudio): clamp max/ultra reasoning effort to LM Studio's ceiling 2026-07-16 07:57:51 -07:00
test_local_stream_timeout.py
…
test_manual_compression_feedback.py fix(context): harden compression failure feedback 2026-07-16 14:34:03 +05:30
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 fix(memory): drain queued writes on shutdown 2026-07-17 04:55:58 -07:00
test_memory_boundary_commit.py fix: serialize /new end→switch boundary on the memory manager worker 2026-07-09 03:21:54 +05:30
test_memory_provider.py fix(memory): align external prefetch guard with fail-open contracts 2026-07-16 12:48:48 -07:00
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 feat(models): add Claude Sonnet 5 support 2026-07-20 02:25:44 -07:00
test_moa_aggregator_cache_control.py
…
test_moa_aggregator_cost_slot.py
…
test_moa_reasoning_effort.py fix(moa): aggregator resolves reasoning like an acting model when slot is unset (#64756) 2026-07-15 00:11:04 -07:00
test_moa_slot_api_mode.py
…
test_moa_switch_api_mode.py
…
test_moa_trace_streamed_capture.py
…
test_model_extra_type_guard.py
…
test_model_metadata.py fix(bedrock): add Fable + Claude 4.6/4.7/4.8 1M entries to context table, drop stale cached values 2026-07-20 05:38:55 -07:00
test_model_metadata_local_ctx.py fix(model_metadata): widen localhost->IPv4 rewrite to all sibling probe sites 2026-07-09 14:08:44 +05:30
test_model_metadata_ssl.py
…
test_models_dev.py
…
test_moonshot_schema.py
…
test_non_stream_stale_timeout.py
…
test_none_deref_guards.py fix: widen None-deref guards to config-derived sibling sites + tests 2026-07-09 21:10:07 -07:00
test_nous_credits_gauge.py
…
test_nous_credits_snapshot.py feat(tui+cli): change your Nous plan from the terminal (/subscription, /topup, terminal-billing UX) (#51639) 2026-07-18 14:30:24 +05:30
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
…
test_pet_generate.py
…
test_platform_hint_desktop.py fix(agent): tag desktop chat sessions as desktop 2026-07-08 06:18:18 -07:00
test_platform_hint_overrides.py
…
test_plugin_llm.py
…
test_portal_tags.py feat(portal): ambient conversation context entangles aux/MoA/delegate calls 2026-07-16 01:13:43 -07:00
test_pre_compress_memory_context.py fix(redaction): normalize URL credential key aliases 2026-07-20 02:25:57 -07:00
test_preflight_compression_gate.py
…
test_probe_cache_followups.py fix(model_metadata): address Phase-2 review findings on probe caches 2026-07-09 14:08:44 +05:30
test_prompt_builder.py fix: tolerate UTF-8 BOM in cron jobs.json and context files 2026-07-18 02:31:20 -07:00
test_prompt_caching.py refactor(salvage): scope #40632 to the two live copy-on-write sites 2026-07-09 14:35:14 +05:30
test_proxy_and_url_validation.py
…
test_rate_limit_tracker.py
…
test_reactions.py feat(agent): core affection reaction detector + reaction_callback 2026-07-10 05:41:59 -05:00
test_reasoning_stale_timeout_floor.py feat(x_search): default model grok-4.20-reasoning -> grok-4.5 (#67719) 2026-07-19 16:32:20 -07:00
test_redact.py fix(redaction): cover strict URL reference forms 2026-07-20 02:25:57 -07:00
test_replay_cleanup.py fix(agent): preserve none vs unknown tool effects (#61783) 2026-07-11 05:41:58 -07:00
test_restore_primary_pool_reselect.py
…
test_resume_stale_active_task.py
…
test_runtime_cwd.py fix(agent): scope install-tree guard to fallback-picked cwds, allow cli/tui in-tree dev 2026-07-16 04:32:23 -07:00
test_save_url_image.py
…
test_secret_scope.py
…
test_set_runtime_main_custom_provider.py fix(auxiliary): apply review fixes to #36043 — guard named-custom routing, drop dead key assignment, tighten Palantir host match 2026-07-16 07:28:07 -07:00
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): guard skill slash commands against core-command and slug collisions 2026-07-14 16:41:21 +05:30
test_skill_commands_reload.py
…
test_skill_utils.py fix: widen UTF-8 BOM tolerance to all sibling frontmatter parsers 2026-07-17 04:52:02 -07:00
test_ssl_ca_guard.py
…
test_ssl_verify.py
…
test_stream_read_timeout_floor.py
…
test_stream_single_writer_guard.py fix(streaming): make the single-writer fence best-effort so a missing guard can't crash a turn (#66448) 2026-07-17 18:31:09 +00:00
test_streaming_context_scrubber.py
…
test_subagent_progress.py
…
test_subagent_stop_hook.py
…
test_subdirectory_hints.py
…
test_subdirectory_hints_tilde.py
…
test_subscription_view.py feat(tui+cli): change your Nous plan from the terminal (/subscription, /topup, terminal-billing UX) (#51639) 2026-07-18 14:30:24 +05:30
test_summarize_tool_result_type_safety.py fix: harden remaining display-layer surfaces against non-string tool args 2026-07-15 00:10:22 -07:00
test_summary_prefix_semantics.py
…
test_summary_prefix_tool_use.py fix(compression): affirm tool use stays active in the compaction handoff prefix (#66291) 2026-07-17 06:49:42 -07:00
test_system_prompt.py fix(agent): scope install-tree guard to fallback-picked cwds, allow cli/tui in-tree dev 2026-07-16 04:32:23 -07:00
test_system_prompt_restore.py
…
test_think_scrubber.py test(agent): cover think scrubber leak after flush-then-retry 2026-07-16 01:07:29 +05:30
test_thinking_timeout_guidance.py
…
test_thread_scoped_output.py fix(ci): make tests, workflows, and attribution reliable under load (#66373) 2026-07-17 20:55:24 +00:00
test_title_generator.py fix(ci): make tests, workflows, and attribution reliable under load (#66373) 2026-07-17 20:55:24 +00:00
test_tool_call_arg_no_redaction.py
…
test_tool_dispatch_helpers.py fix(agent): preserve none vs unknown tool effects (#61783) 2026-07-11 05:41:58 -07:00
test_tool_guardrails.py fix(agent): tolerate lone UTF-16 surrogates in tool-guardrail hashing 2026-07-18 02:08:39 -07:00
test_tool_result_classification.py fix(agent): preserve none vs unknown tool effects (#61783) 2026-07-11 05:41:58 -07:00
test_trace_upload.py feat(sessions): trace export + HF upload via 'sessions export --format trace' (#60507) 2026-07-07 15:12:49 -07:00
test_transcription_registry.py fix(deepinfra): harden multimodal provider routing 2026-07-14 02:59:39 +05:30
test_tts_registry.py
…
test_turn_context.py fix(auxiliary): sync runtime after fallback restoration 2026-07-17 09:08:30 -07:00
test_turn_finalizer_cleanup_guard.py
…
test_turn_finalizer_final_response_persistence.py refactor(turn_finalizer): extract _is_pure_tool_call_tail, fix SQLite durability 2026-07-19 07:27:10 +05:30
test_turn_finalizer_interrupt_alternation.py
…
test_turn_finalizer_iteration_limit_exit.py fix(agent): keep pending verification behind exit provenance 2026-07-10 11:53:58 +05:30
test_turn_overlap_tripwire.py fix: exempt persist-disabled review forks from the session-scoped tripwire 2026-07-19 01:09:29 -07:00
test_turn_retry_state.py
…
test_unsupported_parameter_retry.py feat(analytics): record auxiliary model usage per task in session accounting (#65537) 2026-07-16 04:23:12 -07:00
test_unsupported_temperature_retry.py feat(analytics): record auxiliary model usage per task in session accounting (#65537) 2026-07-16 04:23:12 -07:00
test_usage_pricing.py fix(pricing): strip apac./au. Bedrock region prefixes so cost isn't unknown 2026-07-20 05:38:45 -07:00
test_verification_evidence.py
…
test_verification_stop.py fix(approval): allow verifier temp cleanup 2026-07-12 04:32:52 -07:00
test_verification_stop_caching.py
…
test_verify_hooks.py
…
test_vertex_adapter.py
…
test_video_gen_registry.py fix(deepinfra): harden multimodal provider routing 2026-07-14 02:59:39 +05:30
test_vision_resolved_args.py
…
test_vision_routing_31179.py
…