Skip to content

A self-improving RLM agent for coding workflows and long-running autonomous tasks.

Rust

refactor(coding-agent): remove test-only config cache reset APIs (#1849)

Sebastian Müller378e32d58130
diff --git a/packages/coding-agent/.changes/remove-config-cache-reset.md b/packages/coding-agent/.changes/remove-config-cache-reset.md
new file mode 100644
index 0000000000..8150a69571
--- /dev/null
+++ b/packages/coding-agent/.changes/remove-config-cache-reset.md
@@ -0,0 +1 @@
+- Removed internal test-only configuration cache reset hooks.
diff --git a/packages/coding-agent/src/core/model-registry.ts b/packages/coding-agent/src/core/model-registry.ts
index 0bd646d229..4ebf6c3b8d 100644
--- a/packages/coding-agent/src/core/model-registry.ts
+++ b/packages/coding-agent/src/core/model-registry.ts
@@ -37,7 +37,6 @@ import {
} from "./prime-inference-models.js";
import { BUILT_IN_PROVIDER_DISPLAY_NAMES } from "./provider-display-names.js";
import {
- clearConfigValueCache,
resolveConfigValueOrThrow,
resolveConfigValueUncached,
resolveHeadersOrThrow,
@@ -349,9 +348,6 @@ function applyModelOverride(model: Model<Api>, override: ModelOverride): Model<A
return result;
}
-/** Clear the config value command cache. Exported for testing. */
-export const clearApiKeyCache = clearConfigValueCache;
-
function readOpenAICodexAccountId(token: string): string | undefined {
try {
const payload = JSON.parse(Buffer.from(token.split(".")[1] ?? "", "base64url").toString("utf8")) as {
diff --git a/packages/coding-agent/src/core/resolve-config-value.ts b/packages/coding-agent/src/core/resolve-config-value.ts
index 8db0821cc0..965d2098a1 100644
--- a/packages/coding-agent/src/core/resolve-config-value.ts
+++ b/packages/coding-agent/src/core/resolve-config-value.ts
@@ -141,8 +141,3 @@ export function resolveHeadersOrThrow(
}
return Object.keys(resolved).length > 0 ? resolved : undefined;
}
-
-/** Clear the config value command cache. Exported for testing. */
-export function clearConfigValueCache(): void {
- commandResultCache.clear();
-}
diff --git a/packages/coding-agent/test/auth-storage.test.ts b/packages/coding-agent/test/auth-storage.test.ts
index 27b7ff7a0f..049d254206 100644
--- a/packages/coding-agent/test/auth-storage.test.ts
+++ b/packages/coding-agent/test/auth-storage.test.ts
@@ -5,7 +5,6 @@ import { registerOAuthProvider } from "@earendil-works/pi-ai/oauth";
import lockfile from "proper-lockfile";
import { afterEach, beforeEach, describe, expect, test, vi } from "vitest";
import { AuthStorage } from "../src/core/auth-storage.js";
-import { clearConfigValueCache } from "../src/core/resolve-config-value.js";
describe("AuthStorage", () => {
let tempDir: string;
@@ -22,7 +21,6 @@ describe("AuthStorage", () => {
if (tempDir && existsSync(tempDir)) {
rmSync(tempDir, { recursive: true });
}
- clearConfigValueCache();
vi.restoreAllMocks();
});
@@ -835,26 +833,6 @@ describe("AuthStorage", () => {
expect(count).toBe(1);
});
- test("clearConfigValueCache allows command to run again", async () => {
- const counterFile = join(tempDir, "counter");
- writeFileSync(counterFile, "0");
-
- const counterPath = toShPath(counterFile);
- const command = `!sh -c 'count=$(cat "${counterPath}"); echo $((count + 1)) > "${counterPath}"; echo "key-value"'`;
- writeAuthJson({
- anthropic: { type: "api_key", key: command },
- });
-
- authStorage = AuthStorage.create(authJsonPath);
- await authStorage.getApiKey("anthropic");
-
- clearConfigValueCache();
- await authStorage.getApiKey("anthropic");
-
- const count = parseInt(readFileSync(counterFile, "utf-8").trim(), 10);
- expect(count).toBe(2);
- });
-
test("different commands are cached separately", async () => {
writeAuthJson({
anthropic: { type: "api_key", key: "!echo key-anthropic" },
diff --git a/packages/coding-agent/test/model-registry.test.ts b/packages/coding-agent/test/model-registry.test.ts
index 4add0e701b..0afca0a61f 100644
--- a/packages/coding-agent/test/model-registry.test.ts
+++ b/packages/coding-agent/test/model-registry.test.ts
@@ -6,7 +6,7 @@ import { getApiProvider } from "@earendil-works/pi-ai";
import { getOAuthProvider, registerOAuthProvider } from "@earendil-works/pi-ai/oauth";
import { afterEach, beforeEach, describe, expect, test } from "vitest";
import { AuthStorage } from "../src/core/auth-storage.js";
-import { clearApiKeyCache, ModelRegistry, type ProviderConfigInput } from "../src/core/model-registry.js";
+import { ModelRegistry, type ProviderConfigInput } from "../src/core/model-registry.js";
describe("ModelRegistry", () => {
let tempDir: string;
@@ -24,7 +24,6 @@ describe("ModelRegistry", () => {
if (tempDir && existsSync(tempDir)) {
rmSync(tempDir, { recursive: true });
}
- clearApiKeyCache();
});
function providerConfig(