Skip to content

Commit 47ad9b4

Browse files
committed
server: filter malformed tool-call text in final responses
1 parent 73d4d12 commit 47ad9b4

2 files changed

Lines changed: 2 additions & 1 deletion

File tree

tests/test-dflash-plumbing.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,7 @@ int main(int argc, char ** argv) {
719719
ok &= expect(server_context.find("llama_dflash_rollback(ctx, slot.id, seq_backup, slot.n_pos_before_draft, n_hidden_keep)") != std::string::npos, "DFlash rollback must use the hidden-state keep count at grammar boundaries");
720720
ok &= expect(server_context.find("dflash_suppressed_for_reasoning_tool_marker") != std::string::npos, "server must disable DFlash after raw tool markers inside hidden reasoning without steering generation");
721721
ok &= expect(server_task.find("state.update_chat_msg(content, true, oaicompat_msg_diffs, true)") != std::string::npos, "streaming responses must filter partial tool-call deltas");
722+
ok &= expect(server_task.find("state.update_chat_msg(content, false, oaicompat_msg_diffs, true)") != std::string::npos, "final tool-parsing responses must filter malformed raw tool-call text too");
722723
ok &= expect(server_task.find("task_result_has_complete_partial_tool_calls") != std::string::npos, "streaming responses must allow complete tool-call deltas before final EOS");
723724
ok &= expect(server_task.find("task_result_filter_incomplete_partial_tool_calls") != std::string::npos, "streaming responses must expose stable tool-call headers without partial arguments");
724725
ok &= expect(server_task.find("A partial stream may expose the stable tool name/id for UX") != std::string::npos, "partial tool-call streaming must document the header-only reliability boundary");

tools/server/server-task.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -388,7 +388,7 @@ struct server_task_result_cmpl_final : server_task_result {
388388

389389
virtual void update(task_result_state & state) override {
390390
is_updated = true;
391-
oaicompat_msg = state.update_chat_msg(content, false, oaicompat_msg_diffs, stream);
391+
oaicompat_msg = state.update_chat_msg(content, false, oaicompat_msg_diffs, true);
392392

393393
oai_resp_id = state.oai_resp_id;
394394
oai_resp_reasoning_id = state.oai_resp_reasoning_id;

0 commit comments

Comments
 (0)