[AAASM-2641] ♻️ (python-sdk): Align _core exports + native tests to the thin shim#80
Open
Chisanan232 wants to merge 8 commits into
Open
[AAASM-2641] ♻️ (python-sdk): Align _core exports + native tests to the thin shim#80Chisanan232 wants to merge 8 commits into
Chisanan232 wants to merge 8 commits into
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.
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
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.
…orts The thin pyo3 shim (AAASM-2640) no longer exposes the synchronous policy round-trip. Remove PolicyResult and PolicyTimeoutError from the lazy export map, the optional-core __all__ list, and the TYPE_CHECKING block; RuntimeClient and GovernanceEvent remain the native _core surface.
Drop the fake PolicyResult/PolicyTimeoutError from the stub _core module and assert they are no longer in agent_assembly.__all__, while RuntimeClient and GovernanceEvent still are.
The thin shim no longer exposes a synchronous policy round-trip. Remove the query_policy timeout test and the query_policy call in the concurrency/deadlock test; send_event and close still exercise the delegation to aa-sdk-client. The mock runtime server keeps modelling the full wire protocol.
The native _core module now exposes only RuntimeClient and GovernanceEvent. Drop PolicyResult from the README import example, fix the architecture overview (two symbols; RuntimeClient is a thin shim over aa-sdk-client that ships events), and remove the stale PolicyTimeoutError note from the exceptions reference.
ddaa6c3 to
407ba1e
Compare
GovernanceEvent deserializes its argument as an aa_core::AuditEntry, but
the FFI benchmark passed an ad-hoc {event_type, agent_id, ...} dict that
is not a valid AuditEntry, so the benchmark errored whenever the native
module was actually built (it is skipped in CI, which hid the bug). Use a
valid AuditEntry payload so the benchmark exercises the real FFI path.
|
10 tasks
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
Python-side alignment to the thin pyo3 shim (Story AAASM-2561). Stacked on #79 (AAASM-2640), which delegates the native
RuntimeClienttoaa-sdk-clientand removes the native synchronousquery_policyround-trip.agent_assembly/__init__.py: dropPolicyResult/PolicyTimeoutErrorfrom the lazy export map, the optional-core__all__list, and theTYPE_CHECKINGblock. The native_coresurface is nowRuntimeClient+GovernanceEvent.test/unit/test_init_exports.py: stub_coreexposes onlyRuntimeClient/GovernanceEvent; assert the dropped symbols are not inagent_assembly.__all__.test/integration/test_native_core_runtime.py(opt-in,AAASM_RUN_NATIVE_CORE_TESTS=1): remove thequery_policytimeout test and thequery_policycall in the concurrency test;send_event/closestill exercise the delegation. The mock runtime server keeps modelling the full wire protocol._coresymbols;RuntimeClientis a thin shim that ships events), and the exceptions reference no longer mention the removed symbols. (ADR0001-hook-architecture.mdis left as a historical record.)Type of Change
Breaking Changes
agent_assembly.PolicyResultandagent_assembly.PolicyTimeoutError(native_coresymbols) are removed. They had no pure-Python callers; documented policy checks use the httpx gateway client.Related Issues
Testing
uv sync+pytestgreen (418 passed, 10 skipped — native + optional-framework tests skip in a pure-Python install).ruff/mypyintroduce no new findings vsmaster(changes only remove code + edit Markdown).Checklist