Defer Codex dynamic tools behind search

Defer OpenClaw Codex dynamic tools behind Codex tool_search, keep required turn-control tools direct, pin the managed Codex harness to 0.129.0-alpha.15, and document the real behavior/token impact from the live dev-agent watch.
This commit is contained in:
pashpashpash
2026-05-07 16:40:37 -07:00
committed by GitHub
parent e984a99c7e
commit 3f217964d1
24 changed files with 428 additions and 331 deletions

View File

@@ -46,7 +46,6 @@ const CODEX_YOLO_PERMISSION_INSTRUCTIONS = [
"Approval policy is currently never. Do not provide the `sandbox_permissions` for any reason, commands will be rejected.",
].join("\n");
const HAPPY_PATH_TOOL_NAMES = new Set([
"canvas",
"nodes",
"cron",
"message",
@@ -84,6 +83,7 @@ type CodexPromptSnapshotApi = {
createCodexDynamicToolSpecsForPromptSnapshot: (params: {
tools: AnyAgentTool[];
pluginConfig?: { codexDynamicToolsProfile?: "native-first" | "openclaw-compat" };
directToolNames?: string[];
}) => CodexDynamicToolSpec[];
};
@@ -320,7 +320,6 @@ function createDynamicTools(params: {
agentId: "main",
workspaceDir: WORKSPACE_DIR,
agentDir: AGENT_DIR,
config: baseConfig,
sessionKey: params.ctx.SessionKey,
sessionId: `session-tools-${params.trigger}`,
runId: `run-tools-${params.trigger}`,
@@ -361,6 +360,7 @@ function createDynamicTools(params: {
return codexApi.createCodexDynamicToolSpecsForPromptSnapshot({
tools: normalized.filter((tool) => HAPPY_PATH_TOOL_NAMES.has(tool.name)),
pluginConfig: { codexDynamicToolsProfile: "native-first" },
directToolNames: ["message"],
});
}
@@ -486,8 +486,8 @@ function createScenarios(): PromptScenario[] {
id: "telegram-heartbeat-codex-tool",
title: "Telegram Direct Codex Heartbeat Tool Turn",
notes: [
"Heartbeat happy path: Codex receives the structured `heartbeat_respond` dynamic tool because `messages.visibleReplies` is `message_tool`.",
"The heartbeat tool carries the notify/no-notify decision, outcome, summary, and optional notification text instead of relying only on final-text parsing.",
"Heartbeat happy path: Codex receives the structured `heartbeat_respond` dynamic tool in the searchable catalog instead of the initial tool context.",
"The heartbeat tool still carries the notify/no-notify decision, outcome, summary, and optional notification text instead of relying only on final-text parsing.",
],
trigger: "heartbeat",
ctx: heartbeatCtx,
@@ -756,7 +756,7 @@ function renderReadme(scenarios: PromptScenario[]): string {
"",
"- OpenAI model through the Codex harness and Codex app-server runtime.",
'- `messages.visibleReplies: "message_tool"`, which is the Codex-harness default for visible source replies.',
"- Telegram direct chat, Discord group chat, and a heartbeat turn with `heartbeat_respond` available.",
"- Telegram direct chat, Discord group chat, and a heartbeat turn with `heartbeat_respond` available through searchable dynamic tools.",
"",
"The Markdown files show selected app-server thread/turn params plus a reconstructed model-bound prompt layer stack: Codex `gpt-5.5` model instructions from a pinned Codex model catalog fixture, Codex permission developer instructions for the happy-path yolo profile, simulated OpenClaw workspace bootstrap config instructions, OpenClaw developer instructions, user turn input, and references to the complete dynamic tool catalog.",
"",
@@ -799,7 +799,7 @@ function renderReadme(scenarios: PromptScenario[]): string {
export function createHappyPathPromptSnapshotFiles(): PromptSnapshotFile[] {
const scenarios = createScenarios();
return [
const files = [
{
path: path.join(CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR, "README.md"),
content: renderReadme(scenarios),
@@ -812,8 +812,9 @@ export function createHappyPathPromptSnapshotFiles(): PromptSnapshotFile[] {
path: path.join(CODEX_RUNTIME_HAPPY_PATH_PROMPT_SNAPSHOT_DIR, scenario.toolSnapshotFile),
content: stableJson(scenario.dynamicTools),
})),
].map((file) => ({
...file,
];
return files.map((file) => ({
path: file.path,
content: file.content.endsWith("\n") ? file.content : `${file.content}\n`,
}));
}