[AAASM-4906] 🐛 (adapters): Sweep pending fail-closed across adapters + formatter docs + hermetic tests#284
Conversation
Sweep the pending-approval fail-open (AAASM-4898 sibling) across the remaining adapters. smolagents, llamaindex, openai_agents, mcp, microsoft_agent_framework, haystack and agno gated tool execution on `status == "deny"` only, so a terminal `"pending"` (approval timed out or the resolver returned pending again) fell through and ran the tool. Change each terminal gate to `status != "allow"`, matching the LangChain handler and the fixed crewai/_shared gates: only an explicit allow may proceed; any other terminal verdict fails closed via the already-present is_pending_flow branch. Refs AAASM-4906
Regression test per adapter proving a still-"pending" verdict after the approval round-trip fails closed and never invokes the wrapped tool body, locking in the AAASM-4906 fix. llamaindex and agno cover both the sync and async gate. Refs AAASM-4906
The formatter gate is black (.pre-commit-config.yaml: isort + autoflake + black + mypy; there is no ruff-format hook — ruff is the linter only). CONTRIBUTING.md and the authoring-adapters checklist still referenced `ruff format`; point them at black to match reality. Refs AAASM-4906
Extend the AAASM-4898 hermeticity pattern to the remaining files whose init_assembly() tests dial a real gateway when a native _core.so is present (they stub GatewayClient/adapters/network but not the native connect_runtime_client/register_agent path). Add an autouse fixture pinning _native_core_available() to False so the full suite is deterministic in both native-present and native-absent modes. Refs AAASM-4906
| assert patcher.apply() is True | ||
| try: | ||
| tool = FakeTool() | ||
| result = tool(text="hello") |
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
|
Claude Code automated review — PR #284 (AAASM-4906)Verdict: merge-ready (pending the required Pioneer approval — this review does not approve). CIAll 19 checks green; 0 failed. Codecov / SonarCloud
Scope vs AAASM-4906 (all three AC parts satisfied)
Side-effectsLow risk, none blocking. The Ready to merge once a Pioneer reviewer approves. — Claude Code (automated review) |



Description
Follow-up sweep to AAASM-4898 (PR #283). Closes the remaining instances of the pending-approval fail-open pattern class across the SDK, plus two sibling clean-ups surfaced during #283 review.
(a) Adapter fail-closed sweep. Seven adapters —
smolagents,llamaindex,openai_agents,mcp,microsoft_agent_framework,haystack,agno— gated tool execution onif status == "deny"only, so a terminal"pending"verdict (approval timed out, or the resolver returned pending again) fell through and ran the tool under enforce. Each terminal gate now requiresstatus == "allow"to proceed, matching the LangChain handler (callback_handler.py:166) and the fixed crewai/_sharedgates. The existingis_pending_flowbranch already produces the correct "approval rejected" response for these blocked verdicts. llamaindex and agno each had two gate sites (sync + async).(b) Formatter-doc drift.
CONTRIBUTING.mdanddocs/guides/authoring-adapters.mdstill referencedruff format; the real formatter gate is black (.pre-commit-config.yaml: isort + autoflake + black + mypy — no ruff-format hook; ruff is the linter only). Both now point at black. Note: the ticket also referenced a rootpython-sdk/CLAUDE.md:22,87— no such file exists in the repo; the only trackedCLAUDE.mdis.claude/CLAUDE.md, already corrected to black under AAASM-4898.(c) Test hermeticity siblings. Extended the AAASM-4898 autouse
_native_core_available() -> Falsefixture to the remaining files whoseinit_assembly()tests dial a real gateway when a native_core.sois present (they stub GatewayClient/adapters/network but not the nativeconnect_runtime_client/register_agentpath):test/bench/test_init_assembly_coldstart.py,test/bench/test_latency_contracts.py,test/integration/test_assembly_integration.py,test/integration/test_spawn_lineage_integration.py,test/unit/adapters/langchain/test_runtime.py. The full suite is now deterministic in both native-present and native-absent modes.Type of Change
Breaking Changes
Related Issues
Testing
A terminal-
pendingregression test per adapter proves the tool body never runs (llamaindex/agno cover sync + async). Gates run locally in the worktree:ruff check agent_assemblyclean;pre-commit run --all-files(isort + autoflake + black + mypy) clean on changed files; full suitepytest test/→ 1195 passed, 16 skipped. (Pre-existing generated-proto black drift underagent_assembly/proto/was reverted to keep the diff scoped.)Checklist
🤖 Generated with Claude Code