Dev log #26 Deep in the libp2p weeds: Fixing DHT prefixes and Yamux resets
Description and use
Two protocol-level bug fixes were submitted as open PRs: one ensures the Kademlia DHT propagates the protocol_prefix to the wire so private networks can be built, and another ensures Yamux reports a remote reset instead of a clean EOF on bounded reads. Four issues were also opened to document the bugs, fix CI breakage from the Nim echo server, and address the agentmesh SDK build failure on Python 3.14.
Problem
The py-libp2p library ignores a custom protocol_prefix passed to the Kademlia DHT, causing it to speak /ipfs/kad/1.0.0 on the wire even when a private or specialized DHT is intended. Additionally, when a remote peer sends a RST frame on a bounded read, the library reports a clean EOF instead of signaling an abrupt connection reset, which can corrupt file transfers and break reliable p2p networking.
Outcome
Two protocol-level bug fixes were submitted as open PRs: one ensures the Kademlia DHT propagates the protocol_prefix to the wire so private networks can be built, and another ensures Yamux reports a remote reset instead of a clean EOF on bounded reads. Four issues were also opened to document the bugs, fix CI breakage from the Nim echo server, and address the agentmesh SDK build failure on Python 3.14.
Workflow
- Investigate why a custom protocol_prefix passed to the DHT was being ignored on the wire
- Trace execution flow to confirm the prefix was accepted but not propagated to the protocol level
- Write an issue documenting the evidence that the prefix was dropped before submitting a fix PR
- Implement a fix adding ~130 lines and removing 17 lines to propagate the prefix to the protocol level
- Investigate how Yamux handles stream resets on bounded reads
- Confirm the library was reporting a clean EOF instead of a RST when a remote peer reset the stream
- Write an issue documenting the protocol-level quirk
- Implement a fix (+59/-1) to report the reset state correctly on bounded reads
- Submit both PRs for review and await maintainer feedback
- Open issues for CI breakage (Nim echo server no longer compiles), agentmesh SDK build failure on Python 3.14, and document all findings
Evidence
I opened a PR titled fix(kad_dht): honour protocol_prefix on the wire because I realized that even if you pass a custom protocol_prefix to the DHT, the library was just... ignoring it. It would accept the configuration, but then it would go right ahead and speak /ipfs/kad/1.0.0 on the wire anyway.
I added about 130 lines of code and ripped out 17 to ensure that the prefix actually gets propagated down to the protocol level where it belongs.
If a remote peer sends a RST (reset) frame, the local reader should know that something went wrong. However, I found that on a bounded read, the library was reporting a clean EOF.
A clean EOF tells the application 'everything finished successfully,' while a RST should tell the application 'the connection was dropped abruptly.'
I opened kad_dht: protocol_prefix is accepted and then ignored to lay out the evidence of how the prefix was being dropped.
make sdk-python fails on a Python 3.14 host because the error message was completely unhelpful—it didn't name anything relevant to
- Record date: 2026-10-20T05:56:26.369Z