Skip to content

fix(tests): fix 48 native-hooks test failures in docker CI#1610

Merged
imran-siddique merged 1 commit into
mainfrom
fix/test-native-hooks
Apr 30, 2026
Merged

fix(tests): fix 48 native-hooks test failures in docker CI#1610
imran-siddique merged 1 commit into
mainfrom
fix/test-native-hooks

Conversation

@imran-siddique
Copy link
Copy Markdown
Member

Fixes all 48 test failures introduced by the native-hooks PRs (#1582, #1585, #1588, #1591, #1605):

  • crewai_hooks (38 tests): Reload adapter module after installing stubs so _HOOKS_AVAILABLE picks up the mock
  • semantic_kernel_hooks (8 tests): Replace deprecated asyncio.get_event_loop() with asyncio.run() for Python 3.11+
  • smolagents_hooks (1 test): Fix test that used a blocked pattern in a step expected to pass
  • adapter_exception_identity (1 test): Remove xfail from openai_agents_sdk now that native hooks conversion is done

- crewai_hooks: reload adapter module after installing crewai.hooks
  stubs to reset _HOOKS_AVAILABLE flag (38 tests)
- semantic_kernel_hooks: replace deprecated asyncio.get_event_loop()
  with asyncio.run() for Python 3.11+ compat (8 tests)
- smolagents_hooks: fix test that used blocked pattern in non-failing
  assertion step (1 test)
- adapter_exception_identity: remove xfail from openai_agents_sdk now
  that native hooks conversion is complete (1 test)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
@imran-siddique imran-siddique merged commit a68ddc1 into main Apr 30, 2026
26 checks passed
@imran-siddique imran-siddique deleted the fix/test-native-hooks branch April 30, 2026 05:21
@github-actions
Copy link
Copy Markdown

🤖 AI Agent: security-scanner — View details

No security issues found.

@github-actions
Copy link
Copy Markdown

🤖 AI Agent: breaking-change-detector — API Compatibility

API Compatibility

No breaking changes detected.

@github-actions
Copy link
Copy Markdown

🤖 AI Agent: test-generator — `agent-governance-python/agent-os/tests/test_crewai_hooks.py`

agent-governance-python/agent-os/tests/test_crewai_hooks.py

  • test_hooks_availability_after_reload -- Validate that _HOOKS_AVAILABLE is correctly updated after reloading the adapter module.

agent-governance-python/agent-os/tests/test_semantic_kernel_hooks.py

  • test_invalid_context_handling -- Test governance filter behavior when provided with an invalid or malformed context.
  • test_next_fn_failure_handling -- Ensure governance_filter handles exceptions raised by next_fn properly.

agent-governance-python/agent-os/tests/test_smolagents_hooks.py

  • test_blocks_pattern_in_observation -- Add a negative test case for blocked patterns in observations to ensure proper handling.

@github-actions github-actions Bot added the tests label Apr 30, 2026
@github-actions
Copy link
Copy Markdown

Dependency Review

✅ No vulnerabilities or license issues or OpenSSF Scorecard issues found.

Scanned Files

None

@github-actions
Copy link
Copy Markdown

🤖 AI Agent: docs-sync-checker — Docs Sync

Docs Sync

  • README.md -- ensure no sections reference the outdated behavior of asyncio.get_event_loop() or _PENDING_CONVERSION.
  • CHANGELOG.md -- missing entry for test behavior changes related to native hooks fixes.

@github-actions github-actions Bot added the size/S Small PR (< 50 lines) label Apr 30, 2026
@github-actions
Copy link
Copy Markdown

🤖 AI Agent: code-reviewer — Action Items:

TL;DR: 0 blockers, 1 warning. Fixes test failures effectively but introduces a potential issue with module reloading.

# Sev Issue Where
1 Warn importlib.reload may cause unexpected behavior in multi-threaded or complex environments test_crewai_hooks.py

Action Items:

  • None, as there are no blockers.

Warnings:

# Issue Where Follow-up
1 importlib.reload may cause unexpected behavior in multi-threaded or complex environments test_crewai_hooks.py Fine as follow-up PR

@github-actions
Copy link
Copy Markdown

PR Review Summary

Check Status Details
🔍 Code Review ❌ Failed Issues detected
🛡️ Security Scan ✅ Completed Analysis complete
🔄 Breaking Changes ⚠️ Warning See details
📝 Docs Sync ✅ Completed Analysis complete
🧪 Test Coverage ❌ Failed Issues detected

Verdict: ❌ Changes needed

imran-siddique added a commit to imran-siddique/agent-governance-toolkit that referenced this pull request May 4, 2026
…#1610)

- crewai_hooks: reload adapter module after installing crewai.hooks
  stubs to reset _HOOKS_AVAILABLE flag (38 tests)
- semantic_kernel_hooks: replace deprecated asyncio.get_event_loop()
  with asyncio.run() for Python 3.11+ compat (8 tests)
- smolagents_hooks: fix test that used blocked pattern in non-failing
  assertion step (1 test)
- adapter_exception_identity: remove xfail from openai_agents_sdk now
  that native hooks conversion is complete (1 test)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
MohammadHaroonAbuomar pushed a commit to MohammadHaroonAbuomar/agt-acs that referenced this pull request Jun 1, 2026
…#1610)

- crewai_hooks: reload adapter module after installing crewai.hooks
  stubs to reset _HOOKS_AVAILABLE flag (38 tests)
- semantic_kernel_hooks: replace deprecated asyncio.get_event_loop()
  with asyncio.run() for Python 3.11+ compat (8 tests)
- smolagents_hooks: fix test that used blocked pattern in non-failing
  assertion step (1 test)
- adapter_exception_identity: remove xfail from openai_agents_sdk now
  that native hooks conversion is complete (1 test)

Co-authored-by: Copilot <223556219+Copilot@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

size/S Small PR (< 50 lines) tests

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant