Skip to content

fix(xai): drop stale 256K grok-4.6 context cache + generalize pre-catalog guard - #85434

Merged
teknium1 merged 2 commits into
mainfrom
hermes/hermes-82921ad2
Aug 13, 2026
Merged

teknium1 merged 2 commits into
mainfrom
hermes/hermes-82921ad2

Conversation

@teknium1

Copy link
Copy Markdown
Collaborator

Summary

Users who ran grok-4.6 before its 500K catalog entry landed keep a stale persisted 256K context length forever — this drops that leftover so it re-resolves, and generalizes the guard so the whole class (MiniMax-M3, Grok-4.3/-4.6/-4-fast/-4.20, qwen3.6-plus) is covered by one rule instead of per-model patches.

Salvages #84341 by @Julientalbot (cherry-picked, authorship preserved), then widens per the never-patch-predicates rule; also absorbs the guards requested in #37684 by @AhmetArif0.

Changes

  • agent/model_metadata.py: cherry-picked grok-4.6 guard (@Julientalbot), then replaced the three per-model _model_name_suggests_* stale-cache predicates with one generic _stale_pre_catalog_cache_entry() driven by _PRE_CATALOG_STALE_KEYS. A cached value is dropped only when the model resolves (longest-key-first, same as step 8) to a listed catalog key AND the cached value is at or below what the old resolution path could have produced (largest shorter matching catch-all, or the 256K fallback). Probe-derived values above that threshold are never dropped. _model_name_suggests_minimax_m3 kept for its two non-cache callers.
  • tests/agent/test_model_metadata.py: contributor's TestGrok46StaleCacheGuard E2E test preserved; predicate unit tests migrated to the generic guard; new TestGenericPreCatalogStaleGuard covering qwen3.6-plus / grok-4-fast / grok-4.20 incl. an E2E stale-drop-and-re-resolve.

Validation

Result
tests/agent/test_model_metadata.py + test_minimax_provider.py 93/93 pass
Sabotage run (guard disabled) 3 E2E tests fail as expected, restore → green
Stale-base gate 0 behind origin/main, 2-file diff

Infographic

Stale context cache guard — one generic rule replaces per-model patches

@github-actions

github-actions Bot commented Aug 13, 2026

Copy link
Copy Markdown
Contributor

૮ >ﻌ< ა ci review

ran on 14caecc — fix(model_metadata): generalize pre-catalog stale context-ca

⚠️ Warnings

OSV vulnerability scan · View job

5 known vulnerabilities found in pinned dependencies.

How to fix:

Review the findings in the Security tab. Update the affected dependencies if a patched version is available.


debug info

CI timings

CI timings · View report · View job

Wall time 3m37s vs 6m38s (-45.5%). 11 job(s) slower, 12 faster, 1 unchanged.

  • Python tests / Run tests slice 10/12: +32.0s
  • Python tests / Run tests slice 5/12: +30.0s
  • Python tests / Run tests slice 1/12: -26.0s
  • Check contributors / check-attribution: -26.0s
  • Python tests / Run tests slice 2/12: +25.0s

@alt-glitch alt-glitch added type/bug Something isn't working comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint provider/xai xAI (Grok) P3 Low — cosmetic, nice to have labels Aug 13, 2026
julientalbot-ergonomia and others added 2 commits August 13, 2026 10:15
docs.x.ai (2026-08-12): grok-4.6 is the flagship, 500K context.
Live GET /v1/models lists grok-4.6 at context_length 500000
(no grok-4.6-latest alias).

#84661 landed the catalog. Main already lists native grok-4.6
on the xAI picker. This is only the leftover cache guard
(same pattern as grok-4.3): pre-catalog builds persisted the
grok-4 catch-all (256K).
Replaces the per-model _model_name_suggests_grok_4_3/_grok_4_6/
_minimax_m3 stale-cache predicates with one generic
_stale_pre_catalog_cache_entry() guard driven by
_PRE_CATALOG_STALE_KEYS. A cached context length is dropped when the
model resolves (longest-key-first, same as step 8) to a listed catalog
key and the cached value is at or below what the old resolution path
could have produced (largest shorter matching catch-all, or the 256K
fallback).

Also covers qwen3.6-plus, grok-4-fast, and grok-4.20 (the models
PR #37684 requested guards for), absorbing that PR.

_model_name_suggests_minimax_m3 is kept for its two non-cache callers
(models.dev underreport guard, cache-control gating in
agent_runtime_helpers).
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

comp/agent Core agent runtime: loop, agent_init, prompt builder, context-compression, responses endpoint P3 Low — cosmetic, nice to have provider/xai xAI (Grok) type/bug Something isn't working

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants