Problem
crates/wash/src/profile.rs:77 — the active profile is stored in a OnceLock<Profile> and loaded on first access. There's no path to refresh it. The MCP server lives for the entire session.
This works today because no aggregator writes profiles yet (per the wash#13 plan). When that lands, a profile written mid-session won't be picked up until the next CLI restart. That undermines the adaptive layer's whole point.
Proposed fix
Two reasonable options:
- TTL refresh. Wrap the cached profile in a struct holding
(Profile, Instant), refresh on access if older than ~30s. Cheap, no IPC.
- Mtime watch. Stat the profile file on each access; reload only when mtime moves. Slightly more work per access but always fresh.
Option 2 is probably the right one — profile reads are infrequent (per tool call), and we already stat files in the Read mtime cache.
Either way, cached() needs to switch from OnceLock to a Mutex<Option<...>> or RwLock<...>. The byte-stable tools/list invariant must be preserved (test in tests/mcp_stdio.rs).
Files
crates/wash/src/profile.rs — cached(), get(), and load_active().
Note
The RELAYWASH_PROFILE_PATH test override should keep working — easy to honor in the new path.
Problem
crates/wash/src/profile.rs:77— the active profile is stored in aOnceLock<Profile>and loaded on first access. There's no path to refresh it. The MCP server lives for the entire session.This works today because no aggregator writes profiles yet (per the wash#13 plan). When that lands, a profile written mid-session won't be picked up until the next CLI restart. That undermines the adaptive layer's whole point.
Proposed fix
Two reasonable options:
(Profile, Instant), refresh on access if older than ~30s. Cheap, no IPC.Option 2 is probably the right one — profile reads are infrequent (per tool call), and we already stat files in the Read mtime cache.
Either way,
cached()needs to switch fromOnceLockto aMutex<Option<...>>orRwLock<...>. The byte-stabletools/listinvariant must be preserved (test intests/mcp_stdio.rs).Files
crates/wash/src/profile.rs—cached(),get(), andload_active().Note
The
RELAYWASH_PROFILE_PATHtest override should keep working — easy to honor in the new path.