fix(honcho): flatten multimodal list content in sync_turn (#30252) - #30294
fix(honcho): flatten multimodal list content in sync_turn (#30252)#30294Bartok9 wants to merge 1 commit into
Conversation
|
Competing fix with #30264, #22768, and #26484 — all add multimodal list content flattening to Honcho |
|
Closing to stay within contributor PR limit. Will resubmit with fresh rebase if the issue remains open in main. |
…ch#30252) OpenAI-style multimodal user messages carry content as a list: [{"type": "text", "text": "..."}, {"type": "image_url", ...}] Previously, sync_turn called sanitize_context(user_content or "") directly on this list value, causing: TypeError: expected string or bytes-like object, got 'list' The exception was silently swallowed by the _sync() wrapper and the vision turn was dropped from Honcho's memory entirely. Fix: add a _flatten_content() static method that: - passes plain strings through unchanged - joins text parts with a space - replaces image_url/image blocks with the literal placeholder [image] - uses a generic [<type>] placeholder for any unknown block types sync_turn now accepts Union[str, list, None] for both arguments and routes them through _flatten_content() before sanitise_context(). Fixes NousResearch#30252
d34f7d3 to
b281340
Compare
|
This appears to be fixed on current main by the centralized memory-sync normalization work. Evidence from this automated hermes-sweeper review:
Thanks for the focused Honcho patch and the tests. The final implementation landed at the shared memory boundary, so the same class of multimodal sync issue is handled for all memory providers rather than only Honcho. |
Problem
HonchoMemoryProvider.sync_turnerrors when called with OpenAI-style multimodal list content (the shape used for vision turns):The call
sanitize_context(user_content or "")receives alist, raising:The exception is caught silently by the
_sync()wrapper and the turn is silently dropped from Honcho's memory — the user representation never learns about anything visual the assistant was shown.Closes #30252.
Fix
Add a
_flatten_content()static method that normalises list-shaped content to a plain string before sanitisation:textparts are joined with a spaceimage_url/imageparts become the literal placeholder[image][<type>]sync_turnnow acceptsstr | list | Nonefor both arguments.Tests
5 new tests in
TestSyncTurnMultimodalContent:[image]placeholderNonecontent does not raise_flatten_contentstatic method handles all known block typesAll 120 existing honcho plugin tests pass.