diff --git a/agent.py b/agent.py index 5555f72..78844ac 100644 --- a/agent.py +++ b/agent.py @@ -333,9 +333,8 @@ def _extract_deadlines(text: str) -> list[ExtractedDeadline]: ) ) seen.add(("notice", notice_date)) - deadlines.sort(key=lambda item: (item.deadline_date, item.kind != "notice")) - # Public contract wants renewal before derived notice for the same clause. - deadlines.sort(key=lambda item: 0 if item.kind == "renewal" else 1) + # Public contract wants renewal before the derived notice date for a clause. + deadlines.sort(key=_deadline_sort_key) return deadlines