Repository navigation
perf(models-config): targetProvider short-circuit with disk-vs-config validation - #73261
zeroaltitude wants to merge 38 commits into
Conversation
…etection Replaces mtime-based fingerprinting with content-based hashes for the implicit-provider-discovery cache key, plus a second-factor models.json content hash that catches external edits / partial corruption / sibling process writes between cache hits. Includes the security hardening findings raised by Aisle on the original combined PR (openclaw#72869). # Why content hashes The previous mtime-based key invalidated on every OAuth token refresh because auth-profiles.json gets rewritten with new access/refresh timestamps even when the set of available providers doesn't change. Same for models.json mtime: the file is the OUTPUT of this function, so each call observed its own write and invalidated the next call. Now: - auth-profiles.json: SHA-256 over a stable serialization that strips volatile OAuth session fields (access, refresh, expires*, issuedAt, refreshed/lastChecked/lastRefresh/lastValidatedAt). Token rotation no longer invalidates; structural changes (added/removed profiles, rotated static type:token credentials) still do. - models.json: NOT included in the input fingerprint (would cause self-invalidation). Instead its content hash is captured at write time and stored alongside the readyCache entry. Every cache check recomputes the file hash and compares; any external edit / corruption / tamper invalidates the cache and forces re-plan. # Security hardening (Aisle review on PR openclaw#72869) - 🟠 High #1 (CWE-59 symlink-following chmod): ensureModelsFileMode now lstats first and refuses to chmod symlinks or non-regular files. Closes the attack where a symlink at ${agentDir}/models.json points at a sensitive owned file and our best-effort chmod follows. - 🟡 Med #3 (CWE-1321 prototype pollution): stripAuthProfilesVolatile now uses Object.create(null) for the result and explicitly filters __proto__ / prototype / constructor keys (belt-and-suspenders). - 🟡 Med #4 (DoS via unbounded fingerprinting): MAX_AUTH_PROFILES_BYTES = 8 MiB cap (above which we hash raw bytes), MAX_AUTH_PROFILES_DEPTH = 64 with a depth-cap marker so deeply-nested JSON cannot stack- overflow the gateway. - 🟡 Med #5 (CWE-312 secrets in cache): buildModelsJsonFingerprint now returns SHA-256 hex of the canonical payload instead of the raw stable-stringified payload. The readyCache holds no verbatim secret material; heap snapshots / debug telemetry / core dumps cannot leak apiKey strings via this path. # Token-rotation correctness "token" is intentionally NOT in AUTH_PROFILE_VOLATILE_FIELDS even though OAuth-style 'token' fields rotate. Profiles with type: 'token' use the literal token key as a long-lived static credential, and stripping it would mask real auth-state changes when a user rotates that credential. Documented inline. # Tests Two tests in models-config.fingerprint-cache.test.ts: - 'does not invalidate the cache when OAuth session fields rotate' (rotates access/refresh/expires; cache stays valid) - 'DOES invalidate the cache when a static type:token credential rotates' (rotates the literal token field; cache invalidates) # Compatibility MODELS_JSON_STATE.readyCache value shape extended with modelsJsonHash: { fingerprint, modelsJsonHash, result }. All three plan return paths (skip/noop/write) capture the post-write hash. The refreshedFingerprint re-key path forwards modelsJsonHash through unchanged. This is one of two PRs split out of openclaw#72869. The targetProvider short-circuit work landed separately.
… validation
Add a fast path to ensureOpenClawModelsJson for callers that know which
provider/model they're about to use (e.g. the pi-embedded runner).
When set, the implicit-provider-discovery pipeline can be skipped IF
the on-disk models.json provider entry STRUCTURALLY matches what the
current configuration would produce.
# Why structural comparison
A naive 'is configured' check (does any non-empty credential exist on
disk for this provider) silently bypasses several real failure modes:
- Rotated apiKey: cold start with new key in config, old key still on
disk, presence-only check fires, all calls fail with 401 until
something else invalidates.
- Attacker-tampered baseUrl: redirect to exfil endpoint kept across
restarts.
- Attacker-injected headers: arbitrary auth material kept across
restarts.
The new readExistingProviderMatchesConfig compares all four
security-relevant fields:
apiKey - resolved through resolveSecretInputRef (env-ref expansion
via createConfigRuntimeEnv) before string equality vs. disk
baseUrl - exact string equality
headers - stable structural equality (key-order independent)
auth - stable structural equality
Any mismatch falls through to full planning + writes. This is safe to
use on cold start and after gateway restart.
# API
Adds EnsureOpenClawModelsJsonOptions exported type with targetProvider
and targetModel, layered on top of the existing options shape (kept
all of pluginMetadataSnapshot, workspaceDir, providerDiscoveryProviderIds,
providerDiscoveryTimeoutMs).
# Tests
5 cases in models-config.target-provider-short-circuit.test.ts:
- hit-on-match: full structural match short-circuits planning
- miss-on-rotated-key: config apiKey change forces a full plan
- miss-on-baseUrl-change: tampered disk baseUrl rejects short-circuit
- miss-on-tampered-headers: any disk header drift rejects short-circuit
- miss-on-cold-cache: empty in-memory cache + missing disk file forces a plan
- hit-after-warm-fingerprint: warm in-memory cache reuse
# Dependencies
This is one of two PRs split out of the original combined openclaw#72869.
The cache-fingerprint work (auth-profiles content hash, models.json
drift detection, fingerprint hashing, security hardening) landed
separately as perf/models-config-cache-fingerprint.
This branch can land independently. When both branches land, the
original PR openclaw#72869 can be closed as superseded.
🔒 Aisle Security AnalysisWe found 4 potential security issue(s) in this PR:
1. 🟠 TOCTOU symlink swap enables arbitrary file read and chmod via models.json short-circuit path
DescriptionIn This creates a classic time-of-check/time-of-use window:
Additionally, Vulnerable code: const lst = await fs.lstat(targetPath).catch(() => null);
if (!lst || lst.isSymbolicLink() || !lst.isFile()) {
return false;
}
if (lst.size > MAX_MODELS_JSON_SHORT_CIRCUIT_BYTES) {
return false;
}
...
raw = await fs.readFile(targetPath, "utf8");and: await fs.chmod(pathname, 0o600).catch(() => {
// best-effort
});RecommendationMake the read and permission-setting operations symlink-safe and race-resistant by operating on an already-opened file descriptor and validating it with One approach (POSIX): import { open } from "node:fs/promises";
import { constants as FS } from "node:fs";
const fh = await open(targetPath, FS.O_RDONLY | FS.O_NOFOLLOW);
try {
const st = await fh.stat();
if (!st.isFile()) return false;
if (st.size > MAX_MODELS_JSON_SHORT_CIRCUIT_BYTES) return false;
const raw = await fh.readFile({ encoding: "utf8" });
...
} finally {
await fh.close();
}For mode enforcement, avoid
This removes the TOCTOU window and prevents symlink-following reads/chmods. 2. 🟠 SSRF / credential exfiltration via models.json per-model baseUrl/api not validated in targetProvider short-circuit
DescriptionThe However, This is security-relevant because the runtime later uses per-model fields originating from
Vulnerable logic (short-circuit trusts disk even if // Other provider fields (models[], ... compat, etc.) are NOT compared.
// ...
if (!stableEqual(configuredProvider.baseUrl, diskProvider.baseUrl)) return false;
// apiKey, headers, auth comparisons...
return true;Runtime sink consuming per-model baseUrl from models.json: baseUrl: providerConfig.baseUrl ?? discoveredModel.baseUrl,
...
baseUrl: requestConfig.baseUrl ?? discoveredModel.baseUrl,RecommendationDo not short-circuit unless all request-destination and request-shaping fields that can affect runtime network calls are proven consistent between config and disk. At minimum, include structural comparison of Example defensive approach (prefer correctness over speed): // Pseudocode: extend comparison to cover model-level transport fields
if (!stableEqual(configuredProvider.models, diskProvider.models)) return false;
if (!stableEqual(configuredProvider.request, diskProvider.request)) return false;
if (!stableEqual(configuredProvider.api, diskProvider.api)) return false;Alternatively, make the short-circuit conditional on Also consider validating that any resolved 3. 🟡 Potential stack/CPU DoS via recursive stableStringify on attacker-controlled models.json fields
Description
In
Vulnerable code: function stableEqual(a: unknown, b: unknown): boolean {
return stableStringify(a) === stableStringify(b);
}and the recursive serializer: function stableStringify(value: unknown): string {
if (value === null || typeof value !== "object") return JSON.stringify(value);
if (Array.isArray(value)) return `[${value.map((entry) => stableStringify(entry)).join(",")}]`;
const entries = Object.entries(value as Record<string, unknown>).toSorted(([a], [b]) =>
a.localeCompare(b),
);
return `{${entries.map(([key, entry]) => `${JSON.stringify(key)}:${stableStringify(entry)}`).join(",")}}`;
}Even though RecommendationAvoid unbounded recursive stringification on untrusted data. Options:
Example depth-limited stringify: function stableStringifySafe(value: unknown, depth = 0, maxDepth = 200): string {
if (depth > maxDepth) throw new Error("max depth exceeded");
if (value === null || typeof value !== "object") return JSON.stringify(value) ?? "null";
if (Array.isArray(value)) {
return `[${value.map(v => stableStringifySafe(v, depth + 1, maxDepth)).join(",")}]`;
}
const rec = value as Record<string, unknown>;
const keys = Object.keys(rec).sort();
return `{${keys.map(k => `${JSON.stringify(k)}:${stableStringifySafe(rec[k], depth + 1, maxDepth)}`).join(",")}}`;
}
function stableEqual(a: unknown, b: unknown): boolean {
try {
return stableStringifySafe(a) === stableStringifySafe(b);
} catch {
return false; // fall through to full plan
}
}This keeps the short-circuit check robust while preventing stack/CPU DoS. 4. 🔵 TOCTOU race in models.json short-circuit integrity check leads to stale readyCache
Description
Because there is no locking or post-check revalidation of the file’s contents/identity, another process (or thread) with concurrent write access to Impact:
Vulnerable code (short-circuit path): const matches = await readExistingProviderMatchesConfig(...);
if (matches) {
await ensureModelsFileModeForModelsJson(targetPath);
const result = { agentDir, wrote: false };
MODELS_JSON_STATE.readyCache.set(cacheKey, Promise.resolve({ fingerprint, result }));
return result;
}RecommendationMake the short-circuit check robust against concurrent modification before caching/returning: Option A (simplest): run the short-circuit path under the same Option B (stronger, cross-process TOCTOU mitigation): use an atomic check strategy and only cache if the file is unchanged:
Example sketch: const fd = await fs.open(targetPath, 'r');
try {
const s1 = await fd.stat();
const raw = await fd.readFile('utf8');
const parsed = JSON.parse(raw);
const ok = /* compare parsed vs config */;
const s2 = await fd.stat();
if (ok && s1.ino === s2.ino && s1.mtimeMs === s2.mtimeMs && s1.size === s2.size) {
MODELS_JSON_STATE.readyCache.set(cacheKey, Promise.resolve({ fingerprint, result }));
return result;
}
} finally {
await fd.close();
}Also consider avoiding caching the short-circuit result unless the check is performed under a lock or validated with a file-identity/mtime recheck. Analyzed PR: #73261 at commit Last updated on: 2026-04-28T05:45:21Z Re-review progress:
|
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 682c12624c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
Greptile SummaryAdds a Confidence Score: 5/5PR is safe to merge — no P0 or P1 findings; all previously flagged security issues confirmed resolved. All four security-critical field comparisons (apiKey, baseUrl, headers, auth) are symmetric and handle the undefined-vs-string drift case. The readyCache ordering fix is verified by the new fs.readFile spy test. Prototype injection, symlink, and oversized-file vectors are guarded. No new attack surfaces introduced. No files require special attention. Reviews (2): Last reviewed commit: "fix(models-config): symmetric baseUrl, e..." | Re-trigger Greptile |
Addresses Codex P1, Greptile P2, and Aisle Med #1/#2/#3 on openclaw#73260: # Streaming bounded hash (Codex P1 / Aisle Med #2) The previous oversize-branch in readAuthProfilesStableHash still did fs.readFile(path) which loaded the entire file into memory \u2014 the MAX_AUTH_PROFILES_BYTES cap was effectively unenforced. Same problem for readModelsJsonContentHash (no cap at all). New helper safeHashRegularFile(): - lstat first; reject symlinks and non-regular files - bail at lstat-time if size exceeds maxBytes (returns sentinel hash so size-change still invalidates the cache) - open with O_NOFOLLOW where supported (closes lstat\u2192open TOCTOU) - fstat after open to verify it's still a regular file - createReadStream(fd) with bounded highWaterMark; destroy if accumulated bytes exceed maxBytes (handles the case where attacker grows the file between lstat and stream completion) Both readers now route through safeHashRegularFile. Models.json gets a 1 MiB cap (MAX_MODELS_JSON_BYTES); auth-profiles keeps its 8 MiB cap. # O_NOFOLLOW chmod (Aisle Med #1, CWE-367) The previous lstat-then-chmod sequence was racy: an attacker who could rename/replace ${agentDir}/models.json between the two syscalls could have chmod() follow a swapped-in symlink to an arbitrary file. Replaced with fs.open(path, O_RDONLY | O_NOFOLLOW) \u2192 fchmod via the file handle. The open itself refuses symlinks atomically; the fchmod operates on the validated fd, eliminating the race. When O_NOFOLLOW is unavailable (rare but possible), falls back to plain O_RDONLY \u2014 the prior lstat protection was already best-effort. # Symlink-safe reads (Aisle Med #3, CWE-59) Previous fs.readFile in the hash readers followed symlinks. With the safeHashRegularFile refactor above, both auth-profiles.json and models.json now reject symlinks before reading. # JSDoc fix (Greptile P2) readModelsJsonContentHash's prior comment said "forces a re-plan" when the file is absent, but the call site does null === null comparison which is a cache hit, not a re-plan (the steady-state skip case for plan.action === 'skip'). Updated the comment to explain the actual semantics: stable absence is a stable result; drift is a re-plan. # Tests 14/14 existing tests pass. No new test cases needed \u2014 the existing file-mode and fingerprint-cache tests cover both the symlink-rejection paths (via lstat shortcut) and the modelsJsonHash second-factor. Lint: 0 errors.
…tegration Addresses Codex P2, Greptile P1+P2x2, and Aisle High #1 + Med #2/#3/#4 on PR openclaw#73261: # Greptile P1 / Aisle High #1: asymmetric baseUrl (CWE-918, SSRF) The previous guard: if (typeof configuredProvider.baseUrl === 'string' && configuredProvider.baseUrl !== diskProvider.baseUrl) short-circuited the check entirely when config omitted baseUrl (common for providers with compiled-in defaults). An attacker who could tamper with on-disk models.json could set baseUrl to an exfil endpoint and the short-circuit would accept it silently \u2014 exactly the SSRF/credential-exfil vector this PR was meant to close. Replaced with symmetric stableEqual() so config-undefined vs disk-string is a mismatch and falls through to full planning, which re-applies provider/plugin defaults and rewrites the file. # Codex P2: env-ref API key comparison resolveConfiguredApiKeyForCompare resolved env refs to the env-var VALUE (env[ref.id]). But planOpenClawModelsJson persists env-source api keys to models.json as the env-var NAME (e.g. 'OPENAI_API_KEY'), not the value \u2014 that's what resolveApiKeyFromCredential returns for env source. Comparing value-vs-name always mismatched, so the short-circuit never fired for the most common config form ('apiKey: "${env.OPENAI_API_KEY}"'). Now the helper returns the env-var NAME for env-source refs, while still verifying the env is currently populated (so we don't short-circuit on a misconfigured environment). Plaintext values still compare directly. # Greptile P2 (perf): readyCache integration The short-circuit returned before the readyCache check, so warm callers paid the disk read + JSON.parse cost on every call. Reordered: 1. compute fingerprint (cheap) 2. check readyCache \u2014 warm hit returns immediately, no disk I/O 3. if cold, attempt short-circuit on disk 4. if short-circuit succeeds, populate readyCache so subsequent calls take the warm path Net effect: warm callers now skip disk entirely; cold callers with intact disk state still get the short-circuit benefit; full plan fires only on real drift. # Aisle Med #2 (CWE-59): symlink-following short-circuit reads readExistingProviderMatchesConfig used fs.readFile on a possibly- symlinked target. Now lstat-checks first and refuses symlinks / non-regular files. # Aisle Med #3 (CWE-1321): prototype-chain key access explicitProviders[targetProvider] could fall through to a prototype key like '__proto__' / 'constructor' / 'prototype'. Now uses Object.hasOwn at both lookup sites (caller AND readExistingProviderMatchesConfig) to refuse inherited keys. Also explicit string check rejects the three known dangerous keys. # Aisle Med #4 (CWE-400): unbounded models.json read Added MAX_MODELS_JSON_SHORT_CIRCUIT_BYTES = 1 MiB cap on the disk read in the short-circuit path. Files above the cap fall through to full planning rather than being parsed. # Tests Updated hit-after-warm-fingerprint test (Greptile P2) to use fs.readFile spy and assert no disk read occurs on the warm path. Added short-circuit-populates-cache test that drops the in-memory cache between runs, fires the short-circuit, then verifies the third call takes the warm path with no disk read. 14/14 tests pass. Lint: 0 errors.
|
All five findings landed in
|
|
@greptile-apps: please do re-review/re-score |
|
Codex review: needs real behavior proof before merge. Reviewed June 4, 2026, 6:22 PM ET / 22:22 UTC. Summary PR surface: Source +1219, Tests +1738, Other +257. Total +3214 across 13 files. Reproducibility: yes. for the review findings from source inspection: the PR head removes imports it still needs, reads legacy auth-profile JSON, and omits current-main plugin catalog reconciliation. I did not run tests because this is a read-only review. Review metrics: none identified. Merge readiness Overall follows the weaker of proof and patch quality, so missing proof can cap an otherwise strong patch. Rank-up moves:
Proof guidance:
Risk before merge
Maintainer options:
Next step before merge
Security Review findings
Review detailsBest possible solution: Layer the targetProvider/targetModel fast path on top of current-main Do we have a high-confidence way to reproduce the issue? Yes for the review findings from source inspection: the PR head removes imports it still needs, reads legacy auth-profile JSON, and omits current-main plugin catalog reconciliation. I did not run tests because this is a read-only review. Is this the best way to solve the issue? No. The targetProvider fast path is a plausible optimization, but the current implementation is not the best merge shape until it preserves the current-main SQLite auth-profile and generated plugin-catalog contracts. Full review comments:
Overall correctness: patch is incorrect AGENTS.md: found and applied where relevant. Codex review notes: model gpt-5.5, reasoning high; reviewed against f4c448f65b5f. Label changesLabel justifications:
Evidence reviewedPR surface: Source +1219, Tests +1738, Other +257. Total +3214 across 13 files. View PR surface stats
Security concerns:
What I checked:
Likely related people:
What the crustacean ranks mean
Shiny media proof means a screenshot, video, or linked artifact directly shows the changed behavior. Runtime, network, CSP, and security claims still need visible diagnostics. How this review workflow works
|
…rget-provider-short-circuit # Conflicts: # src/agents/models-config.ts
…rget-provider-short-circuit
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 9e4c01b6b8
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| // Populate readyCache so the next call with identical inputs | ||
| // takes the warm-cache path above without re-reading disk. | ||
| MODELS_JSON_STATE.readyCache.set(cacheKey, Promise.resolve({ fingerprint, result })); | ||
| return result; |
There was a problem hiding this comment.
Scope ready-cache entries to short-circuit mode
When a targetProvider short-circuit succeeds, this stores a global readyCache entry keyed only by fingerprint, even though only one provider was validated. A later ensureOpenClawModelsJson(...) call without targetProvider can hit that cache and skip full planning, leaving other providers stale on disk. This is reproducible whenever one caller does targeted prewarm and another later expects full reconciliation in the same process.
Useful? React with 👍 / 👎.
| } else if (typeof diskProvider.apiKey === "string" && diskProvider.apiKey.length > 0) { | ||
| return false; |
There was a problem hiding this comment.
Treat non-string disk apiKey as mismatch
In the resolvedConfiguredApiKey === undefined branch, only non-empty string diskProvider.apiKey values are rejected. If models.json has a non-string apiKey (for example tampered object/number) while config omits apiKey, this function still returns a structural match and short-circuits planning. That preserves malformed or attacker-modified provider state instead of forcing a rewrite.
Useful? React with 👍 / 👎.
|
ClawSweeper PR egg: 🔥 warming; proof passed, review follow-up or readiness checks remain. Hatch with Rules and detailsHatchability:
About:
|
…rget-provider-short-circuit # Conflicts: # CHANGELOG.md
…rget-provider-short-circuit
|
Reviewed the latest ClawSweeper comment and prepared the requested |
|
ClawSweeper changelog finding addressed.
@clawsweeper please re-review. |
…rget-provider-short-circuit # Conflicts: # src/agents/embedded-agent-runner/compact.hooks.harness.ts # src/agents/embedded-agent-runner/compact.hooks.test.ts # src/agents/embedded-agent-runner/run.ts
…rget-provider-short-circuit Integration rotation: merge origin/main into topic branch. Conflict resolution in src/agents/models-config.ts: - Keep branch's content-based fingerprinting (ContentHashOutcome, readAuthProfilesStableOutcome, modelsContentOutcomesMatch, sync buildModelsJsonFingerprint with authProfilesHash). - Keep branch's target-provider short-circuit fast path — the entire block is the point of this PR. - Drop main's mtime-based fingerprinting, inlined withModelsJsonWriteLock, and readPluginCatalogMtimes. - Keep HEAD's planAndWrite(fingerprint) call.
…rget-provider-short-circuit
|
Superseded by #90741 — a single reconciled implementation that unifies the content-hash fingerprint cache (#73260) and the #90741 also fixes a correctness gap shared by both PRs: the fingerprint hashed the legacy Verified on the unified branch: 190/190 |
Summary
Splits the targetProvider short-circuit half of #72869 into a standalone PR.
Adds a fast path to
ensureOpenClawModelsJsonfor callers that know which provider/model they are about to use (e.g. the pi-embedded runner). When set, the implicit-provider-discovery pipeline can be skipped IF the on-diskmodels.jsonprovider entry structurally matches what the current configuration would produce.Why structural comparison
A naive "is configured" check (does any non-empty credential exist on disk for this provider) silently bypasses several real failure modes:
The new
readExistingProviderMatchesConfigcompares all four security-relevant fields:apiKeyresolveSecretInputRef(env-ref expansion viacreateConfigRuntimeEnv) before string equality vs. diskbaseUrlheadersauthAny mismatch falls through to full planning + write. This is safe to use on cold start and after gateway restart.
API
Adds
EnsureOpenClawModelsJsonOptionsexported type withtargetProviderandtargetModel, layered on top of the existing options shape (kept all ofpluginMetadataSnapshot,workspaceDir,providerDiscoveryProviderIds,providerDiscoveryTimeoutMs).Tests
6 cases in
models-config.target-provider-short-circuit.test.ts:hit-on-match— full structural match short-circuits planningmiss-on-rotated-key— configapiKeychange forces a full planmiss-on-baseUrl-change— tampered diskbaseUrlrejects short-circuitmiss-on-tampered-headers— any disk header drift rejects short-circuitmiss-on-cold-cache— empty in-memory cache + missing disk file forces a planhit-after-warm-fingerprint— warm in-memory cache reuseDependencies
This is one of two PRs split out of the original combined #72869. The cache-fingerprint work (auth-profiles content hash, models.json drift detection, fingerprint hashing, security hardening) is in #73260.
This branch can land independently of the cache PR; the two changes touch different code paths.
Related
Real behavior proof
Behavior or issue addressed: Target-provider models-config short-circuit safety from PR perf(models-config): targetProvider short-circuit with disk-vs-config validation #73261, including provider-level
apidrift and uncacheable models hash fail-closed behavior.Real environment tested: Local OpenClaw topic branch
perf/models-config-target-provider-short-circuitat2f89c7b99a, including final perf(models-config): content-hash auth-profiles + models.json drift detection #73260 ContentHashOutcome contract, isolated temporary agent directory, productionensureOpenClawModelsJsoninvoked through atsxruntime driver with no test harness or mocks.Exact steps or command run after this patch: Ran a real proof driver after the patch covering steady-state targetProvider hit, provider
apidrift, and oversizemodels.json.Evidence after fix: Full copied runtime output is in the PR comment: perf(models-config): targetProvider short-circuit with disk-vs-config validation #73261 (comment)
Excerpt of copied live output:
Observed result after fix: The production path keeps the short-circuit only for structurally matching provider config, refuses provider-level
apidrift, and refuses uncacheable models hashes instead of treating them as stable cache hits.What was not tested: Nothing else for this PR's changed behavior beyond the isolated local runtime proof and supplemental automated validation.