




















@@ -19,7 +19,7 @@ import {
1919finalizeHarnessContextEngineTurn,
2020formatPrePromptPrecheckLog,
2121formatErrorMessage,
22-hasBeforeToolCallPolicy,
22+getBeforeToolCallPolicyDiagnosticState,
2323isActiveHarnessContextEngine,
2424isSubagentSessionKey,
2525loadCodexBundleMcpThreadConfig,
@@ -946,6 +946,7 @@ export async function runCodexAppServerAttempt(
946946const pluginConfig = readCodexPluginConfig(options.pluginConfig);
947947const computerUseConfig = resolveCodexComputerUseConfig({ pluginConfig });
948948const configuredAppServer = resolveCodexAppServerRuntimeOptions({ pluginConfig });
949+const beforeToolCallPolicy = getBeforeToolCallPolicyDiagnosticState();
949950const resolvedWorkspace = resolveUserPath(params.workspaceDir);
950951await fs.mkdir(resolvedWorkspace, { recursive: true });
951952const sandboxSessionKey =
@@ -966,11 +967,21 @@ export async function runCodexAppServerAttempt(
966967appServer: configuredAppServer,
967968 pluginConfig,
968969env: process.env,
969-shouldPromote: hasBeforeToolCallPolicy(),
970+shouldPromote:
971+beforeToolCallPolicy.hasBeforeToolCallHook ||
972+beforeToolCallPolicy.trustedToolPolicies.length > 0,
970973canUseUntrustedApprovalPolicy:
971974configuredAppServer.start.transport !== "stdio" ||
972975isCodexAppServerApprovalPolicyAllowedByRequirements("untrusted"),
973976});
977+if (configuredAppServer.approvalPolicy === "never" && appServer.approvalPolicy === "untrusted") {
978+embeddedAgentLog.info("codex app-server approval policy promoted for OpenClaw tool policy", {
979+from: "never",
980+to: "untrusted",
981+beforeToolCallHook: beforeToolCallPolicy.hasBeforeToolCallHook,
982+trustedToolPolicies: beforeToolCallPolicy.trustedToolPolicies,
983+});
984+}
974985let pluginAppServer: CodexAppServerRuntimeOptions = appServer;
975986const nativeHookRelayEvents = resolveCodexNativeHookRelayEvents({
976987configuredEvents: options.nativeHookRelay?.events,
此内容由惯性聚合(RSS阅读器)自动聚合整理,仅供阅读参考。 原文来自 — 版权归原作者所有。