fix(rating): surface unparseable ratings as REVIEW instead of a silent Hold (#1170) - #1189
Open
aniketshukla1 wants to merge 1 commit into
Open
Conversation
…t Hold (TauricResearch#1170) The shared rating parser returned "Hold" whenever it could not extract a 5-tier rating, conflating a genuine neutral call with a parse failure. It also missed ratings wrapped in fullwidth/CJK punctuation (e.g. "Rating:Overweight", "评级:Overweight(超配)") and its token scan could partially match longer words. - rating.py: add extract_rating(), which returns None when no rating is recognised (never a silent default), normalises harmless fullwidth/CJK punctuation, and matches whole alphabetic tokens (so "buyer"/"holding" don't match). parse_rating() is kept as a backward-compatible wrapper. Add a RATING_REVIEW sentinel that is deliberately not a 5-tier value. - signal_processing / memory: surface RATING_REVIEW for an unparseable decision so a parse failure is visible downstream and in the log instead of masquerading as Hold. The 5-tier rating stays distinct from the 3-tier trade action. - tests: add tests/test_rating.py covering canonical/markdown/punctuation/localized/whole-word/None cases; update the two tests that asserted the old silent-Hold behaviour.
|
Caution The consumer version of Gemini Code Assist on GitHub has been sunset. All code review activity has officially ceased. |
rajatvarna
added a commit
to rajatvarna/TradingAgents
that referenced
this pull request
Aug 10, 2026
Port debate opening-turn guards (TauricResearch#1210), unparseable rating REVIEW sentinel (TauricResearch#1189), Reddit defusedxml + multi-retry (TauricResearch#1218/TauricResearch#1219), and merge six upstream main commits (news UTC, OHLCV cache TTL, CLI no-console, README). Update integration plan and CHANGELOG. Co-authored-by: Cursor <cursoragent@cursor.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
The shared rating parser (
tradingagents/agents/utils/rating.py) returned"Hold"whenever it could not extract a 5-tier rating, conflating a genuine neutral call with a parse failure. It also missed ratings wrapped in fullwidth/CJK punctuation (e.g.Rating:Overweight,评级:Overweight(超配)), and its token scan could partially match longer words.Closes #1170.
Changes
rating.py: addextract_rating(), which returnsNonewhen no rating is recognised (never a silent default), normalises harmless fullwidth/CJK punctuation, and matches whole alphabetic tokens (sobuyer/holding/sellerdon't spuriously match).parse_rating()is kept as a backward-compatible wrapper. NewRATING_REVIEWsentinel that is deliberately not a 5-tier value.signal_processing.py/memory.py: surfaceRATING_REVIEWfor an unparseable decision, so a parse failure is visible to downstream consumers and in the decision log instead of masquerading asHold. The 5-tier rating stays distinct from the 3-tier trade action.tests/test_rating.py(canonical / markdown / fullwidth / localized / whole-word /Nonecases); update the two existing tests that asserted the old silent-Holdbehaviour.Acceptance criteria (#1170)
HoldREVIEW)