Wrap a resolved template so that rendering it can never render a silent blank:
format/formatPromptValue try the primary template and, on ANY render
error, log and re-render from the committed snapshot fallback. Rethrows only
if the fallback itself throws (the code is broken against its own committed
contract). This is the single choke point where every resolution path — and
so every consumer — gets the guarantee, without changing any call site: the
result still IS a BasePromptTemplate (a Proxy delegating everything except
the two render methods to primary).
Wrap a resolved template so that rendering it can never render a silent blank:
format/formatPromptValuetry theprimarytemplate and, on ANY render error, log and re-render from the committed snapshotfallback. Rethrows only if the fallback itself throws (the code is broken against its own committed contract). This is the single choke point where every resolution path — and so every consumer — gets the guarantee, without changing any call site: the result still IS aBasePromptTemplate(a Proxy delegating everything except the two render methods toprimary).