refactor: dedupe enforceFinalTag resolution

This commit is contained in:
Peter Steinberger
2026-01-13 02:06:05 +00:00
parent eb6cace60f
commit c1f82d9ec1

View File

@@ -189,6 +189,9 @@ const appendUsageLine = (
return updated;
};
const resolveEnforceFinalTag = (run: FollowupRun["run"], provider: string) =>
Boolean(run.enforceFinalTag || isReasoningTagProvider(provider));
export async function runReplyAgent(params: {
commandBody: string;
followupRun: FollowupRun;
@@ -412,9 +415,7 @@ export async function runReplyAgent(params: {
prompt: memoryFlushSettings.prompt,
extraSystemPrompt: flushSystemPrompt,
ownerNumbers: followupRun.run.ownerNumbers,
enforceFinalTag:
followupRun.run.enforceFinalTag ||
isReasoningTagProvider(provider),
enforceFinalTag: resolveEnforceFinalTag(followupRun.run, provider),
provider,
model,
authProfileId: followupRun.run.authProfileId,
@@ -662,9 +663,10 @@ export async function runReplyAgent(params: {
prompt: commandBody,
extraSystemPrompt: followupRun.run.extraSystemPrompt,
ownerNumbers: followupRun.run.ownerNumbers,
enforceFinalTag:
followupRun.run.enforceFinalTag ||
isReasoningTagProvider(provider),
enforceFinalTag: resolveEnforceFinalTag(
followupRun.run,
provider,
),
provider,
model,
authProfileId: followupRun.run.authProfileId,