-
Notifications
You must be signed in to change notification settings - Fork 22
Open
Description
Bug Description
things.today() raises a TypeError when there are overdue tasks (with no start date) mixed with regular today tasks.
TypeError: '<' not supported between instances of 'NoneType' and 'str'
Root Cause
In things/api.py, line 527:
result.sort(key=lambda task: (task["today_index"], task["start_date"]))The today() function merges three task lists:
regular_today_tasks— have astart_dateunconfirmed_scheduled_tasks— have astart_dateunconfirmed_overdue_tasks— queried withstart_date=False, sostart_dateisNone
When Python tries to sort tuples containing a mix of None and str values, it raises TypeError. This happens whenever you have at least one overdue task (no start date) mixed with regular today tasks.
Suggested Fix
Use None-safe sort keys:
result.sort(key=lambda task: (task["today_index"] or 0, task["start_date"] or ""))Other Affected Sorts
There are two other similar sorts in the same file that could also fail with None values:
logbook():result.sort(key=lambda task: task["stop_date"], reverse=True)— could fail ifstop_dateisNonedeadlines():result.sort(key=lambda task: task["deadline"])— less likely but still possible
Environment
- things.py v1.0.0
- Python 3.14
- macOS
- Triggered via things-mcp v0.7.2
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels