[AAASM-2640] ♻️ (aa-ffi-python): Delegate RuntimeClient transport to aa-sdk-client#79
Merged
Merged
Conversation
Bump the aa-core / aa-proto git-SHA pin to the agent-assembly master commit that ships aa-sdk-client, and add aa-sdk-client itself at the same SHA (single workspace checkout per ADR 0002). The next commit delegates the runtime client to it. Handle the new aa-proto ActionType::ToolResult variant in the audit-event translation helpers, which the new SHA requires.
Make the pyo3 binding a thin shim over the shared aa-sdk-client crate (ADR 0002). RuntimeClient.connect/send_event/close now delegate to aa_sdk_client::AssemblyClient — the UDS transport, IPC wire codec, and background lifecycle live once in aa-sdk-client instead of being reimplemented here. Remove the local tokio worker loop, frame codec, and the synchronous query_policy round-trip (PolicyResult / PolicyTimeoutError): policy and approval are server-side per the trust model, and the advisory, non-authoritative credential preflight is provided transitively by aa-sdk-client — the shim holds no security authority. Type translation (GovernanceEvent, audit_event_to/from_wire_bytes) is retained. Drop the now-unused tokio and once_cell dependencies.
9 tasks
aa-sdk-client ships events over a bounded channel with a blocking send, so under backpressure report_event can park the calling thread. Holding the GIL there stalls every other Python thread — and deadlocks outright when the runtime peer is an in-process Python thread (the native test's mock runtime). Wrap the delegation in py.detach so the GIL is released for the duration of the send.
10 tasks
The thin shim no longer exposes PolicyResult, so the native-core-build workflow's import verification (`from agent_assembly._core import ..., PolicyResult`) failed after maturin built the module. Import only the symbols the shim exposes (RuntimeClient, GovernanceEvent).
Contributor
Author
🤖 Claude Code — review resultCI: ✅ green. Scope vs AAASM-2640 / Story AAASM-2561 / ADR 0002: ✅ complete.
Notes (non-blocking, intentional):
Verdict: ✅ Ready to approve & merge. This is the base of the stack — merge first (#79 → #80 → #81), rebasing each child onto |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description
Make the Python SDK's pyo3 binding (
rust/aa-ffi-python) a thin shim over the sharedaa-sdk-clientcrate, per ADR 0002 (Epic AAASM-2552, "SDK security boundary + FFI consolidation"). The runtime-client logic — UDS transport, IPC wire codec, and theAssemblyClientlifecycle — now lives once inaa-sdk-clientinstead of being reimplemented in the binding.RuntimeClient.connect / send_event / closedelegate toaa_sdk_client::AssemblyClient(spawn_ipc_thread+AssemblyClient::new/report_event/shutdown).query_policyround-trip (PolicyResult/PolicyTimeoutError) are removed. Policy / approval are server-side in the trust model, and advisory, non-authoritative credential preflight is provided transitively byaa-sdk-client— the shim holds no security authority.GovernanceEvent,audit_event_to/from_wire_bytes) is retained.aa-core/aa-proto/aa-sdk-client) are pinned to one agent-assembly SHA (9cf8a033) — git-SHA distribution per ADR 0002.tokio/once_celldropped; the newaa-proto ActionType::ToolResultvariant is handled.Net:
rust/aa-ffi-python/src/lib.rsshrinks from 719 → ~290 lines (−497 / +64).The Python-facing export/test alignment (dropping
PolicyResult/PolicyTimeoutErrorfrom_coreexports + updating the gated native tests) follows in AAASM-2641, stacked on this PR.Type of Change
Breaking Changes
The native
_coremodule dropsquery_policy,PolicyResult, andPolicyTimeoutError. No pure-Python caller uses them (policy checks go through the httpx gateway client); they were a SDK-side reimplementation of runtime-client logic that this Epic retires. The documented public API (init_assembly→context.client.*) is unaffected.Related Issues
Testing
cargo buildcompiles the shim againstaa-sdk-clientwith zero warnings; the PyO3 extension links (-undefined dynamic_lookup, asmaturinsets).uv sync+pytestgreen (418 passed, 11 skipped — native + optional-framework tests skip in a pure-Python install).Checklist