From b53c08812df6db28ed29c25438f2905cecbcea1f Mon Sep 17 00:00:00 2001 From: Greyson LaLonde Date: Wed, 25 Mar 2026 06:40:25 +0800 Subject: [PATCH 1/2] fix: use None check instead of isinstance for memory in human feedback learn --- lib/crewai/src/crewai/flow/human_feedback.py | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/lib/crewai/src/crewai/flow/human_feedback.py b/lib/crewai/src/crewai/flow/human_feedback.py index 7add43f7a..9bace438e 100644 --- a/lib/crewai/src/crewai/flow/human_feedback.py +++ b/lib/crewai/src/crewai/flow/human_feedback.py @@ -374,10 +374,8 @@ def human_feedback( ) -> Any: """Recall past HITL lessons and use LLM to pre-review the output.""" try: - from crewai.memory.unified_memory import Memory - mem = flow_instance.memory - if not isinstance(mem, Memory): + if mem is None: return method_output query = f"human feedback lessons for {func.__name__}: {method_output!s}" matches = mem.recall(query, source=learn_source) @@ -412,10 +410,8 @@ def human_feedback( ) -> None: """Extract generalizable lessons from output + feedback, store in memory.""" try: - from crewai.memory.unified_memory import Memory - mem = flow_instance.memory - if not isinstance(mem, Memory): + if mem is None: return llm_inst = _resolve_llm_instance() prompt = _get_hitl_prompt("hitl_distill_user").format( @@ -448,7 +444,7 @@ def human_feedback( ] if lessons: - mem.remember_many(lessons, source=learn_source) + mem.remember_many(lessons, source=learn_source) # type: ignore[union-attr] except Exception: # noqa: S110 pass # non-critical: don't fail the flow because lesson storage failed From 8a1424534e3ef1a0af755956ad27b4bfce1c58ae Mon Sep 17 00:00:00 2001 From: Greyson LaLonde Date: Wed, 25 Mar 2026 07:05:57 +0800 Subject: [PATCH 2/2] ci: run mypy on full package instead of changed files only --- .github/workflows/type-checker.yml | 35 ++---------------------------- 1 file changed, 2 insertions(+), 33 deletions(-) diff --git a/.github/workflows/type-checker.yml b/.github/workflows/type-checker.yml index 03a5841a0..7b0cbe2da 100644 --- a/.github/workflows/type-checker.yml +++ b/.github/workflows/type-checker.yml @@ -17,8 +17,6 @@ jobs: steps: - name: Checkout code uses: actions/checkout@v4 - with: - fetch-depth: 0 # Fetch all history for proper diff - name: Restore global uv cache id: cache-restore @@ -42,37 +40,8 @@ jobs: - name: Install dependencies run: uv sync --all-groups --all-extras - - name: Get changed Python files - id: changed-files - run: | - # Get the list of changed Python files compared to the base branch - echo "Fetching changed files..." - git diff --name-only --diff-filter=ACMRT origin/${{ github.base_ref }}...HEAD -- '*.py' > changed_files.txt - - # Filter for files in src/ directory only (excluding tests/) - grep -E "^src/" changed_files.txt > filtered_changed_files.txt || true - - # Check if there are any changed files - if [ -s filtered_changed_files.txt ]; then - echo "Changed Python files in src/:" - cat filtered_changed_files.txt - echo "has_changes=true" >> $GITHUB_OUTPUT - # Convert newlines to spaces for mypy command - echo "files=$(cat filtered_changed_files.txt | tr '\n' ' ')" >> $GITHUB_OUTPUT - else - echo "No Python files changed in src/" - echo "has_changes=false" >> $GITHUB_OUTPUT - fi - - - name: Run type checks on changed files - if: steps.changed-files.outputs.has_changes == 'true' - run: | - echo "Running mypy on changed files with Python ${{ matrix.python-version }}..." - uv run mypy ${{ steps.changed-files.outputs.files }} - - - name: No files to check - if: steps.changed-files.outputs.has_changes == 'false' - run: echo "No Python files in src/ were modified - skipping type checks" + - name: Run type checks + run: uv run mypy lib/crewai/src/crewai/ - name: Save uv caches if: steps.cache-restore.outputs.cache-hit != 'true'