Repository navigation
fix(rule_taxonomy): treat rows with an error_message as errors - #618
Conversation
caohy1988
left a comment
There was a problem hiding this comment.
Thanks for this — the shared error check is the right fix for the first item in #602.
I ran the taxonomy tests at this head (211 passed) and the same new tests against the previous source (7 failed). I also reproduced the seeded-corpus claim: on build_realistic_corpus(random.Random(0), ..., 100), the 10 sessions with an error_message go from completed=True / FIN-NO-ANSWER to completed=False / TB-ABORT. The last-invocation and case-sensitive status limits you called out still hold, and a missing error_message (including NaN and the "null" / "nan" forms) is not treated as an error.
A few follow-ups, none of them blocking this change:
-
When
statusarrives as a pandas nullable NA (for example after reading a DataFrame with a nullable string column viaitertuples()), the new shared error check can raiseTypeError: boolean value of NA is ambiguouson a cleanAGENT_COMPLETEDorINVOCATION_COMPLETED, and also on aTOOL_ERRORthat used to be recognized from the event type alone. The comparison isspan.status == "ERROR"first;pd.NA == "ERROR"ispd.NA, andorthen tries to use that as a boolean. A guard likeisinstance(span.status, str) and span.status == "ERROR"would keep the case-sensitive check and still let the event type or message decide when status is missing. The committed tests didn't catch this because their missing-value fixtures keep a populated status. -
The changelog can read as if an
error_messagealone always producesTB-UNRECOVERED. In the code, that label still needs a completed run whose final tool call failed; a later successful retry clears it, and a deciding terminal error isTB-ABORT. -
Non-string
error_messagevalues such as0orFalseget stringified and treated as real errors. That's only an issue for a malformed column, not ordinary BigQuery STRING nulls.
I filed these as #619.
Thanks for the fix! If you've found the SDK useful, it'd mean a lot if you could give the repo a star.
Thank you @caohy1988 |
This PR addresses part of issue #602.
Summary
Part of #602: the first item, "Error rows can read as a successful completion or tool outcome". The other items in that issue are not changed.
rule_taxonomydecided whether a row failed fromstatusand an_ERRORevent type only, whileSpan.has_erroralso counts a populatederror_message. On thedecision-realisticseeded corpus, the 10 failed sessions read ascompleted=Trueand gotFIN-NO-ANSWER.What changed
LLM_RESPONSEprogress check, the abort row and tool-end status:status == "ERROR", an_ERRORevent type, or anerror_message.AGENT_COMPLETEDorINVOCATION_COMPLETEDthat carries an error does not complete the run. When invocation rows exist, the last one still decides.error_messagethat arrives from a DataFrame as NaN or NaT is not an error. As elsewhere in the SDK's text handling, a blank,"null"or"nan"string is treated as missing.TB-UNRECOVEREDshows the error message of a failedTOOL_COMPLETEDthat also has a result, andTB-ABORTon a non-_ERRORrow says the row "logged an error that stopped the run". The wording for_ERRORrows is unchanged.Behaviour on the seeded corpus
build_realistic_corpus(random.Random(0), ..., 100), the 10 sessions with anerror_message:completedTrueFIN-NO-ANSWERFalseTB-ABORTLimits (not changed here)
AGENT_COMPLETEDfollowed by a cleanINVOCATION_COMPLETED. Those sessions still read as completed, because the last invocation row decides.statusis still compared case-sensitively, asSpan.has_errordoes. The lowercasestatus="error"seeded rows are caught through theirerror_message.Testing
pytest tests/test_rule_taxonomy.py: 211 passed. With the new tests and the old source, 7 fail.pyink --checkandisort --check-onlyonsrcandtests: clean.