Skip to content

[AAASM-4809] ✅ (test): Drive real pydantic_ai/agno/llamaindex hooks in fail-open conformance#277

Merged
Chisanan232 merged 3 commits into
masterfrom
v0.0.1/AAASM-4809/conformance_real_hooks
Jul 17, 2026
Merged

[AAASM-4809] ✅ (test): Drive real pydantic_ai/agno/llamaindex hooks in fail-open conformance#277
Chisanan232 merged 3 commits into
masterfrom
v0.0.1/AAASM-4809/conformance_real_hooks

Conversation

@Chisanan232

@Chisanan232 Chisanan232 commented Jul 17, 2026

Copy link
Copy Markdown
Contributor

Description

The fail-open conformance matrix (test/unit/adapters/failopen_conformance.py) had coverage blind spots: three of its adapter cells drove a wrapper that the shipped framework never actually runs, or exercised only the sync sibling of an async chokepoint. This makes those cells green while the real interception path stays untested.

  • pydantic_ai — the driver drove _apply_tool_run_patch (the pydantic-ai <0.3.0 Tool._run hook). On the pinned/shipped pydantic-ai (>=0.3.0), Tool._run does not exist and production interception is AbstractToolset.call_tool (patch.py:348, signature (self, name, tool_args, ctx, tool)). The cell drove a wrapper that never runs on the shipped framework. Now points at _apply_toolset_call_tool_patch with a fake toolset and the real signature.
  • agno — the async chokepoint FunctionCall.aexecute (patch.py:208) was unexercised; the driver drove only the sync execute. Now drives both.
  • llamaindex — the primary modern path FunctionTool.acall (patch.py:303; awaited by FunctionAgent/ReActAgent via AgentWorkflow) was unexercised; the driver drove only sync call. Now drives both.

A shared _assert_sync_and_async_agree guard requires an adapter's sync and async wrappers to reach the same verdict per cell, so an async-only fail-open (or fail-closed) regression cannot hide behind a passing sync path.

Type of Change

  • 🔧 Bug fix (test-coverage gap)

Breaking Changes

  • No

Related Issues

Testing

  • Unit tests added/updated

The conformance suite is its own regression guard: pytest test/unit/adapters/test_failopen_conformance.py361 passed, and the pydantic_ai call_tool, agno aexecute, and llamaindex acall wrappers are now genuinely driven across every scenario × mode. Verified out-of-band that each async path blocks under enforce and runs under observe, and that the agreement guard catches a sync/async divergence. ruff check, black, and mypy all clean.

Checklist

  • Code follows project style guidelines
  • Self-review completed
  • Comments added for complex logic
  • All tests passing

Chisanan232 and others added 3 commits July 18, 2026 06:55
…nformance

The pinned/shipped Pydantic AI (>=0.3.0) intercepts tool execution at
AbstractToolset.call_tool, not the <0.3.0 Tool._run hook. The conformance
cell drove _apply_tool_run_patch, exercising a wrapper the shipped framework
never runs. Point it at _apply_toolset_call_tool_patch with the real
(self, name, tool_args, ctx, tool) signature and a fake toolset.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The agno driver drove only the sync FunctionCall.execute wrapper, leaving the
async aexecute chokepoint — agno's primary async tool path — unexercised. Drive
both entry points and add _assert_sync_and_async_agree so an async-only fail-open
regression cannot hide behind a passing sync path.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
The llamaindex driver drove only the sync FunctionTool.call wrapper; acall — the
primary modern path awaited by FunctionAgent / ReActAgent via AgentWorkflow — went
unexercised. Apply _apply_tool_acall_patch and drive both, reusing the sync/async
agreement guard so the async path is genuinely governed.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
@sonarqubecloud

Copy link
Copy Markdown

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.

📢 Thoughts on this report? Let us know!

@Chisanan232

Copy link
Copy Markdown
Contributor Author

🤖 Claude Code — PR review

Scope (AAASM-4809, LOW): ✅ fixed conformance-matrix blind spots — pydantic_ai driver now drives the real AbstractToolset.call_tool (was the dead Tool._run), + agno aexecute and llamaindex acall async paths now exercised, with a sync/async agreement guard so an async-only fail-open can't hide.

  1. CI — ✅ all green (18); 361 conformance cases pass.
  2. Scope/ready — ✅ test harness only (test module unchanged = regression guard); ruff/black/mypy clean.
  3. Side effects — none (test-only; no adapter/product code touched).
  4. FE — n/a.

Verdict: ready to merge pending Pioneer approval.

@Chisanan232
Chisanan232 merged commit 464afeb into master Jul 17, 2026
22 checks passed
@Chisanan232
Chisanan232 deleted the v0.0.1/AAASM-4809/conformance_real_hooks branch July 17, 2026 23:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant