debug: add prefix template resolution logging

This commit is contained in:
Sebastian
2026-01-14 23:15:46 -05:00
parent d0a4cce41e
commit 7b04e6ac42
2 changed files with 11 additions and 0 deletions

View File

@@ -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,

View File

@@ -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,