Skip to content

fix(rating): surface unparseable ratings as REVIEW instead of a silent Hold (#1170) - #1189

Open
aniketshukla1 wants to merge 1 commit into
TauricResearch:mainfrom
aniketshukla1:fix/1170-rating-explicit-unparseable
Open

fix(rating): surface unparseable ratings as REVIEW instead of a silent Hold (#1170)#1189
aniketshukla1 wants to merge 1 commit into
TauricResearch:mainfrom
aniketshukla1:fix/1170-rating-explicit-unparseable

Conversation

@aniketshukla1

Copy link
Copy Markdown

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: 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 / seller don't spuriously match). parse_rating() is kept as a backward-compatible wrapper. New RATING_REVIEW sentinel that is deliberately not a 5-tier value.
  • signal_processing.py / memory.py: surface RATING_REVIEW for an unparseable decision, so a parse failure is visible to downstream consumers and in the decision log instead of masquerading as Hold. The 5-tier rating stays distinct from the 3-tier trade action.
  • tests: add tests/test_rating.py (canonical / markdown / fullwidth / localized / whole-word / None cases); update the two existing tests that asserted the old silent-Hold behaviour.

Acceptance criteria (#1170)

  • An unrecognized or missing rating never silently becomes Hold
  • Canonical English, Markdown-wrapped, and harmless punctuation variants are covered by tests
  • A localized example is parsed per a documented policy (fullwidth punctuation normalised; whole-word token matching)
  • Rating (5-tier) and trade-action (3-tier) fields remain separate and are not inferred from each other
  • A mismatch between the decision text and the machine signal is visible downstream (REVIEW)

…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.
@gemini-code-assist

Copy link
Copy Markdown

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>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Rating parser silently converts unrecognized output to Hold

1 participant