fix: port the issue-455 free-text contract fix to 9 sibling tools (lockstep) - #464
Open
jmoreira-valory wants to merge 2 commits into
Open
fix: port the issue-455 free-text contract fix to 9 sibling tools (lockstep)#464jmoreira-valory wants to merge 2 commits into
jmoreira-valory wants to merge 2 commits into
Conversation
…ckstep) Every tool that still derived its web-search query from the trader-template regex with a raw-prompt fallback gets the merged #459+#461 machinery: byte-identical parse_prompt block (frozen mirror, now 11 files), _flagged_null_result on empty retrieval, unsearchable-query short-circuit, and scan_truncated/tier observability. Trader-template path byte-identical; free text keeps the whole prompt for the LLM and derives only the query. In scope: superforcaster, superforcaster_calibrated_full_search, superforcaster_full_search, superforcaster_polymarket_v1/v2/v3, finetuned_prediction (tournament pins re-pinned), prediction_request_rag_v1, prediction_request_reasoning_v1. Out of scope (different fix shape): factual_research family and the other partial-leak tools. 945 customs tests green; sextet green; lock --check verified. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
CI pylint flagged the napthaai test files: black had re-wrapped the long assert lines, moving the code off the line-level disable comments. Replace them with module-level private-cap aliases (one disable each, below the imports) and the pylint-suggested falsiness assert. Co-Authored-By: Claude Fable 5 <noreply@anthropic.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
Ports the merged issue #455 fix (PRs #459 + #461, already live in
superforcaster_polymarket_v4andsuperforcaster_market_aware) into the 9 sibling tools that still have the exact same bug shape: a trader-template-onlyextract_questionregex whose miss-path sends the raw prompt verbatim as the web-search query, so every non-trader caller (Pearl Connect free text) gets degraded or empty retrieval — silently.Minimal, mechanical, lockstep port per tool — no behavior change on the trader-template path (byte-identical question + query), no template/dispatch/model/cost changes:
parse_prompt(prompt) -> ParsedPrompt(question, query, tier)— the frozen parse block, inserted byte-identical in every tool (the mirror now spans 11 files; verified programmatically, 8313 chars each)._flagged_null_result— organic AND peopleAlsoAsk both empty →p_yes/p_no 0.5/0.5, confidence 0, withempty_retrieval/null_reason/parse_tier/scan_truncatedinused_params(off-chain observability; on-chain JSON shape unchanged).scan_truncated(template tier exempt) + the single-log tier chain, same semantics as fix: bound the candidate scan + reject unsearchable queries (v4 + market-aware, lockstep) #461.In scope (code-verified inventory, every package re-read on this branch)
superforcastersuperforcaster_calibrated_full_searchsuperforcaster_full_searchsuperforcaster-polymarket-v1,-v2superforcaster-polymarket-v3finetuned_prediction(predict-base,predict-fine-tuned,predict-fine-tuned-calibrated)prediction_request_rag_v1(+claude variant)prediction_request_reasoning_v1(+claude variant)parsed.queryonly at the direct-leak sitesDeliberately out of scope (different fix shape; follow-up batch):
factual_researchfamily (LLM-reframe pipeline; leakage only on the zero-sub-questions fallback),prediction_request_v1,prediction_request_sme,prediction_url_cot_v1,resolve_market,resolve_market_reasoning,prediction_langchain. Tools without web retrieval (corcel, dalle, gemini, prepare_tx, propose_question, resolve_market_jury) need nothing.Invariants held (verified per tool, then re-verified centrally)
==against the canonical block).extract_questionoutput (pinned by a test in every tool).Verification
assert_not_calledon the search mock, both-empty flagged null live + cached-replay, malformed-Serper typed errors, scan-window semantics).autonomy packages lock+lock --checkclean; zero third-party pin drift.benchmark/tournament_tools.json: the 3predict-*wires re-pinned to the newfinetuned_predictionCID;factual_research-v2,superforcaster-polymarket-v4,superforcaster-market-awareunchanged.Deployment follow-up (not this PR)
The 5 production tools span BOTH platforms (Gnosis predict fleet + Polygon 21/25/44). After merge + release: agent-deployments PR re-pinning
TOOLS_TO_PACKAGE_HASHfor the affected envs — metadata republish per mech (per-mechurlpreserved viamake update-metadata), as in the v0.21.29 rollout.🤖 Generated with Claude Code