fix(memory-islands): resolve folder_id from payload metadata (regression tests + fix) - #14
Open
skorphil wants to merge 1 commit into
Conversation
…regression tests OWUI's /api/chat/completions handler pops folder_id and chat_id out of the top-level form_data and re-injects them into body['metadata'] (keys metadata.folder_id, metadata.chat_id, metadata.user_id). The filter inlet therefore never sees top-level folder_id/chat_id, so _resolve_folder always returned None and chats inside a folder were wrongly treated as Global Workspace (e.g. /island-guidelines emitted the 'outside folder' guidance). Read folder_id/chat_id from body['metadata'] first, falling back to legacy top-level keys and the Chats model. Verified against a running OWUI 0.11.0 container: Chats.get_chat_folder_id is async. Tests now use the real payload shape (metadata carries the IDs; top-level is absent) and lock the resolution behavior: metadata folder_id wins, Chats-model fallback uses metadata.chat_id, and global workspace returns None so the command handler only emits the outside-folder guidance in that case.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes the reported bug where a chat inside a folder was treated as Global Workspace. Root cause: OWUI pops folder_id/chat_id out of top-level form_data into body[metadata] in /api/chat/completions. Tests lock the realistic payload shape (metadata carries IDs, top-level absent) and the fix reads metadata first with Chats-model fallback. Verified against running OWUI 0.11.0 container. Results: 5 failures before fix, 35 passed + 1 skipped after; ruff clean.