fix(spec-search): use Message objects in run_self_on_task and planner prompt fix#556
Open
gazaille4mila wants to merge 2 commits into
Open
fix(spec-search): use Message objects in run_self_on_task and planner prompt fix#556gazaille4mila wants to merge 2 commits into
gazaille4mila wants to merge 2 commits into
Conversation
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.
What does this PR do?
This PR fixes two concrete Spec Search failure modes in diagnose and planner flows.
Fix 1:
run_self_on_tasknow sendsMessageobjects (not dicts) toteacher_engine.generate.Root cause and failing paths:
Sequence[Message]and dereference message attributes:messages_to_dicts) usesm.role.valueandm.content._prepare_anthropic_messages) branches onm.role.value.messages_to_dicts, e.g. src/openjarvis/engine/cloud.py#L576.'dict' object has no attribute 'role', causing repeated diagnose-tool failures.Fix 2: Updated the planner prompt example to a valid numeric hunk (for example
@@ -3,1 +3,1 @@), so teacher-produced PATCH edits are parseable and no longer downgraded for malformed diff syntax.Root cause and parser path:
@@ ....Nonewhich triggers downgrade warning logic at src/openjarvis/learning/spec_search/plan/prompt_diff.py#L141: "diff could not be applied, downgrading to REPLACE".How was this tested?
Added a regression test asserting Message(role=Role.USER, ...) is passed and output fields are preserved.
Checklist
uv run pytest tests/ -v)All green except for
collecting tests/evals/comparison/test_export_to_table_gen_roundtrip.pyfailing because of polar import fail (nothing to do with my changes)uv run ruff check src/ tests/)uv run ruff format --check src/ tests/)n/a
n/a
n/a