5.7 KiB
Prompt
draft hyper detailed implementation plans for [three] prospective new transport (tpt) backends for tractor’s
.ipclayer, from four GitHub issues: TIPC (gh #378) using built-in linux socket API w/triointerfacing, leveraging TIPC’s built-in discovery machinery; QUIC (gh #353) using theirohlib, ideally with the py asyncio support (via ffi) rewritten for trio; wg (gh #482 and/or #443) with other shuttle-able tpts, usingpyroute2, as much trio wrapping as possible where any other async support can be replaced.
With constraints: “be only slightly speculative”; realistic given the linked info; the plans must be workable “by another model/provider without much discrepancy on the design or lib selections needed”; do it all in a new /open-wkt off main; and be “as modular and modern-async-python-as-nearly-functional-style as possible.”
Key follow-up prompts that changed the design mid-session:
wg requires binding a socket on both ends of the tunnel, the new support we added to
py-multiaddrin their #108 enables declaring this in the maddr? […] so the/ip4/10.0.0.1/udp/666/ip4/192.168.0.13/tcp/80bullet example from #443 isn’t correct for a wg tunnel maddr and would actually end up looking like,/ip4/10.0.0.1/udp/666/wg/<pub-key>/ip4/192.168.0.13/tcp/80no?
right, we’re likely going to need less
tuple-formedUnwrappedAddressusage to make them all work and/or to extend the unwrapped form with a proto-str, likely the key frommultiaddrsno?
better encapsulating
UnwrappedAddressfor use externally is really way overdue; we should likely be encouraging (if not preventing unwrapped) wrapped addrs always much like other (std) libs,ipaddresscomes to mind.
so iirc netns mgmt becomes a lower-level runtime config-api rather then an actor-app-code API which can be dynamically changed once the actor is up ya?
Response summary
A research-and-planning branch, ng_tpts_planning — no runtime code touched. Five plan docs under ai/tpt-backends/ plus a corrected wg example set under examples/multihost/wg_lan/, across 9 commits.
Three design conclusions came out of the planning that outlive the branch:
wgis a bindspace, not aMsgTransport. The/wg/maddr segment is infix: bearer (underlay ip+udpListenPort, bound by the kernel) →/wg/u<key>(an identity, bound by nothing) → overlay (the only part tractor binds). Verified empirically by installingbaudco/py-multiaddr@wg_support(py-multiaddr#108) in a throwaway venv and round-tripping each candidate form; gh #482’s original suffix form parses but is semantically inverted.- Proto-key the
UnwrappedAddressform, spelled with themultiaddrprotocol names, dispatched via_address_types[addr[0]]. Kills a whole collision class (TIPC’s(str, int)≡TCPAddress; iroh’s(str, str)swallowed by the UDS case) and is the recommended migration before any new backend lands. - netns is a runtime/boot-time config API, not an app-code one —
setns(2)is per-thread and won’t move already-created sockets, so there is deliberately noawait actor.enter_netns(...).
Also verified that trio.SocketStream/SocketListener are address-family agnostic (no AF_* check anywhere), which is what makes TIPC the cheapest of the three backends to add.
Four related issues were annotated with the results (#378, #353, #482, #443); #443’s body was rewritten to reflect the corrected grammar, with no existing checkbox state changed.
Files changed
ai/tpt-backends/00_shared_backend_contract.md— normative backend duck-type contract, registration checklist, §1.1 proto-key conclusionai/tpt-backends/01_tipc_backend.md— TIPC plan; service addressing,TIPC_TOP_SRVpush registry, instance-collision hazard, step-0 probeai/tpt-backends/02_quic_iroh_backend.md—irohplan;uniffi→triobridge, listener/stream adapters, API-truth tableai/tpt-backends/03_wg_tunnel_bindspace.md—wg-as-bindspace plan; verified maddr grammar, 3-owner split, netns realityai/tpt-backends/README.md— indexexamples/multihost/wg_lan/wg_maddr.py— frozenmsgspectunnelled addr + pure parse/render helpers; impureverify_wg_peer()kept separateexamples/multihost/wg_lan/host_a_srv.py— host-A actor treeexamples/multihost/wg_lan/host_b_client.py— host-B dialerexamples/multihost/wg_lan/README.md— grammar, owner table, setup, “what changed vs #482”
Human edits
Substantial human steering rather than post-hoc editing; the corrections were applied by the model in-session after being challenged:
- rejected an initial claim that
wghas “nothing to bind at the tunnel layer” and supplied the correct composed maddr form, which forced a rewrite of plan 03 §3.2 and a retraction in the already-posted #443 comment - rejected a supporting claim that
/ip4/../udp/443/quic-v1was “also composed” - directed the proto-key/
ipaddress-discipline conclusion and the netns-as-runtime-config framing, both of which were then folded back into the docs - chose the commit boundaries and authored all commits; ran every
gitmutation (commit, rebase, push) themselves
One model-initiated correction pre-publication: a self-review downgraded two overconfident claims (the uniffi/asyncio thesis and TIPC duplicate-binder behaviour) to explicitly-flagged assumptions before the #353/#378 comments were posted.