fix: ignore tools.exec.pathPrepend for node hosts

This commit is contained in:
Peter Steinberger
2026-02-14 20:44:25 +01:00
parent 2fa78c17d1
commit e4d63818f5
3 changed files with 12 additions and 7 deletions

View File

@@ -316,7 +316,16 @@ export function createExecTool(
});
applyShellPath(env, shellPath);
}
applyPathPrepend(env, defaultPathPrepend);
// `tools.exec.pathPrepend` is only meaningful when exec runs locally (gateway) or in the sandbox.
// Node hosts intentionally ignore request-scoped PATH overrides, so don't pretend this applies.
if (host === "node" && defaultPathPrepend.length > 0) {
warnings.push(
"Warning: tools.exec.pathPrepend is ignored for host=node. Configure PATH on the node host/service instead.",
);
} else {
applyPathPrepend(env, defaultPathPrepend);
}
if (host === "node") {
const approvals = resolveExecApprovals(agentId, { security, ask });
@@ -362,10 +371,6 @@ export function createExecTool(
const argv = buildNodeShellCommand(params.command, nodeInfo?.platform);
const nodeEnv = params.env ? { ...params.env } : undefined;
if (nodeEnv) {
applyPathPrepend(nodeEnv, defaultPathPrepend, { requireExisting: true });
}
const baseAllowlistEval = evaluateShellAllowlist({
command: params.command,
allowlist: [],