fix(agents): clear stale frontier tool denies

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 13:51:16 +09:00
parent 8a49a03100
commit 467248535e
5 changed files with 177 additions and 10 deletions
@@ -8,7 +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"
import { applyFrontierToolSchemaPermission } from "../frontier-tool-schema-guard"
export function maybeCreateHephaestusConfig(input: {
disabledAgents: string[]
@@ -90,10 +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)
}
hephaestusConfig.permission = applyFrontierToolSchemaPermission(
hephaestusConfig.permission,
resolvedModel,
hephaestusOverride?.permission
)
const gptDeny = getGptApplyPatchPermission(resolvedModel)
if (Object.keys(gptDeny).length > 0 && hephaestusConfig.permission) {
@@ -143,6 +143,75 @@ describe("maybeCreateSisyphusConfig", () => {
});
});
describe("#given frontier default model with category override to non-frontier model", () => {
test("#when config is created #then stale grep and glob denies are cleared", () => {
// given
const agentOverrides: AgentOverrides = {
sisyphus: {
category: "non-frontier",
},
};
const mergedCategories: Record<string, CategoryConfig> = {
"non-frontier": {
model: "openai/gpt-5.4",
},
};
// when
const config = maybeCreateSisyphusConfig({
disabledAgents: [],
agentOverrides,
availableModels: new Set(["anthropic/claude-opus-4-7", "openai/gpt-5.4"]),
systemDefaultModel: "anthropic/claude-opus-4-7",
isFirstRunNoCache: false,
availableAgents: [],
availableSkills: [],
availableCategories: [],
mergedCategories,
useTaskSystem: false,
});
// then
expect(config?.model).toBe("openai/gpt-5.4");
expect(config?.permission).not.toHaveProperty("grep");
expect(config?.permission).not.toHaveProperty("glob");
});
});
describe("#given non-frontier model with user override denying grep and glob", () => {
test("#when config is created #then explicit user denies are preserved", () => {
// given
const agentOverrides: AgentOverrides = {
sisyphus: {
model: "openai/gpt-5.4",
permission: {
grep: "deny",
glob: "deny",
} as Record<string, "deny">,
},
};
const mergedCategories: Record<string, CategoryConfig> = {};
// when
const config = maybeCreateSisyphusConfig({
disabledAgents: [],
agentOverrides,
availableModels: new Set(["openai/gpt-5.4"]),
systemDefaultModel: "openai/gpt-5.4",
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
+6 -5
View File
@@ -8,7 +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"
import { applyFrontierToolSchemaPermission } from "../frontier-tool-schema-guard"
export function maybeCreateSisyphusConfig(input: {
disabledAgents: string[]
@@ -84,10 +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)
}
sisyphusConfig.permission = applyFrontierToolSchemaPermission(
sisyphusConfig.permission,
resolvedModel,
sisyphusOverride?.permission
)
const gptDeny = getGptApplyPatchPermission(resolvedModel)
if (Object.keys(gptDeny).length > 0 && sisyphusConfig.permission) {