[AAASM-3683] 🔒 (python-sdk): Pass language-SDK package version through the FFI into the handshake#175
Conversation
…ough SHA Re-pin aa-core/aa-proto/aa-sdk-client to agent-assembly AAASM-3683, which adds the sdk_version field to AssemblyConfig and threads it through spawn_ipc_thread into the signed handshake. Re-pin to the squash-merge commit once PR #1226 lands. Refs AAASM-3683. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extend RuntimeClient.connect to accept optional agent_id and sdk_version and pass them into spawn_ipc_thread, so the agent identity is signed into the session handshake (AAASM-3587) and the user-facing PyPI package version is the one signed into the handshake proof (AAASM-3683). None falls back to the crate version via resolved_sdk_version. Refs AAASM-3683. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
connect_runtime_client now resolves the installed agent-assembly version via importlib.metadata (falling back to agent_assembly.__version__) and forwards it plus the agent id into the native RuntimeClient.connect, so the language-package version is signed into the handshake for accurate downgrade detection (AAASM-3683). An older native connect (without the new params) is retried with the legacy positional signature. Refs AAASM-3683. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Extend the fake native core's connect to capture the agent_id/sdk_version args and add tests asserting connect_runtime_client forwards the resolved package version (and None when unresolvable, so the shim falls back to the crate version), plus that _sdk_version reads importlib.metadata. Refs AAASM-3683. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Codecov Report✅ All modified and coverable lines are covered by tests. 📢 Thoughts on this report? Let us know! |
Review — AAASM-3683 (python-sdk #175)CI: Authoritative gates green. Scope: Matches the ticket. Tests: Covered — Verdict: READY ✅ (merge-blocked only by the acceptance-class SonarCloud/codecov checks per project policy). — Claude Code |
…3683) Add install_fake_core_with_connect helper to drive the native connect path against builds that raise, plus tests for the previously-uncovered new lines: - connect() legacy single-arg fallback on TypeError (older native build) - None returned when the legacy retry also fails and on generic connect failure - _sdk_version fallback to agent_assembly.__version__ when distribution metadata is missing, and None when neither source resolves Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
|
Added test coverage for the previously-uncovered new-code paths flagged by codecov/patch + SonarCloud (commit
Added a reusable Local: full suite 677 passed / 16 skipped (env-gated); the 5 new tests cover all changed lines in the diff range ( — Claude Code |
| ``agent_assembly.__version__`` rather than returning ``None`` (AAASM-3683).""" | ||
| import importlib.metadata | ||
|
|
||
| import agent_assembly |
| to the crate version instead of raising (AAASM-3683).""" | ||
| import importlib.metadata | ||
|
|
||
| import agent_assembly |
|



Description
Follow-up to agent-assembly AAASM-3683. AAASM-3666 signs an
sdk_versioninto the IPC handshake, but it was sourced from the sharedaa-sdk-clientcrate version. This PR makes the Python SDK forward its PyPI package version through the FFI so the version signed into the handshake reflects the installed SDK release, giving AAASM-3571 accurate downgrade detection.aa-core/aa-proto/aa-sdk-clientto agent-assembly AAASM-3683 (addssdk_versiontoAssemblyConfig+ threads it throughspawn_ipc_thread). Must be re-pinned to the squash-merge SHA once agent-assembly PR #1226 lands.RuntimeClient.connectnow accepts optionalagent_idandsdk_versionand passes them intospawn_ipc_thread(the agent id is also signed into the handshake per AAASM-3587).connect_runtime_clientresolves the installed version viaimportlib.metadata.version("agent-assembly")(falling back toagent_assembly.__version__) and forwards it.Nonefalls back to the crate version (no regression vs 3666). An older nativeconnectis retried with the legacy positional signature.Type of Change
Breaking Changes
connect's new params are optional; the Python layer retries the legacy signature against an older native build.Related Issues
Testing
Unit tests added/updated
.venv/bin/python -m pytest test/→ 667 passed, 16 skipped (native/optional-dep skips). New tests assertconnect_runtime_clientforwards the resolved package version (andNonewhen unresolvable), and that_sdk_versionreadsimportlib.metadata.ruff checkclean on all changed files (the 77 pre-existing errors are all in generatedagent_assembly/proto/*_pb2*.py).mypy agent_assembly+ pre-commit mypy (incl. tests) clean; the remaining_coreimport errors are pre-existing (native extension not built locally).Needs CI: the native-core integration tests (
test_native_core_runtime.py, maturin build) are gated behindAAASM_RUN_NATIVE_CORE_TESTS=1and were not run locally — the end-to-end signed-handshake-version path needs CI (or a maturin build) to exercise.Checklist
🤖 Generated with Claude Code