mirror of
https://github.com/moltbot/moltbot.git
synced 2026-05-07 07:58:36 +00:00
Rename Codex runtime prompt snapshot directory (#76274)
* test: rename Codex runtime prompt snapshots * test: refresh prompt snapshots with node24 * test: format prompt snapshot markdown in generator
This commit is contained in:
@@ -568,9 +568,7 @@ Full JSON: `codex-dynamic-tools.discord-group.json`
|
||||
"type": "string"
|
||||
},
|
||||
"action": {
|
||||
"enum": [
|
||||
"send"
|
||||
],
|
||||
"enum": ["send"],
|
||||
"type": "string"
|
||||
},
|
||||
"activityName": {
|
||||
@@ -938,9 +936,7 @@ Full JSON: `codex-dynamic-tools.discord-group.json`
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
],
|
||||
"required": ["action"],
|
||||
"type": "object"
|
||||
},
|
||||
"name": "message"
|
||||
@@ -545,9 +545,7 @@ Full JSON: `codex-dynamic-tools.telegram-direct.json`
|
||||
"type": "string"
|
||||
},
|
||||
"action": {
|
||||
"enum": [
|
||||
"send"
|
||||
],
|
||||
"enum": ["send"],
|
||||
"type": "string"
|
||||
},
|
||||
"activityName": {
|
||||
@@ -915,9 +913,7 @@ Full JSON: `codex-dynamic-tools.telegram-direct.json`
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
],
|
||||
"required": ["action"],
|
||||
"type": "object"
|
||||
},
|
||||
"name": "message"
|
||||
@@ -547,9 +547,7 @@ Full JSON: `codex-dynamic-tools.heartbeat-turn.json`
|
||||
"type": "string"
|
||||
},
|
||||
"action": {
|
||||
"enum": [
|
||||
"send"
|
||||
],
|
||||
"enum": ["send"],
|
||||
"type": "string"
|
||||
},
|
||||
"activityName": {
|
||||
@@ -917,9 +915,7 @@ Full JSON: `codex-dynamic-tools.heartbeat-turn.json`
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"action"
|
||||
],
|
||||
"required": ["action"],
|
||||
"type": "object"
|
||||
},
|
||||
"name": "message"
|
||||
@@ -939,21 +935,11 @@ Full JSON: `codex-dynamic-tools.heartbeat-turn.json`
|
||||
"type": "boolean"
|
||||
},
|
||||
"outcome": {
|
||||
"enum": [
|
||||
"no_change",
|
||||
"progress",
|
||||
"done",
|
||||
"blocked",
|
||||
"needs_attention"
|
||||
],
|
||||
"enum": ["no_change", "progress", "done", "blocked", "needs_attention"],
|
||||
"type": "string"
|
||||
},
|
||||
"priority": {
|
||||
"enum": [
|
||||
"low",
|
||||
"normal",
|
||||
"high"
|
||||
],
|
||||
"enum": ["low", "normal", "high"],
|
||||
"type": "string"
|
||||
},
|
||||
"reason": {
|
||||
@@ -963,11 +949,7 @@ Full JSON: `codex-dynamic-tools.heartbeat-turn.json`
|
||||
"type": "string"
|
||||
}
|
||||
},
|
||||
"required": [
|
||||
"outcome",
|
||||
"notify",
|
||||
"summary"
|
||||
],
|
||||
"required": ["outcome", "notify", "summary"],
|
||||
"type": "object"
|
||||
},
|
||||
"name": "heartbeat_respond"
|
||||
@@ -23,7 +23,8 @@ import { normalizeAgentRuntimeTools } from "../../../src/plugin-sdk/agent-harnes
|
||||
import { createOpenClawCodingTools } from "../../../src/plugin-sdk/agent-harness.js";
|
||||
import { loadBundledPluginTestApiSync } from "../../../src/test-utils/bundled-plugin-public-surface.js";
|
||||
|
||||
export const HAPPY_PATH_PROMPT_SNAPSHOT_DIR = "test/fixtures/agents/prompt-snapshots/happy-path";
|
||||
export const CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR =
|
||||
"test/fixtures/agents/prompt-snapshots/codex-runtime-happy-path";
|
||||
export const CODEX_MODEL_PROMPT_FIXTURE_DIR =
|
||||
"test/fixtures/agents/prompt-snapshots/codex-model-catalog";
|
||||
|
||||
@@ -697,8 +698,14 @@ function renderReadme(scenarios: PromptScenario[]): string {
|
||||
"",
|
||||
"Codex model prompt fixtures:",
|
||||
"",
|
||||
`- ${path.relative(HAPPY_PATH_PROMPT_SNAPSHOT_DIR, CODEX_MODEL_PROMPT_FIXTURE_PATH)}`,
|
||||
`- ${path.relative(HAPPY_PATH_PROMPT_SNAPSHOT_DIR, CODEX_MODEL_PROMPT_SOURCE_PATH)}`,
|
||||
`- ${path.relative(
|
||||
CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR,
|
||||
CODEX_MODEL_PROMPT_FIXTURE_PATH,
|
||||
)}`,
|
||||
`- ${path.relative(
|
||||
CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR,
|
||||
CODEX_MODEL_PROMPT_SOURCE_PATH,
|
||||
)}`,
|
||||
"",
|
||||
].join("\n");
|
||||
}
|
||||
@@ -707,15 +714,15 @@ export function createHappyPathPromptSnapshotFiles(): PromptSnapshotFile[] {
|
||||
const scenarios = createScenarios();
|
||||
return [
|
||||
{
|
||||
path: path.join(HAPPY_PATH_PROMPT_SNAPSHOT_DIR, "README.md"),
|
||||
path: path.join(CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR, "README.md"),
|
||||
content: renderReadme(scenarios),
|
||||
},
|
||||
...scenarios.map((scenario) => ({
|
||||
path: path.join(HAPPY_PATH_PROMPT_SNAPSHOT_DIR, `${scenario.id}.md`),
|
||||
path: path.join(CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR, `${scenario.id}.md`),
|
||||
content: renderScenarioSnapshot(scenario),
|
||||
})),
|
||||
...scenarios.map((scenario) => ({
|
||||
path: path.join(HAPPY_PATH_PROMPT_SNAPSHOT_DIR, scenario.toolSnapshotFile),
|
||||
path: path.join(CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR, scenario.toolSnapshotFile),
|
||||
content: stableJson(scenario.dynamicTools),
|
||||
})),
|
||||
].map((file) => ({
|
||||
|
||||
@@ -14,7 +14,7 @@ import {
|
||||
} from "../../scripts/sync-codex-model-prompt-fixture.js";
|
||||
import {
|
||||
CODEX_MODEL_PROMPT_FIXTURE_DIR,
|
||||
HAPPY_PATH_PROMPT_SNAPSHOT_DIR,
|
||||
CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR,
|
||||
} from "../helpers/agents/happy-path-prompt-snapshots.js";
|
||||
|
||||
describe("happy path prompt snapshots", () => {
|
||||
@@ -25,22 +25,25 @@ describe("happy path prompt snapshots", () => {
|
||||
expect(fs.readFileSync(file.path, "utf8"), file.path).toBe(file.content);
|
||||
}
|
||||
const committed = fs
|
||||
.readdirSync(HAPPY_PATH_PROMPT_SNAPSHOT_DIR)
|
||||
.readdirSync(CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR)
|
||||
.filter((entry) => entry.endsWith(".md") || entry.endsWith(".json"))
|
||||
.map((entry) => path.join(HAPPY_PATH_PROMPT_SNAPSHOT_DIR, entry));
|
||||
.map((entry) => path.join(CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR, entry));
|
||||
expect(committed.toSorted()).toEqual([...expectedPaths].toSorted());
|
||||
});
|
||||
|
||||
it("deletes stale generated snapshot artifacts", async () => {
|
||||
const root = fs.mkdtempSync(path.join(os.tmpdir(), "openclaw-prompt-snapshot-stale-"));
|
||||
try {
|
||||
const snapshotDir = path.join(root, HAPPY_PATH_PROMPT_SNAPSHOT_DIR);
|
||||
const snapshotDir = path.join(root, CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR);
|
||||
fs.mkdirSync(snapshotDir, { recursive: true });
|
||||
const stalePath = path.join(HAPPY_PATH_PROMPT_SNAPSHOT_DIR, "stale-snapshot.md");
|
||||
const stalePath = path.join(
|
||||
CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR,
|
||||
"stale-snapshot.md",
|
||||
);
|
||||
fs.writeFileSync(path.join(root, stalePath), "stale\n");
|
||||
|
||||
const deleted = await deleteStalePromptSnapshotFiles(root, [
|
||||
{ path: path.join(HAPPY_PATH_PROMPT_SNAPSHOT_DIR, "current.md") },
|
||||
{ path: path.join(CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR, "current.md") },
|
||||
]);
|
||||
|
||||
expect(deleted).toEqual([stalePath]);
|
||||
|
||||
Reference in New Issue
Block a user