fix(agents): hide grep glob for frontier agents

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
YeonGyu-Kim
2026-04-27 12:49:20 +09:00
parent f74d03ca90
commit c46b712997
8 changed files with 222 additions and 6 deletions
@@ -8,6 +8,7 @@ import { applyEnvironmentContext } from "./environment-context"
import { applyCategoryOverride, mergeAgentConfig } from "./agent-overrides"
import { applyModelResolution, getFirstFallbackModel } from "./model-resolution"
import { getGptApplyPatchPermission } from "../gpt-apply-patch-guard"
import { getFrontierToolSchemaPermission } from "../frontier-tool-schema-guard"
export function maybeCreateHephaestusConfig(input: {
disabledAgents: string[]
@@ -89,6 +90,11 @@ export function maybeCreateHephaestusConfig(input: {
}
const resolvedModel = hephaestusConfig.model ?? ""
const frontierDeny = getFrontierToolSchemaPermission(resolvedModel)
if (Object.keys(frontierDeny).length > 0 && hephaestusConfig.permission) {
Object.assign(hephaestusConfig.permission, frontierDeny)
}
const gptDeny = getGptApplyPatchPermission(resolvedModel)
if (Object.keys(gptDeny).length > 0 && hephaestusConfig.permission) {
Object.assign(hephaestusConfig.permission, gptDeny)
@@ -1,3 +1,5 @@
/// <reference types="bun-types" />
import { describe, expect, test } from "bun:test";
import { maybeCreateSisyphusConfig } from "./sisyphus-agent";
import type { AgentOverrides } from "../types";
@@ -12,7 +14,7 @@ describe("maybeCreateSisyphusConfig", () => {
model: "openai/gpt-5.4",
permission: {
apply_patch: "allow",
},
} as Record<string, "allow">,
},
};
const mergedCategories: Record<string, CategoryConfig> = {};
@@ -46,7 +48,7 @@ describe("maybeCreateSisyphusConfig", () => {
model: "anthropic/claude-opus-4-7",
permission: {
apply_patch: "allow",
},
} as Record<string, "allow">,
},
};
const mergedCategories: Record<string, CategoryConfig> = {};
@@ -73,6 +75,74 @@ describe("maybeCreateSisyphusConfig", () => {
});
});
describe("#given Opus 4.7 model with user override allowing grep and glob", () => {
test("#when config is created #then grep and glob are still denied", () => {
// given
const agentOverrides: AgentOverrides = {
sisyphus: {
model: "anthropic/claude-opus-4-7",
permission: {
grep: "allow",
glob: "allow",
} as Record<string, "allow">,
},
};
const mergedCategories: Record<string, CategoryConfig> = {};
// when
const config = maybeCreateSisyphusConfig({
disabledAgents: [],
agentOverrides,
availableModels: new Set(["anthropic/claude-opus-4-7"]),
systemDefaultModel: "anthropic/claude-opus-4-7",
isFirstRunNoCache: false,
availableAgents: [],
availableSkills: [],
availableCategories: [],
mergedCategories,
useTaskSystem: false,
});
// then
expect(config?.permission).toHaveProperty("grep", "deny");
expect(config?.permission).toHaveProperty("glob", "deny");
});
});
describe("#given GPT 5.5 model with user override allowing grep and glob", () => {
test("#when config is created #then grep and glob are still denied", () => {
// given
const agentOverrides: AgentOverrides = {
sisyphus: {
model: "openai/gpt-5.5",
permission: {
grep: "allow",
glob: "allow",
} as Record<string, "allow">,
},
};
const mergedCategories: Record<string, CategoryConfig> = {};
// when
const config = maybeCreateSisyphusConfig({
disabledAgents: [],
agentOverrides,
availableModels: new Set(["openai/gpt-5.5"]),
systemDefaultModel: "openai/gpt-5.5",
isFirstRunNoCache: false,
availableAgents: [],
availableSkills: [],
availableCategories: [],
mergedCategories,
useTaskSystem: false,
});
// then
expect(config?.permission).toHaveProperty("grep", "deny");
expect(config?.permission).toHaveProperty("glob", "deny");
});
});
describe("#given generic GPT model with user override allowing apply_patch", () => {
test("#when config is created #then apply_patch is still denied", () => {
// given
@@ -81,7 +151,7 @@ describe("maybeCreateSisyphusConfig", () => {
model: "openai/gpt-4o",
permission: {
apply_patch: "allow",
},
} as Record<string, "allow">,
},
};
const mergedCategories: Record<string, CategoryConfig> = {};
@@ -8,6 +8,7 @@ import { applyOverrides } from "./agent-overrides"
import { applyModelResolution, getFirstFallbackModel } from "./model-resolution"
import { createSisyphusAgent } from "../sisyphus"
import { getGptApplyPatchPermission } from "../gpt-apply-patch-guard"
import { getFrontierToolSchemaPermission } from "../frontier-tool-schema-guard"
export function maybeCreateSisyphusConfig(input: {
disabledAgents: string[]
@@ -83,6 +84,11 @@ export function maybeCreateSisyphusConfig(input: {
sisyphusConfig = applyOverrides(sisyphusConfig, sisyphusOverride, mergedCategories, directory)
const resolvedModel = sisyphusConfig.model ?? ""
const frontierDeny = getFrontierToolSchemaPermission(resolvedModel)
if (Object.keys(frontierDeny).length > 0 && sisyphusConfig.permission) {
Object.assign(sisyphusConfig.permission, frontierDeny)
}
const gptDeny = getGptApplyPatchPermission(resolvedModel)
if (Object.keys(gptDeny).length > 0 && sisyphusConfig.permission) {
Object.assign(sisyphusConfig.permission, gptDeny)