fix(agents): deny apply_patch for GPT models to prevent verification hangs (#2935)
GPT models (5.3-codex, 5.4, etc.) frequently hang when using apply_patch due to verification loops. This adds: 1. Tool restriction: apply_patch is denied for GPT variants of Hephaestus, Sisyphus-Junior, and Sisyphus agents 2. Prompt guidance: GPT-specific prompts now explicitly instruct using edit/write tools instead of apply_patch 3. Removed the 'Always use apply_patch' instruction from sisyphus-junior/gpt-5-4.ts that contradicted the fix The deny is model-conditional — Claude variants retain apply_patch access since it works reliably there.
This commit is contained in:
@@ -5,6 +5,7 @@ import { createExploreAgent } from "./explore"
|
||||
import { createMomusAgent } from "./momus"
|
||||
import { createMetisAgent } from "./metis"
|
||||
import { createAtlasAgent } from "./atlas"
|
||||
import { createSisyphusAgent } from "./sisyphus"
|
||||
|
||||
const TEST_MODEL = "anthropic/claude-sonnet-4-5"
|
||||
|
||||
@@ -111,4 +112,23 @@ describe("read-only agent tool restrictions", () => {
|
||||
expect(permission["call_omo_agent"]).toBeUndefined()
|
||||
})
|
||||
})
|
||||
|
||||
describe("Sisyphus GPT variants", () => {
|
||||
test("deny apply_patch for GPT models but not Claude models", () => {
|
||||
// given
|
||||
const gpt54Agent = createSisyphusAgent("openai/gpt-5.4")
|
||||
const gptGenericAgent = createSisyphusAgent("openai/gpt-5.2")
|
||||
const claudeAgent = createSisyphusAgent(TEST_MODEL)
|
||||
|
||||
// when
|
||||
const gpt54Permission = (gpt54Agent.permission ?? {}) as Record<string, string>
|
||||
const gptGenericPermission = (gptGenericAgent.permission ?? {}) as Record<string, string>
|
||||
const claudePermission = (claudeAgent.permission ?? {}) as Record<string, string>
|
||||
|
||||
// then
|
||||
expect(gpt54Permission["apply_patch"]).toBe("deny")
|
||||
expect(gptGenericPermission["apply_patch"]).toBe("deny")
|
||||
expect(claudePermission["apply_patch"]).toBeUndefined()
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user