Skip to content

Commit 08e48d9

Browse files
Copilotpelikhan
andauthored
Remove unnecessary template-rendering try/catch
Co-authored-by: pelikhan <4175913+pelikhan@users.noreply.github.com>
1 parent ec9440c commit 08e48d9

1 file changed

Lines changed: 11 additions & 24 deletions

File tree

actions/setup/js/handle_agent_failure.cjs

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -1253,30 +1253,17 @@ function buildToolDenialsExceededContext(events, workflowId) {
12531253
// collapsed to a single-line summary so the issue body renders cleanly.
12541254
const normalizedReason = normalizeDeniedPermissionCommand(reason);
12551255

1256-
try {
1257-
const templatePath = getPromptPath("tool_denials_exceeded_context.md");
1258-
const template = fs.readFileSync(templatePath, "utf8");
1259-
return (
1260-
"\n" +
1261-
renderTemplate(template, {
1262-
denial_count: denialCount,
1263-
threshold,
1264-
reason: normalizedReason,
1265-
workflow_id: workflowId || "the workflow",
1266-
})
1267-
);
1268-
} catch {
1269-
return (
1270-
buildWarningAlertLine("Excessive Tool Denials", `The Copilot SDK stopped the session after ${denialCount}/${threshold} permission denials.`) +
1271-
"<details>\n" +
1272-
"<summary><strong>Last denied request</strong></summary>\n\n" +
1273-
"```text\n" +
1274-
`${normalizedReason}\n` +
1275-
"```\n\n" +
1276-
"</details>\n\n" +
1277-
"This is a guardrail stop (`guard.tool_denials_exceeded`) and indicates the workflow's allowed tool set does not match the prompt's requested actions.\n"
1278-
);
1279-
}
1256+
const templatePath = getPromptPath("tool_denials_exceeded_context.md");
1257+
const template = fs.readFileSync(templatePath, "utf8");
1258+
return (
1259+
"\n" +
1260+
renderTemplate(template, {
1261+
denial_count: denialCount,
1262+
threshold,
1263+
reason: normalizedReason,
1264+
workflow_id: workflowId || "the workflow",
1265+
})
1266+
);
12801267
}
12811268

12821269
/**

0 commit comments

Comments
 (0)