fix(strategy_v2): accept positional key/value in DiscoveryContext.set_metadata - #209
Merged
brokermr810 merged 1 commit intoAug 17, 2026
Merged
Conversation
…_metadata Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
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.
Summary
Generated strategies keep calling
context.set_metadata("direction_mode", "long_only")positionally, andDiscoveryContext.set_metadataonly takes keyword arguments, soPOST /api/strategies/generatefails at compile time and the auto-repair round trips into the same TypeError. Accept a(key, value)pair or a mapping in addition to keyword arguments, and spell out the keyword form in the generation prompt so the model is less likely to produce the positional call in the first place.Fixes #208
Changes
strategy_v2/contract.py:set_metadataaccepts(key, value)and a mapping as well as keyword argumentsai_generation_contracts.py: show the keyword-argument form ofset_metadatain the prompttest_strategy_v2_contract.pyTest plan
docker compose up -d --buildtests/test_strategy_v2_contract.py,tests/test_strategy_v2_runtime.py,tests/test_ai_generation_prompt_contracts.py)API documentation (if routes/schemas changed)
docs/api/openapi.yaml(cd backend_api_python && python scripts/export_openapi.py)docs/agent/agent-openapi.jsonif/api/agent/v1routes changedScreenshots (if UI change)