Summary
Registering a foreign (Python) async RPC handler after connect() raises:
InternalError: there is no reactor running, must be called from the context of a Tokio 1.x runtime
The failure is at register_rpc_method itself, before any perform_rpc. The SDK's register_rpc_method runs on the asyncio thread, which has no tokio reactor.
Pre-existing
Found while building PR #58. Reproduces identically through the Python facade on unmodified main, so it is not related to the role-split bindings.
Reproduce
async def handler(data): return f"pong:{data.payload}"
await robot.connect(url, token)
robot.register_rpc_method("ping", handler) # raises here
Workaround (supported path)
Register handlers before connect(). The core stores pre-connect handlers and applies them inside connect(), which runs on the tokio runtime. PR #58's test_rpc_roundtrip uses this path and passes.
Possible fix directions
- Marshal the SDK
register_rpc_method call onto the tokio runtime instead of invoking it on the caller's asyncio thread.
- Or document pre-connect registration as the only supported path and reject post-connect registration with a clear error rather than a panic.
Summary
Registering a foreign (Python) async RPC handler after
connect()raises:The failure is at
register_rpc_methoditself, before anyperform_rpc. The SDK'sregister_rpc_methodruns on the asyncio thread, which has no tokio reactor.Pre-existing
Found while building PR #58. Reproduces identically through the Python facade on unmodified
main, so it is not related to the role-split bindings.Reproduce
Workaround (supported path)
Register handlers before
connect(). The core stores pre-connect handlers and applies them insideconnect(), which runs on the tokio runtime. PR #58'stest_rpc_roundtripuses this path and passes.Possible fix directions
register_rpc_methodcall onto the tokio runtime instead of invoking it on the caller's asyncio thread.