{"slug": "dev-log-21-hardening-webrtc-direct-and-solving-scm-leaks", "title": "Dev log #21 Hardening WebRTC-Direct and solving SCM leaks", "summary": "Developer Yash shipped 8 commits and 11 pull requests across py-libp2p and the Go-based agent-orchestrator, fixing a WebRTC dialer race condition where ICE credentials were set incorrectly before first-contact replay, which had blocked Go-to-Python node interoperability. The work also closed socket leaks in mplex and swarm to prevent long-running nodes from exhausting file descriptors, and addressed cross-platform path handling and GitHub PR polling in the orchestrator. An open PR introduces a true ICE-Lite listener for WebRTC-Direct.", "body_md": "Hi, glad you found your way here. I'm Yash, a developer who contributes to open source, mostly p2p networking and AI tooling. Each week I write up what I shipped, what broke, and what fixing it taught me.\n\n[GitHub](https://github.com/yashksaini-coder) · [X](https://x.com/0xcrackedDev) · [LinkedIn](https://www.linkedin.com/in/yashksaini) · [Portfolio](https://yashksaini.vercel.app/)\n\nThis week was all about the \"glue\" that holds distributed systems together. I spent my time jumping between the Python implementation of libp2p and a Go-based agent orchestrator. It was a week of deep-dives into networking internals—specifically getting WebRTC-Direct to behave across different language implementations—and fixing some frustrating SCM polling issues. Across 8 commits and 11 PRs, I focused on making sure connections are actually closed when they're supposed to be and that our agents aren't hallucinating CI failures.\n\nMost of my energy went into [py-libp2p](https://github.com/libp2p/py-libp2p), where I’m currently neck-deep in WebRTC-Direct work. Networking is one of those things where it works 99% of the time, and then that last 1% takes up 90% of your brainpower.\n\nI pushed 6 commits to `py-libp2p` this week, mostly centered on stabilizing the transport layer. One of the big wins was fixing a race condition in the WebRTC dialer where ICE credentials weren't being set correctly before the first-contact replay. This was specifically blocking interoperability between Go and Python nodes—one of those gnarly \"it works in isolation but fails in the wild\" bugs. I also spent some time on the housekeeping side, fixing socket leaks in both `mplex` and the `swarm`. If you've ever wondered why your long-running nodes eventually run out of file descriptors, it’s usually because of unclosed secured connections. I made sure that when we shut down, we actually release the underlying sockets.\n\nOver in [agent-orchestrator](https://github.com/Untrivial-ai/agent-orchestrator), the work was more about the developer experience and SCM integration. I tackled a weird edge case where workspace files with backslashes in their names were resolving incorrectly on Linux and macOS. It’s a classic cross-platform path handling headache, but getting it right means one less \"it works on my machine\" conversation. I also looked into how the orchestrator handles GitHub polling—specifically an issue where it was re-listing every open PR because the `since` parameter wasn't being respected by the endpoint.\n\nIt was a heavy PR week—11 in total. I had 4 merged, 3 still open, and 4 closed as I refined my approach.\n\nIn the `py-libp2p` world, [PR #1513](https://github.com/libp2p/py-libp2p/pull/1513) was a big documentation push. I documented the STUN listener versus the SDP harness and provided guidance on v1 vs v2 dialing. Clear docs are just as important as clean code when you’re building p2p primitives. I also have [PR #1532](https://github.com/libp2p/py-libp2p/pull/1532) open, which introduces a true ICE-Lite listener for WebRTC-Direct. This is a significant addition (+166 lines) that will make the listener much more robust.\n\nOn the bug-squashing front, [PR #1497](https://github.com/libp2p/py-libp2p/pull/1497) and [PR #1495](https://github.com/libp2p/py-libp2p/pull/1495) landed to fix the connection shutdown and WebRTC dial issues I mentioned earlier. \n\nFor `agent-orchestrator`, I had a few PRs that I ended up closing ([#5089](https://github.com/Untrivial-ai/agent-orchestrator/pull/5089), [#5088](https://github.com/Untrivial-ai/agent-orchestrator/pull/5088), [#5057](https://github.com/Untrivial-ai/agent-orchestrator/pull/5057), and [#5056](https://github.com/Untrivial-ai/agent-orchestrator/pull/5056)). Sometimes you start a fix and realize there's a better architectural way to handle it, or you're iterating fast and a better solution emerges. I’d rather close a PR and open a better one than merge something that isn't quite right. However, [PR #5055](https://github.com/Untrivial-ai/agent-orchestrator/pull/5055) did land, which fixed that backslash filename bug on non-Windows systems.\n\nI opened and closed 6 issues this week, which really tells the story of the week's detective work.\n\nThe most interesting one is [Issue #1498](https://github.com/libp2p/py-libp2p/issues/1498) regarding residual unclosed-socket leaks. This is currently gating our `filterwarnings` guard in the test suite. Until we can guarantee the tests aren't leaking resources, we can't turn on the stricter CI checks. It's a bit of a slog, but it's the kind of maintenance that prevents technical debt from spiraling.\n\nI also opened [Issue #1512](https://github.com/libp2p/py-libp2p/issues/1512) for the ICE-Lite listener work. It's one of those features that started as a \"nice to have\" and quickly became a \"need to have\" for proper WebRTC-Direct support.\n\nOn the `agent-orchestrator` side, [Issue #5046](https://github.com/Untrivial-ai/agent-orchestrator/issues/5046) was a fun find: the Copilot adapter was adding a permanent line to `.git/info/exclude` for every single session. That’s a great way to end up with a massive, messy exclude file if you’re not careful.\n\nReviewing is where I get to see how others are thinking about the same problems. I did 2 reviews this week:\n\nIt was a Python-heavy week (6 commits/PRs) with a solid side of Go (2 commits/PRs).\n\nWith 508 additions and only 41 deletions, this was definitely a \"building and fixing\" week rather than a \"cleaning and refactoring\" week. I’m adding new capabilities to the WebRTC stack, and that naturally comes with a higher line count.\n\nThe goal for next week is to get the ICE-Lite listener PR (#1532) in `py-libp2p` across the finish line. I also want to circle back to those socket leaks in the test suite. It's not the most glamorous work, but seeing a clean, green CI with no resource warnings is a special kind of satisfying. On the orchestrator side, I'll be keeping an eye on the SCM polling fixes to make sure our agent's view of the world stays in sync with GitHub.\n\nCatch you next week!", "url": "https://wpnews.pro/news/dev-log-21-hardening-webrtc-direct-and-solving-scm-leaks", "canonical_source": "https://dev.to/yashksaini/dev-log-hardening-webrtc-direct-and-solving-scm-leaks-i5k", "published_at": "2026-09-19 05:49:17+00:00", "updated_at": "2026-09-19 05:54:12.972094+00:00", "lang": "en", "topics": ["ai-agents", "developer-tools"], "entities": ["Yash", "py-libp2p", "libp2p", "agent-orchestrator", "Untrivial-ai", "GitHub", "WebRTC-Direct", "ICE-Lite"], "alternates": {"html": "https://wpnews.pro/news/dev-log-21-hardening-webrtc-direct-and-solving-scm-leaks", "markdown": "https://wpnews.pro/news/dev-log-21-hardening-webrtc-direct-and-solving-scm-leaks.md", "text": "https://wpnews.pro/news/dev-log-21-hardening-webrtc-direct-and-solving-scm-leaks.txt", "jsonld": "https://wpnews.pro/news/dev-log-21-hardening-webrtc-direct-and-solving-scm-leaks.jsonld"}}