mirror of
https://gitea.toothfairyai.com/ToothFairyAI/tf_code.git
synced 2026-04-01 06:42:26 +00:00
fix: permission checks for external_directory and doom_loop (#4433)
Co-authored-by: Aiden Cline <aidenpcline@gmail.com> Co-authored-by: AerionDyseti <AerionDyseti@users.noreply.github.com>
This commit is contained in:
@@ -136,6 +136,7 @@ export namespace SessionProcessor {
|
||||
|
||||
const parts = await MessageV2.parts(input.assistantMessage.id)
|
||||
const lastThree = parts.slice(-DOOM_LOOP_THRESHOLD)
|
||||
|
||||
if (
|
||||
lastThree.length === DOOM_LOOP_THRESHOLD &&
|
||||
lastThree.every(
|
||||
@@ -160,6 +161,17 @@ export namespace SessionProcessor {
|
||||
input: value.input,
|
||||
},
|
||||
})
|
||||
} else if (permission.doom_loop === "deny") {
|
||||
throw new Permission.RejectedError(
|
||||
input.assistantMessage.sessionID,
|
||||
"doom_loop",
|
||||
value.toolCallId,
|
||||
{
|
||||
tool: value.toolName,
|
||||
input: value.input,
|
||||
},
|
||||
`You seem to be stuck in a doom loop, please stop repeating the same action`,
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user