fix(workflows): normalize two-digit years in GetDOBTask#6124
Open
he-yufeng wants to merge 1 commit into
Open
Conversation
A literal two-digit year like 90 builds a valid date (year 90 AD) that passes the future-date check, so the task completes with a corrupted birthdate. Normalize year < 100 with a pivot window keyed on the current year, matching what the prompt already asks the model to do.
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.
Closes #6067
GetDOBTask's prompt tells the model to normalize two-digit years ("90" likely means 1990), but_update_dob_impltakesyearas a raw int with no lower bound. Smaller/faster models often pass the spoken value through literally, anddate(90, 5, 15)is a valid Python date (year 90 AD): the future-date check passes, noToolErroris raised, and the task completes with a corrupted birthdate. Because this workflow tends to feed identity/healthcare/fintech intake, it's silent data corruption rather than a visible error.Fix: normalize
year < 100at the top of_update_dob_implwith a pivot window keyed on the current year, which is exactly what the prompt already promises. 90 -> 1990, 05 -> 2005, 26 -> 2026, 27 -> 1927. Four-digit years are left untouched, so there's no regression. The issue floated a hard floor (raise onyear < 1900) as an alternative; I went with normalization since it matches the documented prompt contract and the smaller behavioral change.Verified:
tests/test_dob.py(unit, no LLM). It fails onmain(date(90, 5, 15) != date(1990, 5, 15)) and passes with the fix.pytest tests/test_dob.py --unit-> 2 passed.ruff checkandruff format --checkclean on both files.