Scope model catalogs and caches by thread originator (#56284)

## What changed

Select an originator-specific models manager before resolving thread model metadata. Supported originators send their own `originator` header and use separate in-memory catalogs and disk caches, so each thread receives the corresponding model instructions and tools.

Reuse managers for repeated originators and share the API-key model discovery setting across them. Unsupported originators retain the default manager and catalog.

## Testing

Add coverage for originator headers, concurrent catalog isolation, cache reuse across restarts, shared discovery policy, and the instructions and tools sent in actual turns.

GitOrigin-RevId: ae4aa51c8df2813a72fc8aed8978fd630e467069
This commit is contained in:
Kenny Yi
2026-10-22 22:44:48 +00:00
committed by copyberry
parent 35e2102808
commit 2326a3f74b
11 changed files with 579 additions and 5 deletions
@@ -94,7 +94,10 @@ fn cleanup_reclaims_unpublished_and_aged_legacy_clones() -> Result<()> {
staging_root.join(format!("{}file", MarketplaceStagingDir::directory_prefix()));
fs::write(&unrelated_file, "keep")?;
let now = SystemTime::now();
// Base synthetic ages on the filesystem clock, which can differ from the wall clock.
let now = fs::metadata(&legacy_add)?
.modified()?
.max(fs::metadata(&legacy_upgrade)?.modified()?);
for (age, expected_legacy_dirs) in [
(Duration::ZERO, [true, true]),
(