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