Repository navigation
fix(a2a): make list_tasks sorting and filtering safe across naive and aware datetimes - #8739
梦想陆地的鱼 (heyseere) wants to merge 1 commit into
Conversation
Strix Security ReviewWarning This pull request has 84 commits after the last Strix review ( ✅ No open security findings. PR summary: Adds a `_parse_status_timestamp` helper in the A2A task utilities that normalizes task status timestamps to aware UTC datetimes, and uses it for both the `list_tasks` timestamp filter and sort key, plus normalizing a naive `status_timestamp_after` cutoff. This removes the `TypeError` raised when tasks mixed aware timestamps with missing ones, and adds tests for the mixed, naive-cutoff, and aware-cutoff cases. Review summaryThis PR fixes a crash in the A2A Review 1 on this PR · Reviewed by Strix |
2f3babb to
faf2a21
Compare
|
Friendly ping for a review when you have a moment. All bot checks are green and the PR is mergeable; happy to adjust anything. |
3b6ce0c to
e5231fc
Compare
e5231fc to
c21e906
Compare
Related issue
Fixes #8735
Summary
list_tasksraisedTypeError: can't compare offset-naive and offset-aware datetimeswhen the task list mixed tasks carrying aware ISO timestamps with tasks without a timestamp (the sort key returned naivedatetime.min), and when callers passed a naivestatus_timestamp_after. This PR normalizes status timestamps to aware UTC in a single helper used by both the sort key and the timestamp filter, and normalizes a naive cutoff at entry. Missing timestamps still sort as the oldest instant and are still exempt from the time filter — semantics unchanged, crash removed.Verification
lib/crewai/tests/a2a(104 passed): new tests cover mixed aware/missing-timestamp sorting, a naive cutoff, and an aware cutoff. The mixed-sort and naive-cutoff tests fail withTypeErroron the old code.ruff checkclean on changed files.Disclosure: this PR was produced with AI assistance (ZCode agent) and human-reviewed — please apply the
llm-generatedlabel.Additional context
None
From ZCode
Note
Low Risk
Targeted datetime normalization in a pure list utility with regression tests; no auth, persistence, or API contract changes beyond removing the crash.
Overview
Fixes
TypeErrorwhenlist_taskscompared offset-naive and offset-aware datetimes during sort orstatus_timestamp_afterfiltering.A shared
_parse_status_timestamphelper now parses ISO status strings (includingZ), treats missing timestamps as oldest UTC, and upgrades naive values to UTC.list_tasksuses it for the sort key and cutoff filter, and coerces a naivestatus_timestamp_afterto aware UTC at entry. Sort order and filter rules are unchanged.Tests cover mixed missing/aware timestamp sorting, naive cutoffs, and aware time filtering.
Reviewed by Cursor Bugbot for commit c21e906. Bugbot is set up for automated code reviews on this repo. Configure here.