core/text: a template that cannot render a conversation is refused at load, not thrown

ChatTemplate::load ran the thinking probe, the first full render, outside any handler; a template
that compiles but fails in the reply-format analysis (here llama.cpp's own DeepSeek-V4.1 template,
which calls dict()) threw out of load and ended the process. It is now RAD_E_FORMAT with the
template's words, as a failing render already is per request.
This commit is contained in:
baKon authored and StillDeadcode committed 2026-10-27 18:15:58 +01:00
1 parent fa8c746497
commit 70639f7ea2
2 files changed
+33 -9

No files matched your search

+10
View File
@@ -1150,6 +1150,16 @@ TEST(a_template_that_does_not_parse_is_a_value_and_not_a_throw) {
CHECK(!t.ready());
}
/* A template that compiles but cannot render a conversation (here it calls a function the engine
* does not have) is refused at load as a value too: the first full render, the thinking probe,
* used to throw out of load() and end the process. */
TEST(a_template_that_cannot_render_is_refused_at_load_and_not_thrown) {
ChatTemplate t;
CHECK(t.load("{%- for m in messages -%}{{- dict(m, x=1).content -}}{%- endfor -%}", "", "") ==
RAD_E_FORMAT);
CHECK(!t.ready());
}
/* Messages come from an HTTP request, so any malformed shape is refused, never thrown. */
TEST(a_message_list_that_is_not_one_is_refused_rather_than_thrown) {
ChatTemplate t;