Fix set_prompt_pom: build a PromptObjectModel from the section list#40
Open
jakubkarolczyk wants to merge 1 commit into
Open
Fix set_prompt_pom: build a PromptObjectModel from the section list#40jakubkarolczyk wants to merge 1 commit into
jakubkarolczyk wants to merge 1 commit into
Conversation
d5211b9 to
f5ea1a4
Compare
set_prompt_pom stored the raw list (self.agent.pom = pom), but the prompt renderer (_process_prompt_sections) calls self.agent.pom.to_dict(), so a documented List[Dict] input crashed at render time with "'list' object has no attribute 'to_dict'". Convert the list to a PromptObjectModel (via from_json) before storing; pass through anything already a POM. Prompts built incrementally with prompt_add_section were unaffected — they mutate the existing model — which is why the bundled examples never tripped this. Update test_set_prompt_pom_succeeds_when_use_pom_true: it asserted the buggy contract (agent.pom IS the raw list); now asserts agent.pom is a PromptObjectModel whose to_dict() equals the input.
f5ea1a4 to
2fab50d
Compare
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.
Problem
set_prompt_pom(pom: List[Dict[str, Any]])stored the raw list (self.agent.pom = pom), but the prompt renderer (PromptManager._process_prompt_sections) callsself.agent.pom.to_dict(). So the documentedList[Dict]input crashed at render time:Prompts built incrementally with
prompt_add_sectionwere unaffected — they mutate the existingPromptObjectModel— which is why the bundled examples never tripped it.set_prompt_pomis the only path that overwritespomwith a list.Fix
Convert the list to a
PromptObjectModel(viafrom_json) before storing; pass through anything already a POM object. One file (core/agent/prompt/manager.py): two imports + the conversion.Verified
set_prompt_pom([...])now rendersprompt:{pom}(previously crashed).contexts→prompt:{pom, contexts}.