Commit 7ab4ee7ba for llama.cpp

commit 7ab4ee7baad2d920464cbacfad4f4b07cf111fd2
Author: Nicolas Mowen <nickmowen213@gmail.com>
Date:   Tue Sep 22 01:38:52 2026 -0600

    chat : Fix Muse Glimmer tool-call first parser error (#29242)

    * Fix Muse Glimmer tool-call first parser error

    * Add test to verify

    * Condense patterns

    * remove test for trigger patterns

diff --git a/common/parsers/muse-glimmer.cpp b/common/parsers/muse-glimmer.cpp
index add95697e..d03bf2d58 100644
--- a/common/parsers/muse-glimmer.cpp
+++ b/common/parsers/muse-glimmer.cpp
@@ -130,7 +130,7 @@ common_chat_params common_chat_params_init_muse_glimmer(const common_chat_templa
         });
         data.grammar_triggers = {
             { COMMON_GRAMMAR_TRIGGER_TYPE_PATTERN,
-              "<\\|start\\|>assistant( to=(?!self<\\|message\\|>)(?!user<\\|message\\|>)[^<]*?<\\|message\\|>)" },
+              "(?:^|<\\|start\\|>assistant)( to=(?!self<\\|message\\|>)(?!user<\\|message\\|>)[^<]*?<\\|message\\|>)" },
         };
     }

diff --git a/tests/test-chat.cpp b/tests/test-chat.cpp
index 13733c1d9..f2728f7cc 100644
--- a/tests/test-chat.cpp
+++ b/tests/test-chat.cpp
@@ -6357,6 +6357,14 @@ static void test_template_output_peg_parsers(bool detailed_debug) {
             .expect(message_assist)
             .run();

+        // A tool call as the first message of the turn: "<|start|>assistant" is the
+        // generation prompt, so the output starts at " to=".
+        tst.test(" to=special_function<|message|>" + call_markup)
+            .tools({ special_function_tool })
+            .reasoning_format(COMMON_REASONING_FORMAT_AUTO)
+            .expect(message_assist_call)
+            .run();
+
         // "Inform then act": the model answers the user and calls a tool in ONE generation,
         // closing the answer with <|eom|>. The answer must stop there rather than swallow it.
         tst.test(" to=user<|message|>Hello, world!\nWhat's up?<|eom|>"