Skip to content

llama-server: text never carries the media marker (#98) - #112

Merged
cobanov merged 2 commits into
cobanov:mainfrom
MCsumz:media-marker-never-in-text
Nov 25, 2026
Merged

cobanov merged 2 commits into
cobanov:mainfrom
MCsumz:media-marker-never-in-text

Conversation

@MCsumz

@MCsumz MCsumz commented Nov 23, 2026

Copy link
Copy Markdown
Contributor

First of the three from #98. patches/0022: 0021 went to #111 this morning.

/props publishes the marker that stands for an image in the prompt, so a tool that read /props put it into the chat. mtmd then expected one image more than the request had, and that request and every later one in the chat failed with "Failed to tokenize prompt" (HTTP 400). patches/0022 writes the marker as [media marker] in all message text and tool definitions, before the images get theirs.

Check Result
scripts/apply-patches.sh on 970b51c, after 0001-0018 and patches/fleet applies; a second pass skips it
tests/server_media_marker_test.py (new, in test-fleet.sh) passes; fails without the server-common.cpp change
Console, memfix8 on the same pin (PS5 Fat, Qwen3.5-9B + mmproj, 64k) /props in a message, as a tool result, an image, and an image with the marker in its text: all answered (before: HTTP 400)

I haven't checked it against #103 (b12600) yet, since that's still a draft.

🤖 Generated with Claude Code

/props publishes the marker that stands for an image in the prompt, so a
tool that read /props put it into a chat. mtmd then expected one image more
than the request had, and that request and every later one in the chat
failed with "Failed to tokenize prompt" (HTTP 400). patches/0022 writes the
marker as [media marker] in all message text and tool definitions before
the images get theirs.

tests/server_media_marker_test.py, run by scripts/test-fleet.sh, sends the
marker in a user message, a tool result and a tool definition to
/apply-template and checks that it reaches the prompt only as
[media marker], and that chat, messages and responses still answer.

Applied on llama.cpp 970b51c after patches 0001-0018 and patches/fleet; a
second pass of scripts/apply-patches.sh skips it. On macOS the new test
passes, and fails without the server-common.cpp change. On the console with
memfix8 (same pin): /props in a message, as a tool result, an image, and an
image with the marker in its text were all answered (before: HTTP 400).
From github.com/MCsumz/PS5LM-memfix.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01Dem3SmAW35vh3Kc6DxfxPm
# Conflicts:
#	CHANGELOG.md

@cobanov cobanov left a comment

Copy link
Copy Markdown
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks @MCsumz, this checks out. 0022 is the next free number, and it applies on d2bceda3d after #103's patches as well as on the old pin. The marker is stripped before oaicompat_content_load_media puts the real markers in, and tool definitions are covered too. The /apply-template check fails without the change, and your console runs cover the mtmd side.

I merged main into the branch (a CHANGELOG conflict only), so CI now runs on the new pin. I'll merge once it's green.

One optional thing: taking the string by j.get_ref<const std::string &>() for the find would save copying every base64 image string.

@cobanov
cobanov merged commit 9766ad9 into cobanov:main Nov 25, 2026
3 checks passed
MCsumz added a commit to MCsumz/PS5LM-memfix that referenced this pull request Nov 27, 2026
…stream

docs/UPSTREAM-TESTS.md: the 27 November runs, main 5e96235 on the PS5
Pro and main + cobanov#114 + cobanov#117 on the PS5 Fat. The README's fix table now
says where each fix is upstream: the heap (cobanov#110), the keep-alive fix
(with the llama.cpp move, cobanov#103), the Qwen3.5 cache (cobanov#88) and the media
marker (cobanov#112) are on main; the scratch fix is next.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants