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:
@@ -6,6 +6,7 @@ import { getAgentConfigKey } from "../shared/agent-display-names"
|
||||
import { getSessionModel, setSessionModel } from "../shared/session-model-state"
|
||||
import { getMainSessionID, setSessionAgent, subagentSessions } from "../features/claude-code-session-state"
|
||||
import { applyUltraworkModelOverrideOnMessage } from "./ultrawork-model-override"
|
||||
import { NATIVE_LOOP_TRIGGERED_FLAG } from "./command-execute-before"
|
||||
import { parseRalphLoopArguments } from "../hooks/ralph-loop/command-arguments"
|
||||
|
||||
import type { CreatedHooks } from "../create-hooks"
|
||||
@@ -223,7 +224,7 @@ export function createChatMessageHandler(args: {
|
||||
.catch(() => {})
|
||||
}
|
||||
|
||||
if (hooks.ralphLoop) {
|
||||
if (hooks.ralphLoop && output.message[NATIVE_LOOP_TRIGGERED_FLAG] !== true) {
|
||||
const parts = output.parts
|
||||
const promptText =
|
||||
parts
|
||||
|
||||
Reference in New Issue
Block a user