save_context_length and _invalidate_cached_context_length loaded the yaml,
mutated it and rewrote it unlocked; a concurrent agent's save in between was
dropped (or an invalidated, too-large length resurrected), forcing re-probes or
context overflow. Both now run under a cross-process file lock (agent/model_metadata_cache.py).