From 7b04e6ac42ac62963ce033325a652e1bfc65689e Mon Sep 17 00:00:00 2001 From: Sebastian Date: Wed, 14 Jan 2026 23:15:46 -0500 Subject: [PATCH] debug: add prefix template resolution logging --- src/auto-reply/reply/agent-runner-execution.ts | 3 +++ src/auto-reply/reply/reply-dispatcher.ts | 8 ++++++++ 2 files changed, 11 insertions(+) diff --git a/src/auto-reply/reply/agent-runner-execution.ts b/src/auto-reply/reply/agent-runner-execution.ts index d1f0e276d..b580dcc4b 100644 --- a/src/auto-reply/reply/agent-runner-execution.ts +++ b/src/auto-reply/reply/agent-runner-execution.ts @@ -127,6 +127,9 @@ export async function runAgentTurnWithFallback(params: { run: (provider, model) => { // Notify that model selection is complete (including after fallback). // This allows responsePrefix template interpolation with the actual model. + logVerbose( + `[prefix-debug] onModelSelected firing: provider=${provider} model=${model} thinkLevel=${params.followupRun.run.thinkLevel}`, + ); params.opts?.onModelSelected?.({ provider, model, diff --git a/src/auto-reply/reply/reply-dispatcher.ts b/src/auto-reply/reply/reply-dispatcher.ts index b8eeca477..4a45161d8 100644 --- a/src/auto-reply/reply/reply-dispatcher.ts +++ b/src/auto-reply/reply/reply-dispatcher.ts @@ -75,6 +75,14 @@ function normalizeReplyPayloadInternal( // Prefer dynamic context provider over static context const prefixContext = opts.responsePrefixContextProvider?.() ?? opts.responsePrefixContext; + // Debug logging for prefix template resolution + if (opts.responsePrefix?.includes("{")) { + // eslint-disable-next-line no-console + console.log( + `[prefix-debug] normalizing with context: ${JSON.stringify(prefixContext)} prefix: ${opts.responsePrefix}`, + ); + } + return normalizeReplyPayload(payload, { responsePrefix: opts.responsePrefix, responsePrefixContext: prefixContext,