Skip to content

fix(workflows): normalize two-digit years in GetDOBTask#6124

Open
he-yufeng wants to merge 1 commit into
livekit:mainfrom
he-yufeng:fix/dob-two-digit-year
Open

fix(workflows): normalize two-digit years in GetDOBTask#6124
he-yufeng wants to merge 1 commit into
livekit:mainfrom
he-yufeng:fix/dob-two-digit-year

Conversation

@he-yufeng

Copy link
Copy Markdown
Contributor

Closes #6067

GetDOBTask's prompt tells the model to normalize two-digit years ("90" likely means 1990), but _update_dob_impl takes year as a raw int with no lower bound. Smaller/faster models often pass the spoken value through literally, and date(90, 5, 15) is a valid Python date (year 90 AD): the future-date check passes, no ToolError is 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 < 100 at the top of _update_dob_impl with 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 on year < 1900) as an alternative; I went with normalization since it matches the documented prompt contract and the smaller behavioral change.

Verified:

  • Added tests/test_dob.py (unit, no LLM). It fails on main (date(90, 5, 15) != date(1990, 5, 15)) and passes with the fix.
  • pytest tests/test_dob.py --unit -> 2 passed.
  • ruff check and ruff format --check clean on both files.

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.
@he-yufeng he-yufeng requested a review from a team as a code owner June 16, 2026 10:46

@devin-ai-integration devin-ai-integration Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

✅ Devin Review: No Issues Found

Devin Review analyzed this PR and found no bugs or issues to report.

Open in Devin Review

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.

GetDOBTask silently accepts two-digit years as ancient dates (e.g. year 90 AD)

1 participant