feat(agents): add centralized GPT apply_patch permission guard
Extract hardcoded GPT apply_patch permission logic into a reusable module
to ensure consistent behavior across all agents. This prevents GPT models
from using the unreliable apply_patch tool while allowing other models.
- Add gpt-apply-patch-guard.ts with GPT_APPLY_PATCH_GUIDANCE and getGptApplyPatchPermission
- Update Hephaestus agent to use centralized permission logic
- Update Sisyphus-Junior agent to use centralized permission logic
- Update all GPT prompt builders to reference shared guidance constant
🤖 Generated with assistance of OhMyOpenCode
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
import type { AgentConfig } from "@opencode-ai/sdk";
|
||||
import type { AgentMode, AgentPromptMetadata } from "../types";
|
||||
import { isGptModel, isGpt5_4Model, isGpt5_3CodexModel } from "../types";
|
||||
import { isGpt5_4Model, isGpt5_3CodexModel } from "../types";
|
||||
import type {
|
||||
AvailableAgent,
|
||||
AvailableTool,
|
||||
@@ -8,6 +8,7 @@ import type {
|
||||
AvailableCategory,
|
||||
} from "../dynamic-agent-prompt-builder";
|
||||
import { categorizeTools, buildAgentIdentitySection } from "../dynamic-agent-prompt-builder";
|
||||
import { getGptApplyPatchPermission } from "../gpt-apply-patch-guard";
|
||||
|
||||
import { buildHephaestusPrompt as buildGptPrompt } from "./gpt";
|
||||
import { buildHephaestusPrompt as buildGpt53CodexPrompt } from "./gpt-5-3-codex";
|
||||
@@ -125,7 +126,7 @@ export function createHephaestusAgent(
|
||||
permission: {
|
||||
question: "allow",
|
||||
call_omo_agent: "deny",
|
||||
...(isGptModel(model) ? { apply_patch: "deny" as const } : {}),
|
||||
...getGptApplyPatchPermission(model),
|
||||
} as AgentConfig["permission"],
|
||||
reasoningEffort: "medium",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user